changed Reset via Buttons during Startup

This commit is contained in:
Marcel Peterkau 2023-04-17 21:52:49 +02:00
parent ec62eeee1e
commit 97cdd7fad1
2 changed files with 22 additions and 4 deletions

View File

@ -13,7 +13,7 @@
#define HOST_NAME "AirsoftTimer_%08X"
#define SHUTDOWN_DELAY_MS 5000
#define RESETABLE_AFTER_STARTUP_MS 30000
#define STARTUP_DELAY_MS 20000
#define GPIO_LORA_TX D3
#define GPIO_LORA_RX D4

View File

@ -236,8 +236,26 @@ void loop()
#ifdef FEATURE_ENABLE_WIFI_CLIENT
tmrWiFiMaintainConnection.update();
#endif
if (globals.systemStatus == sysStat_Shutdown)
switch (globals.systemStatus)
{
case sysStat_Error:
/* code */
break;
case sysStat_Normal:
/* code */
break;
case sysStat_Shutdown:
SystemShutdown();
break;
case sysStat_Startup:
if (millis() > STARTUP_DELAY_MS)
globals.systemStatus = sysStat_Normal;
break;
default:
break;
}
yield();
}
@ -565,7 +583,7 @@ void ProcessKeyCombos(bool *btnState)
else if (keyCount_Fac2 == 4 && keyCount_Fac3 == 0)
{
Serial.printf("KeyCombo: Reset Timer\n");
if (millis() < RESETABLE_AFTER_STARTUP_MS)
if (globals.systemStatus == sysStat_Startup)
{
OverrideDisplay("RST ", 5000);
PersistenceData.faction_1_timer = 0;
@ -577,7 +595,7 @@ void ProcessKeyCombos(bool *btnState)
else
{
OverrideDisplay("ERR ", 5000);
Serial.printf("ERROR: only %d seconds after Startup!\n", RESETABLE_AFTER_STARTUP_MS / 1000);
Serial.printf("ERROR: only %d seconds after Startup!\n", STARTUP_DELAY_MS / 1000);
}
}