diff --git a/conf/telemetry/iridium.xml b/conf/telemetry/iridium.xml new file mode 100644 index 0000000000..6ca164367e --- /dev/null +++ b/conf/telemetry/iridium.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/airborne/ap_downlink.h b/sw/airborne/ap_downlink.h index 66b81a3c31..9b305617de 100644 --- a/sw/airborne/ap_downlink.h +++ b/sw/airborne/ap_downlink.h @@ -159,6 +159,11 @@ #define PERIODIC_SEND_GPS() DOWNLINK_SEND_GPS(&gps_mode, &gps_utm_east, &gps_utm_north, &gps_course, &gps_alt, &gps_gspeed,&gps_climb, &gps_itow, &gps_utm_zone, &gps_nb_ovrn) #define PERIODIC_SEND_GPS_SOL() DOWNLINK_SEND_GPS_SOL(&gps_Pacc, &gps_Sacc, &gps_PDOP, &gps_numSV) #define PERIODIC_SEND_DebugChao() DOWNLINK_SEND_DebugChao(&ugear_debug1, &ugear_debug2, &ugear_debug3, &ugear_debug4, &ugear_debug5, &ugear_debug6) +#else +# ifdef PERIOD_GPS_0 +# include "gps.h" +# define PERIODIC_SEND_GPS() gps_send() +# endif #endif #ifdef USE_BARO_MS5534A diff --git a/sw/airborne/gps.c b/sw/airborne/gps.c index 313e0d92cd..b8affff9d0 100644 --- a/sw/airborne/gps.c +++ b/sw/airborne/gps.c @@ -33,6 +33,7 @@ #include "latlong.h" #include "sys_time.h" #include "airframe.h" +#include "periodic.h" #ifdef USE_USB_SERIAL #include "usb_serial.h" @@ -56,13 +57,19 @@ volatile uint16_t gps_msg_received_counter; #endif void gps_downlink( void ) { - static uint8_t _4Hz; - _4Hz++; if (_4Hz > 3) _4Hz = 0; - -#if defined DOWNLINK_GPS_1Hz - if (_4Hz == 0) +# ifdef DOWNLINK_GPS_1Hz +# warning "Deperecated DOWNLINK_GPS_1Hz: Please Use Telemetry xml to reduce data rate" +# endif + + +#ifndef PERIOD_GPS_0 + gps_send(); #endif +} + +void gps_send( void ) { + DOWNLINK_SEND_GPS(&gps_mode, &gps_utm_east, &gps_utm_north, &gps_course, &gps_alt, &gps_gspeed,&gps_climb, &gps_itow, &gps_utm_zone, &gps_nb_ovrn); static uint8_t i; diff --git a/sw/airborne/gps.h b/sw/airborne/gps.h index 9d1e882229..b5c0b1e6f4 100644 --- a/sw/airborne/gps.h +++ b/sw/airborne/gps.h @@ -67,6 +67,7 @@ void gps_init( void ); void gps_configure( void ); void parse_gps_msg( void ); void gps_downlink( void ); +void gps_send( void ); void gps_configure_uart( void ); @@ -115,24 +116,13 @@ extern struct svinfo gps_svinfos[GPS_NB_CHANNELS]; #define GpsToggleLed() {} #endif -#define UseGpsPos(_callback) { \ - if (GpsFixValid()) { \ - last_gps_msg_t = cpu_time_sec; \ - _callback(); \ - GpsToggleLed(); \ - } \ - gps_downlink(); \ - } - -#ifdef UGEAR -#define UseGpsPosUgear(_callback) { \ +#define UseGpsPosNoSend(_callback) { \ if (GpsFixValid()) { \ last_gps_msg_t = cpu_time_sec; \ _callback(); \ GpsToggleLed(); \ } \ } -#endif #ifdef GPS_CONFIGURE #define GpsParseOrConfigure() { \ diff --git a/sw/airborne/main_ap.c b/sw/airborne/main_ap.c index e2afe0d8c5..994a535f3b 100644 --- a/sw/airborne/main_ap.c +++ b/sw/airborne/main_ap.c @@ -777,18 +777,17 @@ void event_task_ap( void ) { if (gps_pos_available){ //gps_downlink(); gps_verbose_downlink = !launch; -// UseGpsPos(estimator_update_state_gps); - UseGpsPosUgear(estimator_update_state_gps); + UseGpsPosNoSend(estimator_update_state_gps); gps_msg_received_counter = gps_msg_received_counter+1; #ifdef GX2 if (gps_msg_received_counter == 1){ - gps_downlink(); + gps_send(); gps_msg_received_counter = 0; } #endif #ifdef XSENSDL if (gps_msg_received_counter == 25){ - gps_downlink(); + gps_send(); gps_msg_received_counter = 0; } #endif @@ -814,7 +813,8 @@ void event_task_ap( void ) { gps_msg_received = FALSE; if (gps_pos_available) { gps_verbose_downlink = !launch; - UseGpsPos(estimator_update_state_gps); + UseGpsPosNoSend(estimator_update_state_gps); + gps_downlink(); gps_pos_available = FALSE; } } diff --git a/sw/airborne/sim/sim_gps.c b/sw/airborne/sim/sim_gps.c index c47de8d00a..52d7aeade2 100644 --- a/sw/airborne/sim/sim_gps.c +++ b/sw/airborne/sim/sim_gps.c @@ -73,7 +73,9 @@ value sim_use_gps_pos(value x, value y, value z, value c, value a, value s, valu gps_numSV = 7; gps_verbose_downlink = !launch; - UseGpsPos(estimator_update_state_gps); + UseGpsPosNoSend(estimator_update_state_gps); + gps_downlink(); + return Val_unit; }