Modified battery icon levels

This commit is contained in:
Krzysiek Egzmont 2023-11-02 02:44:05 +01:00
parent c057f8a097
commit 9777b5df8b
3 changed files with 6 additions and 6 deletions

View File

@ -104,14 +104,14 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
if(gBatteryVoltageAverage > 840)
gBatteryDisplayLevel = 6; // battery overvoltage
gBatteryDisplayLevel = 7; // battery overvoltage
else if(gBatteryVoltageAverage < 630)
gBatteryDisplayLevel = 0; // battery critical
else {
gBatteryDisplayLevel = 1;
const uint8_t levels[] = {5,25,50,75};
const uint8_t levels[] = {5,17,41,65,88};
uint8_t perc = BATTERY_VoltsToPercent(gBatteryVoltageAverage);
for(uint8_t i = 5; i >= 1; i--){
for(uint8_t i = 6; i >= 1; i--){
if (perc > levels[i-2]) {
gBatteryDisplayLevel = i;
break;

View File

@ -983,7 +983,7 @@ void RADIO_PrepareTX(void)
if (gBatteryDisplayLevel == 0)
State = VFO_STATE_BAT_LOW; // charge your battery !
else
if (gBatteryDisplayLevel >= 6)
if (gBatteryDisplayLevel > 6)
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
}
else

View File

@ -30,10 +30,10 @@ void UI_DrawBattery(uint8_t* bitmap, uint8_t level, uint8_t blink)
else
{
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
if (level > 1)
if (level > 2)
{
unsigned int i;
uint8_t bars = level - 1;
uint8_t bars = level - 2;
if (bars > 4)
bars = 4;
for (i = 0; i < bars; i++)