/* 32 */
};
+/* #define AO_SEND_ALL_BARO */
+
+#define AO_TELEMETRY_BARO 0x80
+
+/*
+ * This packet allows the full sampling rate baro
+ * data to be captured over the RF link so that the
+ * flight software can be tested using 'real' data.
+ *
+ * Along with this telemetry packet, the flight
+ * code is modified to send full-rate telemetry all the time
+ * and never send an RDF tone; this ensure that the full radio
+ * link is available.
+ */
+struct ao_telemetry_baro {
+ uint16_t serial; /* 0 */
+ uint16_t tick; /* 2 */
+ uint8_t type; /* 4 */
+ uint8_t samples; /* 5 number samples */
+
+ int16_t baro[12]; /* 6 samples */
+ /* 32 */
+};
+
union ao_telemetry_all {
struct ao_telemetry_generic generic;
struct ao_telemetry_sensor sensor;
struct ao_telemetry_location location;
struct ao_telemetry_satellite satellite;
struct ao_telemetry_companion companion;
+ struct ao_telemetry_baro baro;
};
/*
/* Set delay between telemetry reports (0 to disable) */
+#ifdef AO_SEND_ALL_BARO
+#define AO_TELEMETRY_INTERVAL_PAD AO_MS_TO_TICKS(100)
+#define AO_TELEMETRY_INTERVAL_FLIGHT AO_MS_TO_TICKS(100)
+#define AO_TELEMETRY_INTERVAL_RECOVER AO_MS_TO_TICKS(100)
+#else
#define AO_TELEMETRY_INTERVAL_PAD AO_MS_TO_TICKS(1000)
#define AO_TELEMETRY_INTERVAL_FLIGHT AO_MS_TO_TICKS(100)
#define AO_TELEMETRY_INTERVAL_RECOVER AO_MS_TO_TICKS(1000)
+#endif
void
ao_telemetry_set_interval(uint16_t interval);
ao_radio_send(&telemetry, sizeof (telemetry));
}
+static uint8_t ao_baro_sample;
+
+#ifdef AO_SEND_ALL_BARO
+static void
+ao_send_baro(void)
+{
+ uint8_t sample = ao_sample_adc;
+ uint8_t samples = (sample - ao_baro_sample) & (AO_ADC_RING - 1);
+
+ if (samples > 12) {
+ ao_baro_sample = (ao_baro_sample + (samples - 12)) & (AO_ADC_RING - 1);
+ samples = 12;
+ }
+ telemetry.generic.tick = ao_adc_ring[sample].tick;
+ telemetry.generic.type = AO_TELEMETRY_BARO;
+ telemetry.baro.samples = samples;
+ for (sample = 0; sample < samples; sample++) {
+ telemetry.baro.baro[sample] = ao_adc_ring[ao_baro_sample].pres;
+ ao_baro_sample = ao_adc_ring_next(ao_baro_sample);
+ }
+ ao_radio_send(&telemetry, sizeof (telemetry));
+}
+#endif
+
static void
ao_send_configuration(void)
{
while (ao_telemetry_interval) {
+#ifdef AO_SEND_ALL_BARO
+ ao_send_baro();
+#endif
ao_send_sensor();
#if HAS_COMPANION
if (ao_companion_running)
ao_send_location();
ao_send_satellite();
#endif
+#ifndef AO_SEND_ALL_BARO
if (ao_rdf &&
(int16_t) (ao_time() - ao_rdf_time) >= 0)
{
ao_rdf_time = ao_time() + AO_RDF_INTERVAL_TICKS;
ao_radio_rdf(AO_RDF_LENGTH_MS);
}
+#endif
time += ao_telemetry_interval;
delay = time - ao_time();
if (delay > 0)