Make repeater RX watchdog MeshCore-aware and tune temporary radio
Use RX-only radio recovery and feed the repeater reboot watchdog after MeshCore parsing. Default to 24 hours, apply temporary watchdog and advert intervals in RAM, and report temporary durations as days, hours, and minutes. Add regression coverage and an ESP-NOW bridge setup guide.
This commit is contained in:
1 parent
91d636b8ff
commit
2b4a35adb7
19 files changed
+1265
-140
No files matched your search
+53
-8
@@ -1142,6 +1142,33 @@ settings use a safe effective power without replacing the saved preference.
|
||||
- `normalradio` cancels pending and active temporary-radio windows, then
|
||||
restores the saved radio tuple after its CLI reply has drained on the
|
||||
current channel. Permanent `radioat` entries are not removed.
|
||||
- On repeaters, the reply includes total minutes plus `NdNhNm` (days, hours,
|
||||
minutes) and the watchdog policy for that session. For example:
|
||||
|
||||
```text
|
||||
OK - temp params for 1440 mins (1d0h0m); rx.watchdog=12hours
|
||||
OK - temp params for 3075 mins (2d3h15m); rx.watchdog=12hours
|
||||
OK - temp params for 180 mins (0d3h0m); rx.watchdog=off (temp<12hours)
|
||||
```
|
||||
|
||||
Repeater timing overrides apply only while a temporary window is running:
|
||||
|
||||
| Temporary duration | No-RX reboot watchdog | Flood advert interval | Direct/local advert interval |
|
||||
| --- | --- | --- | --- |
|
||||
| Up to and including 3 hours | Off | Saved normal interval | 1 hour |
|
||||
| More than 3, less than 12 hours | Off | 3 hours | 1 hour |
|
||||
| 12 hours or longer | 12 hours | 3 hours | 1 hour |
|
||||
|
||||
The duration is the requested window length, not the decreasing time remaining.
|
||||
The first temporary adverts are scheduled from successful radio activation;
|
||||
hourly local adverts still run when a flood advert is also due. `get
|
||||
advert.interval` and `get flood.advert.interval` report the effective intervals.
|
||||
The web configuration form continues to show and edit the saved normal advert
|
||||
settings. These include any changes made during a temporary session.
|
||||
Expiry, cancellation, reboot, or power
|
||||
loss removes the temporary overrides. Normal mode uses the saved advert
|
||||
intervals and the 24-hour watchdog policy. An explicitly saved normal-mode
|
||||
`rx.watchdog off` remains off outside temporary sessions.
|
||||
|
||||
---
|
||||
|
||||
@@ -1168,6 +1195,12 @@ settings use a safe effective power without replacing the saved preference.
|
||||
- `del radioat` and `del tempradioat` delete all entries when `n` is omitted.
|
||||
- Each queue supports 3 entries. Scheduled entries are not saved across reboot.
|
||||
- `radioat` saves the new radio preferences when it fires. `tempradioat` applies temporarily, then reverts to the saved radio preferences.
|
||||
- `tempradioat` uses the repeater timing table above, with duration calculated
|
||||
from `end_time - start_time`. Its acceptance reply includes total minutes, `NdNhNm`,
|
||||
and the planned `rx.watchdog` setting. Queuing a future entry does not change
|
||||
the running watchdog or advert intervals; the overrides start only after
|
||||
the temporary radio parameters are successfully applied. If restoration
|
||||
needs retries after expiry, the timing overrides still end with the window.
|
||||
- A successful scheduling reply notes any RXPS effective-level/preamble change
|
||||
required by the scheduled tuple. `RXPS continuous-fast` means the tuple is
|
||||
accepted but will use continuous receive because no safe duty-cycle level is
|
||||
@@ -1651,12 +1684,16 @@ send text.flood checking ridge link
|
||||
- `set rx.watchdog on`
|
||||
- `set rx.watchdog off`
|
||||
|
||||
**Default:** `off`
|
||||
**Default:** `on`, with a 24-hour no-RX timeout in normal mode.
|
||||
|
||||
**Notes:**
|
||||
- When enabled, the first check is due after a full 12-hour observation window. The repeater then checks roughly every 12 hours and reboots if it has not successfully received a radio packet during the preceding 12 hours.
|
||||
- Enabling the watchdog starts a new 12-hour observation window. Rebooting also starts a new window, so a quiet mesh can reboot no more often than once every 12 hours.
|
||||
- The check reuses the radio driver's existing last-receive timestamp. It does not poll, sample, or wake the radio or CPU. A due check waits for the next normal loop/wake, so its actual cadence can drift around the 12-hour target. With RX power saving enabled, packets received during normal listening windows count as activity; the watchdog does not alter the RX/sleep timing.
|
||||
- In normal mode, the repeater reboots after 24 hours without a received packet passing MeshCore parsing. Each such reception restarts this timeout; checks use a sliding deadline rather than waiting for another 24-hour checkpoint.
|
||||
- While `tempradio` or `tempradioat` is running, windows of at least 12 hours use a 12-hour no-RX timeout. Shorter windows disable this reboot watchdog for the duration of the session. This temporary policy also overrides a saved normal-mode `off` setting.
|
||||
- Startup, a successful temporary-radio activation/replacement, expiry, cancellation, or manually changing this setting starts a fresh observation window. Expiry is processed before the watchdog, so a temporary window ending exactly at its watchdog deadline restores normal timing first.
|
||||
- `get rx.watchdog` reports both the effective on/off state and timeout or short-session disabled reason. `set rx.watchdog on|off` saves the normal-mode preference; temporary-session rules remain active until that session ends. Existing saved preferences are retained when upgrading; the new default applies to fresh settings or older preference files without this field.
|
||||
- The check uses the last successful MeshCore parse time, recorded before receive delays and routing filters. It does not require the packet to be addressed to this repeater or its encrypted payload to be decrypted; duplicate receptions also count. This checks MeshCore packet structure, not sender authentication.
|
||||
- It does not poll, sample, or wake the radio or CPU. A due check waits for the next normal loop/wake. With RX power saving enabled, qualifying packets received during normal listening windows count as activity; the watchdog does not alter the RX/sleep timing.
|
||||
- Transmitting, radio interrupts, and raw LoRa packets rejected by the MeshCore parser do not reset the timer. Packets dropped before parsing because the packet pool is full do not count either. This whole-board reboot setting is separate from the automatic radio-only recovery watchdog, which still measures successful raw radio reads.
|
||||
|
||||
---
|
||||
|
||||
@@ -2172,13 +2209,18 @@ hardware busy-result count.
|
||||
- `set radio.watchdog <minutes>`
|
||||
|
||||
**Parameters:**
|
||||
- `minutes`: `0` to disable, or `1-120` minutes
|
||||
- `minutes`: `0` to use the standard 30-minute soft recovery interval, or `1-120` minutes to override it
|
||||
|
||||
**Default:** `5`
|
||||
|
||||
**Note:** This watchdog belongs to the MQTT observer runtime and is not
|
||||
available on a standalone FULL repeater. On quiet meshes, increasing it can
|
||||
reduce false recoveries when no traffic is expected.
|
||||
**Note:** This setting belongs to the MQTT observer runtime and is not
|
||||
available on a standalone FULL repeater. It sets the interval without a
|
||||
successfully received packet before soft radio recovery. Transmissions and
|
||||
interrupts alone do not restart the timer. Setting it to `0` removes the
|
||||
observer override; automatic radio recovery remains active. The normal hard
|
||||
recovery threshold is 12 hours, where the radio supports it, and recovery does
|
||||
not reboot the whole board. On quiet meshes, increasing the soft interval can
|
||||
reduce unnecessary recoveries when no traffic is expected.
|
||||
|
||||
---
|
||||
|
||||
@@ -4032,6 +4074,9 @@ still overrides the first-boot default after an update.
|
||||
|
||||
### Bridge (When bridge support is compiled in)
|
||||
|
||||
For a complete two-repeater setup with each option explained, see the
|
||||
[ESP-NOW bridge setup guide](espnow_bridge_setup.md).
|
||||
|
||||
#### View the compiled bridge type
|
||||
**Usage:** `get bridge.type`
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
# ESP-NOW bridge: simple setup
|
||||
|
||||
Use two ESP32 LoRa boards to join two MeshCore networks with different radio
|
||||
settings. Each board repeats on its own LoRa network, and the boards exchange
|
||||
packets directly over 2.4 GHz ESP-NOW. No router, internet connection, or manual
|
||||
peer pairing is needed.
|
||||
|
||||
```text
|
||||
LoRa network A <--> Repeater A <-- ESP-NOW --> Repeater B <--> LoRa network B
|
||||
```
|
||||
|
||||
## 1. Choose the firmware
|
||||
|
||||
Install the exact board's **Full ESP-NOW bridge repeater** image on each board.
|
||||
The target name ends in `_repeater_bridge_espnow`; a standard Heltec V4 uses
|
||||
`heltec_v4_repeater_bridge_espnow`. Full/MQTT and Full Companion images are
|
||||
different choices. See the [firmware picker guide](firmware_picker.md).
|
||||
|
||||
Open each board's [USB console](https://flasher.meshcore.io/console) at
|
||||
115200 baud and run:
|
||||
|
||||
```text
|
||||
get bridge.type
|
||||
```
|
||||
|
||||
The answer must be `espnow`. `mqtt`, `rs232`, or `none` means that image does
|
||||
not provide the ESP-NOW bridge described here.
|
||||
|
||||
## 2. Set each board's LoRa network
|
||||
|
||||
Configure one board at a time over USB. Replace the placeholders below with
|
||||
the radio settings used by the network on that board's side. Use `Bridge-A`
|
||||
for the first board and `Bridge-B` for the second, or choose your own names.
|
||||
|
||||
```text
|
||||
set bridge.enabled off
|
||||
set name Bridge-A
|
||||
set radio <freq>,<bw>,<sf>,<cr>
|
||||
reboot
|
||||
```
|
||||
|
||||
Do not type the angle-bracket placeholders literally.
|
||||
|
||||
| Radio option | Meaning |
|
||||
| --- | --- |
|
||||
| `freq` | LoRa frequency in MHz. Match the local network on this side. |
|
||||
| `bw` | LoRa bandwidth in kHz. Match that network's bandwidth. |
|
||||
| `sf` | Spreading factor, 5-12. Match that network's setting. |
|
||||
| `cr` | Coding-rate value, 5-8. Match that network's setting. |
|
||||
| `name` | A label to tell the two repeaters apart. It does not pair them. |
|
||||
|
||||
**`set radio` requires a reboot to apply.** After reconnecting, `get radio`
|
||||
shows the saved settings. Use permanent radio settings for this setup;
|
||||
`tempradio` sessions expire.
|
||||
|
||||
## 3. Configure the ESP-NOW link on both boards
|
||||
|
||||
Run this block on **both** boards. Replace `YourSharedKey` with the same
|
||||
case-sensitive secret on each board, using 1-15 characters. Channel `6` is
|
||||
an example; both boards must use the same channel.
|
||||
|
||||
```text
|
||||
set bridge.enabled off
|
||||
set bridge.channel 6
|
||||
set bridge.format wrapped
|
||||
set bridge.secret YourSharedKey
|
||||
set bridge.source tx
|
||||
set bridge.delay 500
|
||||
set repeat on
|
||||
set bridge.enabled on
|
||||
```
|
||||
|
||||
These settings are saved across reboot. Bridge changes apply immediately;
|
||||
changing an enabled bridge's channel, format, or secret restarts the bridge.
|
||||
Stopping it first lets you finish configuring both sides before connecting them.
|
||||
|
||||
## What each bridge option does
|
||||
|
||||
| Option | Choices and purpose |
|
||||
| --- | --- |
|
||||
| `bridge.enabled` | `on` starts the bridge; `off` stops it and keeps its saved settings. |
|
||||
| `bridge.channel` | The 2.4 GHz channel, 1-13. Match it on both boards. This is separate from the LoRa frequency in `set radio`. |
|
||||
| `bridge.format` | `wrapped` is the default for this two-repeater setup and uses the shared secret. `raw` connects to primary-ESP-NOW nodes such as `Generic_ESPNOW` or `SenseCapIndicator-ESPNow`; it ignores the secret. Both peers must use compatible formats. |
|
||||
| `bridge.secret` | A matching, case-sensitive value of 1-15 characters for `wrapped` mode. It separates bridge groups; it is not strong encryption. MeshCore's own message encryption remains in place. |
|
||||
| `bridge.source` | `tx` crosses packets this repeater transmits on LoRa, after its forwarding decisions; use this for the setup above. `rx` crosses received packets before those decisions and can pass traffic the local repeater would not forward. |
|
||||
| `bridge.delay` | Wait before processing a packet received from the other bridge, in milliseconds. Range: 0-10000. Start with the default `500`. |
|
||||
| `repeat` | `on` enables normal LoRa forwarding; `off` disables forwarding. Keep it `on` on both bridge repeaters. Normal routing, scope, and packet-filter rules still apply. |
|
||||
| `bridge.type` | Read-only firmware capability. It must report `espnow` for this guide. |
|
||||
| `bridge.running` | Read-only runtime state. `on` means the local bridge started; it does not prove the other board is reachable. |
|
||||
|
||||
This fork uses **`set bridge.source tx`** or **`rx`**. Some upstream guides
|
||||
use `logTx` and `logRx`; those are not the command values used here.
|
||||
|
||||
For a LoRa gateway connected to primary-ESP-NOW Companions instead of another
|
||||
LoRa repeater, see [raw ESP-NOW compatibility](WiFi.md#wifi-companion-setup).
|
||||
|
||||
## 4. Check the link
|
||||
|
||||
Run on both boards:
|
||||
|
||||
```text
|
||||
get bridge.enabled
|
||||
get bridge.running
|
||||
get bridge.channel
|
||||
get bridge.format
|
||||
get bridge.secret
|
||||
get bridge.source
|
||||
get bridge.delay
|
||||
get repeat
|
||||
get radio
|
||||
```
|
||||
|
||||
Expected: enabled and running `on`, matching channel/format/secret, source
|
||||
`tx`, delay `500`, repeat `on`, and the intended LoRa settings on each side.
|
||||
|
||||
Send a message from a Companion on network A to one on network B, then reply
|
||||
from B to A. Check both directions; configuration readback alone does not test
|
||||
delivery.
|
||||
|
||||
If it does not work:
|
||||
|
||||
- **Commands are unavailable:** check `get bridge.type` and the firmware choice.
|
||||
- **Enabled is on but running is off:** initialization failed. Reboot and
|
||||
check again; ensure another WiFi service is not occupying the radio.
|
||||
- **Both are running but traffic does not cross:** compare channel, format,
|
||||
and secret; confirm each board's LoRa settings were applied with a reboot,
|
||||
and check the networks' forwarding and scope rules.
|
||||
|
||||
A running bridge keeps the device awake, even with device power saving enabled.
|
||||
For every command's full details, see the [bridge CLI reference](cli_commands.md#bridge-when-bridge-support-is-compiled-in).
|
||||
|
||||
For a broader comparison with a Linux-based bridge, see the
|
||||
[MeshCore Nexus bridging guide](https://meshcore.nexus/guides/lora-bridging#method-2-meshcore-esp-now-bridge).
|
||||
@@ -175,6 +175,9 @@ RS-232 image. Choose Wi-Fi MQTT under **Logging / MQTT**; it is an output mode,
|
||||
not a second connection choice. Repeaters may still offer separate ESP-NOW or
|
||||
Ethernet bridge firmware because those paths use different compiled drivers.
|
||||
|
||||
For commands and option explanations, follow the
|
||||
[ESP-NOW bridge setup guide](espnow_bridge_setup.md).
|
||||
|
||||
An ESP-NOW bridge target keeps LoRa as its primary mesh radio. Its runtime
|
||||
`bridge.format` setting chooses the peer protocol: `wrapped` (the
|
||||
backward-compatible bridge-to-bridge default using `bridge.secret`) or `raw`
|
||||
|
||||
@@ -54,10 +54,35 @@ where supported. An observed healthy RX state clears the sequence. Recovery
|
||||
preserves tuning, TX power, receive gain, and the operator's power-saving intent.
|
||||
The existing radio liveness and RXPS watchdogs remain active for other failures.
|
||||
|
||||
The radio liveness watchdog measures time without a successfully received
|
||||
packet. Only a positive `recvRaw()` result restarts its observation window;
|
||||
TX completion, CAD interrupts, and failed packet reads do not. Reception counts
|
||||
even if application parsing rejects the packet or the packet pool is full.
|
||||
The check runs after pending RX is drained and TX completes, before the next
|
||||
queued transmission, so sustained outbound traffic cannot postpone recovery.
|
||||
|
||||
The default silence thresholds are 30 minutes for a soft RX/AGC re-arm and
|
||||
12 hours for a radio-only hard recovery where supported. MQTT observer
|
||||
`radio.watchdog` settings can override the soft interval. A successful hard
|
||||
recovery starts a fresh observation window to limit repeated resets on a quiet
|
||||
mesh; a failed hard recovery remains escalated and retries after 30 seconds.
|
||||
Targets with `RADIO_LIVENESS_SOFT_ONLY` repeat soft recovery at the soft interval
|
||||
because their radio cannot be reset independently. These recoveries do not
|
||||
reboot the MCU. The repeater's `rx.watchdog` is a separate whole-board reboot
|
||||
watchdog, enabled by default with a 24-hour sliding deadline since the last
|
||||
received packet passed MeshCore parsing. Its timer is updated before receive
|
||||
delays and routing filters; raw LoRa reads rejected by the parser do not count.
|
||||
MeshCore parsing checks the packet structure, not sender authentication or
|
||||
decryption of traffic addressed to other nodes. Temporary
|
||||
radio windows of at least 12 hours use a 12-hour deadline; shorter windows
|
||||
disable that reboot watchdog until the window ends. The temporary timing
|
||||
overrides are held in RAM and do not replace saved normal-mode preferences.
|
||||
|
||||
The status read uses the two-byte GetStatus transaction. The pinned RadioLib
|
||||
getStatus() helper requests zero copied data bytes, so its return value is not
|
||||
usable for this mode check. The dedicated read restores the normal SPI command
|
||||
layout afterward and does not wake a duty-cycling radio to inspect its mode.
|
||||
|
||||
Validation lives in `test_noise_floor_estimator`, `test_rx_power_saving`,
|
||||
`test_radio_receive_contract.py`, and `test_sx126x_receive_mode.py`.
|
||||
`test_radio_liveness`, `test_radio_receive_contract.py`, and
|
||||
`test_sx126x_receive_mode.py`.
|
||||
Reference in new issue
Block a user