static void gps_cb(uint8_t sender_id, uint32_t stamp __attribute__((unused)), struct GpsState *gps_s) { /* ignore callback from own AbiSendMsgGPS */ if (sender_id == GPS_MULTI_ID) { return; } uint32_t now_ts = get_sys_time_usec(); #ifdef SECONDARY_GPS current_gps_id = gps_multi_switch(gps_s); if (gps_s->comp_id == current_gps_id) { gps = *gps_s; AbiSendMsgGPS(GPS_MULTI_ID, now_ts, gps_s); } #else gps = *gps_s; AbiSendMsgGPS(GPS_MULTI_ID, now_ts, gps_s); #endif if (gps.tow != gps_time_sync.t0_tow) { gps_time_sync.t0_ticks = sys_time.nb_tick; gps_time_sync.t0_tow = gps.tow; } }
void gps_periodic_check(struct GpsState *gps_s) { if (sys_time.nb_sec - gps_s->last_msg_time > GPS_TIMEOUT) { gps_s->fix = GPS_FIX_NONE; } #ifdef SECONDARY_GPS current_gps_id = gps_multi_switch(gps_s); if (gps_s->comp_id == current_gps_id) { gps = *gps_s; } #else gps = *gps_s; #endif }
static void gps_cb(uint8_t sender_id, uint32_t stamp __attribute__((unused)), struct GpsState *gps_s) { if (sender_id == GPS_MULTI_ID) { return; } uint32_t now_ts = get_sys_time_usec(); #ifdef SECONDARY_GPS current_gps_id = gps_multi_switch(gps_s); if (gps_s->comp_id == current_gps_id) { gps = *gps_s; AbiSendMsgGPS(GPS_MULTI_ID, now_ts, gps_s); } #else gps = *gps_s; AbiSendMsgGPS(GPS_MULTI_ID, now_ts, gps_s); #endif }