|
@ -310,15 +310,18 @@ class PubMqtt { |
|
|
char *pyld = new char[len + 1]; |
|
|
char *pyld = new char[len + 1]; |
|
|
strncpy(pyld, (const char*)payload, len); |
|
|
strncpy(pyld, (const char*)payload, len); |
|
|
pyld[len] = '\0'; |
|
|
pyld[len] = '\0'; |
|
|
|
|
|
if(NULL == strstr(topic, "limit")) |
|
|
root[F("val")] = atoi(pyld); |
|
|
root[F("val")] = atoi(pyld); |
|
|
|
|
|
else |
|
|
|
|
|
root[F("val")] = (int)(atof(pyld) * 10.0f); |
|
|
|
|
|
|
|
|
if(pyld[len-1] == 'W') |
|
|
if(pyld[len-1] == 'W') |
|
|
limitAbs = true; |
|
|
limitAbs = true; |
|
|
delete[] pyld; |
|
|
delete[] pyld; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const char *p = topic + strlen(mCfgMqtt->topic); |
|
|
const char *p = topic + strlen(mCfgMqtt->topic); |
|
|
uint8_t pos = 0; |
|
|
uint8_t pos = 0, elm = 0; |
|
|
uint8_t elm = 0; |
|
|
|
|
|
char tmp[30]; |
|
|
char tmp[30]; |
|
|
|
|
|
|
|
|
while(1) { |
|
|
while(1) { |
|
@ -333,8 +336,7 @@ class PubMqtt { |
|
|
root[F("cmd")] = F("limit_nonpersistent_absolute"); |
|
|
root[F("cmd")] = F("limit_nonpersistent_absolute"); |
|
|
else |
|
|
else |
|
|
root[F("cmd")] = F("limit_nonpersistent_relative"); |
|
|
root[F("cmd")] = F("limit_nonpersistent_relative"); |
|
|
} |
|
|
} else |
|
|
else |
|
|
|
|
|
root[F("cmd")] = String(tmp); |
|
|
root[F("cmd")] = String(tmp); |
|
|
break; |
|
|
break; |
|
|
case 3: root[F("id")] = atoi(tmp); break; |
|
|
case 3: root[F("id")] = atoi(tmp); break; |
|
|