Add SD history UI and pin remap
- Add SD history chart + download listing to web UI - Use HSPI for SD and fix SD pin mapping - Swap role/OLED control pins and update role detection - Update README pin mapping and SD/history docs
This commit is contained in:
23
README.md
23
README.md
@@ -21,17 +21,23 @@ Variants:
|
||||
- SCL: GPIO22
|
||||
- RST: **not used** (SSD1306 init uses `-1` reset pin)
|
||||
- I2C address: 0x3C
|
||||
- microSD (on-board)
|
||||
- CS: GPIO13
|
||||
- MOSI: GPIO15
|
||||
- SCK: GPIO14
|
||||
- MISO: GPIO2
|
||||
- I2C RTC (DS3231)
|
||||
- SDA: GPIO21
|
||||
- SCL: GPIO22
|
||||
- I2C address: 0x68
|
||||
- Battery ADC: GPIO35 (via on-board divider)
|
||||
- **Role select**: GPIO13 (INPUT_PULLDOWN)
|
||||
- LOW = Sender
|
||||
- HIGH = Receiver
|
||||
- **OLED control**: GPIO14 (INPUT_PULLDOWN)
|
||||
- **Role select**: GPIO14 (INPUT_PULLDOWN, sampled at boot)
|
||||
- HIGH = Sender
|
||||
- LOW/floating = Receiver
|
||||
- **OLED control**: GPIO13 (INPUT_PULLDOWN, sender only)
|
||||
- HIGH = force OLED on
|
||||
- LOW = allow auto-off after timeout
|
||||
- Not used on receiver (OLED always on)
|
||||
- Smart meter UART RX: GPIO34 (input-only, always connected)
|
||||
|
||||
### Notes on GPIOs
|
||||
@@ -257,6 +263,8 @@ inline constexpr uint16_t EXPECTED_SENDER_IDS[NUM_SENDERS] = { 0xF19C };
|
||||
- `/sender/<device_id>`: per-sender details
|
||||
- Sender IDs on `/` are clickable (open sender page in a new tab).
|
||||
- In STA mode, the UI is also available via the board’s IP/hostname on your WiFi network.
|
||||
- Main page shows SD card file listing (downloadable).
|
||||
- Sender page includes a history chart (power) with configurable range/resolution/mode.
|
||||
|
||||
## MQTT
|
||||
- Topic: `smartmeter/<deviceId>/state`
|
||||
@@ -293,6 +301,8 @@ Key timing settings in `include/config.h`:
|
||||
- `SERIAL_DEBUG_MODE` / `SERIAL_DEBUG_DUMP_JSON`
|
||||
- `LORA_SEND_BYPASS` (debug only)
|
||||
- `ENABLE_SD_LOGGING` / `PIN_SD_CS`
|
||||
- `SD_HISTORY_MAX_DAYS` / `SD_HISTORY_MIN_RES_MIN`
|
||||
- `SD_HISTORY_MAX_BINS` / `SD_HISTORY_TIME_BUDGET_MS`
|
||||
|
||||
## Limits & Known Constraints
|
||||
- **Compression**: MeterData uses lightweight RLE (good for JSON but not optimal).
|
||||
@@ -309,6 +319,9 @@ Optional CSV logging to microSD (FAT32) when `ENABLE_SD_LOGGING = true`.
|
||||
- Columns:
|
||||
`ts_utc,p_w,p1_w,p2_w,p3_w,e_kwh,bat_v,bat_pct,rssi,snr,err_m,err_d,err_tx,err_last`
|
||||
- `err_last` is written as text (`meter`, `decode`, `loratx`) only on the last sample of a batch that reports an error.
|
||||
- Files are downloadable from the main UI page.
|
||||
- History chart on sender page stream-parses CSVs and bins data in the background.
|
||||
- SD uses the on-board microSD SPI pins (CS=13, MOSI=15, SCK=14, MISO=2).
|
||||
|
||||
## Files & Modules
|
||||
- `include/config.h`, `src/config.cpp`: pins, radio settings, sender IDs
|
||||
@@ -331,7 +344,7 @@ Optional CSV logging to microSD (FAT32) when `ENABLE_SD_LOGGING = true`.
|
||||
1. Set role jumper on GPIO13:
|
||||
- LOW: sender
|
||||
- HIGH: receiver
|
||||
2. OLED control on GPIO14:
|
||||
2. OLED control on GPIO13:
|
||||
- HIGH: always on
|
||||
- LOW: auto-off after 10 minutes
|
||||
3. Build and upload:
|
||||
|
||||
Reference in New Issue
Block a user