RXPS: use measured preamble-symbol capture model

This commit is contained in:
Jarosław Domański committed 2026-09-05 00:02:13 +02:00
1 parent fde20d37d0
commit 6bbd34a296
15 files changed
+1090 -189

No files matched your search

+10 -7
View File
@@ -655,8 +655,6 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
} else {
strcpy(reply, "Error: state must be on or off");
}
} else if (strncmp(config, "radio.rxps.rfrx_disabled ", 25) == 0) {
RXPowerSavingCLI::setRfRxDisabled(&config[25], _rxps_control, reply, 160);
} else if (memcmp(config, "radio.rxps ", 11) == 0) {
if (RXPowerSavingCLI::set(&config[11], _prefs->sf, _prefs->bw, &_prefs->rxps,
_rxps_control, reply, 160)) {
@@ -677,7 +675,8 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
_prefs->bw = bw;
bool rxps_retuned = recalcRxPowerSavingFromLevel(
_prefs->rxps.level, _prefs->sf, _prefs->bw, _prefs->rxps.preamble,
&_prefs->rxps.rx_us, &_prefs->rxps.sleep_us);
&_prefs->rxps.rx_us, &_prefs->rxps.sleep_us,
rxPowerSavingCaptureCost(_rxps_control), rxPowerSavingTransition(_rxps_control));
_callbacks->savePrefs();
strcpy(reply, rxps_retuned ? "OK - reboot to apply (rxps retuned)" : "OK - reboot to apply");
} else {
@@ -949,10 +948,14 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
} else {
sprintf(reply, "> %s", _board->isLoRaFemPaGainEnabled() ? "on" : "off");
}
} else if (strcmp(config, "radio.rxps.rfrx_disabled") == 0) {
RXPowerSavingCLI::getRfRxDisabled(_rxps_control, reply, 160);
} else if (strcmp(config, "radio.rxps") == 0) {
RXPowerSavingCLI::get(&_prefs->rxps, _rxps_control, reply, 160);
} else if (memcmp(config, "radio.rxps", 10) == 0 &&
(config[10] == 0 || config[10] == ' ')) {
// Exact match plus an optional trailing space, the same shape as the `tx`
// key below. A plain strcmp() looks stricter but is a trap here: `get
// radio.rxps ` fails it, falls through to the `radio` prefix branch further
// down and cheerfully answers with the frequency and bandwidth. Every other
// key in this chain is a prefix match and so never noticed the space.
RXPowerSavingCLI::get(&_prefs->rxps, _rxps_control, _prefs->sf, _prefs->bw, reply, 160);
} else if (memcmp(config, "radio", 5) == 0) {
char freq[16], bw[16];
strcpy(freq, StrHelper::ftoa(_prefs->freq));