Dont run push when low on mem, avoid crash
This commit is contained in:
parent
49f166cc67
commit
1d113e6941
@ -271,7 +271,6 @@ void loopGravityOnInterval() {
|
|||||||
LOG_PERF_STOP("loop-gyro-read");
|
LOG_PERF_STOP("loop-gyro-read");
|
||||||
myBatteryVoltage.read();
|
myBatteryVoltage.read();
|
||||||
checkSleepMode(myGyro.getAngle(), myBatteryVoltage.getVoltage());
|
checkSleepMode(myGyro.getAngle(), myBatteryVoltage.getVoltage());
|
||||||
LOG_PERF_PUSH();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
#if defined (ESP8266)
|
#if defined (ESP8266)
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
||||||
|
#include <ESP8266HTTPClient.h>
|
||||||
|
#include <ESP8266mDNS.h>
|
||||||
#else // defined (ESP32)
|
#else // defined (ESP32)
|
||||||
#include <HTTPClient.h>
|
#include <HTTPClient.h>
|
||||||
#endif
|
#endif
|
||||||
@ -45,14 +47,22 @@ void PushTarget::send(float angle, float gravitySG, float corrGravitySG,
|
|||||||
|
|
||||||
if ((timePassed < interval) && !force) {
|
if ((timePassed < interval) && !force) {
|
||||||
#if LOG_LEVEL == 6 && !defined(PUSH_DISABLE_LOGGING)
|
#if LOG_LEVEL == 6 && !defined(PUSH_DISABLE_LOGGING)
|
||||||
/* Log.verbose(F("PUSH: Timer has not expired %l vs %l." CR), timePassed,
|
Log.verbose(F("PUSH: Timer has not expired %l vs %l." CR), timePassed,
|
||||||
interval);*/
|
interval);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ms = millis();
|
_ms = millis();
|
||||||
|
|
||||||
|
if (ESP.getFreeContStack() < 1500) {
|
||||||
|
Log.error(F("PUSH: Low on memory, skipping push since it will crasch. (stack=%d, heap=%d)." CR), ESP.getFreeContStack(), ESP.getFreeHeap());
|
||||||
|
myWifi.closeWifiClient();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//MDNS.close();
|
||||||
|
|
||||||
TemplatingEngine engine;
|
TemplatingEngine engine;
|
||||||
engine.initialize(angle, gravitySG, corrGravitySG, tempC, runTime);
|
engine.initialize(angle, gravitySG, corrGravitySG, tempC, runTime);
|
||||||
|
|
||||||
@ -85,6 +95,8 @@ void PushTarget::send(float angle, float gravitySG, float corrGravitySG,
|
|||||||
sendMqtt(engine);
|
sendMqtt(engine);
|
||||||
LOG_PERF_STOP("push-mqtt");
|
LOG_PERF_STOP("push-mqtt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_PERF_PUSH();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -36,7 +36,11 @@ json = { "id": id,
|
|||||||
"influxdb2-push": "", # InfluxDB2 settings
|
"influxdb2-push": "", # InfluxDB2 settings
|
||||||
"influxdb2-org": "",
|
"influxdb2-org": "",
|
||||||
"influxdb2-bucket": "",
|
"influxdb2-bucket": "",
|
||||||
"influxdb2-auth": ""
|
"influxdb2-auth": "" ,
|
||||||
|
"mqtt-push": "",
|
||||||
|
"mqtt-port": 1883,
|
||||||
|
"mqtt-user": "",
|
||||||
|
"mqtt-pass": ""
|
||||||
}
|
}
|
||||||
set_config( url, json )
|
set_config( url, json )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user