From 1a520f878235e78f7ce2e12a5ac007bc578df253 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Thu, 29 Apr 2021 22:39:08 +0200 Subject: [PATCH] Minor usermod optimisations. --- .../usermod_PIR_sensor_switch.h | 31 +++++++------------ usermods/Temperature/usermod_temperature.h | 29 +++++++++++------ wled00/wled.h | 2 +- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h b/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h index 11277593a..7124552ba 100644 --- a/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h +++ b/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h @@ -87,8 +87,6 @@ private: static const char _name[]; static const char _switchOffDelay[]; static const char _enabled[]; - static const char _active[]; - static const char _inactive[]; /** * return or change if new PIR sensor state is available @@ -126,7 +124,7 @@ private: void publishMqtt(const char* state) { //Check if MQTT Connected, otherwise it will crash the 8266 - if (mqtt != nullptr){ + if (WLED_MQTT_CONNECTED){ char subuf[64]; strcpy(subuf, mqttDeviceTopic); strcat_P(subuf, PSTR("/motion")); @@ -229,12 +227,10 @@ public: */ void addToJsonInfo(JsonObject &root) { - //this code adds "u":{"⏲ PIR sensor state":uiDomString} to the info object - // the value contains a button to toggle the sensor enabled/disabled JsonObject user = root["u"]; if (user.isNull()) user = root.createNestedObject("u"); - +/* JsonArray infoArr = user.createNestedArray(F(" PIR sensor state")); //name String uiDomString = F("