Add IEC62056 parsing, OLED timing, and batch LoRa send

This commit is contained in:
2026-01-28 01:22:13 +01:00
parent 449fff1f06
commit e480677b49
8 changed files with 570 additions and 65 deletions

View File

@@ -36,7 +36,7 @@ Variants:
## Firmware Roles
### Sender (battery-powered)
- Reads DD3 smart meter via optical IR (UART 9600 7E1).
- Reads smart meter via optical IR (UART 9600 7E1).
- Extracts OBIS values:
- Energy total: 1-0:1.8.0*255
- Total power: 1-0:16.7.0*255
@@ -65,6 +65,7 @@ void sender_cycle() {
display_tick();
lora_receive_time_sync(); // optional
keep_oled_on_for_read_window();
deep_sleep(SENDER_WAKE_INTERVAL_SEC);
}
```
@@ -195,11 +196,11 @@ inline constexpr uint16_t EXPECTED_SENDER_IDS[NUM_SENDERS] = { 0xF19C };
```
## OLED Behavior
- After reset, OLED stays **ON for 10 minutes** regardless of switch.
- After that:
- Sender: OLED stays **ON for 10 seconds** on each wake, then powers down for sleep.
- Receiver: OLED follows the 10-minute auto-off behavior:
- GPIO14 HIGH: OLED forced ON.
- GPIO14 LOW: start 10-minute auto-off timer.
- Pages rotate every 10s.
- GPIO14 LOW: auto-off after 10 minutes.
- Pages rotate every 4s.
## Power & Battery
- Sender disables WiFi/BLE, reads VBAT via ADC, uses linear SoC map:
@@ -233,7 +234,7 @@ inline constexpr uint16_t EXPECTED_SENDER_IDS[NUM_SENDERS] = { 0xF19C };
## Limits & Known Constraints
- **Compression**: uses lightweight RLE (good for JSON but not optimal).
- **OBIS parsing**: heuristic SML parser; may need tuning for some DD3 meters.
- **OBIS parsing**: supports IEC 62056-21 ASCII (Mode D) and SML; may need tuning for some meters.
- **Payload size**: JSON < 256 bytes (enforced by ArduinoJson static doc).
- **Battery ADC**: uses simple linear calibration constant in `power_manager.cpp`.
- **OLED**: no hardware reset line is used (matches working reference).
@@ -244,7 +245,7 @@ inline constexpr uint16_t EXPECTED_SENDER_IDS[NUM_SENDERS] = { 0xF19C };
- `include/json_codec.h`, `src/json_codec.cpp`: JSON encode/decode
- `include/compressor.h`, `src/compressor.cpp`: RLE compression
- `include/lora_transport.h`, `src/lora_transport.cpp`: LoRa packet + CRC
- `include/meter_driver.h`, `src/meter_driver.cpp`: SML/OBIS parse
- `include/meter_driver.h`, `src/meter_driver.cpp`: IEC 62056-21 ASCII + SML parse
- `include/power_manager.h`, `src/power_manager.cpp`: ADC + sleep
- `include/time_manager.h`, `src/time_manager.cpp`: NTP + time sync
- `include/wifi_manager.h`, `src/wifi_manager.cpp`: NVS config + WiFi