AP_Notify: Fix for Oreo LED gyro init inidication

If parameter INS_GYRO_CAL is disabled, usually because operator is
arming on a moving vehicle such as a boat, the Oreo LEDs would wait
indefinitely for a gyro calibration that will never happen.  This
removes that dependency.  The LEDs will strobe blue only when gyros are
actually initializing. Not before.  Consequently, this greatly
simiplifies that portion of the code.
This commit is contained in:
Matt 2017-06-30 19:20:13 -04:00 committed by Andrew Tridgell
parent 93fdbf1573
commit d681ec304f

View File

@ -163,36 +163,15 @@ bool OreoLED_PX4::mode_firmware_update()
}
// Procedure for when Pixhawk is booting up and initializing
// Makes all LEDs rapidly strobe blue. Returns LED_INIT_STAGE
// 1 = Default, initialization has not yet begun
// 2 = Initialization flag found, initialization in progress
// 3 = Initialization flag no longer found, initialization complete
// Makes all LEDs rapidly strobe blue while gyros initialize.
bool OreoLED_PX4::mode_init()
{
static uint16_t stage = 1;
// Pixhawk has not begun initializing yet. Strobe all blue
if ((!AP_Notify::flags.initialising) && ((stage == 1))) {
if (AP_Notify::flags.initialising) {
set_rgb(OREOLED_INSTANCE_ALL, OREOLED_PATTERN_STROBE, 0, 0, 255,0,0,0,PERIOD_SUPER,0);
// Pixhawk has begun initializing
} else if ((AP_Notify::flags.initialising) && ((stage == 1))) {
stage = 2;
set_rgb(OREOLED_INSTANCE_ALL, OREOLED_PATTERN_STROBE, 0, 0, 255,0,0,0,PERIOD_SUPER,0);
// Pixhawk still initializing
} else if ((AP_Notify::flags.initialising) && ((stage == 2))) {
set_rgb(OREOLED_INSTANCE_ALL, OREOLED_PATTERN_STROBE, 0, 0, 255,0,0,0,PERIOD_SUPER,0);
// Pixhawk has completed initialization
} else if((!AP_Notify::flags.initialising) && ((stage == 2))) {
stage = 0;
set_rgb(OREOLED_INSTANCE_ALL, OREOLED_PATTERN_SOLID, 0, 0, 255);
} else { stage = 0; }
return stage;
return true;
} else {
return false;
}
}