Browse Source

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.
main
Matthias Grob 3 years ago committed by Igor Mišić
parent
commit
bd50a52c9c
  1. 10
      src/modules/commander/Commander.cpp
  2. 1
      src/modules/commander/Safety.hpp

10
src/modules/commander/Commander.cpp

@ -2307,11 +2307,13 @@ Commander::run() @@ -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;

1
src/modules/commander/Safety.hpp

@ -51,6 +51,7 @@ public: @@ -51,6 +51,7 @@ public:
void activateSafety();
bool isButtonAvailable() { return _button_available; }
bool isSafetyOff() { return _safety_off; }
bool isSafetyDisabled() { return _safety_disabled; }
private:
uORB::Subscription _safety_button_sub{ORB_ID::safety_button};

Loading…
Cancel
Save