Merge branch 'LukePrior-patch-2' into devel

This commit is contained in:
Hansi, dl9rdz 2021-09-18 20:30:14 +02:00
commit 494380a43d
1 changed files with 12 additions and 4 deletions

View File

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