From 7157584fe11dbcf644928f877964d0c2ff7dad90 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 3 Feb 2021 21:38:15 +0100 Subject: [PATCH] FMU safety button: Latch to disabled state As hardware buttons are not particularly reliable and the user flow is to disable safety then arm, then disarm via software / remote, it makes sense to make the button safety state itself sticky and require it to be reset via software. --- src/drivers/safety_button/SafetyButton.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/drivers/safety_button/SafetyButton.cpp b/src/drivers/safety_button/SafetyButton.cpp index 8c7babd4f9..308ff13046 100644 --- a/src/drivers/safety_button/SafetyButton.cpp +++ b/src/drivers/safety_button/SafetyButton.cpp @@ -84,7 +84,7 @@ SafetyButton::CheckButton() _button_counter++; } else if (_button_counter == CYCLE_COUNT) { - // switch to armed state + // switch safety off and to ok-to-arm state _safety_btn_off = true; _button_counter++; } @@ -95,8 +95,9 @@ SafetyButton::CheckButton() _button_counter++; } else if (_button_counter == CYCLE_COUNT) { - // change to disarmed state and notify - _safety_btn_off = false; + // do not switch safety off, + // as a button that is stuck in hardware + // could cause this _button_counter++; }