ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
app_task.h File Reference

AppTask: ACwing Pilot protocol v2 (HANDOVER_FW.md) on the drone side. More...

#include <stdint.h>
#include <stddef.h>
#include "calib_mgr.h"
Include dependency graph for app_task.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  app_task_cfg_t
 

Macros

#define APP_FW_MAJOR   0u
 
#define APP_FW_MINOR   6u
 
#define APP_FW_PATCH   0u
 

Functions

const cal_set_t * app_task_boot (const float mag_hi_default[3])
 Before the scheduler starts: loads the flash image (parameters, name, calibrations) and posts the saved calibrations to the ImuTask (fsh_apply_post).
 
void app_task_start (const app_task_cfg_t *cfg)
 app_init + the RTOS task
 
void app_init (const app_task_cfg_t *cfg)
 protocol logic, also used by the host test
 
void app_step (uint32_t now_ms)
 

Detailed Description

AppTask: ACwing Pilot protocol v2 (HANDOVER_FW.md) on the drone side.

Owns, in one low-priority task (period 5 ms):

  • the command dispatcher (ACK cache, core commands forwarded to the flight core, parameters, calibrations, requests, name);
  • the flash store (parameters, name, calibrations + one backup per type);
  • the v2 telemetry scheduler: CAPS, FLIGHT, NAV, MOTORS, SYSTEM, CHECKS, CALIB, EVENT (x3 for ERROR and above), PARAM lists paced to the TX pool;
  • the pre-flight checks and the ground information for the flight core.

Nothing in here is on the flight path: the flight core (ImuTask) keeps flying and runs the failsafes if this task, BLE or the CPU2 stall. Every frame goes to the high-priority BLE ring (tlm_ble_push_hi).

Definition in file app_task.h.

Macro Definition Documentation

◆ APP_FW_MAJOR

#define APP_FW_MAJOR   0u

Definition at line 24 of file app_task.h.

◆ APP_FW_MINOR

#define APP_FW_MINOR   6u

Definition at line 25 of file app_task.h.

◆ APP_FW_PATCH

#define APP_FW_PATCH   0u

Definition at line 26 of file app_task.h.

Function Documentation

◆ app_task_boot()

const cal_set_t * app_task_boot ( const float  mag_hi_default[3])

Before the scheduler starts: loads the flash image (parameters, name, calibrations) and posts the saved calibrations to the ImuTask (fsh_apply_post).

Returns the calibration set in effect.

Definition at line 806 of file app_task.c.

References cfg_image_t::bak, cfg_image_t::batt_used_scale_i, cfg_image_t::cal, cal_set_defaults(), cfg_load(), cfg_params_get(), fsh_apply_post(), fsh_reset(), cfg_image_t::name, PARAM_COUNT, params_defaults(), params_load(), params_mark_saved(), PV2_CAL_ACCEL, PV2_CAL_COMPASS, PV2_CAL_GYRO, PV2_CAL_LEVEL, s_cal, and s_img.

Referenced by app_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ app_task_start()

void app_task_start ( const app_task_cfg_t *  cfg)

app_init + the RTOS task

Definition at line 929 of file app_task.c.

References app_init(), and AppTask().

Referenced by app_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ app_init()

void app_init ( const app_task_cfg_t *  cfg)

protocol logic, also used by the host test

Definition at line 833 of file app_task.c.

References ackc_reset(), app_task_cfg_t::batt_monitor, cal_apply(), cal_batt(), cal_init(), DEST_ALL, fc_set_sensors(), LINK_BLE, LINK_NONE, app_task_cfg_t::motors_built, app_task_cfg_t::n_motors, s_cal, s_cal_link, s_cfg, s_dest, s_fl_count, s_have_logmsg, s_link, s_list_next, s_owner, s_pend, s_rep, s_sensors, s_usb_now, s_usb_was, and sensors_now().

Referenced by app_task_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ app_step()

void app_step ( uint32_t  now_ms)

Definition at line 851 of file app_task.c.

References ackc_reset(), armed_now(), battery_flight(), build_checks(), cal_running(), cal_set_sensors(), calibration(), commands(), DEST_ALL, due(), events(), fc_set_ground_info(), fc_set_sensors(), LINK_BLE, LINK_NONE, LINK_USB, list_pace(), log_ble_out(), n, PV2_CHECKS_MAX, repeats(), s_batt_fail, s_dest, s_list_next, s_owner, s_ready, s_sensors, s_t_caps, s_t_checks, s_t_flight, s_t_ground, s_t_motors, s_t_nav, s_t_power, s_t_system, s_usb_now, s_usb_was, send_caps(), send_checks(), send_init(), sensors_now(), streams(), tlm_ble_open_streams(), tlm_ble_state(), TLM_BLE_STREAMING, tlm_ble_take_subscribe(), usb_commands(), and usbl_open().

Referenced by AppTask().

Here is the call graph for this function:
Here is the caller graph for this function: