mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
Made the status bar bat volt adaptive
This commit is contained in:
parent
737e5ac8e2
commit
93f6866c87
2
Makefile
2
Makefile
@ -19,7 +19,7 @@ ENABLE_BOOT_BEEPS := 0
|
|||||||
ENABLE_COMPANDER := 1
|
ENABLE_COMPANDER := 1
|
||||||
ENABLE_SHOW_CHARGE_LEVEL := 0
|
ENABLE_SHOW_CHARGE_LEVEL := 0
|
||||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||||
ENABLE_STATUSBAR_VOLTAGE := 0
|
ENABLE_STATUSBAR_VOLTAGE := 1
|
||||||
ENABLE_STATUSBAR_PERCENTAGE := 1
|
ENABLE_STATUSBAR_PERCENTAGE := 1
|
||||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||||
#ENABLE_BAND_SCOPE := 1
|
#ENABLE_BAND_SCOPE := 1
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
15
ui/status.c
15
ui/status.c
@ -115,20 +115,23 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
else
|
else
|
||||||
if (!gChargingWithTypeC)
|
if (!gChargingWithTypeC)
|
||||||
{ // battery voltage or percentage
|
{ // battery voltage or percentage
|
||||||
|
char s[8];
|
||||||
|
|
||||||
#ifdef ENABLE_STATUSBAR_VOLTAGE
|
#ifdef ENABLE_STATUSBAR_VOLTAGE
|
||||||
char s[6];
|
|
||||||
sprintf(s, "%u.%02u", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100);
|
const char *fmt[] = {"%u.%02u", "%2u.%02uV"};
|
||||||
UI_PrintStringSmallBuffer(s, line);
|
unsigned int i = gEeprom.VOX_SWITCH ? 0 : 1; // add a 'V' and shift the text left a bit if the VOX is not showing
|
||||||
//line += 8 * 4;
|
sprintf(s, fmt[i], gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100);
|
||||||
|
UI_PrintStringSmallBuffer(s, line - (i ? 20 : 0));
|
||||||
|
|
||||||
#elif defined(ENABLE_STATUSBAR_PERCENTAGE)
|
#elif defined(ENABLE_STATUSBAR_PERCENTAGE)
|
||||||
|
|
||||||
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
|
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
|
||||||
const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v);
|
const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v);
|
||||||
const unsigned int x = (percent >= 100) ? 0 : 4; // move to the right a bit
|
const unsigned int x = (percent >= 100) ? 0 : 4; // move to the right a bit
|
||||||
char s[8];
|
|
||||||
sprintf(s, "%u%%", percent);
|
sprintf(s, "%u%%", percent);
|
||||||
UI_PrintStringSmallBuffer(s, line + x);
|
UI_PrintStringSmallBuffer(s, line + x);
|
||||||
//line += 8 * 4;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user