![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
AppTask (see app_task.h). More...
#include "app_task.h"#include "proto_v2.h"#include "ack_cache.h"#include "app_link.h"#include "tlm_ble.h"#include "fc_core.h"#include "params.h"#include "cfg_store.h"#include "checks.h"#include "fc_shared.h"#include "ext_sens.h"#include "batt_task.h"#include "log_task.h"#include "usb_link.h"#include <string.h>#include <math.h>#include "cmsis_os2.h"Go to the source code of this file.
Data Structures | |
| struct | rep_t |
Macros | |
| #define | FRAME_CAP 64u |
| #define | CORE_PENDING_MS 1000u /* a core command not answered after 1 s: stop waiting */ |
| #define | REPEAT_N 3u /* ERROR / CRITICAL events: 3 copies ... */ |
| #define | REPEAT_MS 100u /* ... 100 ms apart */ |
| #define | CAL_LINK_ABORT_MS 3000u /* calibration aborted when the app is silent */ |
| #define | LIST_HEADROOM 256u /* bytes left in the HI ring for ACKs while listing */ |
| #define | EV_RATE_MS 30000u /* MAG_INTERFERENCE / HIGH_VIBRATION */ |
| #define | VIB_WARN_MG 1500.0f |
| #define | RATE(dst, v, lo, hi) do { if ((v) != 0u) dst = (uint8_t)((v) < (lo) ? (lo) : ((v) > (hi) ? (hi) : (v))); } while (0) |
Enumerations | |
| enum | { LINK_BLE = 0 , LINK_USB = 1 , LINK_NONE = 0xFF , DEST_ALL = 0xFE } |
Functions | |
| static uint8_t | armed_now (void) |
| static void | tx (const uint8_t *f, size_t len) |
| static uint32_t | bit (uint8_t type) |
| static uint8_t | ack_key (uint8_t link, uint8_t op) |
| static void | ack_link (uint8_t link, uint8_t op, uint8_t seq, uint8_t res, uint8_t why) |
| static void | ack (uint8_t op, uint8_t seq, uint8_t res, uint8_t why) |
| static const char * | ev_text (uint16_t code) |
| static void | send_event (uint8_t level, uint16_t code, int32_t arg, uint32_t now) |
| static void | repeats (uint32_t now) |
| static uint16_t | sensors_now (void) |
| static batt_state_t | batt_now (void) |
| static void | send_caps (void) |
| static float | yaw_heading_deg (const float q[4]) |
| static void | send_flight (void) |
| static int16_t | sat16 (float v) |
| static void | send_nav (void) |
| static void | send_motors (void) |
| static void | send_system (void) |
| static uint16_t | u16c (float v) |
| static void | send_power (void) |
| static void | build_checks (pv2_check_t *it, uint8_t *n) |
| static void | send_checks (void) |
| static void | send_init (void) |
| static void | send_param (int idx) |
| static void | list_start (void) |
| static void | list_pace (void) |
| static void | send_calib (void) |
| static int | save_image (void) |
| static int | save_image_keep_params (void) |
| static void | cal_apply (uint8_t type, const cal_set_t *set) |
| static void | cal_batt (float *vbat, float *used, float *scale_i) |
| static void | battery_flight (void) |
| static void | local_cmd (uint8_t op, uint8_t seq, const uint8_t *p, uint8_t plen, uint32_t now) |
| static int | usb_allowed (uint8_t op) |
| static int | config_op (uint8_t op) |
| static uint8_t | other_link (uint8_t link) |
| static void | usb_commands (uint32_t now) |
| static void | commands (uint32_t now) |
| static void | log_ble_out (void) |
| static int | due (uint32_t now, uint32_t *t, uint32_t period_ms) |
| static void | events (uint32_t now) |
| static void | calibration (uint32_t now) |
| static void | streams (uint32_t now, uint8_t armed) |
| 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_init (const app_task_cfg_t *cfg) |
| protocol logic, also used by the host test | |
| void | app_step (uint32_t now) |
| static void | AppTask (void *arg) |
| void | app_task_start (const app_task_cfg_t *cfg) |
| app_init + the RTOS task | |
Variables | |
| static app_task_cfg_t | s_cfg |
| static cfg_image_t | s_img |
| static cal_set_t | s_cal |
| static uint16_t | s_sensors |
| static uint8_t | s_frame [FRAME_CAP] |
| static uint8_t | s_pend |
| static uint8_t | s_pend_op |
| static uint8_t | s_pend_seq |
| static uint32_t | s_pend_t |
| static uint8_t | s_hz_flight = 10 |
| static uint8_t | s_hz_power = 5 |
| static uint8_t | s_hz_nav = 5 |
| static uint8_t | s_hz_motors = 5 |
| static uint8_t | s_hz_system = 2 |
| static uint32_t | s_t_power |
| static uint16_t | s_fl_count |
| static uint32_t | s_t_flight |
| static uint32_t | s_t_nav |
| static uint32_t | s_t_motors |
| static uint32_t | s_t_system |
| static uint32_t | s_t_checks |
| static uint32_t | s_t_caps |
| static uint32_t | s_t_calib |
| static uint32_t | s_t_ground |
| static int | s_list_next = -1 |
| static rep_t | s_rep [6] |
| static uint32_t | s_t_ev_mag |
| static uint32_t | s_t_ev_vib |
| static uint8_t | s_have_ev_mag |
| static uint8_t | s_have_ev_vib |
| static uint8_t | s_ready |
| static uint8_t | s_batt_fail |
| static uint8_t | s_owner = LINK_NONE |
| static uint8_t | s_dest = DEST_ALL |
| static uint8_t | s_usb_was |
| static uint8_t | s_usb_now |
| static uint8_t | s_cal_link = LINK_BLE |
| static log_msg_t | s_logmsg |
| static uint8_t | s_have_logmsg |
| static uint8_t | s_big [4u+255u+2u] |
| static uint8_t | s_link = LINK_BLE |
AppTask (see app_task.h).
Behavioural reference: the app simulator src/sim/simDrone.ts (command(), tick()) and HANDOVER_FW.md §3-§11.
The protocol logic is app_step(now): pure C on top of host-testable modules (tlm_ble, app_link, fc_core, params, calib_mgr, cfg_store, checks). The RTOS part is only the task loop at the end of the file (not built with HOST_TEST).
Definition in file app_task.c.
| #define FRAME_CAP 64u |
Definition at line 27 of file app_task.c.
| #define CORE_PENDING_MS 1000u /* a core command not answered after 1 s: stop waiting */ |
Definition at line 28 of file app_task.c.
| #define REPEAT_N 3u /* ERROR / CRITICAL events: 3 copies ... */ |
Definition at line 29 of file app_task.c.
| #define REPEAT_MS 100u /* ... 100 ms apart */ |
Definition at line 30 of file app_task.c.
| #define CAL_LINK_ABORT_MS 3000u /* calibration aborted when the app is silent */ |
Definition at line 31 of file app_task.c.
| #define LIST_HEADROOM 256u /* bytes left in the HI ring for ACKs while listing */ |
Definition at line 32 of file app_task.c.
| #define EV_RATE_MS 30000u /* MAG_INTERFERENCE / HIGH_VIBRATION */ |
Definition at line 33 of file app_task.c.
| #define VIB_WARN_MG 1500.0f |
Definition at line 34 of file app_task.c.
| #define RATE | ( | dst, | |
| v, | |||
| lo, | |||
| hi | |||
| ) | do { if ((v) != 0u) dst = (uint8_t)((v) < (lo) ? (lo) : ((v) > (hi) ? (hi) : (v))); } while (0) |
| anonymous enum |
| Enumerator | |
|---|---|
| LINK_BLE | |
| LINK_USB | |
| LINK_NONE | |
| DEST_ALL | |
Definition at line 70 of file app_task.c.
|
static |
Definition at line 469 of file app_task.c.
References fc_state_t::armed, and fc_snapshot().
Referenced by app_step(), battery_flight(), events(), and local_cmd().
|
static |
Definition at line 83 of file app_task.c.
References DEST_ALL, LINK_BLE, LINK_USB, s_dest, s_usb_now, tlm_ble_push_hi(), usbl_put_frame(), and USBL_SRC_APP.
Referenced by ack_link(), repeats(), send_calib(), send_caps(), send_checks(), send_event(), send_flight(), send_init(), send_motors(), send_nav(), send_param(), send_power(), and send_system().
|
static |
Definition at line 93 of file app_task.c.
Referenced by cal_copy_type(), and local_cmd().
|
static |
Definition at line 97 of file app_task.c.
References LINK_USB.
Referenced by ack_link(), and usb_commands().
|
static |
Definition at line 99 of file app_task.c.
References ack_key(), ackc_finish(), pv2_ack(), s_dest, s_frame, seq, and tx().
Referenced by ack(), commands(), and usb_commands().
|
static |
Definition at line 110 of file app_task.c.
References ack_link(), s_link, and seq.
Referenced by commands(), local_cmd(), and log_ble_out().
|
static |
Definition at line 112 of file app_task.c.
References PV2_E_ARMED, PV2_E_BATTERY_CRITICAL, PV2_E_BATTERY_EMERGENCY, PV2_E_BATTERY_LOW, PV2_E_BATTERY_MONITOR_LOST, PV2_E_CALIB_DONE, PV2_E_CALIB_FAILED, PV2_E_DISARMED, PV2_E_FAILSAFE_APP_LINK, PV2_E_FAILSAFE_BATTERY, PV2_E_FAILSAFE_RADIO, PV2_E_FLOW_LOST, PV2_E_GEOFENCE_BREACH, PV2_E_GPS_LOST, PV2_E_HIGH_VIBRATION, PV2_E_HOME_SET, PV2_E_LANDED, PV2_E_MAG_INTERFERENCE, PV2_E_MODE_CHANGED, PV2_E_MOTOR_HOT, PV2_E_MOTOR_KILLED, PV2_E_PARAMS_SAVED, PV2_E_RADIO_OVERRIDE, PV2_E_RTH_STARTED, PV2_E_TAKEOFF_ABORTED, and PV2_E_TAKEOFF_STARTED.
Referenced by send_event().
|
static |
Definition at line 145 of file app_task.c.
References ev_text(), rep_t::left, rep_t::len, n, rep_t::next, PV2_EV_ERROR, pv2_event(), REPEAT_MS, REPEAT_N, s_frame, s_rep, and tx().
Referenced by events(), and local_cmd().
|
static |
Definition at line 160 of file app_task.c.
References rep_t::f, rep_t::left, rep_t::len, rep_t::next, REPEAT_MS, s_rep, and tx().
Referenced by app_step().
|
static |
Definition at line 171 of file app_task.c.
References app_task_cfg_t::board_sensors, ext_sensors(), fsh_est_read(), s_cfg, and fsh_est_t::sensors.
Referenced by app_init(), and app_step().
|
static |
Definition at line 179 of file app_task.c.
References b, app_task_cfg_t::batt_monitor, batt_read(), and s_cfg.
Referenced by build_checks(), cal_batt(), send_caps(), and send_power().
|
static |
Definition at line 188 of file app_task.c.
References APP_FW_MAJOR, APP_FW_MINOR, APP_FW_PATCH, b, batt_now(), batt_state_t::cells, pv2_caps_t::cells, pv2_caps_t::frame, pv2_caps_t::fw, app_task_cfg_t::hw_rev, pv2_caps_t::hw_rev, pv2_caps_t::model, app_task_cfg_t::n_motors, pv2_caps_t::n_motors, cfg_image_t::name, pv2_caps_t::name, pv2_caps_t::proto, pv2_frame(), PV2_FT_CAPS, PV2_PROTO_VERSION, PV2_S_GNSS, s_cfg, s_frame, s_img, s_sensors, pv2_caps_t::sensors, pv2_caps_t::serial, tx(), and app_task_cfg_t::uid.
Referenced by app_step(), local_cmd(), and streams().
|
static |
Definition at line 212 of file app_task.c.
Referenced by send_flight(), and send_nav().
|
static |
Definition at line 222 of file app_task.c.
References fc_state_t::alt_rel_cm, pv2_flight_t::alt_rel_cm, pv2_flight_t::arm, fc_state_t::armed, fc_state_t::autom, pv2_flight_t::autom, fc_state_t::failsafe, pv2_flight_t::failsafe, fc_snapshot(), pv2_flight_t::flags, fc_state_t::flight_time_s, pv2_flight_t::flight_time_s, fsh_est_t::flow_usable, fsh_est_read(), pv2_flight_t::ground_speed_cms, pv2_flight_t::heading_cdeg, pv2_flight_t::home_bearing_cdeg, pv2_flight_t::home_dist_m, fc_state_t::in_air, fc_state_t::input, pv2_flight_t::input, fc_state_t::landed, fc_state_t::mode, pv2_flight_t::mode, P_BEGINNER, PARAM, PV2_FF_ARM_BLOCKED, PV2_FF_BEGINNER, PV2_FF_GEOFENCE_ON, PV2_FF_IN_AIR, PV2_FF_LANDED, pv2_frame(), PV2_FT_FLIGHT, PV2_S_BARO, PV2_S_GNSS, PV2_S_TOF, fsh_est_t::q, pv2_flight_t::rth_eta_s, s_frame, s_ready, s_sensors, tx(), fsh_est_t::vel_body, fc_state_t::vz_cms, pv2_flight_t::vz_cms, and yaw_heading_deg().
Referenced by local_cmd(), and streams().
|
static |
Definition at line 255 of file app_task.c.
Referenced by send_nav(), send_power(), and send_system().
|
static |
Definition at line 257 of file app_task.c.
References fsh_est_t::alt_valid, fsh_est_t::baro_pa, fsh_est_t::flow_q, fsh_est_t::flow_usable, fsh_est_read(), n, pv2_frame(), PV2_FT_NAV, fsh_est_t::q, s_frame, sat16(), fsh_est_t::tof_mm, tx(), fsh_est_t::vel_body, fsh_est_t::vz, and yaw_heading_deg().
Referenced by local_cmd(), and streams().
|
static |
Definition at line 288 of file app_task.c.
References fc_snapshot(), fc_state_t::motor_out_pct, n, app_task_cfg_t::n_motors, pv2_motor_t::out_pct, pv2_motors(), PV2_MOTORS_MAX, pv2_motor_t::rpm, s_cfg, s_frame, pv2_motor_t::temp_c, and tx().
Referenced by local_cmd(), and streams().
|
static |
Definition at line 299 of file app_task.c.
References fsh_est_t::acc_clip, fsh_est_t::acc_gated, fsh_est_t::att_unc_deg, fsh_est_t::cpu_pct, fsh_est_read(), fsh_est_t::imu_temp_c, fsh_est_t::jitter_us, app_task_cfg_t::log_pct, fsh_est_t::loop_hz, fsh_est_t::mag_gated, fsh_est_t::mag_interf_pct, pv2_frame(), PV2_FT_SYSTEM, fsh_est_t::running, s, s_cfg, s_frame, sat16(), tx(), and fsh_est_t::vib_mg.
Referenced by local_cmd(), and streams().
|
static |
Definition at line 322 of file app_task.c.
Referenced by send_power().
|
static |
Definition at line 324 of file app_task.c.
References b, batt_now(), pv2_power_t::cell_mv, pv2_power_t::cells, pv2_power_t::current_ca, pv2_power_t::pct, pv2_frame(), PV2_FT_POWER, PV2_S_CURRENT, pv2_power_t::remain_s, s_frame, s_sensors, sat16(), tx(), u16c(), pv2_power_t::used_mah, pv2_power_t::vbat_mv, and pv2_power_t::warn.
Referenced by local_cmd(), and streams().
|
static |
Definition at line 340 of file app_task.c.
References fsh_est_t::alt_valid, checks_in_t::alt_valid, appl_rc_read(), fsh_est_t::att_unc_deg, checks_in_t::att_unc_deg, b, checks_in_t::batt_cell_v, checks_in_t::batt_crit, checks_in_t::batt_level, fc_state_t::batt_level, app_task_cfg_t::batt_monitor, checks_in_t::batt_monitor, batt_now(), checks_in_t::batt_present, checks_in_t::batt_stale, fc_state_t::batt_stale, checks_in_t::batt_warn, cfg_image_t::cal, checks_in_t::cal_done_mask, checks_build(), cal_set_t::done_mask, checks_in_t::est_running, FC_ARM_RC_FRESH_MS, fc_snapshot(), fsh_est_t::flow_ok, checks_in_t::flow_ok, fsh_est_t::flow_q, checks_in_t::flow_q, fsh_est_read(), checks_in_t::gf_max_alt, checks_in_t::gf_max_dist, checks_in_t::hold_mode, fsh_est_t::imu_ok, checks_in_t::imu_ok, checks_in_t::in_air, fc_state_t::in_air, fsh_est_t::mag_interf_pct, checks_in_t::mag_interf_pct, fc_state_t::mode, n, P_BATT_CRIT, P_BATT_WARN, P_GF_MAX_ALT, P_GF_MAX_DIST, PARAM, PV2_MODE_ALT_HOLD, PV2_MODE_POS_HOLD, checks_in_t::rc_fresh, fc_state_t::rc_stale, checks_in_t::rc_thr, fsh_est_t::running, s_batt_fail, s_cfg, s_img, s_ready, s_sensors, checks_in_t::sensors, fc_state_t::silence_ms, appl_rc_t::thr, checks_in_t::usb_host, and usbl_host().
Referenced by app_step(), and send_checks().
|
static |
Definition at line 383 of file app_task.c.
References build_checks(), n, pv2_checks(), PV2_CHECKS_MAX, s_frame, s_ready, and tx().
Referenced by app_step(), local_cmd(), and streams().
|
static |
Definition at line 391 of file app_task.c.
References app_task_cfg_t::get_init, n, s_cfg, and tx().
Referenced by app_step(), and local_cmd().
|
static |
Definition at line 399 of file app_task.c.
References g_param_def, param_def_t::id, param_get(), params_dirty(), params_visible_count(), params_visible_pos(), pos, pv2_param(), s_frame, s_sensors, and tx().
Referenced by list_pace(), and local_cmd().
|
static |
Definition at line 408 of file app_task.c.
References s_list_next.
Referenced by local_cmd().
|
static |
Definition at line 410 of file app_task.c.
References LIST_HEADROOM, PARAM_COUNT, params_visible(), s_list_next, s_sensors, s_usb_now, send_param(), tlm_ble_hi_free(), USBL_SRC_APP, and usbl_tx_free_src().
Referenced by app_step().
|
static |
Definition at line 420 of file app_task.c.
References cal_frame(), n, s_frame, and tx().
Referenced by calibration(), and local_cmd().
|
static |
Definition at line 427 of file app_task.c.
References cfg_params_put(), cfg_save(), PARAM_COUNT, params_get_all(), and s_img.
Referenced by local_cmd().
|
static |
Definition at line 436 of file app_task.c.
References cfg_save(), and s_img.
Referenced by battery_flight().
|
static |
Definition at line 439 of file app_task.c.
References batt_task_post_scales(), fsh_apply_post(), PV2_CAL_BATTERY, and set.
Referenced by app_init(), and local_cmd().
|
static |
Definition at line 446 of file app_task.c.
References batt_now(), cfg_image_t::batt_used_mah, cfg_image_t::batt_used_scale_i, s_img, used, batt_state_t::vbat, and vbat.
Referenced by app_init().
|
static |
Definition at line 454 of file app_task.c.
References armed_now(), app_task_cfg_t::batt_monitor, batt_task_last_flight(), cfg_image_t::batt_used_mah, cfg_image_t::batt_used_scale_i, batt_flight_t::count, s_cfg, s_fl_count, s_img, save_image_keep_params(), batt_flight_t::scale_i, and batt_flight_t::used_mah.
Referenced by app_step().
|
static |
Definition at line 477 of file app_task.c.
References ack(), armed_now(), cfg_image_t::bak, cfg_image_t::bak_mask, app_task_cfg_t::batt_monitor, bit(), cfg_image_t::cal, cal_abort(), cal_apply(), cal_capture(), cal_copy_type(), cal_result(), cal_running(), cal_save_check(), cal_saved(), cal_set_ref(), cal_start(), cal_type(), cal_set_t::done_mask, list_start(), cfg_image_t::name, params_defaults(), params_index(), params_mark_saved(), params_set(), params_visible(), PV2_ACK_INVALID, PV2_ACK_OK, PV2_ACK_REJECTED, PV2_ACK_UNSUPPORTED, PV2_CAL_STICKS, PV2_E_CALIB_DONE, PV2_E_PARAMS_SAVED, PV2_EV_INFO, PV2_FT_CAPS, PV2_FT_CHECKS, PV2_FT_FLIGHT, PV2_FT_INIT, PV2_FT_MOTORS, PV2_FT_NAV, PV2_FT_POWER, PV2_FT_SYSTEM, PV2_OP_CAL_ABORT, PV2_OP_CAL_CAPTURE, PV2_OP_CAL_RESTORE, PV2_OP_CAL_SAVE, PV2_OP_CAL_SET_REF, PV2_OP_CAL_START, PV2_OP_MOTOR_REMAP, PV2_OP_MOTOR_REVERSE, PV2_OP_PARAM_DEFAULTS, PV2_OP_PARAM_GET, PV2_OP_PARAM_LIST, PV2_OP_PARAM_SAVE, PV2_OP_PARAM_SET, PV2_OP_REQUEST, PV2_OP_SET_NAME, PV2_OP_STREAM_RATES, PV2_R_ARMED, PV2_R_CALIBRATING, PV2_R_NONE, PV2_R_UNKNOWN_PARAM, pv2_rd_f32(), pv2_rd_u16(), RATE, s_cal, s_cal_link, s_cfg, s_hz_flight, s_hz_motors, s_hz_nav, s_hz_power, s_hz_system, s_img, s_link, s_sensors, save_image(), send_calib(), send_caps(), send_checks(), send_event(), send_flight(), send_init(), send_motors(), send_nav(), send_param(), send_power(), send_system(), and seq.
Referenced by commands(), and usb_commands().
|
static |
Definition at line 620 of file app_task.c.
References PV2_OP_CAL_ABORT, PV2_OP_CAL_CAPTURE, PV2_OP_CAL_RESTORE, PV2_OP_CAL_SAVE, PV2_OP_CAL_SET_REF, PV2_OP_CAL_START, PV2_OP_PARAM_DEFAULTS, PV2_OP_PARAM_GET, PV2_OP_PARAM_LIST, PV2_OP_PARAM_SAVE, PV2_OP_PARAM_SET, PV2_OP_REQUEST, PV2_OP_SET_NAME, and PV2_OP_STREAM_RATES.
Referenced by usb_commands().
|
static |
Definition at line 635 of file app_task.c.
References PV2_OP_CAL_CAPTURE, PV2_OP_CAL_RESTORE, PV2_OP_CAL_SAVE, PV2_OP_CAL_SET_REF, PV2_OP_CAL_START, PV2_OP_MOTOR_REMAP, PV2_OP_MOTOR_REVERSE, PV2_OP_PARAM_DEFAULTS, PV2_OP_PARAM_SAVE, PV2_OP_PARAM_SET, PV2_OP_SET_NAME, and PV2_OP_STREAM_RATES.
Referenced by commands(), and usb_commands().
|
static |
Definition at line 649 of file app_task.c.
References LINK_NONE, and s_owner.
Referenced by commands(), and usb_commands().
|
static |
Definition at line 651 of file app_task.c.
References ack_key(), ack_link(), ackc_begin(), ACKC_DONE, ACKC_PENDING, appl_cmd_t::b, config_op(), appl_cmd_t::len, LINK_BLE, LINK_USB, local_cmd(), log_task_usb_app_take(), other_link(), PV2_ACK_REJECTED, PV2_ACK_UNSUPPORTED, PV2_R_NONE, PV2_R_NOT_OVER_USB, PV2_R_OTHER_LINK, s_link, seq, st(), and usb_allowed().
Referenced by app_step().
|
static |
Definition at line 674 of file app_task.c.
References ack(), ack_link(), ackc_begin(), ACKC_DONE, ACKC_PENDING, appl_pop(), appl_cmd_t::b, config_op(), CORE_PENDING_MS, fc_is_core_op(), FC_OP_MOTOR_STOP, fc_post(), fc_take_result(), log_cmd_t::len, fc_cmd_t::len, appl_cmd_t::len, LINK_BLE, local_cmd(), log_task_ble_cmd(), log_cmd_t::op, fc_cmd_t::op, fc_res_t::op, other_link(), log_cmd_t::p, fc_cmd_t::p, PV2_ACK_BUSY, PV2_ACK_REJECTED, PV2_OP_LOG_ERASE, PV2_OP_LOG_LIST, PV2_OP_LOG_READ, PV2_OP_SET_TIME, PV2_R_NONE, PV2_R_OTHER_LINK, fc_res_t::reason, fc_res_t::result, s_pend, s_pend_op, s_pend_seq, s_pend_t, seq, log_cmd_t::seq, fc_cmd_t::seq, fc_res_t::seq, and st().
Referenced by app_step().
|
static |
Definition at line 724 of file app_task.c.
References ack(), log_msg_t::len, log_task_ble_take(), n, log_msg_t::p, pv2_frame(), PV2_FT_ACK, s_big, s_have_logmsg, s_logmsg, tlm_ble_hi_free(), tlm_ble_push_hi(), TLM_BLE_RING_SIZE, tlm_ble_state(), TLM_BLE_STREAMING, and log_msg_t::type.
Referenced by app_step().
|
static |
Definition at line 748 of file app_task.c.
Referenced by app_step(), calibration(), and streams().
|
static |
Definition at line 755 of file app_task.c.
References fc_event_t::arg, armed_now(), cal_take_failed(), fc_event_t::code, EV_RATE_MS, fc_take_event(), fsh_est_read(), fc_event_t::level, PV2_E_CALIB_FAILED, PV2_E_HIGH_VIBRATION, PV2_E_MAG_INTERFERENCE, PV2_EV_ERROR, PV2_EV_WARN, PV2_S_MAG_FC, s, s_have_ev_mag, s_have_ev_vib, s_sensors, s_t_ev_mag, s_t_ev_vib, send_event(), and VIB_WARN_MG.
Referenced by app_step().
|
static |
Definition at line 777 of file app_task.c.
References appl_silence_ms(), cal_abort(), cal_active(), cal_feed(), CAL_LINK_ABORT_MS, cal_take_changed(), cal_tick(), cal_wants_samples(), due(), FC_FS_SHORT_MS, fsh_cal_pop(), g_fsh_cal_want, LINK_USB, s_cal_link, s_t_calib, s_usb_now, and send_calib().
Referenced by app_step().
|
static |
Definition at line 793 of file app_task.c.
References app_task_cfg_t::batt_monitor, due(), s_cfg, s_hz_flight, s_hz_motors, s_hz_nav, s_hz_power, s_hz_system, s_t_caps, s_t_checks, s_t_flight, s_t_motors, s_t_nav, s_t_power, s_t_system, s_usb_now, send_caps(), send_checks(), send_flight(), send_motors(), send_nav(), send_power(), send_system(), tlm_ble_state(), and TLM_BLE_STREAMING.
Referenced by app_step().
| 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().
| 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().
| void app_step | ( | uint32_t | now | ) |
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().
|
static |
Definition at line 920 of file app_task.c.
References app_step().
Referenced by 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().
|
static |
Definition at line 37 of file app_task.c.
Referenced by app_init(), batt_now(), battery_flight(), build_checks(), local_cmd(), send_caps(), send_init(), send_motors(), send_system(), sensors_now(), and streams().
|
static |
Definition at line 38 of file app_task.c.
Referenced by app_task_boot(), battery_flight(), build_checks(), cal_batt(), local_cmd(), save_image(), save_image_keep_params(), and send_caps().
|
static |
Definition at line 39 of file app_task.c.
Referenced by app_init(), app_task_boot(), and local_cmd().
|
static |
Definition at line 40 of file app_task.c.
Referenced by app_init(), app_step(), build_checks(), events(), list_pace(), local_cmd(), send_caps(), send_flight(), send_param(), and send_power().
|
static |
Definition at line 41 of file app_task.c.
Referenced by ack_link(), send_calib(), send_caps(), send_checks(), send_event(), send_flight(), send_motors(), send_nav(), send_param(), send_power(), and send_system().
|
static |
Definition at line 44 of file app_task.c.
Referenced by app_init(), and commands().
|
static |
Definition at line 44 of file app_task.c.
Referenced by commands().
|
static |
Definition at line 44 of file app_task.c.
Referenced by commands().
|
static |
Definition at line 45 of file app_task.c.
Referenced by commands().
|
static |
Definition at line 48 of file app_task.c.
Referenced by local_cmd(), and streams().
|
static |
Definition at line 48 of file app_task.c.
Referenced by local_cmd(), and streams().
|
static |
Definition at line 48 of file app_task.c.
Referenced by local_cmd(), and streams().
|
static |
Definition at line 48 of file app_task.c.
Referenced by local_cmd(), and streams().
|
static |
Definition at line 48 of file app_task.c.
Referenced by local_cmd(), and streams().
|
static |
Definition at line 49 of file app_task.c.
Referenced by app_step(), and streams().
|
static |
Definition at line 50 of file app_task.c.
Referenced by app_init(), and battery_flight().
|
static |
Definition at line 51 of file app_task.c.
Referenced by app_step(), and streams().
|
static |
Definition at line 51 of file app_task.c.
Referenced by app_step(), and streams().
|
static |
Definition at line 51 of file app_task.c.
Referenced by app_step(), and streams().
|
static |
Definition at line 51 of file app_task.c.
Referenced by app_step(), and streams().
|
static |
Definition at line 51 of file app_task.c.
Referenced by app_step(), and streams().
|
static |
Definition at line 51 of file app_task.c.
Referenced by app_step(), and streams().
|
static |
Definition at line 51 of file app_task.c.
Referenced by calibration().
|
static |
Definition at line 51 of file app_task.c.
Referenced by app_step().
|
static |
Definition at line 54 of file app_task.c.
Referenced by app_init(), app_step(), list_pace(), and list_start().
|
static |
Definition at line 58 of file app_task.c.
Referenced by app_init(), repeats(), and send_event().
|
static |
Definition at line 61 of file app_task.c.
Referenced by events().
|
static |
Definition at line 61 of file app_task.c.
Referenced by events().
|
static |
Definition at line 62 of file app_task.c.
Referenced by events().
|
static |
Definition at line 62 of file app_task.c.
Referenced by events().
|
static |
Definition at line 65 of file app_task.c.
Referenced by app_step(), build_checks(), send_checks(), and send_flight().
|
static |
Definition at line 65 of file app_task.c.
Referenced by app_step(), and build_checks().
|
static |
Definition at line 71 of file app_task.c.
Referenced by app_init(), app_step(), and other_link().
|
static |
Definition at line 72 of file app_task.c.
Referenced by ack_link(), app_init(), app_step(), and tx().
|
static |
Definition at line 73 of file app_task.c.
Referenced by app_init(), and app_step().
|
static |
Definition at line 74 of file app_task.c.
Referenced by app_init(), app_step(), calibration(), list_pace(), streams(), and tx().
|
static |
Definition at line 75 of file app_task.c.
Referenced by app_init(), calibration(), and local_cmd().
|
static |
Definition at line 78 of file app_task.c.
Referenced by log_ble_out().
|
static |
Definition at line 79 of file app_task.c.
Referenced by app_init(), and log_ble_out().
|
static |
Definition at line 91 of file app_task.c.
Referenced by log_ble_out().
|
static |
Definition at line 109 of file app_task.c.
Referenced by ack(), app_init(), local_cmd(), and usb_commands().