mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 01:39:30 +02:00
Merge pull request #1485 from No-Signal/bugfix/mqtt_loop_fix
Fixing mqtt_loop setup regression bug
This commit is contained in:
commit
2ef8055535
3 changed files with 14 additions and 14 deletions
|
@ -474,6 +474,18 @@ void core_loop(void*) {
|
|||
}
|
||||
}
|
||||
|
||||
void mqtt_loop(void*) {
|
||||
esp_task_wdt_add(NULL); // Register this task with WDT
|
||||
|
||||
while (true) {
|
||||
START_TIME_MEASUREMENT(mqtt);
|
||||
mqtt_client_loop();
|
||||
END_TIME_MEASUREMENT_MAX(mqtt, datalayer.system.status.mqtt_task_10s_max_us);
|
||||
esp_task_wdt_reset(); // Reset watchdog
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialization
|
||||
void setup() {
|
||||
init_hal();
|
||||
|
@ -573,15 +585,3 @@ void setup() {
|
|||
|
||||
// Loop empty, all functionality runs in tasks
|
||||
void loop() {}
|
||||
|
||||
void mqtt_loop(void*) {
|
||||
esp_task_wdt_add(NULL); // Register this task with WDT
|
||||
|
||||
while (true) {
|
||||
START_TIME_MEASUREMENT(mqtt);
|
||||
mqtt_loop();
|
||||
END_TIME_MEASUREMENT_MAX(mqtt, datalayer.system.status.mqtt_task_10s_max_us);
|
||||
esp_task_wdt_reset(); // Reset watchdog
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -675,7 +675,7 @@ bool init_mqtt(void) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void mqtt_loop(void) {
|
||||
void mqtt_client_loop(void) {
|
||||
// Only attempt to publish/reconnect MQTT if Wi-Fi is connectedand checkTimmer is elapsed
|
||||
if (check_global_timer.elapsed() && WiFi.status() == WL_CONNECTED) {
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ extern const char* ha_device_id;
|
|||
extern char mqtt_msg[MQTT_MSG_BUFFER_SIZE];
|
||||
|
||||
bool init_mqtt(void);
|
||||
void mqtt_loop(void);
|
||||
void mqtt_client_loop(void);
|
||||
bool mqtt_publish(const char* topic, const char* mqtt_msg, bool retain);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue