mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
On-screen battery level when charging
This commit is contained in:
parent
1610daaf01
commit
c4c7148d61
@ -72,6 +72,8 @@ To compile directly in windows without the need of a linux virtual machine:
|
|||||||
Then you can run 'win_make.bat' from the directory you saved this source code too.
|
Then you can run 'win_make.bat' from the directory you saved this source code too.
|
||||||
You may need to edit the bat file (path to make.exe) depending on where you installed the above two packages too.
|
You may need to edit the bat file (path to make.exe) depending on where you installed the above two packages too.
|
||||||
|
|
||||||
|
I've left some notes in the win_make.bat file to maybe help with stuff.
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
|
|
||||||
Many thanks to various people on Telegram for putting up with me during this effort and helping:
|
Many thanks to various people on Telegram for putting up with me during this effort and helping:
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -68,23 +68,29 @@ void BATTERY_GetReadings(bool bDisplayBatteryLevel)
|
|||||||
if (gBatteryCurrent < 501)
|
if (gBatteryCurrent < 501)
|
||||||
{
|
{
|
||||||
if (gChargingWithTypeC)
|
if (gChargingWithTypeC)
|
||||||
gUpdateStatus = true;
|
{
|
||||||
gChargingWithTypeC = 0;
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
gChargingWithTypeC = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!gChargingWithTypeC)
|
if (!gChargingWithTypeC)
|
||||||
{
|
{
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
}
|
}
|
||||||
gChargingWithTypeC = 1;
|
gChargingWithTypeC = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PreviousBatteryLevel != gBatteryDisplayLevel)
|
if (PreviousBatteryLevel != gBatteryDisplayLevel)
|
||||||
{
|
{
|
||||||
if (gBatteryDisplayLevel < 2)
|
if (gBatteryDisplayLevel < 2)
|
||||||
|
{
|
||||||
gLowBattery = true;
|
gLowBattery = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gLowBattery = false;
|
gLowBattery = false;
|
||||||
|
39
ui/main.c
39
ui/main.c
@ -21,6 +21,7 @@
|
|||||||
#include "driver/st7565.h"
|
#include "driver/st7565.h"
|
||||||
#include "external/printf/printf.h"
|
#include "external/printf/printf.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
#include "helper/battery.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
@ -55,7 +56,7 @@ void UI_DisplayMain(void)
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_DECODER
|
#ifdef ENABLE_DTMF_DECODER
|
||||||
bool show_dtmf_rx = true;
|
bool center_line_is_free = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (vfo_num = 0; vfo_num < 2; vfo_num++)
|
for (vfo_num = 0; vfo_num < 2; vfo_num++)
|
||||||
@ -102,7 +103,7 @@ void UI_DisplayMain(void)
|
|||||||
sprintf(String, ">%s", gDTMF_InputBox);
|
sprintf(String, ">%s", gDTMF_InputBox);
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_DECODER
|
#ifdef ENABLE_DTMF_DECODER
|
||||||
show_dtmf_rx = false;
|
center_line_is_free = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
UI_PrintString(String, 2, 0, vfo_num * 3, 8);
|
UI_PrintString(String, 2, 0, vfo_num * 3, 8);
|
||||||
@ -123,13 +124,13 @@ void UI_DisplayMain(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_DTMF_DECODER
|
#ifdef ENABLE_DTMF_DECODER
|
||||||
show_dtmf_rx = false;
|
center_line_is_free = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_DECODER
|
#ifdef ENABLE_DTMF_DECODER
|
||||||
show_dtmf_rx = false;
|
center_line_is_free = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -239,7 +240,7 @@ void UI_DisplayMain(void)
|
|||||||
UI_DisplayFrequency(gInputBox, 31, Line, true, false);
|
UI_DisplayFrequency(gInputBox, 31, Line, true, false);
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_DECODER
|
#ifdef ENABLE_DTMF_DECODER
|
||||||
show_dtmf_rx = false;
|
center_line_is_free = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -453,11 +454,31 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_DECODER
|
#ifdef ENABLE_DTMF_DECODER
|
||||||
if (show_dtmf_rx && gDTMF_ReceivedSaved[0] >= 32)
|
if (center_line_is_free)
|
||||||
{ // show the incoming DTMF live on-screen
|
{
|
||||||
UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3);
|
if (gDTMF_ReceivedSaved[0] >= 32)
|
||||||
}
|
{ // show the on-screen live DTMF decode
|
||||||
|
UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#else
|
||||||
|
if (center_line_is_free)
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
if (gChargingWithTypeC)
|
||||||
|
{ // charging .. show the battery state
|
||||||
|
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v :
|
||||||
|
(gBatteryVoltageAverage > gMax_bat_v) ? gMax_bat_v :
|
||||||
|
gBatteryVoltageAverage;
|
||||||
|
|
||||||
|
sprintf(String, "Charge %u.%02uV %u%%",
|
||||||
|
gBatteryVoltageAverage / 100,
|
||||||
|
gBatteryVoltageAverage % 100,
|
||||||
|
(100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v));
|
||||||
|
|
||||||
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user