Modified battery icon levels
This commit is contained in:
@@ -104,14 +104,14 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
|
|||||||
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
|
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
|
||||||
|
|
||||||
if(gBatteryVoltageAverage > 840)
|
if(gBatteryVoltageAverage > 840)
|
||||||
gBatteryDisplayLevel = 6; // battery overvoltage
|
gBatteryDisplayLevel = 7; // battery overvoltage
|
||||||
else if(gBatteryVoltageAverage < 630)
|
else if(gBatteryVoltageAverage < 630)
|
||||||
gBatteryDisplayLevel = 0; // battery critical
|
gBatteryDisplayLevel = 0; // battery critical
|
||||||
else {
|
else {
|
||||||
gBatteryDisplayLevel = 1;
|
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);
|
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]) {
|
if (perc > levels[i-2]) {
|
||||||
gBatteryDisplayLevel = i;
|
gBatteryDisplayLevel = i;
|
||||||
break;
|
break;
|
||||||
|
2
radio.c
2
radio.c
@@ -983,7 +983,7 @@ void RADIO_PrepareTX(void)
|
|||||||
if (gBatteryDisplayLevel == 0)
|
if (gBatteryDisplayLevel == 0)
|
||||||
State = VFO_STATE_BAT_LOW; // charge your battery !
|
State = VFO_STATE_BAT_LOW; // charge your battery !
|
||||||
else
|
else
|
||||||
if (gBatteryDisplayLevel >= 6)
|
if (gBatteryDisplayLevel > 6)
|
||||||
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
|
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -30,10 +30,10 @@ void UI_DrawBattery(uint8_t* bitmap, uint8_t level, uint8_t blink)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||||
if (level > 1)
|
if (level > 2)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint8_t bars = level - 1;
|
uint8_t bars = level - 2;
|
||||||
if (bars > 4)
|
if (bars > 4)
|
||||||
bars = 4;
|
bars = 4;
|
||||||
for (i = 0; i < bars; i++)
|
for (i = 0; i < bars; i++)
|
||||||
|
Reference in New Issue
Block a user