Split temp & humidity SondeHub updates

pull/173/head
Luke Prior 2021-09-18 13:12:32 +10:00 zatwierdzone przez GitHub
rodzic 7254558c44
commit ae13b7853a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -3488,12 +3488,20 @@ void sondehub_send_data(WiFiClient * client, SondeInfo * s, struct st_sondehub *
w += strlen(w);
}
// Only send temp & humidity if provided
if (((int)s->temperature != 0) && ((int)s->relativeHumidity != 0)) {
// Only send temp if provided
if ((int)s->temperature != 0) {
sprintf(w,
"\"temp\": %.3f,",
float(s->temperature)
);
w += strlen(w);
}
// Only send humidity if provided
if ((int)s->relativeHumidity != 0) {
sprintf(w,
"\"temp\": %.3f,"
"\"humidity\": %.3f,",
float(s->temperature), float(s->relativeHumidity)
float(s->relativeHumidity)
);
w += strlen(w);
}