Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the case where the flight controller is connected to the battery (charge 100), QGC shows no battery #15306

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/modules/mavlink/mavlink_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,13 @@ class MavlinkStreamSysStatus : public MavlinkStream

int lowest_battery_index = 0;

//No battery is connected, select the first group
//Low battery judgment is performed only when the current battery is connected
//When the last cached battery is not connected or the current battery level is lower than the cached battery level,
//the current battery status is replaced with the cached value
for (int i = 0; i < ORB_MULTI_MAX_INSTANCES; i++) {
if (battery_status[i].connected && (battery_status[i].remaining < battery_status[lowest_battery_index].remaining)) {
if (battery_status[i].connected && ((!battery_status[lowest_battery_index].connected)
|| (battery_status[i].remaining < battery_status[lowest_battery_index].remaining))) {
lowest_battery_index = i;
}
}
Expand Down