Commit Graph

68 Commits

Author SHA1 Message Date
9d5f5ed513 Add web last-update timestamp and debug auto-reboot 2026-02-13 01:51:31 +01:00
3a1de36b75 Fix sender stale sample reuse and add append helper 2026-02-05 01:01:03 +01:00
acidburns
595a31f278 docs: refresh README for lora-refactor behavior 2026-02-04 19:04:30 +01:00
290ca55b8b Reset RX signal state at start of each receive window 2026-02-04 15:11:07 +01:00
f177e5562d Drain oversized LoRa packets to prevent RX FIFO corruption 2026-02-04 15:10:37 +01:00
cb6929bdc1 Add detailed sender ACK RX diagnostics with reject context 2026-02-04 14:42:44 +01:00
c3e5ba3a53 Use protocol constants for ACK airtime window sizing 2026-02-04 14:40:34 +01:00
373667ab8a Document minimal batch/ack protocol and timestamp safety rules 2026-02-04 11:57:59 +01:00
f0503af8c7 Refactor LoRa protocol to batch+ack with ACK-based time bootstrap 2026-02-04 11:57:49 +01:00
f08d9a34d3 Normalize power/energy output formatting 2026-02-04 02:33:43 +01:00
7e5e23e56c Scale ACK RX window to LoRa airtime
- Compute ACK receive window from airtime with bounds and margin
- Retry once if initial window misses
- Document ACK window sizing
2026-02-04 01:21:42 +01:00
1024aa3dd0 Add RX reject reasons to telemetry and UI
BACKWARD-INCOMPATIBLE: MeterBatch schema bumped to v2 with err_rx_reject.
- Track and log RX reject reasons (CRC/protocol/role/payload/length/id/batch)
- Include rx_reject in sender telemetry JSON and receiver web UI
- Add lora_receive reject reason logging under SERIAL_DEBUG_MODE
2026-02-04 01:01:49 +01:00
0e7214d606 Repeat batch ACKs to cover RX latency
- Add ACK_REPEAT_COUNT/ACK_REPEAT_DELAY_MS and repeat ACK sends
- Update README with repeat-ACK behavior
2026-02-04 00:53:06 +01:00
5a86d1bd30 Add LoRa TX timing diagnostics
- Log idle/begin/write/end timing for LoRa TX under SERIAL_DEBUG_MODE
- Document TX timing logs in README
2026-02-04 00:48:20 +01:00
0a99bf3268 Send batch ACKs immediately after reassembly
- Move ACK ahead of MQTT/web work to meet sender 400ms window
- Update ACK log format and document early-ACK behavior
2026-02-04 00:36:40 +01:00
4e06f7a96d Log ACK transmit and reject cases
- Add debug log for ACK TX with batch/sender/receiver ids
- Log rejected ACKs to help diagnose mismatched ids or batches
2026-02-04 00:35:01 +01:00
fde4719a50 Improve timesync acquisition and logging
- Add boot acquisition mode with wider RX windows until first TimeSync
- Log sender TimeSync RX results and receiver TX events
- Document acquisition behavior
2026-02-04 00:33:05 +01:00
e0d35d49bc Validate RTC epoch before setting time
- Reject out-of-range DS3231 epochs and log accept/reject under SERIAL_DEBUG_MODE
- Document RTC validation so LoRa TimeSync can recover
2026-02-04 00:31:10 +01:00
e8fb8680cb Gate slow timesync on LoRa reception
- Keep sender in fast TimeSync listen mode until it receives a LoRa beacon
- Reset scheduler when interval changes to avoid stuck timing
2026-02-04 00:03:38 +01:00
cbf0f7d9b9 Expose timesync error in MQTT and web UI
BACKWARD-INCOMPATIBLE: MQTT faults payload now always includes err_last/err_last_text and err_last_age (schema change).
2026-02-04 00:01:38 +01:00
f7a2503d7a Add timesync burst handling and sender-only timeout
- Add TimeSync fault code and labels in UI/SD/web docs
- Trigger receiver beacon bursts on sender drift, but keep errors sender-local
- Sender flags TimeSync only after TIME_SYNC_ERROR_TIMEOUT_MS
2026-02-03 23:40:11 +01:00
43893c24d1 Keep receiver timesync fast and extend sender fast window
- Receiver now sends time sync every 60s indefinitely (mains powered)
- Sender stays in fast timesync listen mode for first 60s even with RTC
2026-02-03 22:28:36 +01:00
cd4c99f125 Calibrate battery ADC and document LiPo curve
- Add BATTERY_CAL config and debug logging for raw ADC samples
- Use LiPo voltage curve (4.2V full, 2.9V empty) for % mapping
- Document battery calibration, curve, and debug output in README
2026-02-03 22:12:48 +01:00
b8a4c27daa Average battery ADC samples
- Read battery 5 times and average for a steadier voltage estimate
2026-02-02 23:28:54 +01:00
2199627a35 Fix OLED autosleep timing and battery sampling cadence
- Track last OLED activity to avoid double timeout; keep power gating on transitions
- Copy TZ before setenv() in timegm_fallback to avoid invalid pointer reuse
- Add BATTERY_SAMPLE_INTERVAL_MS and only refresh cache at batch start when due
- Keep battery sampling to a single ADC read (Arduino core lacks explicit ADC power gating)
2026-02-02 23:01:55 +01:00
90d830da6f Keep receiver LoRa in continuous RX
- Add lora_receive_continuous() helper and use it after init and TX (ACK/time sync)

