altos/aprs: Encode last serial number in SSID. Transmit serial in comment
authorKeith Packard <keithp@keithp.com>
Fri, 20 Jun 2014 07:41:17 +0000 (00:41 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 20 Jun 2014 07:41:17 +0000 (00:41 -0700)
This makes it a lot easier to tell which device is sending
information, and to receive data from multiple devices on the same
receiver.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_aprs.c
src/test/ao_aprs_test.c
telegps/Makefile.am

index 8a1b6a4df2763e1e74ec9f61a082dc012f0da082..c33016f0534e8841122744ff0b83e7d2cfd0ee8b 100644 (file)
@@ -261,6 +261,7 @@ static uint8_t TNC_AX25_HEADER[] = {
 
 #define TNC_CALLSIGN_OFF       7
 #define TNC_CALLSIGN_LEN       6
 
 #define TNC_CALLSIGN_OFF       7
 #define TNC_CALLSIGN_LEN       6
+#define TNC_SSID_OFF           13
 
 static void
 tncSetCallsign(void)
 
 static void
 tncSetCallsign(void)
@@ -275,6 +276,7 @@ tncSetCallsign(void)
        }
        for (; i < TNC_CALLSIGN_LEN; i++)
                TNC_AX25_HEADER[TNC_CALLSIGN_OFF + i] = ' ' << 1;
        }
        for (; i < TNC_CALLSIGN_LEN; i++)
                TNC_AX25_HEADER[TNC_CALLSIGN_OFF + i] = ' ' << 1;
+       TNC_AX25_HEADER[TNC_SSID_OFF] = 0x60 | ((ao_serial_number % 10) << 1);
 #endif
 }
 
 #endif
 }
 
@@ -530,6 +532,7 @@ static int tncComment(uint8_t *buf)
 #ifdef AO_SENSE_MAIN
                       " M%d.%d"
 #endif
 #ifdef AO_SENSE_MAIN
                       " M%d.%d"
 #endif
+                      " %d"
                       , ao_gps_locked(),
                       ao_num_sats(),
                       battery/10,
                       , ao_gps_locked(),
                       ao_num_sats(),
                       battery/10,
@@ -542,6 +545,7 @@ static int tncComment(uint8_t *buf)
                       , main/10,
                       main%10
 #endif
                       , main/10,
                       main%10
 #endif
+                      , ao_serial_number
                );
 #else
        return sprintf((char *) buf,
                );
 #else
        return sprintf((char *) buf,
index 86cf527ae2f4c7219e376135b357aad327a6f14d..573b5cb22a1ed6e3386867b9f10c0f11bb019a84 100644 (file)
@@ -97,36 +97,12 @@ audio_gap(int secs)
 #endif
 }
 
 #endif
 }
 
-#include <math.h>
-
-int
-ao_aprs_encode_altitude_expensive(int meters)
-{
-       double  feet = meters / 0.3048;
-
-       double  encode = log(feet) / log(1.002);
-       return floor(encode + 0.5);
-}
-
 // This is where we go after reset.
 int main(int argc, char **argv)
 {
        int     e, x;
        int     a;
 
 // This is where we go after reset.
 int main(int argc, char **argv)
 {
        int     e, x;
        int     a;
 
-       for (a = 1; a < 100000; a++) {
-               e = ao_aprs_encode_altitude(a);
-               x = ao_aprs_encode_altitude_expensive(a);
-
-               if (e != x) {
-                       double  back_feet, back_meters;
-                       back_feet = pow(1.002, e);
-                       back_meters = back_feet * 0.3048;
-                       fprintf (stderr, "APRS altitude encoding failure: altitude %d actual %d expected %d actual meters %f\n",
-                                a, e, x, back_meters);
-               }
-       }
-
     audio_gap(1);
 
     ao_gps_data.latitude = (45.0 + 28.25 / 60.0) * 10000000;
     audio_gap(1);
 
     ao_gps_data.latitude = (45.0 + 28.25 / 60.0) * 10000000;
index a7defb8a01798816bc553609b5e3cf88a2927365..3f53b949bb94eb55a540d971c2e214c77e8e8c83 100644 (file)
@@ -205,8 +205,6 @@ $(FATJAR): classtelegps.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CL
                -C classes org \
                -C ../libaltos libaltosJNI
 
                -C classes org \
                -C ../libaltos libaltosJNI
 
-classtelegps.stamp: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS)
-
 libaltos.so: build-libaltos
        -rm -f "$@"
        $(LN_S) ../libaltos/.libs/"$@" .
 libaltos.so: build-libaltos
        -rm -f "$@"
        $(LN_S) ../libaltos/.libs/"$@" .