Fix json when metric units are set.

This commit is contained in:
antirez 2024-01-21 10:54:50 +01:00
parent 5579c4afe2
commit 0c3bb23eb4

View File

@ -1807,7 +1807,7 @@ struct aircraft *interactiveReceiveData(struct modesMessage *mm) {
} }
/* If the two data is less than 10 seconds apart, compute /* If the two data is less than 10 seconds apart, compute
* the position. */ * the position. */
if (abs(a->even_cprtime - a->odd_cprtime) <= 10000) { if (llabs(a->even_cprtime - a->odd_cprtime) <= 10000) {
decodeCPR(a); decodeCPR(a);
} }
} else if (mm->metype == 19) { } else if (mm->metype == 19) {
@ -2181,8 +2181,8 @@ char *aircraftsToJson(int *len) {
"{\"hex\":\"%s\", \"flight\":\"%s\", \"lat\":%f, " "{\"hex\":\"%s\", \"flight\":\"%s\", \"lat\":%f, "
"\"lon\":%f, \"altitude\":%d, \"track\":%d, " "\"lon\":%f, \"altitude\":%d, \"track\":%d, "
"\"speed\":%d},\n", "\"speed\":%d},\n",
a->hexaddr, a->flight, a->lat, a->lon, a->altitude, a->track, a->hexaddr, a->flight, a->lat, a->lon, altitude, a->track,
a->speed); speed);
p += l; buflen -= l; p += l; buflen -= l;
/* Resize if needed. */ /* Resize if needed. */
if (buflen < 256) { if (buflen < 256) {