mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-04 07:24:20 +01:00
Revert loopDelay dependency on wifi sleep mode
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -469,9 +469,9 @@ void info() {
|
||||
#if ADC_MODE_VALUE == ADC_VCC
|
||||
DEBUG_MSG_P(PSTR("[MAIN] Power: %u mV\n"), ESP.getVcc());
|
||||
#endif
|
||||
#if WIFI_SLEEP_MODE != WIFI_NONE_SLEEP
|
||||
if (systemLoopDelay()) {
|
||||
DEBUG_MSG_P(PSTR("[MAIN] Power saving delay value: %lu ms\n"), systemLoopDelay());
|
||||
#endif
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@@ -606,4 +606,4 @@ bool isNumber(const char * s) {
|
||||
}
|
||||
}
|
||||
return digit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user