![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
On-flash format of the ACwing flight log (format 1). More...
#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | log_sector_hdr_t |
| sector header More... | |
| struct | log_info_t |
| struct | log_time_t |
| struct | log_att_t |
| struct | log_vert_t |
| struct | log_flight_t |
| struct | log_event_t |
| struct | log_est_t |
| struct | log_power_t |
| struct | log_drop_t |
Macros | |
| #define | LOG_FORMAT 1u |
| #define | LOG_MAGIC 0x474C4341u |
| "ACLG" | |
| #define | LOG_SECTOR 4096u |
| #define | LOG_PAGE 256u |
| #define | LOG_HDR_SIZE 20u |
| #define | LOG_REC_OVERHEAD 3u |
| type, len, crc8 | |
| #define | LOG_REC_MAX 64u |
| largest payload | |
Enumerations | |
| enum | { LR_INFO = 0x01 , LR_TIME = 0x02 , LR_ATT = 0x10 , LR_VERT = 0x11 , LR_FLIGHT = 0x12 , LR_EVENT = 0x13 , LR_EST = 0x14 , LR_POWER = 0x20 , LR_DROP = 0x7F } |
Functions | |
| uint8_t | log_crc8 (const uint8_t *p, uint32_t n) |
| uint16_t | log_crc16 (const uint8_t *p, uint32_t n) |
On-flash format of the ACwing flight log (format 1).
The log flash (W25Q128JV, 16 MB, 4 KB sectors) is a ring of sectors. A log (one per arming, or one per power-on with logMode = always) is a run of consecutive sectors; when the flash is full the oldest sectors are erased and reused, so the oldest log may lose its beginning ("truncated").
Every sector starts with a 20-byte header, then records until the end of the sector or the first 0xFF byte (erased flash). A record never crosses a sector boundary:
[type u8][len u8][payload: len bytes][crc8 over type, len, payload]
CRC-8: poly 0x07, init 0x00 (CRC-8/SMBUS). A reader that finds a bad CRC skips to the next sector. All values little-endian, packed.
The PC decoders (02 - Tools) follow this file: change both together and bump LOG_FORMAT. A NEW record type does not need a new format: readers skip the types they do not know (LR_TIME was added that way, firmware 0.6).
Definition in file log_format.h.
| #define LOG_FORMAT 1u |
Definition at line 28 of file log_format.h.
| #define LOG_MAGIC 0x474C4341u |
"ACLG"
Definition at line 29 of file log_format.h.
| #define LOG_SECTOR 4096u |
Definition at line 30 of file log_format.h.
| #define LOG_PAGE 256u |
Definition at line 31 of file log_format.h.
| #define LOG_HDR_SIZE 20u |
Definition at line 32 of file log_format.h.
| #define LOG_REC_OVERHEAD 3u |
type, len, crc8
Definition at line 33 of file log_format.h.
| #define LOG_REC_MAX 64u |
largest payload
Definition at line 34 of file log_format.h.
| anonymous enum |
Definition at line 50 of file log_format.h.
| uint8_t log_crc8 | ( | const uint8_t * | p, |
| uint32_t | n | ||
| ) |
Definition at line 28 of file log_store.c.
References n.
Referenced by log_append().
| uint16_t log_crc16 | ( | const uint8_t * | p, |
| uint32_t | n | ||
| ) |
Definition at line 38 of file log_store.c.
References n.
Referenced by hdr_ok(), and start_sector().