altos: Remove old AO_SEND_ALL_BARO bits
[fw/altos] / src / kernel / ao_telemetry.c
index f4fcf40074684b58956ffcec7984cef3a350c0d6..5b56d025dd1270aa7ed794f31bd5b11c00d6397a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
+ * Copyright © 2011 Keth Packard <keithp@keithp.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
 static __pdata uint16_t ao_telemetry_interval;
 
 #if HAS_RADIO_RATE
-static __pdata uint16_t ao_telemetry_desired_interval;
+static __xdata uint16_t ao_telemetry_desired_interval;
 #endif
 
 #if HAS_RDF
@@ -269,30 +269,6 @@ ao_send_mini(void)
 
 #endif /* AO_SEND_MINI */
 
-#ifdef AO_SEND_ALL_BARO
-static uint8_t         ao_baro_sample;
-
-static void
-ao_send_baro(void)
-{
-       uint8_t         sample = ao_sample_data;
-       uint8_t         samples = (sample - ao_baro_sample) & (AO_DATA_RING - 1);
-
-       if (samples > 12) {
-               ao_baro_sample = (ao_baro_sample + (samples - 12)) & (AO_DATA_RING - 1);
-               samples = 12;
-       }
-       telemetry.generic.tick = ao_data_ring[sample].tick;
-       telemetry.generic.type = AO_TELEMETRY_BARO;
-       telemetry.baro.samples = samples;
-       for (sample = 0; sample < samples; sample++) {
-               telemetry.baro.baro[sample] = ao_data_ring[ao_baro_sample].adc.pres;
-               ao_baro_sample = ao_data_ring_next(ao_baro_sample);
-       }
-       ao_radio_send(&telemetry, sizeof (telemetry));
-}
-#endif
-
 static __pdata int8_t ao_telemetry_config_max;
 static __pdata int8_t ao_telemetry_config_cur;
 
@@ -344,7 +320,7 @@ ao_send_location(void)
                ao_mutex_get(&ao_gps_mutex);
                ao_xmemcpy(&telemetry.location.flags,
                       &ao_gps_data.flags,
-                      26);
+                      27);
                telemetry.location.tick = ao_gps_tick;
                ao_mutex_put(&ao_gps_mutex);
                ao_radio_send(&telemetry, sizeof (telemetry));
@@ -422,10 +398,6 @@ ao_telemetry(void)
                        if (!(ao_config.radio_enable & AO_RADIO_DISABLE_TELEMETRY))
 #endif
                        {
-#ifdef AO_SEND_ALL_BARO
-                               ao_send_baro();
-#endif
-
 #if HAS_FLIGHT
 # ifdef AO_SEND_MEGA
                                ao_send_mega_sensor();
@@ -453,7 +425,6 @@ ao_telemetry(void)
                                ao_send_satellite();
 #endif
                        }
-#ifndef AO_SEND_ALL_BARO
 #if HAS_RDF
                        if (ao_rdf &&
 #if HAS_APRS
@@ -481,7 +452,6 @@ ao_telemetry(void)
                                ao_aprs_send();
                        }
 #endif /* HAS_APRS */
-#endif /* !AO_SEND_ALL_BARO */
                        time += ao_telemetry_interval;
                        delay = time - ao_time();
                        if (delay > 0) {
@@ -511,14 +481,14 @@ ao_telemetry_set_interval(uint16_t interval)
 #if HAS_RADIO_RATE
        /* Limit max telemetry rate based on available radio bandwidth.
         */
-       static const uint16_t min_interval[] = {
+       static __xdata const uint16_t min_interval[] = {
                /* [AO_RADIO_RATE_38400] = */ AO_MS_TO_TICKS(100),
                /* [AO_RADIO_RATE_9600] = */ AO_MS_TO_TICKS(500),
                /* [AO_RADIO_RATE_2400] = */ AO_MS_TO_TICKS(1000)
        };
 
        ao_telemetry_desired_interval = interval;
-       if (interval < min_interval[ao_config.radio_rate])
+       if (interval && interval < min_interval[ao_config.radio_rate])
                interval = min_interval[ao_config.radio_rate];
 #endif
        ao_telemetry_interval = interval;