From 775ee36d0b97863a67348acfbfe72b4c97f3502c Mon Sep 17 00:00:00 2001 From: Paul Brand Date: Wed, 28 Aug 2024 08:46:30 +0200 Subject: [PATCH] Fixes typo Adds #endif comments --- Software/src/devboard/mqtt/mqtt.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Software/src/devboard/mqtt/mqtt.cpp b/Software/src/devboard/mqtt/mqtt.cpp index 6f4314f2..87dcc413 100644 --- a/Software/src/devboard/mqtt/mqtt.cpp +++ b/Software/src/devboard/mqtt/mqtt.cpp @@ -34,7 +34,7 @@ static String generateCellVoltageAutoConfigTopic(int cell_number, const char* ho static void publish_cell_voltages(void) { #ifdef HA_AUTODISCOVERY static bool mqtt_first_transmission = true; -#endif +#endif // HA_AUTODISCOVERY static JsonDocument doc; static const char* hostname = WiFi.getHostname(); static String state_topic = String("battery-emulator_") + String(hostname) + "/spec_data"; @@ -91,7 +91,7 @@ static void publish_cell_voltages(void) { if (!mqtt_publish(state_topic.c_str(), mqtt_msg, false)) { #ifdef DEBUG_VIA_USB Serial.println("Cell voltage MQTT msg could not be sent"); -#endif +#endif // DEBUG_VIA_USB } doc.clear(); #ifdef HA_AUTODISCOVERY @@ -99,7 +99,7 @@ static void publish_cell_voltages(void) { #endif // HA_AUTODISCOVERY } -#ifdef HA_AUTODISCOVER +#ifdef HA_AUTODISCOVERY struct SensorConfig { const char* object_id; const char* name; @@ -179,7 +179,7 @@ static void publish_common_info(void) { if (!mqtt_publish(state_topic.c_str(), mqtt_msg, false)) { #ifdef DEBUG_VIA_USB Serial.println("Common info MQTT msg could not be sent"); -#endif +#endif // DEBUG_VIA_USB } doc.clear(); #ifdef HA_AUTODISCOVERY @@ -192,7 +192,7 @@ static void reconnect() { // attempt one reconnection #ifdef DEBUG_VIA_USB Serial.print("Attempting MQTT connection... "); -#endif +#endif // DEBUG_VIA_USB const char* hostname = WiFi.getHostname(); char clientId[64]; // Adjust the size as needed snprintf(clientId, sizeof(clientId), "LilyGoClient-%s", hostname); @@ -200,13 +200,13 @@ static void reconnect() { if (client.connect(clientId, mqtt_user, mqtt_password)) { #ifdef DEBUG_VIA_USB Serial.println("connected"); -#endif +#endif // DEBUG_VIA_USB } else { #ifdef DEBUG_VIA_USB Serial.print("failed, rc="); Serial.print(client.state()); Serial.println(" try again in 5 seconds"); -#endif +#endif // DEBUG_VIA_USB // Wait 5 seconds before retrying } } @@ -215,7 +215,7 @@ void init_mqtt(void) { client.setServer(MQTT_SERVER, MQTT_PORT); #ifdef DEBUG_VIA_USB Serial.println("MQTT initialized"); -#endif +#endif // DEBUG_VIA_USB previousMillisUpdateVal = millis(); reconnect();