- Ensure receiver returns to RX immediately after lora_send

- Document continuous RX behavior in README
2026-02-02 22:17:09 +01:00
237e392c02 Make IEC 62056-21 meter input non-blocking
- Add RX state machine with frame buffer, timeouts, and debug counters

- Expose meter_poll_frame/meter_parse_frame and reuse existing OBIS parsing

- Use cached last-valid frame at 1 Hz sampling to avoid blocking

- Document non-blocking meter handling in README
2026-02-02 22:03:58 +01:00
8e6c64a18e Reduce sender power draw (RX windows + CPU/WiFi/ADC/pins)
- Add LoRa idle/sleep/receive-window helpers and use short RX windows for ACK/time sync

- Schedule sender time-sync windows (fast/slow) and track RX vs sleep time in debug

- Lower sender power (80 MHz CPU, WiFi/BT off, reduced ADC sampling, unused pins pulldown)

- Make SERIAL_DEBUG_MODE a build flag, add prod envs with debug off, and document changes
2026-02-02 21:44:04 +01:00
a4d9be1903 Harden history device ID validation and SD download filename 2026-02-02 21:19:44 +01:00
0e12b406de Harden web UI auth, input handling, and SD path validation
- Add optional Basic Auth with NVS-backed credentials and STA/AP flags; protect status, wifi, history, and download routes

- Stop pre-filling WiFi/MQTT/Web UI password fields; keep stored secrets on blank and add clear-password checkboxes

- Add HTML escaping + URL encoding helpers and apply to user-controlled strings; add unit test

- Harden /sd/download path validation (prefix, length, dotdot, slashes) and log rejections

- Enforce protocol version in LoRa receive and release GPIO14 before SD init

- Update README security, SD, and GPIO sharing notes
2026-02-02 21:08:05 +01:00
b5477262ea 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
2026-02-02 01:43:54 +01:00
d32ae30014 Move AP credentials to config and clarify STA UI access 2026-02-02 00:23:52 +01:00
f3af5b3f1c Add SD logging and update docs
- Add optional microSD CSV logging per sender/day on receiver
- Wire logger into receiver packet handling
- Document new batch header fields, build envs, and SD logging
- Make sender links open in a new tab
2026-02-02 00:22:35 +01:00
5085b9ad3d Improve receiver web UI fields and manual 2026-02-02 00:00:55 +01:00
a03c2cdb07 Include sender error counters in batch payload 2026-02-02 00:00:29 +01:00
13f2f02e42 Tidy sender page layout and use SF12 2026-02-01 23:38:43 +01:00
16c1b90b1e Add payload codec test envs and enable serial debug 2026-02-01 22:54:07 +01:00
e5c4e04ff9 Update README for binary batch payload and SF11 2026-02-01 22:42:26 +01:00
e24798eb55 Use compact binary payload for LoRa batches 2026-02-01 22:37:21 +01:00
d27b68c1cc adjust batch ack timing and rename e_wh field 2026-02-01 21:53:18 +01:00
01f4494f00 expand web ui with batch table and manual 2026-02-01 21:04:34 +01:00
50436cd0bb document batching updates and restore bat_v in batches 2026-02-01 20:59:45 +01:00
a0080b249d increase lora throughput and improve receiver display 2026-02-01 20:09:44 +01:00
876c572bb3 force watchdog reinit for custom timeout 2026-02-01 19:37:47 +01:00
13b4025443 add lora send bypass for debugging 2026-02-01 19:34:28 +01:00
7f31b9dd95 instrument tx timings for watchdog analysis 2026-02-01 19:21:59 +01:00
660d1cde94 prevent watchdog from killing while printing json 2026-02-01 18:59:12 +01:00
f9bcfbd5f2 serial debugging console implemented, enable via config.h 2026-02-01 18:43:06 +01:00
fbd18b2e78 no sleep while ack pending 2026-02-01 18:27:58 +01:00
b4344db828 attempted lora fix: timeout increase 2026-02-01 17:53:01 +01:00