feat: option to automatically power off radio after inactivity (#3414)

This commit is contained in:
Paul Tapper
2024-08-28 15:31:25 +10:00
committed by GitHub
parent 1852c8c673
commit af9ba9cef7
41 changed files with 1042 additions and 927 deletions
+11 -2
View File
@@ -82,6 +82,7 @@ enum MenuRadioSetupItems {
ITEM_RADIO_SETUP_START_SOUND,
CASE_PWR_BUTTON_PRESS(ITEM_RADIO_SETUP_PWR_ON_SPEED)
CASE_PWR_BUTTON_PRESS(ITEM_RADIO_SETUP_PWR_OFF_SPEED)
CASE_PWR_BUTTON_PRESS(ITEM_RADIO_SETUP_PWR_AUTO_OFF)
CASE_HAPTIC(ITEM_RADIO_SETUP_PWR_ON_OFF_HAPTIC)
#if defined(PXX2)
ITEM_RADIO_SETUP_OWNER_ID,
@@ -195,6 +196,7 @@ void menuRadioSetup(event_t event)
0,
CASE_PWR_BUTTON_PRESS(0) // pwr on speed
CASE_PWR_BUTTON_PRESS(0) // pwr off speed
CASE_PWR_BUTTON_PRESS(0) // pwr auto off
CASE_HAPTIC(0) // power on/off haptic
CASE_PXX2(0) // owner registration ID
CASE_GPS(LABEL(GPS))
@@ -549,11 +551,18 @@ void menuRadioSetup(event_t event)
#if defined(PWR_BUTTON_PRESS)
case ITEM_RADIO_SETUP_PWR_ON_SPEED:
g_eeGeneral.pwrOnSpeed = pwrDelayToYaml(editChoice(LCD_W-2, y, STR_PWR_ON_DELAY, STR_PWR_OFF_DELAYS, pwrDelayFromYaml(g_eeGeneral.pwrOnSpeed), 0, 4, attr|RIGHT, event));
g_eeGeneral.pwrOnSpeed = pwrDelayToYaml(editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_PWR_ON_DELAY, STR_PWR_OFF_DELAYS, pwrDelayFromYaml(g_eeGeneral.pwrOnSpeed), 0, 4, attr|LEFT, event));
break;
case ITEM_RADIO_SETUP_PWR_OFF_SPEED:
g_eeGeneral.pwrOffSpeed = pwrDelayToYaml(editChoice(LCD_W-2, y, STR_PWR_OFF_DELAY, STR_PWR_OFF_DELAYS, pwrDelayFromYaml(g_eeGeneral.pwrOffSpeed), 0, 4, attr|RIGHT, event));
g_eeGeneral.pwrOffSpeed = pwrDelayToYaml(editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_PWR_OFF_DELAY, STR_PWR_OFF_DELAYS, pwrDelayFromYaml(g_eeGeneral.pwrOffSpeed), 0, 4, attr|LEFT, event));
break;
case ITEM_RADIO_SETUP_PWR_AUTO_OFF:
lcdDrawTextAlignedLeft(y, STR_PWR_AUTO_OFF);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.pwrOffIfInactive, attr|LEFT);
lcdDrawChar(lcdLastRightPos, y, 'm');
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.pwrOffIfInactive, 0, 255);
break;
#endif