diff --git a/POWER.md b/POWER.md index 988ae5ce..5271b22c 100644 --- a/POWER.md +++ b/POWER.md @@ -113,6 +113,14 @@ is sampled during a short continuous-RX calibration instead of in passing, so radio parameters (`set radio …`) re-normalises the periods for the new spreading factor and bandwidth and reports `reboot to apply` as usual. +With RXPS off, the radio wrapper takes the pre-RXPS path: continuous RX, no +duty cycle, no RXPS calibration, and `getLastRSSI`/`getLastSNR` read the radio +directly instead of returning the cached packet metrics. Two fork-wide changes +remain visible while RXPS is off: the TCXO start-up delay is 1.6 ms +(RadioLib's default is 5 ms), applied at radio begin, and `get cad` also +reports the CAD-busy count. Neither changes the receive/sleep state or the +on-air protocol. + ### CPU frequency — `cpu.freq` `set cpu.freq ` caps the CPU clock while the node is awake. Supported diff --git a/src/helpers/radiolib/CustomLR1110Wrapper.h b/src/helpers/radiolib/CustomLR1110Wrapper.h index 5d82e7b1..74681af9 100644 --- a/src/helpers/radiolib/CustomLR1110Wrapper.h +++ b/src/helpers/radiolib/CustomLR1110Wrapper.h @@ -72,6 +72,11 @@ public: protected: // PowerSaving variant int16_t startContinuousReceive() override { + // Pre-RXPS behaviour: the LF clock was never switched, so no restore (and + // no extra standby) is needed. stopDutyCycleHardware() restores the clock + // when the duty cycle is disarmed. + if (!_rx_ps_enabled) return _radio->startReceive(); + // Also covers a stopDutyCycleHardware() whose clock restore failed. int16_t err = _radio->standby(); if (err == RADIOLIB_ERR_NONE) err = ((CustomLR1110*)_radio)->restoreLfClock(); diff --git a/src/helpers/radiolib/RadioLibWrappers.cpp b/src/helpers/radiolib/RadioLibWrappers.cpp index 27626035..db013bb9 100644 --- a/src/helpers/radiolib/RadioLibWrappers.cpp +++ b/src/helpers/radiolib/RadioLibWrappers.cpp @@ -119,6 +119,10 @@ void RadioLibWrapper::resetAGC() { _num_floor_samples = 0; _floor_sample_sum = 0; + // With RXPS off this is the pre-RXPS reset: leave the samples at zero and + // let loop() reconverge, as it did before the power feature. + if (!_rx_ps_enabled) return; + // PowerSaving variant _nf_calib_active = true; // force startReceiveMode() into continuous RX bool packet_in_progress = false; @@ -297,11 +301,16 @@ bool RadioLibWrapper::isChannelActive() { float RadioLibWrapper::getLastRSSI() const { // PowerSaving variant + // With RXPS off, read the radio exactly as before the feature. The cached + // value only exists because a duty-cycled radio may be asleep when a caller + // asks for the metrics of the packet it just read. + if (!_rx_ps_enabled) return _radio->getRSSI(); if (_last_metrics_valid) return _last_rssi; return _rx_ps_armed ? 0 : _radio->getRSSI(); } float RadioLibWrapper::getLastSNR() const { // PowerSaving variant + if (!_rx_ps_enabled) return _radio->getSNR(); if (_last_metrics_valid) return _last_snr; return _rx_ps_armed ? 0 : _radio->getSNR(); } @@ -515,6 +524,7 @@ bool RadioLibWrapper::setRxPowerSaving(bool enabled, uint32_t rx_us, uint32_t sl if (enabled && !supportsRxPowerSaving()) return false; _rx_ps_enabled = enabled; + _last_metrics_valid = false; // metrics from the old mode must not leak _rx_ps_rx_us = rx_us; _rx_ps_sleep_us = sleep_us; _rx_ps_last_error = RADIOLIB_ERR_NONE;