Skip to content

[COMPONENT] ModeManager: EXIT_SAFE_MODE is unconditional, contradicting its FPP doc #511

Description

@Mikefly123

Component: ModeManager (PROVESFlightControllerReference/Components/ModeManager/, active component, module Components)
Category: command behavior vs. documentation

Description

The FPP doc comment for EXIT_SAFE_MODE says the command "only succeeds if currently in safe mode", but the handler is unconditional: when invoked in NORMAL mode it still returns CMD_RESPONSE OK, emits ExitingSafeMode, re-drives all eight load-switch turnOn ports, and re-broadcasts modeChanged(NORMAL).

Found while writing the new ModeManager component UT (test/ut/ModeManagerTester.cpp, case Nominal.ExitSafeModeWhenAlreadyNormal, landed in #510). The test currently pins the implemented behavior and carries a comment noting the mismatch — once this issue is decided, the test should be updated to pin the chosen behavior.

Expected

One of:

  • (a) Handler rejects the command when not in SAFE_MODE (VALIDATION_ERROR, or explicit event + OK-no-op), matching the doc; or
  • (b) The FPP doc is updated to state the command is an unconditional "drive outputs to NORMAL" recovery action (arguably useful as a ground recovery hammer).

Notes

Related finding from the same UT work: packetRouted clears the command-loss debounce latch, so a repeated comm timeout re-runs the full safe-mode entry (sequence, switch-offs, watchdog stop, entry-count increment) even while already in SAFE_MODE. Possibly intended (re-assert safing) but worth confirming while deciding this issue.

🤖 Generated with Claude Code
https://claude.ai/code/session_0156cFUudH6gCKKQLjPbnhsK

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions