28#define FC_RC_STALE_MS 250u
29#define FC_FS_SHORT_MS 1000u
30#define FC_FS_LONG_MS 3000u
31#define FC_LINK_BACK_MS 500u
32#define FC_GROUND_DISARM_MS 3000u
33#define FC_ARM_RC_FRESH_MS 500u
34#define FC_NO_TAKEOFF_MS 10000u
35#define FC_STICK_CANCEL 300
37#define FC_TAKEOFF_VZ 0.6f
38#define FC_LIFTOFF_DH 0.15f
39#define FC_LIFTOFF_TIMEOUT_MS 6000u
40#define FC_LAND_SLOW_VZ 0.3f
41#define FC_TOUCH_VZ 0.12f
42#define FC_TOUCH_MS 700u
43#define FC_TOUCH_MS_NO_TOF 1000u
44#define FC_FLOW_LOST_Q 30u
45#define FC_FLOW_BACK_Q 40u
46#define FC_FLOW_LOST_MS 500u
47#define FC_FLOW_CHECK_H 0.15f
51#define FC_BATT_STALE_MS 1000u
54#define FC_OP_MOTOR_STOP 0xF0u
61typedef struct { uint8_t level; uint16_t code; int32_t arg; }
fc_event_t;
76 void (*motor_test)(uint8_t motor,
float duty);
82 uint8_t (*usb_host)(void);
87 uint8_t armed, mode, autom, failsafe, input, in_air;
90 uint16_t flight_time_s;
91 uint8_t motor_out_pct[8];
107 uint8_t tof_valid, tof_ground;
117 uint8_t armed, mode, autom;
121 float roll_rate, pitch_rate;
148void fc_set_ground_info(uint8_t checks_ready, uint8_t battery_fail, uint8_t calibrating);
static int valid(const cfg_image_t *im)
static void result(const fc_cmd_t *c, uint8_t res, uint8_t why)
uint8_t fc_is_core_op(uint8_t op)
ops executed by the core
int fc_take_result(fc_res_t *r)
1 if a result was taken
int fc_batt_signal(const fc_batt_sig_t *s)
0 = queued, -1 = full
void fc_setpoint(fc_setpoint_t *out)
last setpoints, same context
void fc_set_ground_info(uint8_t checks_ready, uint8_t battery_fail, uint8_t calibrating)
ground information computed by the AppTask (atomic byte stores)
int fc_post(const fc_cmd_t *c)
0 = queued, -1 = full
void fc_init(const fc_config_t *cfg)
void fc_batt_heartbeat(uint32_t now_ms)
every BattTask step
void fc_set_sensors(uint16_t sensors)
sensors detected at run time (a late expansion board): atomic store
void fc_snapshot(fc_state_t *out)
int fc_take_event(fc_event_t *e)
volatile uint8_t g_fc_dbg_in_air
void fc_service(uint32_t now_ms, uint8_t est_running, const fc_vert_t *v)
v: NULL = no vertical estimate (in air only via g_fc_dbg_in_air)
void motors_arm(uint8_t armed)
disarmed: duty forced to 0
battery signal (BattTask -> core): sent when the level or presence changes
setpoints for the attitude / rate loops (phase 3) and the motor mixer
published state (AppTask builds FLIGHT / MOTORS from it)
vertical state from the estimator (flight-control context)