diff --git a/build-flags/build_flags_mega2560slim2 b/build-flags/build_flags_mega2560slim2 index a9d219e..ef80113 100644 --- a/build-flags/build_flags_mega2560slim2 +++ b/build-flags/build_flags_mega2560slim2 @@ -10,7 +10,7 @@ -DNO_HOMIE -DCSSHDC_DISABLE -DSPILED_DISABLE --DAC_DISABLE +#-DAC_DISABLE -DSYSLOG_ENABLE -DPID_DISABLE -DOTA diff --git a/lighthub/abstractch.cpp b/lighthub/abstractch.cpp index 57e1ade..fdccd18 100644 --- a/lighthub/abstractch.cpp +++ b/lighthub/abstractch.cpp @@ -31,7 +31,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)); + strncat(addrstr,subtopic,sizeof(addrstr)-1); if (mqttClient.connected() && lanStatus == OPERATION && !ethernetIdleCount) { mqttClient.publish(addrstr, value, true); diff --git a/lighthub/item.cpp b/lighthub/item.cpp index 6fc83a7..74aa465 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -388,6 +388,14 @@ void Item::setVal(long int par) // Only store if VAL is int (autogenerated or c itemVal->type = aJson_Int; } +void Item::setFloatVal(float par) // Only store if VAL is int (autogenerated or config-defined) +{ + if (!itemVal || (itemVal->type != aJson_Int && itemVal->type != aJson_Float && itemVal->type != aJson_NULL)) return; + //debugSerial<")<itemVal->valueint); //debugSerial<itemVal->valueint); + Float(item->itemVal->valuefloat); //debugSerial<setCmd(cmd.cmdCode); if (optionsFlag & SEND_PARAMETERS) + switch (cmd.itemArgType) { + case ST_FLOAT: + case ST_FLOAT_CELSIUS: + item->setFloatVal(param.asfloat); + // + break; + + case ST_INT32: + case ST_UINT32: + item->setVal(param.asInt32); + break; + + default: item->setSubtype(cmd.itemArgType); item->setVal(param.asInt32); } diff --git a/lighthub/main.cpp b/lighthub/main.cpp index 50ffd59..c3807b3 100644 --- a/lighthub/main.cpp +++ b/lighthub/main.cpp @@ -1494,16 +1494,15 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args) } else { errorSerial<