radio: extract CadController and NoiseFloorEstimator, one prefs source

- CadController (stats, window, re-anchor, visits, staircase, safety,
  starvation relax) and NoiseFloorEstimator split out of LoRaRadioBase
  behind a 4-call CadHw interface; Zephyr-free, host unit tests added
- prefs mandatory: setPrefs() before begin(), LoRaConfig fallbacks and the
  companion/observer placeholder prefs removed; LoRaConfig is the one
  defaults source (invalid-prefs fallback now uses the board TX default)
- TX-wait thread stack owned by the base; reconfigureWithParams removed
- driver extension headers on the public include path
  (zephyr/drivers/lora/*.h); patch 0003 include updated
- comment diet (image-identical); rationale moved to devdocs LLD 03
This commit is contained in:
liquidraver
2026-09-23 14:33:29 +02:00
parent a7d073900e
commit fd2cbe9d62
36 changed files with 935 additions and 1629 deletions
+4 -9
View File
@@ -7,7 +7,6 @@
#include "observer_creds.h"
#include <mesh/Utils.h>
#include <helpers/LoRaConfig.h>
#include <adapters/radio/LoRaRadioBase.h>
#include <adapters/rng/ZephyrRNG.h> /* generateFirstBootIdentity (hardened keygen) */
#include <helpers/MeshcoreJson.h>
@@ -447,8 +446,7 @@ bool ObserverMesh::handleCLI(const char *command, char *reply, int reply_size)
if (f >= 300.0f && f <= 1000.0f) {
_prefs.freq = f;
_store->savePrefs(_prefs);
((LoRaRadioBase *)_radio)->reconfigureWithParams(
_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
((LoRaRadioBase *)_radio)->reconfigure();
snprintf(reply, reply_size, "freq=%.3f MHz", (double)_prefs.freq);
} else {
snprintf(reply, reply_size, "ERR freq must be 300-1000 MHz");
@@ -459,8 +457,7 @@ bool ObserverMesh::handleCLI(const char *command, char *reply, int reply_size)
if (sf >= 7 && sf <= 12) {
_prefs.sf = (uint8_t)sf;
_store->savePrefs(_prefs);
((LoRaRadioBase *)_radio)->reconfigureWithParams(
_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
((LoRaRadioBase *)_radio)->reconfigure();
snprintf(reply, reply_size, "sf=%u", _prefs.sf);
} else {
snprintf(reply, reply_size, "ERR sf must be 7-12");
@@ -484,8 +481,7 @@ bool ObserverMesh::handleCLI(const char *command, char *reply, int reply_size)
if (bw >= ZC_RADIO_BW_MIN_KHZ && bw <= ZC_RADIO_BW_MAX_KHZ) {
_prefs.bw = bw;
_store->savePrefs(_prefs);
((LoRaRadioBase *)_radio)->reconfigureWithParams(
_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
((LoRaRadioBase *)_radio)->reconfigure();
snprintf(reply, reply_size, "bw=%.2f kHz", (double)_prefs.bw);
} else {
snprintf(reply, reply_size, "ERR bw must be 7-500 kHz (or index 0-5)");
@@ -496,8 +492,7 @@ bool ObserverMesh::handleCLI(const char *command, char *reply, int reply_size)
if (cr >= 5 && cr <= 8) {
_prefs.cr = (uint8_t)cr;
_store->savePrefs(_prefs);
((LoRaRadioBase *)_radio)->reconfigureWithParams(
_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
((LoRaRadioBase *)_radio)->reconfigure();
snprintf(reply, reply_size, "cr=%u", _prefs.cr);
} else {
snprintf(reply, reply_size, "ERR cr must be 5-8");