Skip to content

Commit

Permalink
commander: use shutdown_if_allowed() to check for shutdown safety
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Korigodski <[email protected]>
  • Loading branch information
korigod authored and julianoes committed Aug 5, 2019
1 parent 5133453 commit 4d5f922
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/commander/Commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3867,9 +3867,9 @@ void Commander::battery_status_check()
}

// Handle shutdown request from emergency battery action
if (!armed.armed && (battery.warning != _battery_warning)) {
if (battery.warning != _battery_warning) {

if (battery.warning == battery_status_s::BATTERY_WARNING_EMERGENCY) {
if ((battery.warning == battery_status_s::BATTERY_WARNING_EMERGENCY) && shutdown_if_allowed()) {
mavlink_log_critical(&mavlink_log_pub, "Dangerously low battery! Shutting system down");
px4_usleep(200000);

Expand Down

0 comments on commit 4d5f922

Please sign in to comment.