dfm09mod: fix DFM-SN fallback output

pull/53/head
Zilog80 2022-11-14 16:36:38 +01:00
rodzic 41a969b784
commit 6cecd8efb7
1 zmienionych plików z 10 dodań i 9 usunięć

Wyświetl plik

@ -1068,17 +1068,18 @@ static void print_gpx(gpx_t *gpx) {
if (gpx->option.jsn && jsonout && gpx->sek < 60.0) if (gpx->option.jsn && jsonout && gpx->sek < 60.0)
{ {
char *ver_jsn = NULL; char *ver_jsn = NULL;
char json_sonde_id[] = "DFM-xxxxxxxx\0\0"; char json_sonde_id[] = "DFM-xxxxxxxx\0\0"; // default (dfmXtyp==0)
ui8_t dfmXtyp = (gpx->sonde_typ & 0xF); ui8_t dfmXtyp = (gpx->sonde_typ & 0xF);
switch ( dfmXtyp ) { switch ( dfmXtyp ) {
case 0: sprintf(json_sonde_id, "DFM-xxxxxxxx"); break; //json_sonde_id[0] = '\0'; case 6:
case 6: sprintf(json_sonde_id, "DFM-%6X", gpx->SN6); break; // DFM-06 case 8: if (gpx->SN6) sprintf(json_sonde_id, "DFM-%6X", gpx->SN6); // DFM-06(P)
case 8: if (gpx->SN6) sprintf(json_sonde_id, "DFM-%6X", gpx->SN6); // DFM-06P else if (gpx->SN) sprintf(json_sonde_id, "DFM-%6u", gpx->SN); // Pilotsonde 0x8 ?
else sprintf(json_sonde_id, "DFM-%6u", gpx->SN); // Pilotsonde ? break;
break; // 0x7:PS-15 0xA:DFM-09 0xB:DFM-17 0xC:DFM-09P?DFM-17TU 0xD:DFM-17P
case 0xA: sprintf(json_sonde_id, "DFM-%6u", gpx->SN); break; // DFM-09 default: if (gpx->SN) sprintf(json_sonde_id, "DFM-%6u", gpx->SN);
// 0x7:PS-15?, 0xB:DFM-17? 0xC:DFM-09P?DFM-17TU? 0xD:DFM-17P? else if (gpx->SN6) sprintf(json_sonde_id, "DFM-%6X", gpx->SN6); // DFM-06 (incorrect sn_ch decode?)
default : sprintf(json_sonde_id, "DFM-%6u", gpx->SN); break;
// otherwise: "DFM-xxxxxxxx"
} }
// JSON frame counter: gpx->sec_gps , seconds since GPS (ignoring leap seconds, DFM=UTC) // JSON frame counter: gpx->sec_gps , seconds since GPS (ignoring leap seconds, DFM=UTC)