static inline void autopilot_main_periodic( void ) { static uint8_t _cnt = 0; /* read analog baro */ analog_periodic_task(); altimeter_periodic_task(); /* read imu */ imu_periodic_task(); /* run control loops */ autopilot_periodic(); /* set actuators */ autopilot_set_actuators(); /* Run the following tasks 10x times slower than the periodic rate */ _cnt++; if (_cnt >= 10) _cnt = 0; switch (_cnt) { case 0: rc_periodic_task(); if (rc_status == RC_OK) { led_on(LED_RC); } else { led_off(LED_RC); autopilot_set_mode(AP_MODE_FAILSAFE); } break; case 1: comm_periodic_task(COMM_TELEMETRY); #if !HARDWARE_ENABLED_GPS comm_periodic_task(COMM_0); #endif break; case 2: fms_periodic_task(); break; #if BOMB_ENABLED case 3: bomb_periodic_task(); break; #endif } /* flash leds... */ led_periodic_task(); if (ahrs_status == STATUS_INITIALIZING) { RunOnceEvery(50, { led_toggle(LED_AHRS); });
static inline void main_periodic_task( void ) { comm_periodic_task(DA_COMM); RunOnceEvery(200, { led_toggle(4); MESSAGE_SEND_TEST_MESSAGE (DA_COMM, &u8, &i8, &u16, &i16, &u32, &i32, &f, array_u16, array_u32, array_float, &another_u8 ); })
static inline void main_periodic_task( void ) { comm_periodic_task(COMM_TELEMETRY); led_periodic_task(); RunOnceEvery(250, { comm_autopilot_message_send (COMM_TELEMETRY, MESSAGE_ID_GPS_LLH); comm_autopilot_message_send (COMM_TELEMETRY, MESSAGE_ID_GPS_STATUS); comm_autopilot_message_send (COMM_TELEMETRY, MESSAGE_ID_STATUS_LOWLEVEL); });
static inline void main_periodic_task( void ) { analog_periodic_task(); altimeter_periodic_task(); comm_periodic_task(COMM_1); RunOnceEvery(250, { int32_t alt = altimeter_get_altitude(); MESSAGE_SEND_ALTIMETER(COMM_1, &alt, &altimeter_system_status, &altimeter_calibration_offset, &altimeter_calibration_raw); });
static inline void main_periodic_task( void ) { comm_periodic_task(COMM_TELEMETRY); led_periodic_task(); rc_periodic_task(); if (rc_status == RC_OK) led_on(LED_RC); else led_off(LED_RC); RunOnceEvery(250, { MESSAGE_SEND_PPM(COMM_TELEMETRY, ppm_pulses); MESSAGE_SEND_RC(COMM_TELEMETRY, rc_values); });