1.4 KiB
1.4 KiB
Epic 2: Provider Persistent Storage (SD Card)
Goal
Ensure Users, Tasks, and Settings survive device reboots on the ESP32-S3 Provider.
Context
Currently, the Provider's state (Todo tasks, Registered Devices, and User objects) resides in static BSS arrays like g_Tasks[32]. This means the state is lost on every reset.
The ESP32-S3 board has an onboard 3GB SD Card reader. This Epic focuses on migrating the data layer to utilize this SD Card.
Scope & Technologies to Investigate
- Hardware Pinout:
- Determine the exact physical pins the SD Card reader is using on the specific ESP32-S3 board.
- Investigate if it is wired for standard SPI (
sdspi) or native SDMMC (1-bit or 4-bit mode).
- ESP-IDF Storage Drivers:
- Mount a FATFS partition using the
esp_vfs_fat_sdmmc/esp_vfs_fat_sdspicomponents.
- Mount a FATFS partition using the
- Data Model:
- Decide between compiling SQLite for ESP-IDF (better querying, harder setup) or relying on flat
.jsonfiles parsed via cJSON (easier setup, sufficient for MVP limits like 4 users and 32 tasks).
- Decide between compiling SQLite for ESP-IDF (better querying, harder setup) or relying on flat
Next Steps to Start
- Create a
tdd/sd_card_persistence.md. - Find the board schematic or test GPIO configurations to successfully mount the SD Card.
- Abstract the storage functionality into a generic
store.hpp/cppinterface so themanage.cppand API handlers don't need to be rewritten. - Update
seed_users()andseed_tasks()routines to populate initial.jsonfiles if the SD Card is empty.