diff options
author | Keith Packard <keithp@keithp.com> | 2010-07-03 17:42:36 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-07-14 19:10:04 -0700 |
commit | a9ec6be0e92dee01f7aac006ef6f7779c1da1b36 (patch) | |
tree | d509de151b0049301cea622e7777d1b11e53c861 /src | |
parent | 62294ea3830d3ea261a8761edc9fa6f98201d321 (diff) |
Telemetry code was mis-computing RSSI
The RSSI data from the hardware reports in 1/2 dBm increments, and so
must be divided to report plain RSSI numbers.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/ao.h | 2 | ||||
-rw-r--r-- | src/ao_monitor.c | 10 |
2 files changed, 8 insertions, 4 deletions
@@ -804,7 +804,7 @@ ao_gps_report_init(void); */ #define AO_MAX_CALLSIGN 8 -#define AO_TELEMETRY_VERSION 2 +#define AO_TELEMETRY_VERSION 3 struct ao_telemetry { uint8_t addr; diff --git a/src/ao_monitor.c b/src/ao_monitor.c index f2f3fc2e..f019d3b4 100644 --- a/src/ao_monitor.c +++ b/src/ao_monitor.c @@ -26,6 +26,7 @@ ao_monitor(void) __xdata struct ao_radio_recv recv; __xdata char callsign[AO_MAX_CALLSIGN+1]; uint8_t state; + int16_t rssi; for (;;) { __critical while (!ao_monitoring) @@ -33,6 +34,9 @@ ao_monitor(void) if (!ao_radio_recv(&recv)) continue; state = recv.telemetry.flight_state; + + /* Typical RSSI offset for 38.4kBaud at 433 MHz is 74 */ + rssi = (int16_t) (recv.rssi >> 1) - 74; memcpy(callsign, recv.telemetry.callsign, AO_MAX_CALLSIGN); if (state > ao_flight_invalid) state = ao_flight_invalid; @@ -42,7 +46,7 @@ ao_monitor(void) callsign, recv.telemetry.addr, recv.telemetry.flight, - (int) recv.rssi - 74, recv.status, + rssi, recv.status, ao_state_names[state]); printf("%5u a: %5d p: %5d t: %5d v: %5d d: %5d m: %5d " "fa: %5d ga: %d fv: %7ld fp: %5d gp: %5d a+: %5d a-: %5d ", @@ -64,9 +68,9 @@ ao_monitor(void) putchar(' '); ao_gps_tracking_print(&recv.telemetry.gps_tracking); putchar('\n'); - ao_rssi_set((int) recv.rssi - 74); + ao_rssi_set(rssi); } else { - printf("CRC INVALID RSSI %3d\n", (int) recv.rssi - 74); + printf("CRC INVALID RSSI %3d\n", rssi); } ao_usb_flush(); ao_led_toggle(ao_monitor_led); |