-
Notifications
You must be signed in to change notification settings - Fork 5
Normal <-> Payload Auto Switch #145
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this 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 implements automatic low-voltage protection for payload mode with debounced monitoring, along with a refactored mode enumeration scheme that enforces sequential transitions. The implementation adds voltage monitoring at 1Hz with a 10-second debounce window, automatically exiting payload mode when voltage drops below 7.2V or becomes invalid. The mode enum values have been reordered (SAFE_MODE=1, NORMAL=2, PAYLOAD_MODE=3) to support a +1/-1 sequential transition pattern, preventing direct jumps between non-adjacent modes.
Key changes:
- Debounced low-voltage monitoring with automatic payload mode exit after 10 consecutive fault readings
- Sequential mode transition enforcement (PAYLOAD→NORMAL→SAFE, no direct PAYLOAD→SAFE)
- Differential power management: manual exit preserves face switches ON, automatic exit sheds all loads
- Comprehensive integration test suite with 7 tests (6 automated, 1 manual)
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
Makefile |
Adds TEST parameter for selective test execution with pattern matching |
README.md |
Documents single test file execution using TEST variable |
FprimeZephyrReference/test/int/payload_mode_test.py |
New comprehensive integration test suite covering payload mode entry/exit, validation, state persistence, voltage monitoring, and load switch behavior |
FprimeZephyrReference/test/int/mode_manager_test.py |
Updates mode enum values (0→2 for NORMAL, adds PAYLOAD=3) and adjusts test expectations for idempotent behavior |
FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi |
Adds PayloadModeEntryCount telemetry to health packet |
FprimeZephyrReference/Components/ModeManager/docs/sdd.md |
Comprehensive documentation update with requirements, sequence diagrams, load switch mapping, low-voltage thresholds, and integration test descriptions |
FprimeZephyrReference/Components/ModeManager/ModeManager.hpp |
Adds payload mode command handlers, helper methods, low-voltage counter, and voltage threshold constants |
FprimeZephyrReference/Components/ModeManager/ModeManager.fpp |
Defines reordered enum, new commands (ENTER/EXIT_PAYLOAD_MODE), events (EnteringPayloadMode, AutoPayloadModeExit), and PayloadModeEntryCount telemetry |
FprimeZephyrReference/Components/ModeManager/ModeManager.cpp |
Implements 1Hz voltage monitoring, debouncing logic, payload mode transitions, separate face/payload load switch control, and persistent state handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
FprimeZephyrReference/test/int/payload_mode_test.py:72
- 'except' clause does nothing but pass and there is no explanatory comment.
except Exception:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Automatic switch between Normal and Payload mode
Description
Added debounced low-voltage protection in payload mode: invalid/low readings for 10s trigger AutoPayloadModeExit event, drop to NORMAL, and shed all load switches; re-entry now powers all loads to ensure consistent state; manual exit leaves faces on.
Updated integration tests for payload behavior (manual exit power state, voltage monitoring sanity) plus manual low-voltage test coverage; documented new behavior and thresholds in ModeManager SDD.
Next: Automatic mode switch between
normalandsafeRelated Issues/Tickets
#106
#141 should be merged first before this PR
How Has This Been Tested?
Test maybe an issue due to I don't have battery that's in good condition right now, top loader incoming next week.
Screenshots / Recordings (if applicable)
Checklist
Further Notes / Considerations