altos: Add RSSI blinking to new-style telemetry code
[fw/altos] / src / core / ao_monitor.c
index 69eb58e85f8ac1373b9576b66573ecedfefd8019..c167b861fd8b687842e4c5fd6c09b1ecb71c49f9 100644 (file)
 __xdata uint8_t ao_monitoring;
 __pdata uint8_t ao_monitor_led;
 
-#define AO_MONITOR_RING        8
-
-__xdata union ao_monitor {
-               struct ao_telemetry_raw_recv    raw;
-               struct ao_telemetry_orig_recv   orig;
-               struct ao_telemetry_tiny_recv   tiny;
-} ao_monitor_ring[AO_MONITOR_RING];
-
-#define ao_monitor_ring_next(n)        (((n) + 1) & (AO_MONITOR_RING - 1))
+__xdata union ao_monitor ao_monitor_ring[AO_MONITOR_RING];
 
 __data uint8_t ao_monitor_head;
 
@@ -236,6 +228,10 @@ ao_monitor_put(void)
                                printf("%02x", byte);
                        }
                        printf("%02x\n", sum);
+                       if (recv_raw.packet[ao_monitoring + 1] & PKT_APPEND_STATUS_1_CRC_OK) {
+                               rssi = ((int16_t) recv_raw.packet[ao_monitoring] >> 1) - 74;
+                               ao_rssi_set(rssi);
+                       }
                        break;
                }
                ao_usb_flush();