From c549dab11a2a1a07bc17c29d2860ecea6f2b3640 Mon Sep 17 00:00:00 2001 From: Noah Axon Date: Thu, 28 Dec 2023 23:52:02 -0600 Subject: [PATCH] Reduce battery screen flicker, only update on % change --- m5stick-nemo.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/m5stick-nemo.ino b/m5stick-nemo.ino index e8e89cd..f5dde0e 100644 --- a/m5stick-nemo.ino +++ b/m5stick-nemo.ino @@ -502,6 +502,7 @@ int rotation = 1; #if defined(AXP) /// BATTERY INFO /// + int oldbattery=0; void battery_drawmenu(int battery, int b, int c) { DISP.setTextSize(SMALL_TEXT); DISP.fillScreen(BGCOLOR); @@ -530,12 +531,15 @@ int rotation = 1; float c = M5.Axp.GetVapsData() * 1.4 / 1000; float b = M5.Axp.GetVbatData() * 1.1 / 1000; int battery = ((b - 3.0) / 1.2) * 100; - battery_drawmenu(battery, b, c); + if (battery != oldbattery){ + battery_drawmenu(battery, b, c); + } if (check_select_press()) { rstOverride = false; isSwitching = true; current_proc = 1; } + oldbattery = battery; } #endif // AXP