mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 17:19:57 +00:00
Updated menu battery cal from egzumer
This commit is contained in:
parent
4333fdeb3a
commit
aea80cb046
36
app/menu.c
36
app/menu.c
@ -290,11 +290,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
||||
break;
|
||||
|
||||
case MENU_VOL:
|
||||
*pMin = 1760; // 0
|
||||
*pMax = 2000; // 2300
|
||||
break;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
||||
@ -320,6 +315,11 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = +50;
|
||||
break;
|
||||
|
||||
case MENU_BATCAL:
|
||||
*pMin = 1760; // 0
|
||||
*pMax = 2000; // 2300
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@ -616,11 +616,6 @@ void MENU_AcceptSetting(void)
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_VOL:
|
||||
if (gF_LOCK)
|
||||
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
||||
break;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
gSetting_battery_text = gSubMenuSelection;
|
||||
break;
|
||||
@ -734,6 +729,11 @@ void MENU_AcceptSetting(void)
|
||||
if (gF_LOCK)
|
||||
writeXtalFreqCal(gSubMenuSelection);
|
||||
return;
|
||||
|
||||
case MENU_BATCAL:
|
||||
gBatteryCalibration[3] = gSubMenuSelection;
|
||||
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
||||
break;
|
||||
}
|
||||
|
||||
gRequestSaveSettings = true;
|
||||
@ -1009,10 +1009,6 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
||||
break;
|
||||
|
||||
case MENU_VOL:
|
||||
gSubMenuSelection = gBatteryCalibration[3];
|
||||
return;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
gSubMenuSelection = gSetting_battery_text;
|
||||
return;
|
||||
@ -1098,6 +1094,13 @@ void MENU_ShowCurrentSetting(void)
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
break;
|
||||
|
||||
case MENU_BATCAL:
|
||||
gSubMenuSelection = gBatteryCalibration[3];
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// if (gFlagBackupSetting)
|
||||
@ -1286,14 +1289,11 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
// ***********************
|
||||
// restore original value
|
||||
|
||||
if (gMenuCursor == MENU_VOL)
|
||||
if (gMenuCursor == MENU_BATCAL)
|
||||
{
|
||||
if (gF_LOCK)
|
||||
{
|
||||
EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 8);
|
||||
|
||||
// gBatteryCalibration[3] = gSubMenuSelection_original;
|
||||
|
||||
BATTERY_GetReadings(true);
|
||||
}
|
||||
}
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
2
main.c
2
main.c
@ -112,7 +112,7 @@ void Main(void)
|
||||
if (BootMode == BOOT_MODE_F_LOCK)
|
||||
gF_LOCK = true; // flag to say use the hidden menu items
|
||||
else
|
||||
gMenuListCount -= 8; // hide the last few menu items
|
||||
gMenuListCount -= 9; // hide the last few menu items
|
||||
|
||||
// wait for user to release all butts before moving on
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||
|
10
ui/menu.c
10
ui/menu.c
@ -127,7 +127,8 @@ const t_menu_item MenuList[] =
|
||||
|
||||
{"TX-EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
{"F-CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
|
||||
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
||||
|
||||
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
||||
};
|
||||
|
||||
@ -770,6 +771,13 @@ void UI_DisplayMenu(void)
|
||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_BATCAL:
|
||||
{
|
||||
const uint16_t vol = (uint32_t)gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
||||
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, gSubMenuSelection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!already_printed)
|
||||
|
Loading…
Reference in New Issue
Block a user