mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2025-05-05 16:15:17 -04:00
Improved battery calculations for devices without dedicated PMU
This commit is contained in:
parent
96e74246bb
commit
0b9f19916e
2 changed files with 11 additions and 3 deletions
12
Display.h
12
Display.h
|
@ -266,14 +266,22 @@ void draw_battery_bars(int px, int py) {
|
|||
if (battery_ready) {
|
||||
if (battery_installed) {
|
||||
float battery_value = battery_percent;
|
||||
|
||||
// Disable charging state display for now, since
|
||||
// boards without dedicated PMU are completely
|
||||
// unreliable for determining actual charging state.
|
||||
bool disable_charge_status = false;
|
||||
if (battery_indeterminate && battery_state == BATTERY_STATE_CHARGING) {
|
||||
disable_charge_status = true;
|
||||
}
|
||||
|
||||
if (battery_state == BATTERY_STATE_CHARGING) {
|
||||
if (battery_state == BATTERY_STATE_CHARGING && !disable_charge_status) {
|
||||
battery_value = charge_tick;
|
||||
charge_tick += 3;
|
||||
if (charge_tick > 100) charge_tick = 0;
|
||||
}
|
||||
|
||||
if (battery_indeterminate && battery_state == BATTERY_STATE_CHARGING) {
|
||||
if (battery_indeterminate && battery_state == BATTERY_STATE_CHARGING && !disable_charge_status) {
|
||||
stat_area.fillRect(px-2, py-2, 18, 7, SSD1306_BLACK);
|
||||
stat_area.drawBitmap(px-2, py-2, bm_plug, 17, 7, SSD1306_WHITE, SSD1306_BLACK);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue