From: Keith Packard Date: Wed, 22 Jun 2011 19:27:34 +0000 (-0700) Subject: altos: Add arbitrary telemetry packet monitoring X-Git-Tag: 0.9.4.3~50 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=489a68ba8e3bc360e2e8fc887e4c4b840b5a0dd3;ds=sidebyside altos: Add arbitrary telemetry packet monitoring This adds the ability to monitor arbitrary telemetry packets (up to 128 bytes), moving the telemetry data parsing up to the host. Signed-off-by: Keith Packard --- diff --git a/src/ao.h b/src/ao.h index b6a987e3..f5753703 100644 --- a/src/ao.h +++ b/src/ao.h @@ -1036,12 +1036,13 @@ void ao_gps_report_init(void); /* - * ao_telemetry.c + * ao_telemetry_orig.c */ #define AO_MAX_CALLSIGN 8 +#define AO_MAX_TELEMETRY 128 -struct ao_telemetry { +struct ao_telemetry_orig { uint16_t serial; uint16_t flight; uint8_t flight_state; @@ -1080,6 +1081,10 @@ struct ao_telemetry_tiny { * ao_radio_recv tacks on rssi and status bytes */ +struct ao_telemetry_raw_recv { + uint8_t packet[AO_MAX_TELEMETRY + 2]; +}; + struct ao_telemetry_orig_recv { struct ao_telemetry_orig telemetry_orig; int8_t rssi; diff --git a/src/ao_monitor.c b/src/ao_monitor.c index 248857de..ac1929db 100644 --- a/src/ao_monitor.c +++ b/src/ao_monitor.c @@ -26,6 +26,7 @@ ao_monitor(void) { __xdata char callsign[AO_MAX_CALLSIGN+1]; __xdata union { + struct ao_telemetry_raw_recv raw; struct ao_telemetry_orig_recv orig; struct ao_telemetry_tiny_recv tiny; } u; @@ -185,6 +186,15 @@ ao_monitor(void) printf("CRC INVALID RSSI %3d\n", rssi); } break; + default: + if (ao_monitoring > AO_MAX_TELEMETRY) + ao_monitoring = AO_MAX_TELEMETRY; + if (!ao_radio_recv(&recv_raw, ao_monitoring)) + continue; + for (state = 0; state < ao_monitoring + 1; state++) + printf("%02x ", recv_raw.packet[state]); + printf("%02x\n", recv_raw.packet[state]); + break; } ao_usb_flush(); ao_led_toggle(ao_monitor_led); diff --git a/src/ao_telemetry_orig.c b/src/ao_telemetry_orig.c index 9a86882f..4b3a344a 100644 --- a/src/ao_telemetry_orig.c +++ b/src/ao_telemetry_orig.c @@ -25,11 +25,11 @@ __xdata uint16_t ao_rdf_time; #define AO_RDF_LENGTH_MS 500 void -ao_telemetry(void) +ao_telemetry_orig(void) { uint16_t time; int16_t delay; - static __xdata struct ao_telemetry telemetry; + static __xdata struct ao_telemetry_orig telemetry; ao_config_get(); while (!ao_flight_number) @@ -96,10 +96,10 @@ ao_rdf_set(uint8_t rdf) ao_rdf_time = ao_time(); } -__xdata struct ao_task ao_telemetry_task; +__xdata struct ao_task ao_telemetry_orig_task; void -ao_telemetry_init() +ao_telemetry_orig_init() { - ao_add_task(&ao_telemetry_task, ao_telemetry, "telemetry"); + ao_add_task(&ao_telemetry_orig_task, ao_telemetry_orig, "telemetry_orig"); }