Browse Source

Revert loopDelay dependency on wifi sleep mode

pull/1576/head
Max Prokhorov 5 years ago
parent
commit
a02eb5c4ab
2 changed files with 6 additions and 15 deletions
  1. +3
    -12
      code/espurna/system.ino
  2. +3
    -3
      code/espurna/utils.ino

+ 3
- 12
code/espurna/system.ino View File

@ -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);


+ 3
- 3
code/espurna/utils.ino View File

@ -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;
}
}

Loading…
Cancel
Save