|
|
|
@ -150,26 +150,28 @@ void Plane::handle_battery_failsafe(const char *type_str, const int8_t action)
@@ -150,26 +150,28 @@ void Plane::handle_battery_failsafe(const char *type_str, const int8_t action)
|
|
|
|
|
} |
|
|
|
|
FALLTHROUGH; |
|
|
|
|
case Failsafe_Action_Land: |
|
|
|
|
if (flight_stage != AP_Vehicle::FixedWing::FLIGHT_LAND || control_mode == QLAND) { |
|
|
|
|
if (flight_stage != AP_Vehicle::FixedWing::FLIGHT_LAND && control_mode != QLAND) { |
|
|
|
|
// never stop a landing if we were already committed
|
|
|
|
|
if (plane.mission.jump_to_landing_sequence()) { |
|
|
|
|
plane.set_mode(AUTO, MODE_REASON_BATTERY_FAILSAFE); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
FALLTHROUGH; |
|
|
|
|
case Failsafe_Action_RTL: |
|
|
|
|
if (flight_stage != AP_Vehicle::FixedWing::FLIGHT_LAND || control_mode == QLAND ) { |
|
|
|
|
if (flight_stage != AP_Vehicle::FixedWing::FLIGHT_LAND && control_mode != QLAND ) { |
|
|
|
|
// never stop a landing if we were already committed
|
|
|
|
|
set_mode(RTL, MODE_REASON_BATTERY_FAILSAFE); |
|
|
|
|
aparm.throttle_cruise.load(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Failsafe_Action_Terminate: |
|
|
|
|
char battery_type_str[17]; |
|
|
|
|
snprintf(battery_type_str, 17, "%s battery", type_str); |
|
|
|
|
afs.gcs_terminate(true, battery_type_str); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Failsafe_Action_None: |
|
|
|
|
// don't actually do anything, however we should still flag the system as having hit a failsafe
|
|
|
|
|
// and ensure all appropriate flags are going off to the user
|
|
|
|
|