altos: TELEMETRY PROTOCOL CHANGE. Switch to 16-bit serial numbers.
authorKeith Packard <keithp@keithp.com>
Sun, 16 Jan 2011 00:25:10 +0000 (16:25 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 16 Jan 2011 22:32:47 +0000 (14:32 -0800)
What a terrible mistake! The flight computer serial numbers were
recorded in only 8 bits, so serial numbers > 255 would get truncated.

There's really no fix other than bumping the field to 16 bits and
reflashing every TM and TD on the planet. Very unfortunate.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao.h
src/ao_monitor.c
src/ao_telemetry.c

index 37a39a790b643b7061a1614fa3e6f128d90b4a5d..5721c34484c319f37f16c178aba1a6131b57298b 100644 (file)
--- a/src/ao.h
+++ b/src/ao.h
@@ -856,7 +856,7 @@ ao_gps_report_init(void);
 #define AO_TELEMETRY_VERSION   3
 
 struct ao_telemetry {
 #define AO_TELEMETRY_VERSION   3
 
 struct ao_telemetry {
-       uint8_t                 addr;
+       uint16_t                serial;
        uint16_t                flight;
        uint8_t                 flight_state;
        int16_t                 flight_accel;
        uint16_t                flight;
        uint8_t                 flight_state;
        int16_t                 flight_accel;
index 1e7f5102f09676509e624d555bf9fe7eb54c9df0..4ba3da6d848949b27e31495bbde9af68fb56c9eb 100644 (file)
@@ -41,10 +41,10 @@ ao_monitor(void)
                if (state > ao_flight_invalid)
                        state = ao_flight_invalid;
                if (recv.status & PKT_APPEND_STATUS_1_CRC_OK) {
                if (state > ao_flight_invalid)
                        state = ao_flight_invalid;
                if (recv.status & PKT_APPEND_STATUS_1_CRC_OK) {
-                       printf("VERSION %d CALL %s SERIAL %3d FLIGHT %5u RSSI %4d STATUS %02x STATE %7s ",
+                       printf("VERSION %d CALL %s SERIAL %d FLIGHT %5u RSSI %4d STATUS %02x STATE %7s ",
                               AO_TELEMETRY_VERSION,
                               callsign,
                               AO_TELEMETRY_VERSION,
                               callsign,
-                              recv.telemetry.addr,
+                              recv.telemetry.serial,
                               recv.telemetry.flight,
                               rssi, recv.status,
                               ao_state_names[state]);
                               recv.telemetry.flight,
                               rssi, recv.status,
                               ao_state_names[state]);
index 22ab1d67d51422f35f23ada36177275ad31c14c1..7aad929fb8706e7a247cc855a19b164c5bf8ec3d 100644 (file)
@@ -33,7 +33,7 @@ ao_telemetry(void)
        while (!ao_flight_number)
                ao_sleep(&ao_flight_number);
        memcpy(telemetry.callsign, ao_config.callsign, AO_MAX_CALLSIGN);
        while (!ao_flight_number)
                ao_sleep(&ao_flight_number);
        memcpy(telemetry.callsign, ao_config.callsign, AO_MAX_CALLSIGN);
-       telemetry.addr = ao_serial_number;
+       telemetry.serial = ao_serial_number;
        telemetry.flight = ao_log_full() ? 0 : ao_flight_number;
        telemetry.accel_plus_g = ao_config.accel_plus_g;
        telemetry.accel_minus_g = ao_config.accel_minus_g;
        telemetry.flight = ao_log_full() ? 0 : ao_flight_number;
        telemetry.accel_plus_g = ao_config.accel_plus_g;
        telemetry.accel_minus_g = ao_config.accel_minus_g;