AP_Notify: Add tone sequence to alert user when throw detector is armed

Use a medium tempo ascending three tone sequence with sufficient gap to allow the throwing action to be completed without distraction.
This commit is contained in:
Paul Riseborough 2015-12-19 22:19:51 +11:00 committed by Randy Mackay
parent a7b69366a1
commit 1e8af3dea4
3 changed files with 13 additions and 0 deletions

View File

@ -60,6 +60,7 @@ public:
// additional flags
uint32_t external_leds : 1; // 1 if external LEDs are enabled (normally only used for copter)
uint32_t vehicle_lost : 1; // 1 when lost copter tone is requested (normally only used for copter)
uint32_t waiting_for_throw : 1; // 1 when copter is in THROW mode and waiting to detect the user hand launch
};
/// notify_events_type - bitmask of active events.

View File

@ -65,6 +65,8 @@ const ToneAlarm_PX4::Tone ToneAlarm_PX4::_tones[] {
{ "MBNT255>B#8B#8B#8B#8B#8B#8B#8B#8B#8B#8B#8B#8B#8B#8B#8B#8", true },
#define AP_NOTIFY_PX4_TONE_QUIET_COMPASS_CALIBRATING_CTS 14
{ "MBNT255<C16P2", true },
#define AP_NOTIFY_PX4_TONE_WAITING_FOR_THROW 15
{ "MBNT90L4O2A#O3DFN0N0N0", true},
};
bool ToneAlarm_PX4::init()
@ -280,6 +282,15 @@ void ToneAlarm_PX4::update()
}
}
// waiting to be thrown vehicle tone
if (flags.waiting_for_throw != AP_Notify::flags.waiting_for_throw) {
flags.waiting_for_throw = AP_Notify::flags.waiting_for_throw;
if (flags.waiting_for_throw) {
play_tone(AP_NOTIFY_PX4_TONE_WAITING_FOR_THROW);
} else {
stop_cont_tone();
}
}
}
#endif // CONFIG_HAL_BOARD == HAL_BOARD_PX4

View File

@ -55,6 +55,7 @@ private:
uint8_t failsafe_radio : 1; // 1 if radio failsafe
uint8_t vehicle_lost : 1; // 1 if lost copter tone requested
uint8_t compass_cal_running : 1; // 1 if compass calibration is running
uint8_t waiting_for_throw : 1; // 1 if waiting for copter throw launch
} flags;
int8_t _cont_tone_playing;