diff --git a/README.md b/README.md index 2b2edce..ce4b809 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,14 @@ To enable the custom option just uncomment the line by removing the starting '#' # Other changes made +Battery voltage boot screen now includes the percentage (as well as voltage). + * "STEP" menu, added 1.25kHz option, removed 5kHz option * "ABR" menu, shows extended backlight times * "MIC" menu, shows mic gain in dB's, now includes the max mic gain possible (+15.5dB) - +* "VOL" menu, renamed to "BATVOL", shows voltage and percentage +* "AM" menu, renamed to "MODE", shows modulation mode + # Compiler arm-none-eabi GCC version 10.3.1 is recommended, which is the current version on Ubuntu 22.04.03 LTS. diff --git a/firmware b/firmware index a2db72f..de6b562 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index a5c744a..2cedbd4 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index bbf1d24..dcf8584 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/misc.c b/misc.c index e39f9c6..8814862 100644 --- a/misc.c +++ b/misc.c @@ -29,6 +29,9 @@ bool gSetting_350EN; uint8_t gSetting_F_LOCK; bool gSetting_ScrambleEnable; +const uint16_t gMax_bat_v = 840; // 8.4V +const uint16_t gMin_bat_v = 660; // 6.6V + const uint32_t gDefaultAesKey[4] = { 0x4AA5CC60, diff --git a/misc.h b/misc.h index 0d09642..a753c9c 100644 --- a/misc.h +++ b/misc.h @@ -75,6 +75,9 @@ enum CssScanMode_t { typedef enum CssScanMode_t CssScanMode_t; +extern const uint16_t gMax_bat_v; +extern const uint16_t gMin_bat_v; + extern const uint32_t *gUpperLimitFrequencyBandTable; extern const uint32_t *gLowerLimitFrequencyBandTable; diff --git a/ui/menu.c b/ui/menu.c index 9ca85c5..435ccc4 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -89,7 +89,7 @@ static const char MenuList[][7] = "PONMSG", "ROGER", "BATVOL", - "AM", + "MODE", // 48 #ifndef DISABLE_NOAA "NOAA_S", @@ -375,6 +375,10 @@ void UI_DisplayMenu(void) sprintf(String, "%d sec", gSubMenuSelection * 10); break; + case MENU_AM: + strcpy(String, (gSubMenuSelection == 0) ? "FM" : "AM"); + break; + case MENU_BCL: case MENU_BEEP: case MENU_AUTOLK: @@ -383,7 +387,6 @@ void UI_DisplayMenu(void) case MENU_STE: case MENU_D_ST: case MENU_D_DCD: - case MENU_AM: #ifndef DISABLE_NOAA case MENU_NOAA_S: #endif @@ -497,7 +500,7 @@ void UI_DisplayMenu(void) break; case MENU_VOL: - sprintf(String, "%.3fV", gBatteryVoltageAverage * 0.01); // argh, floating point :( + sprintf(String, "%.2fV", gBatteryVoltageAverage * 0.01); // argh, floating point :( break; case MENU_RESET: @@ -511,6 +514,15 @@ void UI_DisplayMenu(void) UI_PrintString(String, 50, 127, 2, 8, true); + if (gMenuCursor == MENU_VOL) + { // 2nd text line + const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : + (gBatteryVoltageAverage > gMax_bat_v) ? gMax_bat_v : + gBatteryVoltageAverage; + sprintf(String, "%u%%", (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v)); + UI_PrintString(String, 50, 127, 4, 8, true); + } + if (gMenuCursor == MENU_OFFSET) UI_PrintString("MHz", 50, 127, 4, 8, true); diff --git a/ui/welcome.c b/ui/welcome.c index 4de2ebc..167a222 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -21,6 +21,7 @@ #include "external/printf/printf.h" #include "helper/battery.h" #include "settings.h" +#include "misc.h" #include "ui/helper.h" #include "ui/welcome.h" #include "version.h" @@ -44,8 +45,14 @@ void UI_DisplayWelcome(void) if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE) { + const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : + (gBatteryVoltageAverage > gMax_bat_v) ? gMax_bat_v : + gBatteryVoltageAverage; + sprintf(WelcomeString0, "VOLTAGE"); - sprintf(WelcomeString1, "%.2fV", gBatteryVoltageAverage * 0.01); // argh, floating point :( + sprintf(WelcomeString1, "%.2fV %u%%", + gBatteryVoltageAverage * 0.01, // argh, floating point :( + (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v)); } else {