Add SetOff menu (experimental)
This commit is contained in:
25
app/app.c
25
app/app.c
@@ -1567,6 +1567,31 @@ void APP_TimeSlice500ms(void)
|
||||
BACKLIGHT_TurnOff();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||
if (gSleepModeCountdown_500ms == gSetting_set_off * 120 && gWakeUp) {
|
||||
ST7565_Init();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
gWakeUp = false;
|
||||
}
|
||||
|
||||
if (gSleepModeCountdown_500ms > 0 && --gSleepModeCountdown_500ms == 0) {
|
||||
gBacklightCountdown_500ms = 0;
|
||||
BACKLIGHT_TurnOff();
|
||||
ST7565_ShutDown();
|
||||
gWakeUp = true;
|
||||
gPowerSaveCountdownExpired = true;
|
||||
}
|
||||
|
||||
if (gWakeUp) {
|
||||
static bool swap = true;
|
||||
swap = !swap; // Alterne l'état à chaque exécution
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, swap);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, swap);
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gReducedService)
|
||||
{
|
||||
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);
|
||||
|
18
app/menu.c
18
app/menu.c
@@ -376,6 +376,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = gSubMenu_SIDEFUNCTIONS_size-1;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||
case MENU_SET_OFF:
|
||||
*pMax = 120;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1;
|
||||
@@ -868,6 +874,12 @@ void MENU_AcceptSetting(void)
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||
case MENU_SET_OFF:
|
||||
gSetting_set_off = gSubMenuSelection;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
gSetting_set_pwr = gSubMenuSelection;
|
||||
@@ -1294,6 +1306,12 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||
case MENU_SET_OFF:
|
||||
gSubMenuSelection = gSetting_set_off;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
gSubMenuSelection = gSetting_set_pwr;
|
||||
|
Reference in New Issue
Block a user