AP_Notify: added notify events for temperature calibration

This commit is contained in:
Andrew Tridgell 2021-01-11 07:09:44 +11:00 committed by Peter Barker
parent 3fb720354d
commit 73e53369e8
4 changed files with 35 additions and 8 deletions

View File

@ -89,7 +89,9 @@ void AP_BoardLED2::update(void)
return; return;
} }
if(AP_Notify::flags.compass_cal_running){ // compass calibration if(AP_Notify::flags.compass_cal_running ||
AP_Notify::flags.temp_cal_running){
// compass calibration or IMU temperature calibration
switch(save_trim_counter) { switch(save_trim_counter) {
case 0: case 0:
hal.gpio->write(HAL_GPIO_A_LED_PIN, HAL_GPIO_LED_ON); // short blinks by both LEDs hal.gpio->write(HAL_GPIO_A_LED_PIN, HAL_GPIO_LED_ON); // short blinks by both LEDs

View File

@ -103,6 +103,7 @@ public:
bool waiting_for_throw; // true when copter is in THROW mode and waiting to detect the user hand launch bool waiting_for_throw; // true when copter is in THROW mode and waiting to detect the user hand launch
bool powering_off; // true when the vehicle is powering off bool powering_off; // true when the vehicle is powering off
bool video_recording; // true when the vehicle is recording video bool video_recording; // true when the vehicle is recording video
bool temp_cal_running; // true if a temperature calibration is running
}; };
/// notify_events_type - bitmask of active events. /// notify_events_type - bitmask of active events.
@ -125,6 +126,9 @@ public:
uint32_t tune_next : 3; // tuning switched to next parameter uint32_t tune_next : 3; // tuning switched to next parameter
uint32_t tune_save : 1; // tuning saved parameters uint32_t tune_save : 1; // tuning saved parameters
uint32_t tune_error : 1; // tuning controller error uint32_t tune_error : 1; // tuning controller error
uint32_t initiated_temp_cal : 1; // 1 when temperature calibration starts
uint32_t temp_cal_saved : 1; // 1 when temperature calibration was just saved
uint32_t temp_cal_failed : 1; // 1 when temperature calibration has just failed
}; };
// The notify flags and values are static to allow direct class access // The notify flags and values are static to allow direct class access

View File

@ -62,7 +62,7 @@ const AP_ToneAlarm::Tone AP_ToneAlarm::_tones[] {
{ "MBT200>A#1", true }, { "MBT200>A#1", true },
#define AP_NOTIFY_TONE_LOUD_BATTERY_ALERT_CTS 13 #define AP_NOTIFY_TONE_LOUD_BATTERY_ALERT_CTS 13
{ "MBNT255>A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8", true }, { "MBNT255>A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8A#8", true },
#define AP_NOTIFY_TONE_QUIET_COMPASS_CALIBRATING_CTS 14 #define AP_NOTIFY_TONE_QUIET_CALIBRATING_CTS 14
{ "MBNT255<C16P2", true }, { "MBNT255<C16P2", true },
#define AP_NOTIFY_TONE_WAITING_FOR_THROW 15 #define AP_NOTIFY_TONE_WAITING_FOR_THROW 15
{ "MBNT90L4O2A#O3DFN0N0N0", true}, { "MBNT90L4O2A#O3DFN0N0N0", true},
@ -206,10 +206,10 @@ void AP_ToneAlarm::update()
if (AP_Notify::flags.compass_cal_running != flags.compass_cal_running) { if (AP_Notify::flags.compass_cal_running != flags.compass_cal_running) {
if (AP_Notify::flags.compass_cal_running) { if (AP_Notify::flags.compass_cal_running) {
play_tone(AP_NOTIFY_TONE_QUIET_COMPASS_CALIBRATING_CTS); play_tone(AP_NOTIFY_TONE_QUIET_CALIBRATING_CTS);
play_tone(AP_NOTIFY_TONE_QUIET_POS_FEEDBACK); play_tone(AP_NOTIFY_TONE_QUIET_POS_FEEDBACK);
} else { } else {
if (_cont_tone_playing == AP_NOTIFY_TONE_QUIET_COMPASS_CALIBRATING_CTS) { if (_cont_tone_playing == AP_NOTIFY_TONE_QUIET_CALIBRATING_CTS) {
stop_cont_tone(); stop_cont_tone();
} }
} }
@ -226,18 +226,38 @@ void AP_ToneAlarm::update()
return; return;
} }
if (AP_Notify::events.compass_cal_saved) { if (AP_Notify::events.compass_cal_saved ||
AP_Notify::events.temp_cal_saved) {
play_tone(AP_NOTIFY_TONE_QUIET_READY_OR_FINISHED); play_tone(AP_NOTIFY_TONE_QUIET_READY_OR_FINISHED);
return; return;
} }
if (AP_Notify::events.compass_cal_failed) { if (AP_Notify::events.compass_cal_failed ||
AP_Notify::events.temp_cal_failed) {
play_tone(AP_NOTIFY_TONE_QUIET_NEG_FEEDBACK); play_tone(AP_NOTIFY_TONE_QUIET_NEG_FEEDBACK);
return; return;
} }
// don't play other tones if compass cal is running if (AP_Notify::events.initiated_temp_cal) {
if (AP_Notify::flags.compass_cal_running) { play_tone(AP_NOTIFY_TONE_QUIET_NEU_FEEDBACK);
return;
}
if (AP_Notify::flags.temp_cal_running != flags.temp_cal_running) {
if (AP_Notify::flags.temp_cal_running) {
play_tone(AP_NOTIFY_TONE_QUIET_CALIBRATING_CTS);
play_tone(AP_NOTIFY_TONE_QUIET_POS_FEEDBACK);
} else {
if (_cont_tone_playing == AP_NOTIFY_TONE_QUIET_CALIBRATING_CTS) {
stop_cont_tone();
}
}
}
flags.temp_cal_running = AP_Notify::flags.temp_cal_running;
// don't play other tones if cal is running
if (AP_Notify::flags.compass_cal_running ||
AP_Notify::flags.temp_cal_running) {
return; return;
} }

View File

@ -64,6 +64,7 @@ private:
uint16_t waiting_for_throw : 1; // 1 if waiting for copter throw launch uint16_t waiting_for_throw : 1; // 1 if waiting for copter throw launch
uint16_t leak_detected : 1; // 1 if leak detected uint16_t leak_detected : 1; // 1 if leak detected
uint16_t powering_off : 1; // 1 if smart battery is powering off uint16_t powering_off : 1; // 1 if smart battery is powering off
uint16_t temp_cal_running : 1; // 1 if temperature calibration is running
} flags; } flags;
bool _have_played_ready_tone : 1; bool _have_played_ready_tone : 1;