Improve EStop Manager's atomics + set to Idle when changing pin/enabled.#449
Conversation
Cpp-Linter Report
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the EStop manager to reduce shared global state/atomics, introduces a more explicit task start/stop lifecycle, and renames the software-initiated trigger API. It also aims to ensure the EStop state returns to Idle when disabling the manager or changing the configured GPIO pin.
Changes:
- Renamed the network/software EStop entrypoint from
Trigger()toSoftwareTrigger()and updated the websocket trigger handler accordingly. - Refactored the EStop manager task lifecycle into
estopmgr_taskStart()/estopmgr_taskStop(), with a kill-request flag to exit the task loop. - Adjusted EStop state publication to track last-published state locally and attempt to reset to Idle on task shutdown.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/message_handlers/websocket/gateway/Trigger.cpp | Updates gateway trigger handling to call the renamed software EStop API. |
| src/EStopManager.cpp | Refactors EStop manager task lifecycle, atomics usage, pin handling, and state publication/reset behavior. |
| include/estop/EStopManager.h | Renames public API from Trigger() to SoftwareTrigger(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR aims to reduce the use of atomics and global
staticvariables within the EStop manager, and improve the resiliency of the ones that are remain required.Additionally, the EStop manager now resets back to the Idle state when being disabled or when changing the pin (otherwise you could not disable it if it was falsely triggered prior to disabling, or if the previously-chosen pin was incorrect and would always read Low).