mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 17:19:57 +00:00
Modified battery icon levels
This commit is contained in:
parent
c057f8a097
commit
9777b5df8b
@ -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;
|
||||
|
2
radio.c
2
radio.c
@ -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
|
||||
|
@ -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++)
|
||||
|
Loading…
Reference in New Issue
Block a user