max17055
This commit is contained in:
jLynx 2024-07-16 08:17:55 +12:00 committed by GitHub
parent 9ef58b7763
commit ae75540d35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 1122 additions and 18 deletions

View file

@ -53,7 +53,7 @@ void BattinfoView::update_result() {
return;
}
bool uichg = false;
battery::BatteryManagement::getBatteryInfo(percent, voltage, current, isCharging);
battery::BatteryManagement::getBatteryInfo(percent, voltage, current);
// update text fields
if (percent <= 100)
text_percent.set(to_string_dec_uint(percent) + " %");
@ -69,8 +69,8 @@ void BattinfoView::update_result() {
labels_opt.hidden(false);
text_current.hidden(false);
text_charge.hidden(false);
text_current.set(to_string_dec_int(current) + " mA");
text_charge.set(isCharging ? "charge" : "discharge");
text_current.set(to_string_decimal(current / 100000.0, 3) + " mA");
text_charge.set(current >= 0 ? "Charging" : "Discharging");
labels_opt.hidden(false);
} else {
if (!labels_opt.hidden()) uichg = true;
@ -80,7 +80,7 @@ void BattinfoView::update_result() {
}
if (uichg) set_dirty();
// to update status bar too, send message in behalf of batt manager
BatteryStateMessage msg{percent, isCharging, voltage};
BatteryStateMessage msg{percent, current >= 0, voltage};
EventDispatcher::send_message(msg);
}