From c7bed971ba88158b9a5986b9ac03945683eba1f7 Mon Sep 17 00:00:00 2001 From: Andrey Klimov Date: Fri, 17 Apr 2020 23:14:17 +0300 Subject: [PATCH] Fixes: negative pin# hung, compilation error, double ON ->white color, analog mapping on the edges of interval, macaddr mask, potential unrelability on LAN re-interability --- lighthub/abstractch.cpp | 3 ++- lighthub/inputs.cpp | 11 +++++++++-- lighthub/item.cpp | 7 ++++--- lighthub/main.cpp | 12 ++++++++---- lighthub/utils.cpp | 2 +- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lighthub/abstractch.cpp b/lighthub/abstractch.cpp index 48f3bf8..c54238b 100644 --- a/lighthub/abstractch.cpp +++ b/lighthub/abstractch.cpp @@ -7,6 +7,7 @@ extern lan_status lanStatus; extern PubSubClient mqttClient; +extern int8_t ethernetIdleCount; int abstractCh::publishTopic(const char* topic, long value, const char* subtopic) { @@ -31,7 +32,7 @@ int abstractCh::publishTopic(const char* topic, const char * value, const char* strncpy(addrstr,topic,sizeof(addrstr)); if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,topic); strncat(addrstr,subtopic,sizeof(addrstr)); - if (mqttClient.connected() && lanStatus == OPERATION) + if (mqttClient.connected() && lanStatus == OPERATION && !ethernetIdleCount) { mqttClient.publish(addrstr, value, true); return 1; diff --git a/lighthub/inputs.cpp b/lighthub/inputs.cpp index 829d7ac..34ad5b9 100644 --- a/lighthub/inputs.cpp +++ b/lighthub/inputs.cpp @@ -852,8 +852,15 @@ void Input::analogPoll(short cause) { if (aJson.getArraySize(inputMap)==5) Noize = aJson.getArrayItem(inputMap, 4)->valueint; - if (mappedInputVal>max) mappedInputVal = max; - if (mappedInputValmax) + { + mappedInputVal = max; + inputVal = 1023; + } + if (mappedInputVal0)) { debugSerial<= thermoSetting) { - if (thermoPin<0) digitalWrite(-thermoPin, HIGH); digitalWrite(thermoPin, LOW); + if (thermoPin<0) digitalWrite(-thermoPin, HIGH); else digitalWrite(thermoPin, LOW); debugSerial< +#include #if defined(__SAM3X8E__) || defined(ARDUINO_ARCH_STM32) #include