Made call to IAS.loop less often. Added some debug outputs. Moved some config parameters out of the code to platformio.ini

This commit is contained in:
Dirk Jahnke 2019-02-01 15:20:56 +01:00
parent 9545620ebf
commit fe9f25c856
1 changed files with 8 additions and 2 deletions

View File

@ -149,7 +149,7 @@ void setupIAS(void) {
// Call home interval in seconds, use 60s only for development.
// Please change it to at least 2 hours in production
IAS.setCallHomeInterval(120);
IAS.callHome(true /*SPIFFS-check*/);
// IAS.callHome(true /*SPIFFS-check*/);
modelTime.setSpeed_modelMsPerRealSecond(atoi(clockSpeed_modelMsPerRealSec_String));
relay1Pin = IAS.dPinConv(relay1Pin_String);
relay2Pin = IAS.dPinConv(relay2Pin_String);
@ -198,6 +198,8 @@ static unsigned long lastTimeOutput_ms = 0;
void loop(void)
{
static unsigned int lastMinutes = 0;
static unsigned long lastIASLoop_ts = 0;
#define CALL_IAS_EVERY_ms 100
static unsigned long firstLoop_ts = 0;
if (firstLoop_ts == 0) firstLoop_ts = millis();
@ -209,10 +211,14 @@ void loop(void)
Serial.println(timeClient.getFormattedTime());
lastTimeOutput_ms = millis();
}
IAS.loop();
if (millis() - lastIASLoop_ts > CALL_IAS_EVERY_ms) {
IAS.loop();
lastIASLoop_ts = millis();
}
if (timeClientInitialized && millis()-lastTimeOutput_ms > TIME_BETWEEN_REALTIME_UPDATE_ms) {
timeClient.update();
Serial.print("t-update: ");
Serial.println(timeClient.getFormattedTime());
lastTimeOutput_ms = millis();
}