Call battery 'full' at 4100mV

This commit is contained in:
Pim van Pelt
2017-11-28 09:01:13 +01:00
parent 4b851ef144
commit 801e4435ce

View File

@ -33,10 +33,10 @@ static void widget_battery_render(struct widget_t *w, void *ev_data) {
mvolts=widget_battery_getvoltage();
color=ILI9341_RED;
if (mvolts<3400) mvolts=3400;
if (mvolts>3700) color=ILI9341_YELLOW;
if (mvolts>4000) color=ILI9341_GREEN;
if (mvolts>4200) mvolts=4200;
h=12-12*(mvolts-3400)/(4200-3400);
if (mvolts>3600) color=ILI9341_YELLOW;
if (mvolts>3900) color=ILI9341_GREEN;
if (mvolts>4100) mvolts=4100;
h=12-12*(mvolts-3400)/(4100-3400);
mgos_ili9341_fillRect(5, 2, 3, 2, color);
mgos_ili9341_fillRect(2, 4, 9, 14, color);