Skip to content

Introducing a Burnwire Manager #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Introducing a Burnwire Manager #258

wants to merge 10 commits into from

Conversation

Mikefly123
Copy link
Member

@Mikefly123 Mikefly123 commented Jun 3, 2025

Summary

Hey team! While I was on the plane to my vacation this week I took some time to scaffold a burn wire manger to address #249!

I didn't bring a board with me, so I haven't been able to test it on hardware yet. I did have the AI overlords code up some unit tests though, which actually did catch some potential logical issues with the code before making this PR.

Intended Usage

I think the docstrings should explain all, but generally what you do with this is for every burn wire port you might want to use you would first initialize the pins you want to use separately as digitalio (catch here is you have to absolutely make sure to default initialize them to the off state haha) then pass those two pins in when you initialize the individual manager. You also pass in the logger and an optional param for setting whether the enable logic is True or False.

NOTE: Burnwire and load switch enable logic will be True (the default) on V5b+ flight controller boards. On V5dev and V5a it is enable False which is quite confusing lol.

There is also a burn wire proto introduced with this PR. I was originally going to include the smart_burn (brunwire with a sensor for feedback on when to stop!) but that was going to convolute the proto because sometimes you won't have a sensor to pass into the manager. So this PR will be for the dumb_burn which just takes a max_timeout as a parameter and a future PR will introduce the smart_burn as its own manager class.

How was this tested

  • Added new unit tests
  • Ran code on hardware (screenshots are helpful)
  • Other (Please describe)
Screenshot 2025-06-04 at 12 37 18 AM

@Mikefly123 Mikefly123 requested a review from Copilot June 3, 2025 22:36
@Mikefly123 Mikefly123 self-assigned this Jun 3, 2025
Copy link
Contributor

@Copilot 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 a burnwire management module including a protocol, a manager implementation, and comprehensive unit tests to validate various activation scenarios and error handling.

  • Added a new BurnwireProto interface in pysquared/protos/burnwire.py
  • Implemented BurnwireManager with configurable enable logic and error handling in pysquared/hardware/burnwire/manager/burnwire.py
  • Provided unit tests covering normal operation, retries, exception handling, and cleanup in tests/unit/hardware/test_burnwire.py

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

File Description
tests/unit/hardware/test_burnwire.py New unit tests covering burn activation logic, retry behavior, and cleanup after errors
pysquared/protos/burnwire.py New protocol defining the burnwire interface with docstring specifications
pysquared/hardware/burnwire/manager/burnwire.py Implementation of BurnwireManager with burn logic, error handling, and usage documentation
Comments suppressed due to low confidence (2)

pysquared/hardware/burnwire/manager/burnwire.py:14

  • Typo in usage example: 'BurnwireManger' should be corrected to 'BurnwireManager'.
from lib.pysquared.hardware.burnwire.manager.burnwire import BurnwireManger

pysquared/hardware/burnwire/manager/burnwire.py:140

  • [nitpick] Consider updating the log message 'Burnwire Safed' to a clearer phrase such as 'Burnwire set to safe state' for improved clarity.
                self._log.info("Burnwire Safed")

You can tell I didn't use AI for this because of all the spelling mistakes haha!

Co-authored-by: Copilot <[email protected]>
@Mikefly123 Mikefly123 added the enhancement New feature or request label Jun 3, 2025
@Mikefly123 Mikefly123 changed the title Burnwire manager Introducing a Burnwire Manager Jun 3, 2025
Signed-off-by: Michael Pham <[email protected]>
wrong-formatt
wrong-formatt previously approved these changes Jun 10, 2025
Copy link

@wrong-formatt wrong-formatt left a comment

Choose a reason for hiding this comment

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

Hey Michael,
Looking over this now that I have some more time on my hands.
A nitpick here, but not sure if you meant to cut out a parameter (looks like to me it is more for smart_burn rather than dumb_burn) or if the documentation is just incorrect, but on burnwire/manager/burnwire.py Line 37 you do include the following:

:param deployment_sensor: Generic input for a sensor object that will act as the deployment sensor for smart_burn(). Defaults to 'False'.

Otherwise, looks good to me! Excited to give the unit tests a spin.

@Mikefly123
Copy link
Member Author

Good catch on that unneeded line in the docstring @wrong-formatt! I went ahead and removed it.

Let's try and test this code out on the new Flight Controller boards tomorrow and we'll go ahead and merge it in if all looks good!

Copy link

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.

2 participants