mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 16:13:33 +08:00
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:
committed by
Lorenz Meier
parent
6f84e79d70
commit
a92931fe84
@@ -2238,6 +2238,8 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!armed.armed) {
|
if (!armed.armed) {
|
||||||
mavlink_log_critical(&mavlink_log_pub, "CRITICAL BATTERY, SHUT SYSTEM DOWN");
|
mavlink_log_critical(&mavlink_log_pub, "CRITICAL BATTERY, SHUT SYSTEM DOWN");
|
||||||
|
usleep(200000);
|
||||||
|
board_pwr(false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (low_bat_action == 1) {
|
if (low_bat_action == 1) {
|
||||||
|
|||||||
@@ -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;
|
preflight_ok = false;
|
||||||
|
|
||||||
if (reportFailures) {
|
if (reportFailures) {
|
||||||
mavlink_log_critical(mavlink_log_pub, "ARMING DENIED: VERY LOW BATTERY");
|
mavlink_log_critical(mavlink_log_pub, "ARMING DENIED: LOW BATTERY");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user