mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
only send heartbeat after MQTT connect
This commit is contained in:
@@ -452,7 +452,7 @@ void MyESP::_mqttOnConnect() {
|
||||
mqttPublish(MQTT_TOPIC_START, MQTT_TOPIC_START_PAYLOAD, false);
|
||||
|
||||
// send heartbeat if enabled
|
||||
_heartbeatCheck();
|
||||
_heartbeatCheck(true);
|
||||
|
||||
// call custom function to handle mqtt receives
|
||||
(_mqtt_callback_f)(MQTT_CONNECT_EVENT, nullptr, nullptr);
|
||||
@@ -1455,11 +1455,6 @@ void MyESP::_heartbeatCheck(bool force) {
|
||||
if ((millis() - last_heartbeat > MYESP_HEARTBEAT_INTERVAL) || force) {
|
||||
last_heartbeat = millis();
|
||||
|
||||
// print to log if force is set, so at bootup
|
||||
if (force) {
|
||||
_printHeap("[SYSTEM]");
|
||||
}
|
||||
|
||||
#ifdef MYESP_DEBUG
|
||||
_printHeap("[HEARTBEAT] ");
|
||||
#endif
|
||||
@@ -1467,6 +1462,11 @@ void MyESP::_heartbeatCheck(bool force) {
|
||||
return;
|
||||
}
|
||||
|
||||
// print to log if force is set
|
||||
if (force) {
|
||||
_printHeap("[SYSTEM]");
|
||||
}
|
||||
|
||||
uint32_t total_memory = _getInitialFreeHeap();
|
||||
uint32_t free_memory = ESP.getFreeHeap();
|
||||
uint8_t mem_available = 100 * free_memory / total_memory; // as a %
|
||||
@@ -2870,7 +2870,6 @@ void MyESP::begin(const char * app_hostname, const char * app_name, const char *
|
||||
_webserver_setup(); // init web server
|
||||
|
||||
_setSystemCheck(false); // reset system check
|
||||
_heartbeatCheck(true); // force heartbeat, will send out message to log too
|
||||
|
||||
_setSystemDropoutCounter(0); // reset # TCP dropouts
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef MyESP_h
|
||||
#define MyESP_h
|
||||
|
||||
#define MYESP_VERSION "1.2.23"
|
||||
#define MYESP_VERSION "1.2.24"
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
Reference in New Issue
Block a user