Skip to content

Conversation

@Mikefly123
Copy link
Member

Summary

This is a first cut at bringing up all of the basic functionalities of the new V5a Flight Controller Board. All import errors and other weird showstoppers have been fixed and main.py will run as normal when you use this code on the new FC board.

Because we will still need to do some extensive updates to the pysquared library to add all of the manager components needed to run the new functionalities (see this PR for a list of them) I have temporarily just implemented most of the new functionalities in reply.py so they can be called as desired for testing.

How was this tested

  • Ran code on hardware (screenshots are helpful)

Current Typical main.py Output

main.py Output
main.py output:
{"time": "2000-01-01 00:01:02", "level": "INFO", "msg": "Booting", "hardware_version": "9.2.4-11-gf12e5e9ed4 on 2025-04-21", "software_version": ""}
{"time": "2000-01-01 00:01:02", "level": "INFO", "msg": "Code Starting in 5 seconds"}
{"time": "2000-01-01 00:01:03", "level": "INFO", "msg": "Code Starting in 4 seconds"}
{"time": "2000-01-01 00:01:04", "level": "INFO", "msg": "Code Starting in 3 seconds"}
{"time": "2000-01-01 00:01:05", "level": "INFO", "msg": "Code Starting in 2 seconds"}
{"time": "2000-01-01 00:01:06", "level": "INFO", "msg": "Code Starting in 1 seconds"}
{"time": "2000-01-01 00:01:07", "level": "DEBUG", "msg": "Initializing watchdog", "pin": "board.WDT_WDI"}
{"time": "2000-01-01 00:01:07", "level": "DEBUG", "msg": "Initializing pin", "pin": "board.WDT_WDI", "initial_value": false}
{"time": "2000-01-01 00:01:07", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:01:07", "level": "DEBUG", "msg": "Initializing Config"}
{"time": "2000-01-01 00:01:07", "level": "DEBUG", "msg": "Initializing spi bus"}
{"time": "2000-01-01 00:01:07", "level": "DEBUG", "msg": "Initializing spi bus"}
TIMEDOUT on IRQwait
Radio2 sent Hello World
{"time": "2000-01-01 00:01:11", "level": "DEBUG", "msg": "Initializing i2c"}
{"time": "2000-01-01 00:01:11", "level": "DEBUG", "msg": "Booting up!", "boot_time": "946684871s"}
{"time": "2000-01-01 00:01:11", "level": "DEBUG", "msg": "Initializing pin", "pin": "board.SPI0_CS0", "initial_value": true}
{"time": "2000-01-01 00:01:11", "level": "DEBUG", "msg": "Initializing pin", "pin": "board.RF1_RST", "initial_value": true}
{"time": "2000-01-01 00:01:11", "level": "DEBUG", "msg": "Initializing radio", "radio_type": "RFM9xManager", "modulation": "<class 'FSK'>"}
{"time": "2000-01-01 00:01:11", "level": "DEBUG", "msg": "Initializing magnetometer"}
{"time": "2000-01-01 00:01:11", "level": "DEBUG", "msg": "Initializing IMU"}
{"time": "2000-01-01 00:01:11", "level": "INFO", "msg": "The satellite has a super secret code!", "super_secret_code": "b'ABCD'"}
{"time": "2000-01-01 00:01:11", "level": "INFO", "msg": "Initializing Functionalities"}
{"time": "2000-01-01 00:01:12", "level": "INFO", "msg": "FC Board Stats", "bytes_remaining": 310928, "boot_number": 27}
{"time": "2000-01-01 00:01:12", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:01:12", "level": "WARNING", "msg": "Radio send attempt failed: Not licensed."}
{"time": "2000-01-01 00:01:12", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:01:12", "level": "DEBUG", "msg": "Listening"}
{"time": "2000-01-01 00:01:12", "level": "DEBUG", "msg": "Attempting to receive data with timeout: 10s"}
{"time": "2000-01-01 00:01:22", "level": "DEBUG", "msg": "No message received"}
{"time": "2000-01-01 00:01:22", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:01:22", "level": "DEBUG", "msg": "Current up time stat:", "uptime": 11}
{"time": "2000-01-01 00:01:22", "level": "WARNING", "msg": "Radio send attempt failed: Not licensed."}
Testing Radio2
None
{"time": "2000-01-01 00:01:22", "level": "DEBUG", "msg": "Listening for 10 seconds"}
{"time": "2000-01-01 00:01:22", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:01:22", "level": "DEBUG", "msg": "Listening"}
{"time": "2000-01-01 00:01:22", "level": "DEBUG", "msg": "Attempting to receive data with timeout: 10s"}
{"time": "2000-01-01 00:01:32", "level": "DEBUG", "msg": "No message received"}
{"time": "2000-01-01 00:01:32", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:01:32", "level": "DEBUG", "msg": "Sleeping for 20 seconds"}
{"time": "2000-01-01 00:01:32", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:01:32", "level": "INFO", "msg": "Setting Safe Sleep Mode"}
{"time": "2000-01-01 00:01:47", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:02", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:02", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:02", "level": "DEBUG", "msg": "Radio temperature read", "temp": 136.0}
{"time": "2000-01-01 00:02:02", "level": "WARNING", "msg": "Radio send attempt failed: Not licensed."}
{"time": "2000-01-01 00:02:02", "level": "DEBUG", "msg": "Listening for 10 seconds"}
{"time": "2000-01-01 00:02:02", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:02", "level": "DEBUG", "msg": "Listening"}
{"time": "2000-01-01 00:02:02", "level": "DEBUG", "msg": "Attempting to receive data with timeout: 10s"}
{"time": "2000-01-01 00:02:12", "level": "DEBUG", "msg": "No message received"}
{"time": "2000-01-01 00:02:12", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:12", "level": "DEBUG", "msg": "Sleeping for 20 seconds"}
{"time": "2000-01-01 00:02:12", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:12", "level": "INFO", "msg": "Setting Safe Sleep Mode"}
{"time": "2000-01-01 00:02:28", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:43", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:43", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:43", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:43", "level": "DEBUG", "msg": "Listening for 10 seconds"}
{"time": "2000-01-01 00:02:43", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:43", "level": "DEBUG", "msg": "Listening"}
{"time": "2000-01-01 00:02:43", "level": "DEBUG", "msg": "Attempting to receive data with timeout: 10s"}
{"time": "2000-01-01 00:02:53", "level": "DEBUG", "msg": "No message received"}
{"time": "2000-01-01 00:02:53", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:53", "level": "DEBUG", "msg": "Sleeping for 20 seconds"}
{"time": "2000-01-01 00:02:53", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:02:53", "level": "INFO", "msg": "Setting Safe Sleep Mode"}
{"time": "2000-01-01 00:03:08", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:03:23", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:03:23", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:03:23", "level": "INFO", "msg": "Looking to get imu data..."}
{"time": "2000-01-01 00:03:23", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:03:23", "level": "INFO", "msg": "IMU has baton"}
{"time": "2000-01-01 00:03:23", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:03:23", "level": "WARNING", "msg": "Radio send attempt failed: Not licensed."}
{"time": "2000-01-01 00:03:23", "level": "DEBUG", "msg": "Listening for 10 seconds"}
{"time": "2000-01-01 00:03:23", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:03:23", "level": "DEBUG", "msg": "Listening"}
{"time": "2000-01-01 00:03:23", "level": "DEBUG", "msg": "Attempting to receive data with timeout: 10s"}
{"time": "2000-01-01 00:03:33", "level": "DEBUG", "msg": "No message received"}
{"time": "2000-01-01 00:03:33", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:03:33", "level": "DEBUG", "msg": "Sleeping for 20 seconds"}
{"time": "2000-01-01 00:03:33", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:03:33", "level": "INFO", "msg": "Setting Safe Sleep Mode"}
{"time": "2000-01-01 00:03:48", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:04", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:04", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:04", "level": "WARNING", "msg": "Radio send attempt failed: Not licensed."}
{"time": "2000-01-01 00:04:04", "level": "DEBUG", "msg": "Listening for 10 seconds"}
{"time": "2000-01-01 00:04:04", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:04", "level": "DEBUG", "msg": "Listening"}
{"time": "2000-01-01 00:04:04", "level": "DEBUG", "msg": "Attempting to receive data with timeout: 10s"}
{"time": "2000-01-01 00:04:14", "level": "DEBUG", "msg": "No message received"}
{"time": "2000-01-01 00:04:14", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:14", "level": "DEBUG", "msg": "Sleeping for 20 seconds"}
{"time": "2000-01-01 00:04:14", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:14", "level": "INFO", "msg": "Setting Safe Sleep Mode"}
{"time": "2000-01-01 00:04:29", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:44", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:44", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:44", "level": "DEBUG", "msg": "Current up time stat:", "uptime": 213}
{"time": "2000-01-01 00:04:44", "level": "WARNING", "msg": "Radio send attempt failed: Not licensed."}
Testing Radio2
None
{"time": "2000-01-01 00:04:44", "level": "DEBUG", "msg": "Listening for 10 seconds"}
{"time": "2000-01-01 00:04:44", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:44", "level": "DEBUG", "msg": "Listening"}
{"time": "2000-01-01 00:04:44", "level": "DEBUG", "msg": "Attempting to receive data with timeout: 10s"}
{"time": "2000-01-01 00:04:54", "level": "DEBUG", "msg": "No message received"}
{"time": "2000-01-01 00:04:54", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:54", "level": "DEBUG", "msg": "Sleeping for 20 seconds"}
{"time": "2000-01-01 00:04:54", "level": "DEBUG", "msg": "Petting watchdog"}
{"time": "2000-01-01 00:04:54", "level": "INFO", "msg": "Setting Safe Sleep Mode"}

Current Typical reply.py Output

Screenshot 2025-05-04 at 8 53 07 AM

@Mikefly123 Mikefly123 added the enhancement New feature or request label May 4, 2025
@Mikefly123 Mikefly123 self-assigned this May 4, 2025
@Mikefly123 Mikefly123 requested a review from Copilot May 4, 2025 15:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces initial support for the new V5a Flight Controller Board by updating board stubs, garbage collector typings, and boot/repl/main scripts to facilitate development and hardware testing.

  • Added new type stubs for gc and board modules
  • Updated initialization code in repl.py and main.py for new hardware components
  • Adjusted project metadata in pyproject.toml to reflect the V5a release

Reviewed Changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
typings/gc.pyi Added full gc module stubs for MicroPython
typings/board.pyi Introduced board pin definitions for the V5a board
repl.py Expanded boot and hardware initialization routines
pyproject.toml Updated project metadata and dependency settings
main.py Revised SPI/I2C and radio initialization for V5a testing
Files not reviewed (3)
  • Makefile: Language not supported
  • lib/requirements.txt: Language not supported
  • sonar-project.properties: Language not supported
Comments suppressed due to low confidence (1)

typings/board.pyi:34

  • Duplicate declaration of 'SPI0_MOSI' detected. Verify if this is intentional or if one of the declarations should be renamed to reflect the correct pin assignment.
SPI0_MOSI: microcontroller.Pin  # GPIO11

@Mikefly123
Copy link
Member Author

I'm just going to shotgun this PR onto main so there is some initial working reference for users of the V5a!

@Mikefly123 Mikefly123 merged commit 40f9663 into main May 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants