AP_Notify: only play not-ready-or-not-finished tone if we've been ready

This commit is contained in:
Peter Barker 2017-10-27 22:08:43 +11:00 committed by Randy Mackay
parent c436235b05
commit 23882aaab0
2 changed files with 6 additions and 1 deletions

View File

@ -277,8 +277,12 @@ void ToneAlarm_PX4::update()
flags.pre_arm_check = AP_Notify::flags.pre_arm_check;
if (flags.pre_arm_check) {
play_tone(AP_NOTIFY_PX4_TONE_QUIET_READY_OR_FINISHED);
_have_played_ready_tone = true;
} else {
play_tone(AP_NOTIFY_PX4_TONE_QUIET_NOT_READY_OR_NOT_FINISHED);
// only play sad tone if we've ever played happy tone:
if (_have_played_ready_tone) {
play_tone(AP_NOTIFY_PX4_TONE_QUIET_NOT_READY_OR_NOT_FINISHED);
}
}
}

View File

@ -62,6 +62,7 @@ private:
uint16_t leak_detected : 1; // 1 if leak detected
uint16_t powering_off : 1; // 1 if smart battery is powering off
} flags;
bool _have_played_ready_tone : 1;
int8_t _cont_tone_playing;
int8_t _tone_playing;