From da367b5d8dce27844baa220198ec114262e57cd0 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 22 Nov 2020 10:31:02 -0500 Subject: [PATCH] added condition for N or S latitude, E or W long --- afsk/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 474fa804..26ff77e2 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -674,8 +674,15 @@ for (int j = 0; j < frameCnt; j++) strcat(str, call); strcat(str, header_str2); // sprintf(header_str2b, "=%7.2f%c%c%c%08.2f%cShi hi ",4003.79,'N',0x5c,0x5c,07534.33,'W'); // add APRS lat and long - sprintf(header_lat, "%7.2f%c",latitude * 100.0,'N'); // lat - sprintf(header_long, "%08.2f%c",longitude * (-100.0),'W'); // long + if (latitude > 0) + sprintf(header_lat, "%7.2f%c",latitude * 100.0,'N'); // lat + else + sprintf(header_lat, "%7.2f%c",latitude * (-100.0),'S'); // lat + if (longitude > 0) + sprintf(header_long, "%08.2f%c",longitude * 100.0,'E'); // long + else + sprintf(header_long, "%08.2f%c",longitude * (-100.0),'W'); // long + sprintf(header_str2b, "=%s%c%c%sShi hi ",header_lat,0x5c,0x5c,header_long); // add APRS lat and long printf("\n\nString is %s \n\n", header_str2b); strcat(str, header_str2b);