propely handle sysstart and display Startup
This commit is contained in:
parent
f33076a0a3
commit
3e77f89538
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
typedef enum eSystem_Status
|
typedef enum eSystem_Status
|
||||||
{
|
{
|
||||||
|
sysStat_null,
|
||||||
sysStat_Startup,
|
sysStat_Startup,
|
||||||
sysStat_Normal,
|
sysStat_Normal,
|
||||||
sysStat_Error,
|
sysStat_Error,
|
||||||
@ -12,6 +13,7 @@ typedef enum eSystem_Status
|
|||||||
} tSystem_Status;
|
} tSystem_Status;
|
||||||
|
|
||||||
const char sSystem_Status_txt[][9] = {
|
const char sSystem_Status_txt[][9] = {
|
||||||
|
"Null",
|
||||||
"Startup",
|
"Startup",
|
||||||
"Normal",
|
"Normal",
|
||||||
"Error",
|
"Error",
|
||||||
|
@ -47,6 +47,7 @@ void SetBatteryType(batteryType_t type);
|
|||||||
void ProcessKeyCombos(bool *btnState);
|
void ProcessKeyCombos(bool *btnState);
|
||||||
void OverrideDisplay(uint32_t time, const char *message1, const char *message2, const char *message3);
|
void OverrideDisplay(uint32_t time, const char *message1, const char *message2, const char *message3);
|
||||||
void initGlobals();
|
void initGlobals();
|
||||||
|
void maintainSysStat();
|
||||||
|
|
||||||
#ifdef FEATURE_ENABLE_LORA
|
#ifdef FEATURE_ENABLE_LORA
|
||||||
void setMPins_Helper(int pin, int status);
|
void setMPins_Helper(int pin, int status);
|
||||||
@ -215,6 +216,7 @@ void setup()
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
|
maintainSysStat();
|
||||||
|
|
||||||
tmrEEPROMCyclicPDS.update();
|
tmrEEPROMCyclicPDS.update();
|
||||||
tmrFactionTicker.update();
|
tmrFactionTicker.update();
|
||||||
@ -240,27 +242,6 @@ void loop()
|
|||||||
tmrWiFiMaintainConnection.update();
|
tmrWiFiMaintainConnection.update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (globals.systemStatus)
|
|
||||||
{
|
|
||||||
case sysStat_Error:
|
|
||||||
/* code */
|
|
||||||
break;
|
|
||||||
case sysStat_Normal:
|
|
||||||
/* code */
|
|
||||||
break;
|
|
||||||
case sysStat_Shutdown:
|
|
||||||
OverrideDisplay(SHUTDOWN_DELAY_MS, " re", "boot", " ");
|
|
||||||
SystemShutdown();
|
|
||||||
break;
|
|
||||||
case sysStat_Startup:
|
|
||||||
if (millis() > STARTUP_DELAY_MS)
|
|
||||||
globals.systemStatus = sysStat_Normal;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,4 +598,52 @@ void ProcessKeyCombos(bool *btnState)
|
|||||||
keyStatus_Fac2 = KEY_RELEASED;
|
keyStatus_Fac2 = KEY_RELEASED;
|
||||||
keyStatus_Fac3 = KEY_RELEASED;
|
keyStatus_Fac3 = KEY_RELEASED;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void maintainSysStat()
|
||||||
|
{
|
||||||
|
|
||||||
|
static tSystem_Status lastStat = sysStat_null;
|
||||||
|
|
||||||
|
// system Status Transistions
|
||||||
|
switch (globals.systemStatus)
|
||||||
|
{
|
||||||
|
case sysStat_Shutdown:
|
||||||
|
SystemShutdown();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case sysStat_Startup:
|
||||||
|
if (millis() > STARTUP_DELAY_MS)
|
||||||
|
globals.systemStatus = sysStat_Normal;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case sysStat_Error:
|
||||||
|
case sysStat_Normal:
|
||||||
|
case sysStat_null:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// system Status Changed Actions
|
||||||
|
if (lastStat != globals.systemStatus)
|
||||||
|
{
|
||||||
|
switch (globals.systemStatus)
|
||||||
|
{
|
||||||
|
case sysStat_Shutdown:
|
||||||
|
OverrideDisplay(SHUTDOWN_DELAY_MS, " re", "boot", " ");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case sysStat_Startup:
|
||||||
|
OverrideDisplay(STARTUP_DELAY_MS, "star", "t up", " ");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case sysStat_Error:
|
||||||
|
case sysStat_Normal:
|
||||||
|
case sysStat_null:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastStat = globals.systemStatus;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user