- ST7735 SPI-Treiber (80x160, 5x7-Font) mit Debug-Panel (5MIN/FRM/DROP/SRC/FREE/CH) - SPI2_HOST statt SPI1_HOST (SPI1 = Flash-reserviert auf ESP32-C5) - xTaskCreate statt xTaskCreatePinnedToCore (C5 ist Single-Core) - SD-Karte (SPI 1-bit, 32 GB, FAT32) + Flash-storage-Fallback - Serial-REPL: stats, seron, seroff, reboot - APA102 RGB-Status-LED (blau=boot, gruen=armed, rot=fehler) - Build: ESP-IDF v6.1-dev, RISC-V, ~920 KB Replaced old block1-4 prototype with full modular firmware.
39 lines
1.3 KiB
C
39 lines
1.3 KiB
C
#pragma once
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "esp_err.h"
|
|
|
|
/* Storage backend for C-ITS capture.
|
|
*
|
|
* Primary : SPI SD card reader (T-Dongle C5 pins). Removable -> pull the card
|
|
* out and read the CSV on a PC.
|
|
* Fallback: built-in flash 'storage' FAT partition (works with no card).
|
|
*
|
|
* CSV files rotate every 10 minutes; a header line is written on open.
|
|
*/
|
|
|
|
/* Mount a backend (SD first, flash fallback) and open the first CSV file.
|
|
* Returns ESP_OK if a usable filesystem is available, ESP_FAIL otherwise
|
|
* (in which case capture continues to serial only). */
|
|
esp_err_t cits_store_init(void);
|
|
|
|
/* Append one CSV record (no newline needed — one is added) and flush
|
|
* periodically. Safe to call from a single processing task. */
|
|
esp_err_t cits_store_log(const char *record);
|
|
|
|
/* Close/flush the current file and start a new one (also called automatically
|
|
* on the 10-minute boundary). */
|
|
void cits_store_rotate(void);
|
|
|
|
/* True if a filesystem (SD or flash) is mounted and logging to it. */
|
|
bool cits_store_ready(void);
|
|
|
|
/* Human-readable backend in use ("sd-card" | "flash" | "none"). */
|
|
const char *cits_store_source(void);
|
|
|
|
/* Absolute path of the file currently being written. */
|
|
const char *cits_store_path(void);
|
|
|
|
/* Total CSV records written since boot. */
|
|
uint64_t cits_store_count(void);
|