From 9449ac896e2dc5465fbc805bc89c595b26c0b17b Mon Sep 17 00:00:00 2001 From: PlayDay <18056374+playday3008@users.noreply.github.com> Date: Mon, 8 Mar 2021 12:05:40 +0100 Subject: [PATCH] Fix Battery icon --- source/Core/Threads/GUIThread.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index 1fbb14f8..0a04b2f3 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -160,11 +160,11 @@ static void gui_drawBatteryIcon() { uint32_t cellV = getInputVoltageX10(systemSettings.voltageDiv, 0) / cellCount; // Should give us approx cell voltage X10 // Range is 42 -> 33 = 9 steps therefore we will use battery 0-9 - if (cellV < 33) - cellV = 33; - cellV -= 33; // Should leave us a number of 0-9 - if (cellV > 9) - cellV = 9; + if (cellV < systemSettings.minVoltageCells) + cellV = systemSettings.minVoltageCells; + cellV -= systemSettings.minVoltageCells; // Should leave us a number of 0-9 + if (cellV > (uint32_t)(42 - systemSettings.minVoltageCells)) + cellV = 42 - systemSettings.minVoltageCells; OLED::drawBattery(cellV + 1); } else { OLED::drawSymbol(15); // Draw the DC Logo