mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
commander: check if battery was already disconnected on arming
If so, don't report. Happens e.g. with USB powered pixhawk.
This commit is contained in:
parent
24142bc014
commit
693af897b3
@ -113,9 +113,13 @@ void BatteryChecks::checkAndReport(const Context &context, Report &reporter)
|
||||
battery_required_count++;
|
||||
}
|
||||
|
||||
if (!_last_armed && context.isArmed()) {
|
||||
_battery_connected_at_arming[index] = battery.connected;
|
||||
}
|
||||
|
||||
if (context.isArmed()) {
|
||||
|
||||
if (!battery.connected) {
|
||||
if (!battery.connected && _battery_connected_at_arming[index]) { // If disconnected after arming
|
||||
/* EVENT
|
||||
*/
|
||||
reporter.healthFailure<uint8_t>(NavModes::All, health_component_t::battery, events::ID("check_battery_disconnected"),
|
||||
@ -243,6 +247,7 @@ void BatteryChecks::checkAndReport(const Context &context, Report &reporter)
|
||||
reporter.setIsPresent(health_component_t::battery);
|
||||
}
|
||||
|
||||
_last_armed = context.isArmed();
|
||||
}
|
||||
|
||||
void BatteryChecks::rtlEstimateCheck(const Context &context, Report &reporter, float worst_battery_time_s)
|
||||
|
||||
@ -53,5 +53,7 @@ private:
|
||||
|
||||
uORB::SubscriptionMultiArray<battery_status_s, battery_status_s::MAX_INSTANCES> _battery_status_subs{ORB_ID::battery_status};
|
||||
uORB::Subscription _rtl_time_estimate_sub{ORB_ID(rtl_time_estimate)};
|
||||
bool _last_armed{false};
|
||||
bool _battery_connected_at_arming[battery_status_s::MAX_INSTANCES] {};
|
||||
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user