mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-21 23:50:36 +08:00
commander: only play safety change tunes if initialized
This commit is contained in:
@@ -1875,6 +1875,7 @@ Commander::run()
|
|||||||
const bool safety_updated = _safety_sub.updated();
|
const bool safety_updated = _safety_sub.updated();
|
||||||
|
|
||||||
if (safety_updated) {
|
if (safety_updated) {
|
||||||
|
const bool previous_safety_valid = (_safety.timestamp != 0);
|
||||||
const bool previous_safety_off = _safety.safety_off;
|
const bool previous_safety_off = _safety.safety_off;
|
||||||
|
|
||||||
if (_safety_sub.copy(&_safety)) {
|
if (_safety_sub.copy(&_safety)) {
|
||||||
@@ -1899,7 +1900,7 @@ Commander::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Notify the user if the status of the safety switch changes
|
// Notify the user if the status of the safety switch changes
|
||||||
if (_safety.safety_switch_available && previous_safety_off != _safety.safety_off) {
|
if (previous_safety_valid && _safety.safety_switch_available && previous_safety_off != _safety.safety_off) {
|
||||||
|
|
||||||
if (_safety.safety_off) {
|
if (_safety.safety_off) {
|
||||||
set_tune(tune_control_s::TUNE_ID_NOTIFY_POSITIVE);
|
set_tune(tune_control_s::TUNE_ID_NOTIFY_POSITIVE);
|
||||||
|
|||||||
Reference in New Issue
Block a user