fix(repeater): close radio-profile bypass paths, dedupe preset/BW logic

CMD_SET_RADIO_PARAMS and the on-device Settings radio editors
(Freq/SF/BW/CR/Preset) called radio_driver.setParams() directly instead
of applyRepeaterRadio(), so editing the companion's own radio params
while relaying on a dedicated profile silently retuned the live radio
off that profile. Both now route through applyRepeaterRadio(), the
single decision point already used at boot and by the on-device
repeater toggle.

Also: overhear-suppression matched queued packets by payload hash
alone, so it could cancel a queued direct-route retransmit that
happened to share a hash with an overheard flood packet — now scoped
to flood-queued entries only. repeaterProfileValid()'s frequency floor
(100 MHz) is raised to 150 MHz to match the radio's actual validated
range. RepeaterScreen's preset-name lookup now uses the same
epsilon-tolerant float comparison as Settings instead of exact ==,
avoiding inconsistent "Custom" labeling between the two screens.

Dedupe: the BW-options table, the value-column x-offset math, and the
default-profile-seeding block had each drifted into two or three
independent copies (RepeaterScreen vs Settings, MyMesh constructor vs
DataStore.cpp upgrade path); factored into shared helpers in
RadioPresets.h / NodePrefs.h.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-06-20 01:50:21 +02:00
parent afe7b8a0ca
commit 4999620fba
9 changed files with 63 additions and 50 deletions

View File

@@ -364,15 +364,8 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
// norm; that stays opt-in. Band-matched rather than a flat frequency so the
// default can't land outside what's legal where the companion is set up.
if (_prefs.repeater_use_profile > 1) _prefs.repeater_use_profile = 0;
if (!(_prefs.repeater_freq >= 100.0f && _prefs.repeater_freq <= 960.0f
&& _prefs.repeater_sf >= 5 && _prefs.repeater_sf <= 12
&& _prefs.repeater_cr >= 5 && _prefs.repeater_cr <= 8
&& _prefs.repeater_bw >= 7.0f && _prefs.repeater_bw <= 510.0f)) {
_prefs.repeater_use_profile = 1;
_prefs.repeater_freq = defaultRepeaterFreqForBand(_prefs.freq);
_prefs.repeater_bw = LORA_BW;
_prefs.repeater_sf = LORA_SF;
_prefs.repeater_cr = LORA_CR;
if (!isValidRepeaterProfile(_prefs.repeater_freq, _prefs.repeater_bw, _prefs.repeater_sf, _prefs.repeater_cr)) {
seedDefaultRepeaterProfile(_prefs);
}
// → 0xC0DE000B: append bot_commands_enabled + quiet-hours. Older files leave
// stray bytes here; clamp so upgraders fall back to off / no quiet hours.