Signed-off-by: Keith Packard <keithp@keithp.com>
authorKeith Packard <keithp@keithp.com>
Thu, 6 Dec 2012 05:01:59 +0000 (21:01 -0800)
committerKeith Packard <keithp@keithp.com>
Thu, 6 Dec 2012 05:01:59 +0000 (21:01 -0800)
altos: Switch APRS to standard position reporting form

Stop using NMEA sentences for position

src/drivers/ao_aprs.c
src/test/ao_aprs_test.c

index 0a41d5fd3e56ccde8c8dd298a6ca97827097d2ef..cea802bb9b9578e01736474503df82bc6ccfc7ff 100644 (file)
@@ -1370,6 +1370,58 @@ void tncGPRMCPacket()
     tncPrintf ("*%02X", gpsNMEAChecksum(tncBuffer + 1, tncLength - 1));
 }
 
     tncPrintf ("*%02X", gpsNMEAChecksum(tncBuffer + 1, tncLength - 1));
 }
 
+/**
+ *   Generate the plain text position packet. Data is written through the tncTxByte
+ *   callback function
+ */
+void tncPositionPacket(void)
+{
+    int32_t    latitude = 45.4694766 * 10000000;
+    int32_t    longitude = -122.7376250 * 10000000;
+    uint32_t   altitude = 10000;
+    uint16_t   lat_deg;
+    uint16_t   lon_deg;
+    uint16_t   lat_min;
+    uint16_t   lat_frac;
+    uint16_t   lon_min;
+    uint16_t   lon_frac;
+
+    char       lat_sign = 'N', lon_sign = 'E';
+
+//    tncPrintf (">ANSR ");
+    if (latitude < 0) {
+       lat_sign = 'S';
+       latitude = -latitude;
+    }
+
+    if (longitude < 0) {
+       lon_sign = 'W';
+       longitude = -longitude;
+    }
+
+    lat_deg = latitude / 10000000;
+    latitude -= lat_deg * 10000000;
+    latitude *= 60;
+    lat_min = latitude / 10000000;
+    latitude -= lat_min * 10000000;
+    lat_frac = (latitude + 50000) / 100000;
+
+    lon_deg = longitude / 10000000;
+    longitude -= lon_deg * 10000000;
+    longitude *= 60;
+    lon_min = longitude / 10000000;
+    longitude -= lon_min * 10000000;
+    lon_frac = (longitude + 50000) / 100000;
+
+    tncPrintf ("=%02u%02u.%02u%c\\%03u%02u.%02u%cO",
+              lat_deg, lat_min, lat_frac, lat_sign,
+              lon_deg, lon_min, lon_frac, lon_sign);
+
+    tncPrintf (" /A=%06u", altitude * 100 / 3048);
+}
+
+
+
 /**
  *   Generate the plain text status packet.  Data is written through the tncTxByte
  *   callback function.
 /**
  *   Generate the plain text status packet.  Data is written through the tncTxByte
  *   callback function.
@@ -1466,7 +1518,8 @@ void tncTxPacket(TNC_DATA_MODE dataMode)
             break;
 
         case TNC_GGA:
             break;
 
         case TNC_GGA:
-            tncGPGGAPacket();
+           tncPositionPacket();
+//            tncGPGGAPacket();
 
             // Select the next packet we will generate.
             tncPacketType = TNC_RMC;
 
             // Select the next packet we will generate.
             tncPacketType = TNC_RMC;
index 1c0b252bc5cd564550d3828d39df38b157ef2c55..cec4d617ba80bea1e166bf39b9767ae83ad86b42 100644 (file)
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
     utcSeconds = 55;
   
     // This is the main loop that process GPS data and waits for the once per second timer tick.
     utcSeconds = 55;
   
     // This is the main loop that process GPS data and waits for the once per second timer tick.
-    for (i = 0; i < 5; i++)
+    for (i = 0; i < 3; i++)
     {
            audio_gap(10);
         // Read the GPS engine serial port FIFO and process the GPS data.
     {
            audio_gap(10);
         // Read the GPS engine serial port FIFO and process the GPS data.