![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
LogTask: owns the log flash, writes the flight log and serves the log download over USB. More...
Go to the source code of this file.
Data Structures | |
| struct | log_task_cfg_t |
| struct | log_cmd_t |
| a log command received over BLE (op, seq, arguments as written by the app) More... | |
| struct | log_msg_t |
| an answer frame for BLE: type and payload (LOG_ENTRY, LOG_DATA, ACK) More... | |
Macros | |
| #define | LOG_POSTROLL_MS 1000u |
| keep logging after DISARM | |
| #define | LOG_TIME_MIN_UNIX 1704067200u |
| 2024-01-01: SET_TIME before this is refused | |
| #define | LOG_USB_PAUSE_MS 5000u |
| no recording after a log command (USB or BLE) | |
Functions | |
| void | log_task_init (const log_task_cfg_t *cfg) |
| void | log_task_step (uint32_t now_ms) |
| uint8_t | log_task_pct (void) |
| flash used %, 0xFF = no log flash (SYSTEM.log); any task | |
| uint8_t | log_task_busy (void) |
| 1 while a transfer is in progress (the task runs faster) | |
| int | log_task_wallclock (uint32_t now_ms, uint32_t *unix_s, uint16_t *ms) |
| wall clock set by the app (PV2_OP_SET_TIME): 0 and UTC time at uptime 'now', -1 if not set since reset. | |
| int | log_task_ble_cmd (const log_cmd_t *c) |
| 0 = queued, -1 = full (answer BUSY) | |
| int | log_task_ble_take (log_msg_t *m) |
| 1 if a frame was taken | |
| int | log_task_usb_app_take (appl_cmd_t *c) |
| 1 if a command was taken | |
| void | log_task_start (const log_task_cfg_t *cfg) |
LogTask: owns the log flash, writes the flight log and serves the log download over USB.
log_task_step() is plain C (host test); the RTOS loop is at the end of log_task.c.
Definition in file log_task.h.
| #define LOG_POSTROLL_MS 1000u |
keep logging after DISARM
Definition at line 35 of file log_task.h.
| #define LOG_TIME_MIN_UNIX 1704067200u |
2024-01-01: SET_TIME before this is refused
Definition at line 36 of file log_task.h.
| #define LOG_USB_PAUSE_MS 5000u |
no recording after a log command (USB or BLE)
Definition at line 37 of file log_task.h.
| void log_task_init | ( | const log_task_cfg_t * | cfg | ) |
Definition at line 53 of file log_task.c.
References log_task_cfg_t::flash, log_mount(), log_q_reset(), log_used_pct(), s_cfg, s_clk, s_disarm_ms, s_have_cmd, s_mounted, s_npre, s_pct, s_rd, s_was_armed, spsc_reset(), and usbl_reset().
Referenced by log_task_start().
| void log_task_step | ( | uint32_t | now_ms | ) |
Definition at line 334 of file log_task.c.
References fc_state_t::armed, b, cmd(), fc_snapshot(), is_log_op(), log_cmd_t::len, log_q_get(), log_q_take_drops(), LOG_REC_MAX, LOG_SRC_COUNT, log_used_pct(), n, log_cmd_t::op, log_cmd_t::p, pauses(), PORT_BLE, PORT_USB, pump(), PV2_OP_HEARTBEAT, PV2_OP_SET_TIME, read_stream(), recording(), s_cmd_ms, s_have_cmd, s_mounted, s_pct, log_cmd_t::seq, spsc_pop(), to_app(), USBL_CMD_MAX, and usbl_poll().
Referenced by LogTask().
| uint8_t log_task_pct | ( | void | ) |
flash used %, 0xFF = no log flash (SYSTEM.log); any task
Definition at line 70 of file log_task.c.
References s_pct.
Referenced by app_start().
| uint8_t log_task_busy | ( | void | ) |
1 while a transfer is in progress (the task runs faster)
Definition at line 71 of file log_task.c.
References s_rd.
Referenced by LogTask().
| int log_task_wallclock | ( | uint32_t | now_ms, |
| uint32_t * | unix_s, | ||
| uint16_t * | ms | ||
| ) |
wall clock set by the app (PV2_OP_SET_TIME): 0 and UTC time at uptime 'now', -1 if not set since reset.
LogTask only.
Definition at line 105 of file log_task.c.
References ms, s_clk, and unix_s.
Referenced by append_time().
| int log_task_ble_cmd | ( | const log_cmd_t * | c | ) |
0 = queued, -1 = full (answer BUSY)
Definition at line 66 of file log_task.c.
References spsc_push().
Referenced by commands().
| int log_task_ble_take | ( | log_msg_t * | m | ) |
1 if a frame was taken
Definition at line 67 of file log_task.c.
References spsc_pop().
Referenced by log_ble_out().
| int log_task_usb_app_take | ( | appl_cmd_t * | c | ) |
1 if a command was taken
Definition at line 68 of file log_task.c.
References spsc_pop().
Referenced by usb_commands().
| void log_task_start | ( | const log_task_cfg_t * | cfg | ) |
Definition at line 385 of file log_task.c.
References log_task_init(), and LogTask().
Referenced by app_start().