Battery calibration function added
This commit is contained in:
16
app/menu.c
16
app/menu.c
@@ -32,6 +32,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "frequencies.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#if defined(ENABLE_OVERLAY)
|
||||
@@ -264,6 +265,11 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
||||
break;
|
||||
|
||||
case MENU_VOL:
|
||||
*pMin = 0;
|
||||
*pMax = 2300;
|
||||
break;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
||||
@@ -585,6 +591,12 @@ 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;
|
||||
@@ -988,6 +1000,10 @@ 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;
|
||||
|
@@ -663,6 +663,7 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_VOL:
|
||||
|
||||
// 1st text line
|
||||
sprintf(String, "%u.%02uV", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||
@@ -677,6 +678,12 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(gF_LOCK){
|
||||
gBatteryCalibration[3] = gSubMenuSelection;
|
||||
sprintf(String, "%u", gSubMenuSelection);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
}
|
||||
|
||||
already_printed = true;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user