microReticulumTbeam/exercises/17_Flash
2026-04-04 11:52:41 -07:00
..
scripts After various memory exercises, then back to GPS to get UBlox working. UBlox is working. TODO: start libraries, downplay SD Card as we can use memory for interim logging 2026-04-04 11:52:41 -07:00
src After various memory exercises, then back to GPS to get UBlox working. UBlox is working. TODO: start libraries, downplay SD Card as we can use memory for interim logging 2026-04-04 11:52:41 -07:00
platformio.ini After various memory exercises, then back to GPS to get UBlox working. UBlox is working. TODO: start libraries, downplay SD Card as we can use memory for interim logging 2026-04-04 11:52:41 -07:00
read_partition_bin.py After various memory exercises, then back to GPS to get UBlox working. UBlox is working. TODO: start libraries, downplay SD Card as we can use memory for interim logging 2026-04-04 11:52:41 -07:00
README.md After various memory exercises, then back to GPS to get UBlox working. UBlox is working. TODO: start libraries, downplay SD Card as we can use memory for interim logging 2026-04-04 11:52:41 -07:00
show_partition_table.py After various memory exercises, then back to GPS to get UBlox working. UBlox is working. TODO: start libraries, downplay SD Card as we can use memory for interim logging 2026-04-04 11:52:41 -07:00

Exercise 17_Flash

This exercise demonstrates using Flash storage as a persistent directory-like file system on an ESP32-S3 board.

Behavior:

  • Mounts SPIFFS at boot and reports total / used / free flash space.
  • Ensures a flash directory at /flash_logs exists.
  • Creates a new log file when the device boots, based on the current timestamp: YYYYMMDD_HHMM.log.
  • Writes a timestamped line into the new log file once per second.
  • Supports console commands to inspect the current file, read it, clear it, append or rewrite it, and list stored files.
  • Files persist across reboots and are stored in flash.

Build and upload:

cd /usr/local/src/microreticulum/microReticulumTbeam/exercises/17_Flash
pio run -e amy -t upload
pio device monitor -b 115200

Commands:

  • help - show command menu
  • stat - show flash / current file status
  • list - list files under /flash_logs
  • read - read the current flash file contents
  • clear - clear the current flash file contents
  • write <text> - overwrite the current flash file with text
  • append <text> - append text to the current flash file

Notes:

  • If the current timestamp file name already exists, the exercise will append a numeric suffix to keep the file unique.
  • On each reboot a new file is created so persistent flash logs accumulate.