Make RXPS preamble adaptive for fast radio settings

This commit is contained in:
mikecarper committed 2026-08-24 20:42:54 -07:00
1 parent 444df2969d
commit e7433abb80
31 files changed
+1393 -242

No files matched your search

+6 -1
View File
@@ -261,7 +261,12 @@ infrastructure node can sleep when device power saving is enabled, so its WiFi
services may be temporarily unavailable. RXPS only duty-cycles the LoRa
receiver. Fresh Cascade-profile builds default to device power saving on,
RXPS on at level 8 with a 16-symbol preamble, and WiFi modem power saving at
`min` on every build that includes ESP32 WiFi.
`min` on every build that includes ESP32 WiFi. The RXPS preamble value is a
saved timing assumption, not the wire length: starting with v1.17.1.5,
SF5-SF8 packets normally use a 32-symbol physical preamble. Firmware selects
64 for the whole SF/BW tuple only when 32 cannot enable RXPS at any level and
64 can (SF5/BW250 and SF6/BW500), then 128 only when neither shorter length
works (SF5/BW500).
When `ENABLE_OTA` is included, a WiFi companion also listens on:
+37 -23
View File
@@ -731,29 +731,37 @@ minimum and return to it exactly when it is safe.
available. Returning to slower settings recalculates from the saved RXPS
minimum.
On SX1262+TCXO boards, the tested fast-setting boundaries are:
On SX1262+TCXO boards, the fast-setting boundaries are:
| SF | BW (kHz) | Effective preamble | Minimum effective RXPS level | Result |
|---:|---------:|-------------------:|-----------------------------:|:-------|
| 7 | 500 | 32 | 7 | RXPS duty cycling |
| 6 | 250 | 32 | 7 | RXPS duty cycling |
| 5 | 125 | 32 | 7 | RXPS duty cycling |
| 5 | 62.5 | 16 | 10 | RXPS duty cycling |
| SF | BW (kHz) | Wire preamble | Effective timing preamble | Minimum effective RXPS level | RX / sleep |
|---:|---------:|--------------:|--------------------------:|-----------------------------:|-----------:|
| 7 | 500 | 32 | 32 | 7 | 2731 / 6101 us |
| 6 | 250 | 32 | 32 | 7 | 2731 / 6101 us |
| 5 | 125 | 32 | 32 | 7 | 2731 / 6101 us |
| 5 | 250 | 64 | 64 | 8 | 1252 / 6424 us |
| 6 | 500 | 64 | 64 | 8 | 1252 / 6424 us |
| 5 | 500 | 128 | 128 | 8 | 626 / 6398 us |
| 5 | 62.5 | 32 | 16 | 10 | 4096 / 6272 us |
SF7/BW500, SF6/BW250, and SF5/BW125 are timing-equivalent because each has a
256 us LoRa symbol. SF5/BW250 and SF5/BW500 use `continuous-fast` even with
preamble 32 in the normal build.
256 us LoRa symbol. SF5/BW250 and SF6/BW500 have 128 us symbols; both need 64
wire symbols to cover the 6 ms transition. SF5/BW500 has 64 us symbols and
needs 128.
The table's effective preamble is the length RXPS uses for its timing window.
The radio's actual transmitted preamble is a firmware property, not a
`radio.rxps` preference. Normal firmware transmits 32 symbols at SF5-SF8 and
16 symbols at SF9-SF12. A controlled build can set
`-D LORA_FAST_PREAMBLE=64`; this changes the actual SF5-SF8 wire preamble and
lets SF5/BW250 duty-cycle at effective level 8 (`1252 / 6424 us`). That profile
passed a 16/16 on-air qualification at 909.950 MHz. SF5/BW500 remains too fast.
Use the 64-symbol option only when every possible sender to an RXPS receiver
uses the longer preamble; treating a 32-symbol sender as if it sent 64 would
create a receive gap.
The wire preamble is a firmware property, not a `radio.rxps` preference. The
effective preamble is the conservative length RXPS uses for its timing window,
which is why SF5/BW62.5 can retain a saved 16-symbol assumption while the radio
transmits 32. Starting with v1.17.1.5, firmware tries 32 first at SF5-SF8, then
64 and 128 only when each shorter length cannot enable RXPS at any level. It
uses 16 at SF9-SF12. Every packet on a tuple, including retries, uses that
tuple's selected length.
Cascade/USA builds on a Heltec V4 and WisMesh Tag (RAK4631 target) passed 16/16
packets in each direction at both SF5/BW250/64 and SF5/BW500/128, CR5,
909.950 MHz. A 64- or 128-symbol timing window is safe only when every possible
sender to the RXPS receiver follows the v1.17.1.5-or-newer adaptive-preamble
contract; a shorter legacy sender would create a receive gap. LoRa OTA
automation treats that version as the wire-format capability boundary.
---
@@ -794,6 +802,7 @@ Station G2/G3 targets default to `off`.
#### View or change RX duty-cycle power saving
**Usage:**
- `get radio.rxps`
- `get radio.rxps.config`
- `get radio.rxps.rfrx_disabled`
- `get rxps.wd`
- `set radio.rxps.rfrx_disabled <state>`
@@ -815,15 +824,20 @@ Station G2/G3 targets default to `off`.
**Notes:**
- `get rxps.wd` reports the RXPS watchdog's soft and hard recovery counts.
- `get radio.rxps.config` adds the persisted level and preamble assumption to
the on/off and timing values. Deployment tools use it to restore a
level-based preference without converting it to fixed manual timings.
- `radio.rxps.rfrx_disabled` is a runtime-only diagnostic setting and resets to `off` after reboot.
- Its default `off` state keeps the host-controlled SX1262 receive path enabled during RX duty-cycle mode. Setting it to `on` reproduces the old missing-RF_RX behavior and can significantly reduce receive sensitivity, making remote commands harder to receive.
- `radio.rxps.rfrx_disabled` is supported only on SX1262 targets with a host-controlled RX enable pin.
- `on` and `conservative` select level `1` with a 16-symbol preamble; `balanced` selects level `5` with a 16-symbol preamble.
- Fresh Cascade-profile builds start with RXPS on at level `8` and a 16-symbol preamble. Saved operator settings still take precedence after an upgrade.
- Level-based settings automatically recalculate their timings when the spreading factor or bandwidth changes. Custom `<rx_us> <sleep_us>` timings remain fixed.
- `get radio.rxps` reports both the saved timing assumption and any effective
preamble/level selected for the current tuple. A 64-symbol effective preamble
appears only in a firmware build whose actual fast preamble is 64.
- `get radio.rxps` keeps the legacy on/off, RX, and sleep reply. The new
`get radio.rxps.config` reply adds the saved level and preamble assumption.
Radio-change replies and the Full Companion terminal status report any
effective level/preamble adjustment. Effective preamble 64 or 128 appears
only when the active tuple's physical wire preamble has that length.
- The selected mode is applied immediately, persisted, and restored after reboot.
---
@@ -2963,7 +2977,7 @@ set direct.retry.margin 10
- Room-server and sensor firmware accept `on` or `off`; numeric SNR thresholds
are repeater-only because those roles do not keep recent-repeater SNR data.
- `off` disables per-packet retry CR overrides and uses the current radio CR.
- Direct path retry packets sent at CR4 or CR5 temporarily use a shorter 16-symbol preamble, then restore the radio's default preamble.
- Retry packets may use a different coding rate, but they keep the radio's normal physical preamble.
- Unknown repeaters start at `+3.00 dB` for adaptive CR selection.
- A failed unknown repeater is seeded at `+2.75 dB`.
- Each later failure lowers the SNR estimate by `0.25 dB`.
+66 -4
View File
@@ -210,6 +210,56 @@ North American example: choose a legal frequency supported by every
participating radio and appropriate to your location. Older radios that do not
support SF5 require a complete replacement tuple passed with `--temp-radio`.
### RXPS handling during TempRadio
RXPS improves receive performance per unit of radio-on time, so the runner
keeps the destination's saved RXPS preference enabled whenever the selected
fast tuple has a qualified timing window. Before changing any radio, it reads
`ver` from the destination, controller, source, and every named relay. It treats
v1.17.1.5 as the first forward contract in which every SF5-SF8 transmission,
including a retry, uses the same tuple-selected physical preamble: normally 32
symbols, 64 only when 32 cannot enable RXPS, and 128 only when neither 32 nor
64 can. A saved RXPS level is also safely retuned after a radio change. An
older or unparseable destination version fails closed: the runner temporarily
sends `set radio.rxps off` instead of assuming an ad-hoc build contains the
timing fixes. Automation deliberately treats the version as a wire-format
contract.
For the default SF5/BW250 tuple, the runner keeps destination RXPS on only when
the destination and every possible sender are v1.17.1.5 or newer. It does not
overwrite an existing level-based preference. Current firmware retunes that
preference against the tuple-selected 64-symbol wire preamble; the qualified boundary is
effective level 8, preamble 64 (`1252 / 6424 us`). A manually configured node
may save `set radio.rxps level 8 preamble 32` before entering TempRadio: when
32 symbols cannot cover the TCXO transition, firmware safely selects the real
64-symbol preamble. If the saved setting uses fixed manual timings, or even one
participant is older or unknown, RXPS is temporarily off. This avoids the
receive gap that a 32-symbol sender or an unretuned manual window would create.
The complete qualified SX1262+TCXO policy is:
| TempRadio SF/BW | Saved reference setting | Qualified boundary | Automation |
| --- | --- | --- | --- |
| SF7/BW500 | `level 7 preamble 32` | 7 / 32 | RXPS on for a current destination |
| SF6/BW250 | `level 7 preamble 32` | 7 / 32 | RXPS on for a current destination |
| SF5/BW125 | `level 7 preamble 32` | 7 / 32 | RXPS on for a current destination |
| SF5/BW250 | `level 8 preamble 32` | 8 / 64 | RXPS on only when every participant follows the 64-symbol contract |
| SF6/BW500 | `level 8 preamble 32` | 8 / 64 | RXPS on only when every participant follows the adaptive-preamble contract |
| SF5/BW500 | `level 8 preamble 32` | 8 / 128 | RXPS on only when every participant follows the adaptive-preamble contract |
| SF5/BW62.5 | `level 10 preamble 16` | 10 / 16 | RXPS on for a current destination |
| Unqualified tuple | none | continuous RX | RXPS temporarily off |
If RXPS was already off, the runner leaves it off. Otherwise it writes the
original level, preamble assumption, receive/sleep periods, and temporary
decision to protected
`target-rxps-settings.json` in the run's working directory, verifies the
temporary state, and restores the exact original setting after the target is
back on its normal radio. Current firmware exposes this complete state through
`get radio.rxps.config`; a legacy reply has only on/off and periods, so the
runner can restore those periods but cannot reconstruct an unreported saved
level. A radio change later recalculates from a preserved saved minimum, so
moving back to a slower tuple returns to the operator's saved level.
## 4. Run an ESP32 update
The ZIP can contain a compatible ready `.mota` or the exact board-and-role
@@ -400,6 +450,9 @@ Useful controls:
default the runner then schedules the target, relays, and a script-configured
source back to their normal radios. Combining it with
`--leave-controller-radio` deliberately preserves the TempRadio topology.
If the version gate required RXPS off, it stays off while that topology is
preserved; use `target-rxps-settings.json` to restore it only after sending
`normalradio`.
- `--allow-non-upgrade` deliberately permits the same or an older version.
- `--replace-active-download` deliberately discards a different update already
downloading or staged on the target. Without it, that update is preserved.
@@ -449,8 +502,11 @@ the destination.
hashes, Merkle root, full-image hash where applicable, identity fields,
signature, codec, base, and the firmware's 1024-byte maximum block size.
Version-3 bootloader packages are refused before any target state changes.
4. Save the controller's normal radio tuple and show the confirmation prompt.
5. Start TempRadio on the target, then far-to-near relays, then the source;
4. Save the controller's normal radio tuple, read every participant's version,
save the destination's RXPS state, select the qualified RXPS policy, and
show the confirmation prompt.
5. Apply and verify that RXPS policy, then start TempRadio on the target,
far-to-near relays, and the source;
finally switch the controller to the same tuple and read it back. The runner
rejects a TempRadio window that cannot cover setup, seeder startup,
discovery, the transfer timeout, final polling, and install checks.
@@ -468,7 +524,8 @@ the destination.
continues the 10-second probes through the mandatory relay-return window. A
source supplied with `--source-already-temp` is never modified.
`--leave-controller-radio` moves the controller back to TempRadio only after
this normal-channel verification.
this normal-channel verification. Restore the destination's exact original
RXPS setting after normal-channel identity is proven.
Remote replies are matched only after queued messages have been drained and
only when they come from the intended contact and fit the command. A ready
@@ -501,7 +558,9 @@ download without replacing it.
The working directory is retained and printed at exit. It contains the exact
served mOTA, `motatool-serve.log`, extracted build inputs when needed, and
`controller-radio.txt`. It contains no saved admin password.
`controller-radio.txt`. When the destination started with RXPS enabled it also
contains protected `target-rxps-settings.json` for manual recovery. It contains
no saved admin password.
## Interruption and recovery
@@ -509,6 +568,9 @@ Ctrl-C stops the seeder, detaches its serial folder, makes one best-effort
request to shorten a source TempRadio window started by the script, and attempts
to restore the controller. The target and relays remain on TempRadio only until
their bounded windows end; rebooting also restores their saved radio settings.
A normal cleanup restores the destination's exact RXPS periods. If that remote
restore cannot be confirmed, use `target-rxps-settings.json` after the target
returns to its normal channel.
A partial download remains safe. Once the target is reachable again (after its
TempRadio window ends, or after putting the controller back on that tuple),
rerunning the same package recognizes its manifest ID and resumes the existing
+19
View File
@@ -47,6 +47,25 @@ reboots. Current full-parser firmware also accepts `normalradio`, which cancels
restores the saved tuple after replying on the current channel. This frequency is intended for North American
configurations. Confirm that it is permitted in your location and change it when necessary.
At SF5/BW250, an SX1262+TCXO destination can keep RXPS enabled only when it and
every sender that can reach it (controller, source, and relays) follow the
v1.17.1.5-or-newer adaptive-preamble contract. The qualified destination
boundary is effective level 8, preamble 64 and `1252 / 6424 us`. For manual
setup, save `set radio.rxps level 8 preamble 32` before entering TempRadio; the
`32` is a conservative saved timing assumption and current firmware selects
the real 64-symbol wire preamble when it retunes the temporary radio. For an
older, unknown, or mixed-version path, use
`set radio.rxps off` for the maintenance window. First record
`get radio.rxps.config`; after `normalradio`, restore a reported level with
`set radio.rxps level N preamble P` (omit `preamble P` when `P` is `0`). A
legacy node returns only on/off and periods, which can be restored with
`set radio.rxps RX_US SLEEP_US`. The scripted runner performs the version
checks, temporary change, verification, and restoration automatically while
preserving automatic retuning. SF5/BW500 is too fast for RXPS even with a
64-symbol preamble, so current firmware selects 128 and uses the qualified
level-8 `626 / 6398 us` timing when every participant supports the adaptive
contract.
## Before you start
Both paths require:
+10
View File
@@ -24,6 +24,16 @@ tempradio 909.950,250,5,5,120
Use the node's current permitted regional frequency in place of `909.950` when necessary.
The scripted updater checks the firmware version of the receiver and every
sender before deciding whether RX power saving can remain active. At
SF5/BW250, an all-v1.17.1.5-or-newer path can use effective RXPS level 8 with
the tuple-selected 64-symbol physical preamble. SF5/BW500 can use level 8 with
128 symbols. Other fast tuples remain at the shortest viable preamble, normally
32. A mixed, older, or unknown long-preamble path is put in continuous receive
for the update, then the receiver's exact saved RXPS setting is restored. This
preserves the RX benefit without risking missed packets from a legacy
32-symbol sender.
> **Can my node install the update?** Choose a release-table artifact explicitly labelled LoRa-OTA capable,
> then confirm `ota self` and `ota status` expose install support; do not infer support from the filename alone.
> LoRa OTA firmware is available for supported **ESP32** boards and nRF52 repeater targets. Every nRF52
+14 -2
View File
@@ -218,6 +218,14 @@ tests use `hops 0`: `hops 1` makes the target echo each source response despite
there being no intermediate relay, increasing half-duplex loss and legacy
three-second retries.
The exact compact chain never qualifies for fast RXPS: its bridge and endpoint
versions predate the v1.17.1.5 adaptive-preamble contract. Keep RXPS off for
this historical chain whether using SF5/BW250 or the faster direct-bench
SF5/BW500 tuple. For a later update whose target, controller, source, and
relays are all v1.17.1.5 or newer, use the generic LoRa OTA runner; it can
retain RXPS at the qualified level-8/preamble-64 boundary for SF5/BW250 or the
level-8/preamble-128 boundary for SF5/BW500.
Put the source on the identical TempRadio tuple. If it is a binary-mode Full
Companion, the current `motatool` can switch modes for the serving session:
@@ -369,8 +377,12 @@ predates the rescue command.
Before the first mutation, the runner saves the destination's RXPS periods,
CPU power-saving state, RX flood delay, airtime factor, and OTA hop reach in
the persistent work directory. It verifies `radio.rxps off`, `powersaving off`,
and `rxdelay 0` after every bridge reboot, plus `af 0` when
the persistent work directory. It reads the destination, controller, source,
and relay versions before applying the same RXPS policy as the generic runner.
The pinned historical chain therefore verifies `radio.rxps off` after every
bridge reboot; a future all-v1.17.1.5-or-newer SF5/BW250 chain would instead
keep RXPS on under the qualified level-8/preamble-64 boundary. It also verifies
`powersaving off` and `rxdelay 0`, plus `af 0` when
`--legacy-full-airtime` was explicitly selected. It restores every original
value only after the exact endpoint is proven. An interrupted run deliberately
leaves those transfer guardrails active; rerun the same command with the same
+31 -27
View File
@@ -104,46 +104,50 @@ protocol frames and terminal replies remain enabled on interface `00`.
```
get radio.rxps
get radio.rxps.config
set radio.rxps {off|on|level 1-10 [preamble 16|32]|rx_us sleep_us}
```
Shows or changes LoRa receive duty cycling on supported radios. Fresh Cascade
Shows or changes LoRa receive duty cycling on supported radios.
`get radio.rxps.config` also reports the saved level and preamble assumption so
automation can restore a level-based preference exactly. Fresh Cascade
builds select level 8 with a 16-symbol timing assumption. The `preamble`
argument controls the RXPS calculation; it does not change the physical wire
preamble. A configured level is the minimum: when faster SF/BW settings shorten
the timing window, firmware raises the effective level only as far as needed,
up to level 10. For SF5-SF8 the normal build can then use the radio's actual
32-symbol transmit preamble if no level is safe under the legacy 16-symbol
assumption. The configured values remain unchanged, so every radio change
recalculates from the saved minimum. A slower tuple returns to that exact level
when it is safe; otherwise firmware keeps using the smallest safe effective
level.
up to level 10. Starting with v1.17.1.5, SF5-SF8 packets normally use a
32-symbol physical preamble. Firmware selects 64, then 128, only when every
shorter choice fails to enable RXPS at any level. The configured values remain
unchanged, so every radio change recalculates from the saved minimum. A slower
tuple returns to that exact level and the shortest viable wire preamble.
If neither adjustment leaves enough time for the radio to wake, RXPS stays
logically enabled but receives continuously instead of rejecting the radio
setting or starting an invalid duty cycle. `get radio.rxps` reports this as
`mode=continuous-fast` and reports any `effective-level` or
`effective-preamble` adjustment. On SX1262 boards with a TCXO, SF5/BW125 works
at effective level 7 with preamble 32; SF5/BW250 and SF5/BW500 use the
continuous fallback. A later compatible SF/BW change resumes duty cycling
without another RXPS command.
setting or starting an invalid duty cycle. The Companion terminal's
`get radio.rxps` reports this as `mode=continuous-fast` and reports any
`effective-level` or `effective-preamble` adjustment;
`get radio.rxps.config` reports the persisted preference. A later compatible
SF/BW change resumes duty cycling without another RXPS command.
For the SX1262+TCXO boards tested here, these fast combinations are the useful
RXPS boundary profiles (CR does not change the RXPS preamble timing):
| SF | BW (kHz) | Effective preamble | Minimum effective level | RX / sleep |
|---:|---------:|-------------------:|------------------------:|-----------:|
| 7 | 500 | 32 | 7 | 2731 / 6101 us |
| 6 | 250 | 32 | 7 | 2731 / 6101 us |
| 5 | 125 | 32 | 7 | 2731 / 6101 us |
| 5 | 62.5 | 16 | 10 | 4096 / 6272 us |
| SF | BW (kHz) | Wire preamble | Effective preamble | Minimum effective level | RX / sleep |
|---:|---------:|--------------:|-------------------:|------------------------:|-----------:|
| 7 | 500 | 32 | 32 | 7 | 2731 / 6101 us |
| 6 | 250 | 32 | 32 | 7 | 2731 / 6101 us |
| 5 | 125 | 32 | 32 | 7 | 2731 / 6101 us |
| 5 | 250 | 64 | 64 | 8 | 1252 / 6424 us |
| 6 | 500 | 64 | 64 | 8 | 1252 / 6424 us |
| 5 | 500 | 128 | 128 | 8 | 626 / 6398 us |
| 5 | 62.5 | 32 | 16 | 10 | 4096 / 6272 us |
SF5/BW250 and SF5/BW500 remain too fast for a true TCXO duty cycle in the
normal 32-symbol build, so they use `continuous-fast`. A controlled build with
`-D LORA_FAST_PREAMBLE=64` changes the actual SF5-SF8 wire preamble. SF5/BW250
then uses effective level 8 and `1252 / 6424 us`; that combination passed a
16/16 on-air qualification at 909.950 MHz. SF5/BW500 still uses
`continuous-fast`. Deploy a longer physical preamble consistently across all
senders that may reach an RXPS receiver.
The 64- and 128-symbol rows require the v1.17.1.5-or-newer adaptive-preamble
contract on every sender that may reach the RXPS receiver. Cascade/USA builds
on a Heltec V4 and WisMesh Tag (RAK4631 target) passed 16/16 packets in each
direction at both SF5/BW250/64 and SF5/BW500/128, CR5, 909.950 MHz. An older
sender makes a long-preamble timing window unsafe, so use continuous RX for a
mixed deployment. Retry packets use the same physical preamble as other
packets.
```
get wifi.powersave
@@ -390,7 +394,7 @@ For example:
```text
channels
channel #rgdata Hello from Eugene 👋
channel #rgdata Hello from Eugene
channel 2 Another message
show channels on
```