From 90fa1dac8185eade5e73c34228c84cd14b86d637 Mon Sep 17 00:00:00 2001 From: Malcolm Robb Date: Wed, 6 Aug 2014 15:21:50 +0100 Subject: [PATCH] net_io port 30003 bug Thanks to "Harrie" for this one. Fix the SBS port 30003 stream to always include speed and/or heading when available. --- net_io.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/net_io.c b/net_io.c index df6c842..25abb88 100644 --- a/net_io.c +++ b/net_io.c @@ -370,9 +370,19 @@ void modesSendSBSOutput(struct modesMessage *mm) { p += sprintf(p, ","); } - // Field 13 and 14 are the ground Speed and Heading (if we have them) - if (mm->bFlags & MODES_ACFLAGS_NSEWSPD_VALID) {p += sprintf(p, ",%d,%d", mm->velocity, mm->heading);} - else {p += sprintf(p, ",,");} + // Field 13 is the ground Speed (if we have it) + if (mm->bFlags & MODES_ACFLAGS_SPEED_VALID) { + p += sprintf(p, ",%d", mm->velocity); + } else { + p += sprintf(p, ","); + } + + // Field 14 is the ground Heading (if we have it) + if (mm->bFlags & MODES_ACFLAGS_HEADING_VALID) { + p += sprintf(p, ",%d", mm->heading); + } else { + p += sprintf(p, ","); + } // Fields 15 and 16 are the Lat/Lon (if we have it) if (mm->bFlags & MODES_ACFLAGS_LATLON_VALID) {p += sprintf(p, ",%1.5f,%1.5f", mm->fLat, mm->fLon);}