Switch from GPLv2 to GPLv2+
[fw/altos] / src / kernel / ao_telemetry.c
index 854ac898dcbc646613caf036050e7ce205c6e2a0..e70791792d5644c30ab5745ee2d8a7966648beda 100644 (file)
@@ -3,7 +3,8 @@
  *
  * 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
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -75,6 +76,13 @@ static __pdata uint16_t ao_aprs_time;
 
 static __xdata union ao_telemetry_all  telemetry;
 
+static void
+ao_telemetry_send(void)
+{
+       ao_radio_send(&telemetry, sizeof (telemetry));
+       ao_delay(1);
+}
+
 #if defined AO_TELEMETRY_SENSOR
 /* Send sensor packet */
 static void
@@ -117,7 +125,7 @@ ao_send_sensor(void)
        telemetry.sensor.accel_minus_g = 0;
 #endif
 
-       ao_radio_send(&telemetry, sizeof (telemetry));
+       ao_telemetry_send();
 }
 #endif
 
@@ -156,7 +164,7 @@ ao_send_mega_sensor(void)
        telemetry.mega_sensor.mag_z = packet->hmc5883.z;
 #endif
 
-       ao_radio_send(&telemetry, sizeof (telemetry));
+       ao_telemetry_send();
 }
 
 static __pdata int8_t ao_telemetry_mega_data_max;
@@ -190,8 +198,8 @@ ao_send_mega_data(void)
                telemetry.mega_data.speed = ao_speed;
                telemetry.mega_data.height = ao_height;
 
-               ao_radio_send(&telemetry, sizeof (telemetry));
                ao_telemetry_mega_data_cur = ao_telemetry_mega_data_max;
+               ao_telemetry_send();
        }
 }
 #endif /* AO_SEND_MEGA */
@@ -221,7 +229,7 @@ ao_send_metrum_sensor(void)
        telemetry.metrum_sensor.sense_a = packet->adc.sense_a;
        telemetry.metrum_sensor.sense_m = packet->adc.sense_m;
 
-       ao_radio_send(&telemetry, sizeof (telemetry));
+       ao_telemetry_send();
 }
 
 static __pdata int8_t ao_telemetry_metrum_data_max;
@@ -248,8 +256,8 @@ ao_send_metrum_data(void)
                telemetry.metrum_data.accel_minus_g = 2;
 #endif
 
-               ao_radio_send(&telemetry, sizeof (telemetry));
                ao_telemetry_metrum_data_cur = ao_telemetry_metrum_data_max;
+               ao_telemetry_send();
        }
 }
 #endif /* AO_SEND_METRUM */
@@ -279,7 +287,7 @@ ao_send_mini(void)
 
        telemetry.mini.ground_pres = ao_ground_pres;
 
-       ao_radio_send(&telemetry, sizeof (telemetry));
+       ao_telemetry_send();
 }
 
 #endif /* AO_SEND_MINI */
@@ -316,8 +324,8 @@ ao_send_configuration(void)
                ao_xmemcpy (telemetry.configuration.version,
                            CODE_TO_XDATA(ao_version),
                            AO_MAX_VERSION);
-               ao_radio_send(&telemetry, sizeof (telemetry));
                ao_telemetry_config_cur = ao_telemetry_config_max;
+               ao_telemetry_send();
        }
 }
 
@@ -339,8 +347,8 @@ ao_send_location(void)
                       27);
                telemetry.location.tick = ao_gps_tick;
                ao_mutex_put(&ao_gps_mutex);
-               ao_radio_send(&telemetry, sizeof (telemetry));
                ao_telemetry_loc_cur = ao_telemetry_gps_max;
+               ao_telemetry_send();
        }
 }
 
@@ -356,8 +364,8 @@ ao_send_satellite(void)
                       &ao_gps_tracking_data.sats,
                       AO_MAX_GPS_TRACKING * sizeof (struct ao_telemetry_satellite_info));
                ao_mutex_put(&ao_gps_mutex);
-               ao_radio_send(&telemetry, sizeof (telemetry));
                ao_telemetry_sat_cur = ao_telemetry_gps_max;
+               ao_telemetry_send();
        }
 }
 #endif
@@ -380,8 +388,8 @@ ao_send_companion(void)
                       ao_companion_data,
                       ao_companion_setup.channels * 2);
                ao_mutex_put(&ao_companion_mutex);
-               ao_radio_send(&telemetry, sizeof (telemetry));
                ao_telemetry_companion_cur = ao_telemetry_companion_max;
+               ao_telemetry_send();
        }
 }
 #endif