Decouple sender meter reads and harden meter RX robustness
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static constexpr uint32_t METER_FRAME_TIMEOUT_MS = 1500;
|
||||
// LoRa TX/RX windows can block the main loop for several seconds at SF12.
|
||||
// Keep partial frame state long enough so valid telegrams are not dropped.
|
||||
static constexpr uint32_t METER_FRAME_TIMEOUT_MS = 20000;
|
||||
static constexpr size_t METER_FRAME_MAX = 512;
|
||||
|
||||
enum class MeterRxState : uint8_t {
|
||||
@@ -24,6 +26,10 @@ static uint32_t g_rx_timeout = 0;
|
||||
static uint32_t g_last_log_ms = 0;
|
||||
|
||||
void meter_init() {
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
// Buffer enough serial data to survive long LoRa blocking sections.
|
||||
Serial2.setRxBufferSize(8192);
|
||||
#endif
|
||||
Serial2.begin(9600, SERIAL_7E1, PIN_METER_RX, -1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user