Another try to fix exception

Another try to fix exception (#14067)
This commit is contained in:
Theo Arends 2021-12-22 18:11:35 +01:00
parent 9c3fb8fc82
commit 7bf6e5a773

View File

@ -80,7 +80,7 @@ bool Rg15Poll(void) {
if (++Rg15.time == RG15_EVENT_TIMEOUT) {
Rg15.acc = 0;
Rg15.rate = 0;
MqttPublishSensor();
// MqttPublishSensor();
}
return false;
@ -96,7 +96,7 @@ bool Rg15Poll(void) {
Rg15Process(rg15_buffer);
}
MqttPublishSensor();
// MqttPublishSensor();
return true;
}
@ -142,15 +142,16 @@ float Rg15Parse(char* buffer, const char* item) {
char* start = strstr(buffer, item);
if (start != nullptr) {
char* end = strstr(start, " mm");
if (end != nullptr) {
char tmp = end[0];
end[0] = '\0';
float result = CharToFloat (start + strlen(item));
end[0] = tmp;
return result;
} else {
return 0.0f;
}
}
return 0.0f;
}
bool Rg15Command(void) {
bool serviced = true;
@ -167,6 +168,7 @@ bool Rg15Command(void) {
char rg15_buffer[255];
if (Rg15ReadLine(rg15_buffer)) {
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("HRG: Received %*_H"), strlen(rg15_buffer), rg15_buffer);
Response_P(PSTR("{\"" D_JSON_SERIALRECEIVED "\":\"%s\"}"), rg15_buffer);
Rg15Process(rg15_buffer);
}