Commander: Switch system off if in undervoltage condition and disarmed.

This is necessary to not have systems deep-discharge the battery while sitting idle. While at it we also deny arming in low battery conditions to ensure people who just landed with a low battery do not take off again and fail to get a successful RTL.
This commit is contained in:
Lorenz Meier 2017-02-02 16:06:44 +01:00 committed by Lorenz Meier
parent 6f84e79d70
commit a92931fe84
2 changed files with 4 additions and 2 deletions

View File

@ -2238,6 +2238,8 @@ int commander_thread_main(int argc, char *argv[])
if (!armed.armed) {
mavlink_log_critical(&mavlink_log_pub, "CRITICAL BATTERY, SHUT SYSTEM DOWN");
usleep(200000);
board_pwr(false);
} else {
if (low_bat_action == 1) {

View File

@ -1166,11 +1166,11 @@ int preflight_check(struct vehicle_status_s *status, orb_advert_t *mavlink_log_p
}
}
if (battery->warning == battery_status_s::BATTERY_WARNING_CRITICAL) {
if (battery->warning == battery_status_s::BATTERY_WARNING_LOW) {
preflight_ok = false;
if (reportFailures) {
mavlink_log_critical(mavlink_log_pub, "ARMING DENIED: VERY LOW BATTERY");
mavlink_log_critical(mavlink_log_pub, "ARMING DENIED: LOW BATTERY");
}
}