![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
Drone parameters of protocol v2 (HANDOVER_FW.md §8, ids.ts PARAMS). More...
#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | param_def_t |
Macros | |
| #define | PARAM(i) param_get(i) |
Enumerations | |
| enum | { P_TAKEOFF_ALT = 0 , P_LAND_SPEED , P_AUTO_DISARM , P_MAX_TILT , P_MAX_YAW_RATE , P_MAX_CLIMB , P_MAX_HSPEED , P_BEGINNER , P_FS_APP_SHORT , P_FS_APP_LONG , P_FS_RADIO , P_FS_GPS_LOST , P_FS_FLOW_LOST , P_BATT_WARN , P_BATT_CRIT , P_BATT_EMERG , P_GF_MAX_ALT , P_GF_CEILING , P_GF_MAX_DIST , P_GF_ACTION , P_RTH_ALT , P_RTH_STICK_CANCEL , P_ARM_REQUIRE_CHECKS , P_COMPASS_PRIMARY , P_BATT_CAPACITY , P_BATT_CELLS , P_LOG_MODE , PARAM_COUNT } |
| indices in the table (fast access from the flight core) More... | |
| enum | { PARAM_LOG_OFF = 0 , PARAM_LOG_ARMED = 1 , PARAM_LOG_ALWAYS = 2 } |
| log modes (P_LOG_MODE) More... | |
Functions | |
| void | params_defaults (void) |
| RAM <- defaults (dirty until saved) | |
| int | params_index (uint16_t id) |
| -1 if unknown | |
| float | param_get (int idx) |
| lock-free read, any thread | |
| uint8_t | params_set (uint16_t id, float v, uint8_t *reason) |
| PARAM_SET rules: returns an ACK result (PV2_ACK_*) and sets *reason. | |
| void | params_load (const float *values, uint16_t n) |
| flash image | |
| void | params_get_all (float *values) |
| PARAM_COUNT values. | |
| void | params_mark_saved (void) |
| saved <- RAM | |
| uint8_t | params_dirty (int idx) |
| RAM != flash. | |
| uint8_t | params_visible (int idx, uint16_t sensors) |
| listing: parameters whose sensor is missing are omitted | |
| uint16_t | params_visible_count (uint16_t sensors) |
| int | params_visible_pos (int idx, uint16_t sensors) |
| index in PARAM_LIST, -1 if hidden | |
Variables | |
| const param_def_t | g_param_def [PARAM_COUNT] |
Drone parameters of protocol v2 (HANDOVER_FW.md §8, ids.ts PARAMS).
Ids are stable forever: add new ids, never reuse one. Values are float32 on the wire and here. RAM values are written only by the AppTask (one 32-bit store each, atomic on Cortex-M); the flight core reads them at any time with param_get() without locks.
Host-testable: no HAL, no RTOS.
Definition in file params.h.
| anonymous enum |
indices in the table (fast access from the flight core)
| anonymous enum |
| void params_defaults | ( | void | ) |
RAM <- defaults (dirty until saved)
Definition at line 45 of file params.c.
References g_param_def, PARAM_COUNT, and s_val.
Referenced by app_task_boot(), local_cmd(), and params_load().
| int params_index | ( | uint16_t | id | ) |
-1 if unknown
Definition at line 50 of file params.c.
References g_param_def, and PARAM_COUNT.
Referenced by cfg_params_get(), local_cmd(), and params_set().
| float param_get | ( | int | idx | ) |
lock-free read, any thread
Definition at line 56 of file params.c.
References PARAM_COUNT, and s_val.
Referenced by send_param().
| uint8_t params_set | ( | uint16_t | id, |
| float | v, | ||
| uint8_t * | reason | ||
| ) |
PARAM_SET rules: returns an ACK result (PV2_ACK_*) and sets *reason.
Definition at line 68 of file params.c.
References in_range(), P_BATT_CRIT, P_BATT_EMERG, P_BATT_WARN, params_index(), PV2_ACK_INVALID, PV2_ACK_OK, PV2_R_NONE, PV2_R_OUT_OF_RANGE, PV2_R_UNKNOWN_PARAM, and s_val.
Referenced by local_cmd().
| void params_load | ( | const float * | values, |
| uint16_t | n | ||
| ) |
flash image
out-of-range values -> default
Definition at line 84 of file params.c.
References param_def_t::def, g_param_def, in_range(), n, P_BATT_CRIT, P_BATT_EMERG, P_BATT_WARN, PARAM_COUNT, params_defaults(), and s_val.
Referenced by app_task_boot().
| void params_get_all | ( | float * | values | ) |
PARAM_COUNT values.
Definition at line 96 of file params.c.
References PARAM_COUNT, and s_val.
Referenced by save_image().
| void params_mark_saved | ( | void | ) |
saved <- RAM
Definition at line 101 of file params.c.
References PARAM_COUNT, s_saved, and s_val.
Referenced by app_task_boot(), and local_cmd().
| uint8_t params_dirty | ( | int | idx | ) |
RAM != flash.
Definition at line 106 of file params.c.
References PARAM_COUNT, s_saved, and s_val.
Referenced by send_param().
| uint8_t params_visible | ( | int | idx, |
| uint16_t | sensors | ||
| ) |
listing: parameters whose sensor is missing are omitted
Definition at line 112 of file params.c.
References g_param_def, param_def_t::needs, and PARAM_COUNT.
Referenced by list_pace(), local_cmd(), params_visible_count(), and params_visible_pos().
| uint16_t params_visible_count | ( | uint16_t | sensors | ) |
Definition at line 119 of file params.c.
References n, PARAM_COUNT, and params_visible().
Referenced by send_param().
| int params_visible_pos | ( | int | idx, |
| uint16_t | sensors | ||
| ) |
index in PARAM_LIST, -1 if hidden
Definition at line 126 of file params.c.
References params_visible(), and pos.
Referenced by send_param().
|
extern |
Definition at line 11 of file params.c.
Referenced by cfg_load(), cfg_params_get(), cfg_params_put(), in_range(), params_defaults(), params_index(), params_load(), params_visible(), and send_param().