Summary
Implement a ping-pong double-buffer to decouple scan processing from flash/SD writes. This prevents storage write latency from blocking the scan pipeline.
Inspired by the ESP32DualBandWardriver's Buffer class, which alternates two buffers for this exact purpose.
Design
- Two fixed-size buffers alternate: one accumulates new data, one flushes to storage
- When the active buffer is full (or a time threshold is hit), swap and signal the flush task
- Flush task writes the completed buffer to flash/SD while new data goes to the other buffer
- Generic
PingPongBuffer<const N: usize> in the library crate — reusable across storage backends
Implementation
- Fits naturally into Embassy async — flush task awaits on a swap signal (
Signal or Channel)
- Buffer size tunable per platform:
- ESP32 (M5StickC): ~2KB per buffer (tight DRAM)
- ESP32-S3 (XIAO): larger, especially with PSRAM
no_std + alloc compatible (or purely static with const generics)
Use Cases
Relates To
Summary
Implement a ping-pong double-buffer to decouple scan processing from flash/SD writes. This prevents storage write latency from blocking the scan pipeline.
Inspired by the ESP32DualBandWardriver's
Bufferclass, which alternates two buffers for this exact purpose.Design
PingPongBuffer<const N: usize>in the library crate — reusable across storage backendsImplementation
SignalorChannel)no_std+alloccompatible (or purely static with const generics)Use Cases
Relates To