Browse Source

AP_Notify: add radio and battery failsafe

radio and battery failsafe are slow flashing yellow
pre-arm check failure changed to double flashing yellow
mission-4.1.18
Randy Mackay 12 years ago
parent
commit
b3c636dfa3
  1. 4
      libraries/AP_Notify/AP_Notify.h
  2. 49
      libraries/AP_Notify/ToshibaLED.cpp

4
libraries/AP_Notify/AP_Notify.h

@ -34,7 +34,9 @@ public: @@ -34,7 +34,9 @@ public:
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 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

49
libraries/AP_Notify/ToshibaLED.cpp

@ -90,6 +90,7 @@ void ToshibaLED::update_colours(void) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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…
Cancel
Save