diff --git a/app/app.c b/app/app.c index 186ba31..7cb7644 100644 --- a/app/app.c +++ b/app/app.c @@ -1375,8 +1375,68 @@ void APP_TimeSlice500ms(void) } } #endif +#ifdef ENABLE_FMRADIO + if (gFmRadioCountdown_500ms > 0) + { + gFmRadioCountdown_500ms--; + if (gFmRadioMode) // 1of11 + return; + } +#endif + if (gBacklightCountdown_500ms > 0 && !gAskToSave && !gCssBackgroundScan && + // don't turn off backlight if user is in backlight menu option + !(gScreenToDisplay == DISPLAY_MENU && (UI_MENU_GetCurrentMenuId() == MENU_ABR || UI_MENU_GetCurrentMenuId() == MENU_ABR_MAX))) + { + if (--gBacklightCountdown_500ms == 0) { + if (gEeprom.BACKLIGHT_TIME < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) { + // backlight is not set to be always on + BACKLIGHT_TurnOff(); + } + } + } + if (gReducedService) + { + BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent); + + if (gBatteryCurrent > 500 || gBatteryCalibration[3] < gBatteryCurrentVoltage) + { +#ifdef ENABLE_OVERLAY + overlay_FLASH_RebootToBootloader(); +#else + NVIC_SystemReset(); +#endif + } + + return; + } + + gBatteryCheckCounter++; + // Skipped authentic device check + if (gCurrentFunction != FUNCTION_TRANSMIT) + { + + if ((gBatteryCheckCounter & 1) == 0) + { + BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryVoltageIndex++], &gBatteryCurrent); + if (gBatteryVoltageIndex > 3) + gBatteryVoltageIndex = 0; + BATTERY_GetReadings(true); + } + } + + // regular display updates (once every 2 sec) - if need be + if ((gBatteryCheckCounter & 3) == 0) + { + if (gChargingWithTypeC ) + gUpdateStatus = true; +#ifdef ENABLE_SHOW_CHARGE_LEVEL + if (gChargingWithTypeC) + gUpdateDisplay = true; +#endif + } + if (!gCssBackgroundScan #ifdef ENABLE_FMRADIO && (gFM_ScanState == FM_SCAN_OFF || gAskToSave) diff --git a/settings.c b/settings.c index 017e193..6d3cceb 100644 --- a/settings.c +++ b/settings.c @@ -772,6 +772,9 @@ void SETTINGS_WriteBuildOptions(void) #endif #ifdef ENABLE_BLMIN_TMP_OFF | (1 << 3) +#endif +#ifdef ENABLE_AM_FIX + | (1 << 4) #endif ; EEPROM_WriteBuffer(0x1FF0, buf);