diff --git a/README.md b/README.md index 4089615..b59f2f9 100644 --- a/README.md +++ b/README.md @@ -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. 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 Many thanks to various people on Telegram for putting up with me during this effort and helping: diff --git a/firmware b/firmware index 9df4dd5..baa9e74 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index b4ce314..9fb8ba1 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 8bcb76f..9ce24f7 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/helper/battery.c b/helper/battery.c index ebef8cc..4fc8482 100644 --- a/helper/battery.c +++ b/helper/battery.c @@ -68,23 +68,29 @@ void BATTERY_GetReadings(bool bDisplayBatteryLevel) if (gBatteryCurrent < 501) { if (gChargingWithTypeC) - gUpdateStatus = true; - gChargingWithTypeC = 0; + { + gUpdateStatus = true; + gUpdateDisplay = true; + } + gChargingWithTypeC = false; } else { if (!gChargingWithTypeC) { - gUpdateStatus = true; + gUpdateStatus = true; + gUpdateDisplay = true; BACKLIGHT_TurnOn(); } - gChargingWithTypeC = 1; + gChargingWithTypeC = true; } if (PreviousBatteryLevel != gBatteryDisplayLevel) { if (gBatteryDisplayLevel < 2) + { gLowBattery = true; + } else { gLowBattery = false; diff --git a/ui/main.c b/ui/main.c index 265e225..1321592 100644 --- a/ui/main.c +++ b/ui/main.c @@ -21,6 +21,7 @@ #include "driver/st7565.h" #include "external/printf/printf.h" #include "functions.h" +#include "helper/battery.h" #include "misc.h" #include "radio.h" #include "settings.h" @@ -55,7 +56,7 @@ void UI_DisplayMain(void) // #endif #ifdef ENABLE_DTMF_DECODER - bool show_dtmf_rx = true; + bool center_line_is_free = true; #endif for (vfo_num = 0; vfo_num < 2; vfo_num++) @@ -102,7 +103,7 @@ void UI_DisplayMain(void) sprintf(String, ">%s", gDTMF_InputBox); #ifdef ENABLE_DTMF_DECODER - show_dtmf_rx = false; + center_line_is_free = false; #endif } UI_PrintString(String, 2, 0, vfo_num * 3, 8); @@ -123,13 +124,13 @@ void UI_DisplayMain(void) else { #ifdef ENABLE_DTMF_DECODER - show_dtmf_rx = false; + center_line_is_free = false; #endif } UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8); #ifdef ENABLE_DTMF_DECODER - show_dtmf_rx = false; + center_line_is_free = false; #endif continue; @@ -239,7 +240,7 @@ void UI_DisplayMain(void) UI_DisplayFrequency(gInputBox, 31, Line, true, false); #ifdef ENABLE_DTMF_DECODER - show_dtmf_rx = false; + center_line_is_free = false; #endif } else @@ -453,11 +454,31 @@ void UI_DisplayMain(void) } #ifdef ENABLE_DTMF_DECODER - if (show_dtmf_rx && gDTMF_ReceivedSaved[0] >= 32) - { // show the incoming DTMF live on-screen - UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3); - } + if (center_line_is_free) + { + 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 + 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(); }