Skip to content

Commit

Permalink
GCS_Common: fix send_sys_status() which was killing current value if …
Browse files Browse the repository at this point in the history
…ANY battery was unhealthy
  • Loading branch information
magicrub committed Dec 6, 2024
1 parent ad539ff commit 900fead
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5766,7 +5766,7 @@ void GCS_MAVLINK::send_sys_status()
float battery_current;
const int8_t battery_remaining = battery_remaining_pct(AP_BATT_PRIMARY_INSTANCE);

if (battery.healthy() && battery.current_amps(battery_current)) {
if (battery.healthy(AP_BATT_PRIMARY_INSTANCE) && battery.current_amps(battery_current, AP_BATT_PRIMARY_INSTANCE)) {
battery_current = constrain_float(battery_current * 100,-INT16_MAX,INT16_MAX);
} else {
battery_current = -1;
Expand Down Expand Up @@ -5795,7 +5795,7 @@ void GCS_MAVLINK::send_sys_status()
0,
#endif
#if AP_BATTERY_ENABLED
battery.gcs_voltage() * 1000, // mV
battery.gcs_voltage(AP_BATT_PRIMARY_INSTANCE) * 1000, // mV
battery_current, // in 10mA units
battery_remaining, // in %
#else
Expand Down

0 comments on commit 900fead

Please sign in to comment.