|
|
@ -10,9 +10,7 @@ Copyright (C) 2018 by Xose Pérez <xose dot perez at gmail dot com> |
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#if WIFI_SLEEP_MODE != WIFI_NONE_SLEEP
|
|
|
|
unsigned long _loop_delay = 0; |
|
|
|
#endif
|
|
|
|
|
|
|
|
bool _system_send_heartbeat = false; |
|
|
|
unsigned char _heartbeat_mode = HEARTBEAT_MODE; |
|
|
@ -75,11 +73,9 @@ bool systemGetHeartbeat() { |
|
|
|
return _system_send_heartbeat; |
|
|
|
} |
|
|
|
|
|
|
|
#if WIFI_SLEEP_MODE != WIFI_NONE_SLEEP
|
|
|
|
unsigned long systemLoopDelay() { |
|
|
|
return _loop_delay; |
|
|
|
} |
|
|
|
#endif
|
|
|
|
|
|
|
|
unsigned long systemLoadAverage() { |
|
|
|
return _load_average; |
|
|
@ -160,10 +156,7 @@ void systemLoop() { |
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Power saving delay
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#if WIFI_SLEEP_MODE != WIFI_NONE_SLEEP
|
|
|
|
delay(_loop_delay); |
|
|
|
#endif
|
|
|
|
if (_loop_delay) delay(_loop_delay); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -202,10 +195,8 @@ void systemSetup() { |
|
|
|
_systemSetupSpecificHardware(); |
|
|
|
|
|
|
|
// Cache loop delay value to speed things (recommended max 250ms)
|
|
|
|
#if WIFI_SLEEP_MODE != WIFI_NONE_SLEEP
|
|
|
|
_loop_delay = atol(getSetting("loopDelay", LOOP_DELAY_TIME).c_str()); |
|
|
|
_loop_delay = constrain(_loop_delay, 0, 300); |
|
|
|
#endif
|
|
|
|
_loop_delay = atol(getSetting("loopDelay", LOOP_DELAY_TIME).c_str()); |
|
|
|
_loop_delay = constrain(_loop_delay, 0, 300); |
|
|
|
|
|
|
|
// Register Loop
|
|
|
|
espurnaRegisterLoop(systemLoop); |
|
|
|