mirror of https://github.com/ArduPilot/ardupilot
AP_Notify: add radio and battery failsafe
radio and battery failsafe are slow flashing yellow pre-arm check failure changed to double flashing yellow
This commit is contained in:
parent
8f16dbf95e
commit
b3c636dfa3
|
@ -29,12 +29,14 @@ class AP_Notify
|
|||
public:
|
||||
/// notify_type - bitmask of notification types
|
||||
struct notify_type {
|
||||
uint16_t initialising : 1; // 1 if initialising and copter should not be moved
|
||||
uint16_t gps_status : 2; // 0 = no gps, 1 = no lock, 2 = 2d lock, 3 = 3d lock
|
||||
uint16_t armed : 1; // 0 = disarmed, 1 = armed
|
||||
uint16_t pre_arm_check : 1; // 0 = failing checks, 1 = passed
|
||||
uint16_t save_trim : 1; // 1 if gathering trim data
|
||||
uint16_t esc_calibration: 1; // 1 if calibrating escs
|
||||
uint16_t initialising : 1; // 1 if initialising and copter should not be moved
|
||||
uint16_t gps_status : 2; // 0 = no gps, 1 = no lock, 2 = 2d lock, 3 = 3d lock
|
||||
uint16_t armed : 1; // 0 = disarmed, 1 = armed
|
||||
uint16_t pre_arm_check : 1; // 0 = failing checks, 1 = passed
|
||||
uint16_t save_trim : 1; // 1 if gathering trim data
|
||||
uint16_t esc_calibration : 1; // 1 if calibrating escs
|
||||
uint16_t failsafe_radio : 1; // 1 if radio failsafe
|
||||
uint16_t failsafe_battery : 1; // 1 if battery failsafe
|
||||
};
|
||||
|
||||
// the notify flags are static to allow direct class access
|
||||
|
|
|
@ -90,6 +90,7 @@ void ToshibaLED::update_colours(void)
|
|||
case 0:
|
||||
case 3:
|
||||
case 6:
|
||||
// red on
|
||||
_red_des = TOSHIBA_LED_DIM;
|
||||
_blue_des = TOSHIBA_LED_OFF;
|
||||
_green_des = TOSHIBA_LED_OFF;
|
||||
|
@ -98,6 +99,7 @@ void ToshibaLED::update_colours(void)
|
|||
case 1:
|
||||
case 4:
|
||||
case 7:
|
||||
// blue on
|
||||
_red_des = TOSHIBA_LED_OFF;
|
||||
_blue_des = TOSHIBA_LED_DIM;
|
||||
_green_des = TOSHIBA_LED_OFF;
|
||||
|
@ -106,12 +108,42 @@ void ToshibaLED::update_colours(void)
|
|||
case 2:
|
||||
case 5:
|
||||
case 8:
|
||||
// green on
|
||||
_red_des = TOSHIBA_LED_OFF;
|
||||
_blue_des = TOSHIBA_LED_OFF;
|
||||
_green_des = TOSHIBA_LED_DIM;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
// all off
|
||||
_red_des = TOSHIBA_LED_OFF;
|
||||
_blue_des = TOSHIBA_LED_OFF;
|
||||
_green_des = TOSHIBA_LED_OFF;
|
||||
break;
|
||||
}
|
||||
// exit so no other status modify this pattern
|
||||
return;
|
||||
}
|
||||
|
||||
// failsafe patterns for radio and battery - single flash yellow
|
||||
if (AP_Notify::flags.failsafe_radio || AP_Notify::flags.failsafe_battery) {
|
||||
switch(step) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
// yellow on
|
||||
_red_des = TOSHIBA_LED_DIM;
|
||||
_blue_des = TOSHIBA_LED_OFF;
|
||||
_green_des = TOSHIBA_LED_DIM;
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
// all off
|
||||
_red_des = TOSHIBA_LED_OFF;
|
||||
_blue_des = TOSHIBA_LED_OFF;
|
||||
_green_des = TOSHIBA_LED_OFF;
|
||||
|
@ -145,7 +177,7 @@ void ToshibaLED::update_colours(void)
|
|||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
// even display blue light
|
||||
// all off
|
||||
_red_des = TOSHIBA_LED_OFF;
|
||||
_blue_des = TOSHIBA_LED_OFF;
|
||||
_green_des = TOSHIBA_LED_OFF;
|
||||
|
@ -154,25 +186,25 @@ void ToshibaLED::update_colours(void)
|
|||
}
|
||||
return;
|
||||
}else{
|
||||
// flash yellow if failing pre-arm checks
|
||||
// double flash yellow if failing pre-arm checks
|
||||
if (!AP_Notify::flags.pre_arm_check) {
|
||||
// flashing blue if no gps lock
|
||||
switch(step) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
// yellow on
|
||||
_red_des = TOSHIBA_LED_DIM;
|
||||
_blue_des = TOSHIBA_LED_OFF;
|
||||
_green_des = TOSHIBA_LED_DIM;
|
||||
break;
|
||||
case 5:
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
// even display blue light
|
||||
// all off
|
||||
_red_des = TOSHIBA_LED_OFF;
|
||||
_blue_des = TOSHIBA_LED_OFF;
|
||||
_green_des = TOSHIBA_LED_OFF;
|
||||
|
@ -192,6 +224,7 @@ void ToshibaLED::update_colours(void)
|
|||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
// blue on
|
||||
_red_des = TOSHIBA_LED_OFF;
|
||||
_blue_des = TOSHIBA_LED_DIM;
|
||||
_green_des = TOSHIBA_LED_OFF;
|
||||
|
@ -201,7 +234,7 @@ void ToshibaLED::update_colours(void)
|
|||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
// even display blue light
|
||||
// all off
|
||||
_red_des = TOSHIBA_LED_OFF;
|
||||
_blue_des = TOSHIBA_LED_OFF;
|
||||
_green_des = TOSHIBA_LED_OFF;
|
||||
|
|
Loading…
Reference in New Issue