AP_Notify: update to use capacity_remaining_pct() as a bool

This commit is contained in:
Willian Galvani 2020-04-23 13:18:22 -03:00 committed by Andrew Tridgell
parent 207723319b
commit b9452c83be

View File

@ -526,8 +526,12 @@ void Display::update_battery(uint8_t r)
{
char msg [DISPLAY_MESSAGE_SIZE];
AP_BattMonitor &battery = AP::battery();
uint8_t pct = battery.capacity_remaining_pct();
uint8_t pct;
if (battery.capacity_remaining_pct(pct)) {
snprintf(msg, DISPLAY_MESSAGE_SIZE, "BAT:%4.2fV %2d%% ", (double)battery.voltage(), pct) ;
} else {
snprintf(msg, DISPLAY_MESSAGE_SIZE, "BAT:%4.2fV --%% ", (double)battery.voltage()) ;
}
draw_text(COLUMN(0), ROW(r), msg);
}