mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
fix(repeater): validate profile against chip freq bounds; fix digit-editor padding
isValidRepeaterProfile() hard-coded the 150-960 MHz SX1262 range, which would wrongly reject legal frequencies on any other chip. Take the freq bounds as parameters and pass radio_driver.getFreqBounds() at both call sites (repeaterProfileValid() and the load-time migration), so the chip's own validated range is the single source of truth. DataStore.cpp gains a target.h include for radio_driver (declared extern there). DigitEditor::render() now zero-pads the integer part to int_digits: the cursor addresses place values (100/10/1/0.1…), so a value with fewer integer digits than int_digits would shift every glyph and misplace the highlight. No visual change for the frequency field (always 3 digits). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <Arduino.h>
|
||||
#include "DataStore.h"
|
||||
#include "Features.h" // FEAT_JOYSTICK_ROTATION_SETTING (else `#if !FEAT_…` is always true)
|
||||
#include <target.h> // radio_driver — repeater-profile freq bounds (getFreqBounds)
|
||||
|
||||
#if defined(EXTRAFS) || defined(QSPIFLASH)
|
||||
#define MAX_BLOBRECS 100
|
||||
@@ -364,7 +365,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 (!isValidRepeaterProfile(_prefs.repeater_freq, _prefs.repeater_bw, _prefs.repeater_sf, _prefs.repeater_cr)) {
|
||||
float rpt_lo, rpt_hi; radio_driver.getFreqBounds(rpt_lo, rpt_hi);
|
||||
if (!isValidRepeaterProfile(_prefs.repeater_freq, _prefs.repeater_bw, _prefs.repeater_sf, _prefs.repeater_cr, rpt_lo, rpt_hi)) {
|
||||
seedDefaultRepeaterProfile(_prefs);
|
||||
}
|
||||
// → 0xC0DE000B: append bot_commands_enabled + quiet-hours. Older files leave
|
||||
|
||||
Reference in New Issue
Block a user