From 4c6e1199dd44103d02f7e2724e439373e4ab961f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sun, 5 Mar 2017 22:38:09 +0100 Subject: [PATCH] Fix typo in mqtt reports. Added MQTT_RELAY_REPORT --- code/espurna/config/general.h | 3 ++- code/espurna/espurna.ino | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index dea3cc97..2a8b095e 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -174,8 +174,9 @@ #define MQTT_UPTIME_REPORT 4 #define MQTT_FREEHEAP_REPORT 8 #define MQTT_VCC_REPORT 16 +#define MQTT_RELAY_REPORT 32 -#define MQTT_REPORTS (MQTT_STATUS_REPORT | MQTT_UPTIME_REPORT | MQTT_FREEHEAP_REPORT) +#define MQTT_REPORTS (MQTT_STATUS_REPORT | MQTT_UPTIME_REPORT | MQTT_FREEHEAP_REPORT | MQTT_RELAY_REPORT) // ----------------------------------------------------------------------------- // I2C diff --git a/code/espurna/espurna.ino b/code/espurna/espurna.ino index 78a19922..bf5621c8 100644 --- a/code/espurna/espurna.ino +++ b/code/espurna/espurna.ino @@ -59,19 +59,22 @@ void hardwareLoop() { DEBUG_MSG("[MAIN] Power: %d mV\n", ESP.getVcc()); #endif - #if (MQTT_REPORTS | MQTT_STATUS_REPORT) + #if (MQTT_REPORTS & MQTT_STATUS_REPORT) mqttSend(MQTT_STATUS_TOPIC, "1"); #endif - #if (MQTT_REPORTS | MQTT_IP_REPORT) + #if (MQTT_REPORTS & MQTT_IP_REPORT) mqttSend(MQTT_IP_TOPIC, getIP().c_str()); #endif - #if (MQTT_REPORTS | MQTT_UPTIME_REPORT) + #if (MQTT_REPORTS & MQTT_UPTIME_REPORT) mqttSend(MQTT_UPTIME_TOPIC, String(uptime_seconds).c_str()); #endif - #if (MQTT_REPORTS | MQTT_FREEHEAP_REPORT) + #if (MQTT_REPORTS & MQTT_FREEHEAP_REPORT) mqttSend(MQTT_FREEHEAP_TOPIC, String(ESP.getFreeHeap()).c_str()); #endif - #if (MQTT_REPORTS | MQTT_VCC_REPORT) + #if (MQTT_REPORTS & MQTT_RELAY_REPORT) + relayMQTT(); + #endif + #if (MQTT_REPORTS & MQTT_VCC_REPORT) #if ENABLE_ADC_VCC mqttSend(MQTT_VCC_TOPIC, String(ESP.getVcc()).c_str()); #endif