29 if (absAddr < s_logBase || absAddr >=
s_logEnd)
32 const unsigned idx =
static_cast<unsigned>(off / 4096U);
37 const uint32_t secBase =
s_logBase +
static_cast<uint32_t
>(idx) * 4096U;
38 if (!
s_flash->eraseSector(secBase))
48 const uint32_t
end =
s_nextAddr +
static_cast<uint32_t
>(len) - 1U;
49 const uint32_t firstSec = (
start / 4096U) * 4096U;
50 const uint32_t lastSec = (
end / 4096U) * 4096U;
51 for (uint32_t
a = firstSec;
a <= lastSec;
a += 4096U) {
67 uint16_t payload_len) {
75 memcpy(buf + 4, &tag, 2);
76 memcpy(buf + 6, &t_ms, 4);
77 memcpy(buf + 10, &payload_len, 2);
105#if !FLIGHT_LOG_ENABLE
115 pl[0] =
static_cast<uint8_t
>(from);
116 pl[1] =
static_cast<uint8_t
>(to);
126 memcpy(pl + 2, &psi, 4);
130void logLis3dh(
float ax_g,
float ay_g,
float az_g, uint32_t t_ms) {
133 float pl[3] = {ax_g, ay_g, az_g};
137void logLps28dfw(
float hpa,
float temp_c,
float alt_m, uint32_t t_ms) {
140 float pl[3] = {hpa, temp_c, alt_m};
144void logIsm330(
float ax,
float ay,
float az,
float gx,
float gy,
float gz,
148 float pl[6] = {ax, ay, az, gx, gy, gz};
static constexpr uint32_t FLIGHT_LOG_REGION_BYTES
void logLis3dh(float ax_g, float ay_g, float az_g, uint32_t t_ms)
bool flightLogInit(SPIFlash &flash, uint32_t capacityBytes)
void logMcp3201(uint16_t raw, float psi, uint32_t t_ms)
void logIsm330(float ax, float ay, float az, float gx, float gy, float gz, uint32_t t_ms)
void logFlightStateTransition(FlightState from, FlightState to, uint32_t t_ms, uint8_t reason)
void logLps28dfw(float hpa, float temp_c, float alt_m, uint32_t t_ms)
FlightState flightStateGet()
static void start(gnss_frame_parser_t *p, uint8_t byte)
*brief create JSON pointer *sa reference_tokens const string_t & a
*brief create JSON pointer *sa reference_tokens end()
constexpr uint8_t REC_VER
bool sectorEnsureErased(uint32_t absAddr)
uint8_t s_sectorErased[MAX_SECTORS/8]
bool sectorMarked(unsigned idx)
bool appendRecord(uint16_t tag, uint32_t t_ms, const void *payload, uint16_t payload_len)
constexpr unsigned MAX_SECTORS
void sectorMark(unsigned idx)
bool appendSpanning(const uint8_t *data, size_t len)
constexpr size_t REC_HEADER