ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
log_task.h
Go to the documentation of this file.
1
27#ifndef LOG_TASK_H
28#define LOG_TASK_H
29
30#include <stdint.h>
31#include "log_store.h"
32#include "proto_v2.h"
33#include "app_link.h"
34
35#define LOG_POSTROLL_MS 1000u
36#define LOG_TIME_MIN_UNIX 1704067200u
37#define LOG_USB_PAUSE_MS 5000u
39typedef struct {
41 char hw_rev;
42 uint8_t fw[3];
43 uint16_t (*sensors)(void);
45 void (*usb_pump)(void);
47 int (*erase_chip)(void);
49
51typedef struct { uint8_t op, seq, len; uint8_t p[17]; } log_cmd_t;
53typedef struct { uint8_t type, len; uint8_t p[sizeof(pv2_log_data_hdr_t) + PV2_LOG_DATA_MAX]; } log_msg_t;
54
55void log_task_init(const log_task_cfg_t *cfg);
56void log_task_step(uint32_t now_ms);
58uint8_t log_task_pct(void);
60uint8_t log_task_busy(void);
63int log_task_wallclock(uint32_t now_ms, uint32_t *unix_s, uint16_t *ms);
64
65/* ---- BLE, AppTask side ---- */
66int log_task_ble_cmd(const log_cmd_t *c);
69/* ---- USB, AppTask side: the commands that are not log commands ---- */
72#ifndef HOST_TEST
73void log_task_start(const log_task_cfg_t *cfg);
74#endif
75
76#endif /* LOG_TASK_H */
Flight-log store: ring of sectors on a NOR flash (format in log_format.h).
uint8_t seq
Definition log_task.c:48
uint16_t ms
Definition log_task.c:42
uint32_t unix_s
Definition log_task.c:41
int log_task_usb_app_take(appl_cmd_t *c)
1 if a command was taken
Definition log_task.c:68
uint8_t log_task_busy(void)
1 while a transfer is in progress (the task runs faster)
Definition log_task.c:71
void log_task_init(const log_task_cfg_t *cfg)
Definition log_task.c:53
uint8_t log_task_pct(void)
flash used %, 0xFF = no log flash (SYSTEM.log); any task
Definition log_task.c:70
int log_task_ble_cmd(const log_cmd_t *c)
0 = queued, -1 = full (answer BUSY)
Definition log_task.c:66
void log_task_step(uint32_t now_ms)
Definition log_task.c:334
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 rese...
Definition log_task.c:105
void log_task_start(const log_task_cfg_t *cfg)
Definition log_task.c:385
int log_task_ble_take(log_msg_t *m)
1 if a frame was taken
Definition log_task.c:67
ACwing Pilot app protocol v2: identifiers and frame layouts.
#define PV2_LOG_DATA_MAX
Definition proto_v2.h:265
a log command received over BLE (op, seq, arguments as written by the app)
Definition log_task.h:51
uint8_t len
Definition log_task.h:51
flash backend; addresses in bytes from the start of the log area
Definition log_store.h:28
an answer frame for BLE: type and payload (LOG_ENTRY, LOG_DATA, ACK)
Definition log_task.h:53
uint8_t len
Definition log_task.h:53
const log_flash_t * flash
NULL: no log flash on this board
Definition log_task.h:40