Browse Source

Add option to change loopDelay from command line

fastled
Xose Pérez 7 years ago
parent
commit
0fcca15e89
1 changed files with 13 additions and 6 deletions
  1. +13
    -6
      code/espurna/espurna.ino

+ 13
- 6
code/espurna/espurna.ino View File

@ -27,6 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// METHODS // METHODS
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
unsigned long _loopDelay = 0;
void hardwareSetup() { void hardwareSetup() {
EEPROM.begin(EEPROM_SIZE); EEPROM.begin(EEPROM_SIZE);
@ -49,6 +51,7 @@ void hardwareSetup() {
pinMode(16, OUTPUT); pinMode(16, OUTPUT);
digitalWrite(16, HIGH); //Defualt CT input (pin B, solder jumper B) digitalWrite(16, HIGH); //Defualt CT input (pin B, solder jumper B)
#endif #endif
} }
void hardwareLoop() { void hardwareLoop() {
@ -207,6 +210,8 @@ void welcome() {
#if ADC_VCC_ENABLED #if ADC_VCC_ENABLED
DEBUG_MSG_P(PSTR("[INIT] Power: %d mV\n"), ESP.getVcc()); DEBUG_MSG_P(PSTR("[INIT] Power: %d mV\n"), ESP.getVcc());
#endif #endif
DEBUG_MSG_P(PSTR("[INIT] Power saving delay value: %lu ms\n"), _loopDelay);
DEBUG_MSG_P(PSTR("\n")); DEBUG_MSG_P(PSTR("\n"));
} }
@ -221,15 +226,19 @@ void setup() {
systemCheck(false); systemCheck(false);
#endif #endif
// Show welcome message and system configuration
welcome();
// Init persistance and terminal features // Init persistance and terminal features
settingsSetup(); settingsSetup();
if (getSetting("hostname").length() == 0) { if (getSetting("hostname").length() == 0) {
setSetting("hostname", getIdentifier()); setSetting("hostname", getIdentifier());
} }
// Cache loop delay value to speed things (recommended max 250ms)
_loopDelay = atol(getSetting("loopDelay", LOOP_DELAY_TIME).c_str());
// Show welcome message and system configuration
welcome();
// Basic modules, will always run
wifiSetup(); wifiSetup();
otaSetup(); otaSetup();
#if TELNET_SUPPORT #if TELNET_SUPPORT
@ -360,8 +369,6 @@ void loop() {
#endif #endif
// Power saving delay // Power saving delay
#if LOOP_DELAY_TIME
delay(LOOP_DELAY_TIME);
#endif
delay(_loopDelay);
} }

Loading…
Cancel
Save