From 254a64f9a67af1612cfdd32068fb33f1c946526f Mon Sep 17 00:00:00 2001 From: Zilog80 Date: Tue, 19 Sep 2023 16:07:07 +0200 Subject: [PATCH] weathex wrx301d: double check JSON output --- weathex/weathex301d.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/weathex/weathex301d.c b/weathex/weathex301d.c index cdd8107..ff210b9 100644 --- a/weathex/weathex301d.c +++ b/weathex/weathex301d.c @@ -481,6 +481,8 @@ int print_frame() { // JSON if (option_json && gpx.chk2ok) { + if (gpx.chk1ok && gpx.sn2 == gpx.sn1 && gpx.cnt2 == gpx.cnt1) // double check, unreliable checksums + { char *ver_jsn = NULL; fprintf(stdout, "{ \"type\": \"%s\"", "WXR301"); fprintf(stdout, ", \"frame\": %u", gpx.cnt2); @@ -506,6 +508,7 @@ int print_frame() { if (ver_jsn && *ver_jsn != '\0') fprintf(stdout, ", \"version\": \"%s\"", ver_jsn); fprintf(stdout, " }\n"); fprintf(stdout, "\n"); + } } }