24 lines
1.4 KiB
Markdown
24 lines
1.4 KiB
Markdown
# 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
|
|
1. **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).
|
|
2. **ESP-IDF Storage Drivers:**
|
|
- Mount a FATFS partition using the `esp_vfs_fat_sdmmc` / `esp_vfs_fat_sdspi` components.
|
|
3. **Data Model:**
|
|
- Decide between compiling SQLite for ESP-IDF (better querying, harder setup) or relying on flat `.json` files parsed via cJSON (easier setup, sufficient for MVP limits like 4 users and 32 tasks).
|
|
|
|
## Next Steps to Start
|
|
1. Create a `tdd/sd_card_persistence.md`.
|
|
2. Find the board schematic or test GPIO configurations to successfully mount the SD Card.
|
|
3. Abstract the storage functionality into a generic `store.hpp/cpp` interface so the `manage.cpp` and API handlers don't need to be rewritten.
|
|
4. Update `seed_users()` and `seed_tasks()` routines to populate initial `.json` files if the SD Card is empty.
|