![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
A/B image selection, CRC (see cfg_store.h). More...
Go to the source code of this file.
Data Structures | |
| struct | cal_set_v1_t |
| struct | cfg_image_v1_t |
Macros | |
| #define | V1_PARAMS 24 /* P_TAKEOFF_ALT .. P_COMPASS_PRIMARY */ |
Functions | |
| uint32_t | cfg_crc32 (const void *data, uint32_t len) |
| static int | valid_version (const void *page) |
| static int | valid (const cfg_image_t *im) |
| static int | latest_page (void) |
| static void | cal_from_v1 (cal_set_t *d, const cal_set_v1_t *s) |
| void | cfg_params_put (cfg_image_t *img, const float v[PARAM_COUNT]) |
| parameters <-> slots (unknown ids ignored, missing ids -> default) | |
| void | cfg_params_get (const cfg_image_t *img, float v[PARAM_COUNT]) |
| int | cfg_load (cfg_image_t *out) |
| latest valid image (version 1 converted); returns 0 if found, -1 if none (out left untouched) | |
| int | cfg_save (cfg_image_t *img) |
| writes img (seq and crc filled here) to the other page; 0 = ok | |
A/B image selection, CRC (see cfg_store.h).
Definition in file cfg_store.c.
| #define V1_PARAMS 24 /* P_TAKEOFF_ALT .. P_COMPASS_PRIMARY */ |
Definition at line 21 of file cfg_store.c.
| uint32_t cfg_crc32 | ( | const void * | data, |
| uint32_t | len | ||
| ) |
Definition at line 9 of file cfg_store.c.
Referenced by cfg_save(), and valid_version().
|
static |
Definition at line 43 of file cfg_store.c.
References cfg_crc32(), CFG_MAGIC, CFG_VERSION, cfg_image_v1_t::crc, cfg_image_t::crc, cfg_image_t::magic, cfg_image_v1_t::size, cfg_image_t::size, cfg_image_v1_t::version, and cfg_image_t::version.
Referenced by cfg_load(), latest_page(), and valid().
|
static |
Definition at line 54 of file cfg_store.c.
References CFG_VERSION, and valid_version().
Referenced by cfg_save().
|
static |
Definition at line 56 of file cfg_store.c.
References cfg_flash_page(), CFG_PAGES, cfg_image_t::seq, seq, and valid_version().
Referenced by cfg_load(), and cfg_save().
|
static |
Definition at line 68 of file cfg_store.c.
References cal_set_t::accel, cal_set_defaults(), cal_set_t::compass, cal_set_t::done_mask, cal_set_t::gyro, batt_state_t::level, cal_set_t::level, cal_set_t::motors, and s.
Referenced by cfg_load().
| void cfg_params_put | ( | cfg_image_t * | img, |
| const float | v[PARAM_COUNT] | ||
| ) |
parameters <-> slots (unknown ids ignored, missing ids -> default)
Definition at line 76 of file cfg_store.c.
References CFG_PARAM_SLOTS, g_param_def, cfg_param_t::id, param_def_t::id, PARAM_COUNT, cfg_image_t::params, and cfg_param_t::value.
Referenced by cfg_load(), and save_image().
| void cfg_params_get | ( | const cfg_image_t * | img, |
| float | v[PARAM_COUNT] | ||
| ) |
Definition at line 85 of file cfg_store.c.
References CFG_PARAM_SLOTS, g_param_def, cfg_param_t::id, PARAM_COUNT, cfg_image_t::params, params_index(), and cfg_param_t::value.
Referenced by app_task_boot().
| int cfg_load | ( | cfg_image_t * | out | ) |
latest valid image (version 1 converted); returns 0 if found, -1 if none (out left untouched)
Definition at line 95 of file cfg_store.c.
References cfg_image_v1_t::bak, cfg_image_t::bak, cfg_image_v1_t::bak_mask, cfg_image_t::bak_mask, cfg_image_t::batt_used_scale_i, cfg_image_v1_t::cal, cfg_image_t::cal, cal_from_v1(), cfg_flash_page(), CFG_MAGIC, cfg_params_put(), CFG_VERSION, param_def_t::def, g_param_def, latest_page(), cfg_image_t::magic, cfg_image_v1_t::name, cfg_image_t::name, PARAM_COUNT, cfg_image_v1_t::params, pg(), cfg_image_v1_t::seq, cfg_image_t::seq, cfg_image_t::size, V1_PARAMS, valid_version(), and cfg_image_t::version.
Referenced by app_task_boot().
| int cfg_save | ( | cfg_image_t * | img | ) |
writes img (seq and crc filled here) to the other page; 0 = ok
Definition at line 117 of file cfg_store.c.
References cfg_crc32(), cfg_flash_page(), cfg_flash_write(), CFG_MAGIC, CFG_PAGES, CFG_VERSION, cfg_image_t::crc, latest_page(), cfg_image_t::magic, cfg_image_t::seq, seq, cfg_image_t::size, valid(), and cfg_image_t::version.
Referenced by save_image(), and save_image_keep_params().