mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
Battery percentage added
This commit is contained in:
parent
09482d38b3
commit
9131d75cb5
@ -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.
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
3
misc.c
3
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,
|
||||
|
3
misc.h
3
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;
|
||||
|
||||
|
18
ui/menu.c
18
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);
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user