Commander: fix startup sound interrupted by safety button initialization

The safetyButtonHandler() reports that the safety statatus
changed on the first loop iteration when safety is disabled which makes
sense to inform the system that safety is off but the tune for the user
should not be played because it interrupts the startup tune.
This commit is contained in:
Matthias Grob
2022-06-07 18:24:20 +02:00
committed by Igor Mišić
parent 71103e6114
commit bd50a52c9c
2 changed files with 7 additions and 4 deletions
+6 -4
View File
@@ -2307,11 +2307,13 @@ Commander::run()
_safety.isButtonAvailable(), _vehicle_status);
// Notify the user if the status of the safety button changes
if (_safety.isSafetyOff()) {
set_tune(tune_control_s::TUNE_ID_NOTIFY_POSITIVE);
if (!_safety.isSafetyDisabled()) {
if (_safety.isSafetyOff()) {
set_tune(tune_control_s::TUNE_ID_NOTIFY_POSITIVE);
} else {
tune_neutral(true);
} else {
tune_neutral(true);
}
}
_status_changed = true;