mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-05 03:36:13 +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:
co-authored by
Claude Opus 4.8
parent
52e65b960f
commit
4369a0cc74
@@ -65,7 +65,12 @@ struct DigitEditor {
|
||||
// selected row (ink DARK on a LIGHT selection bar); restores LIGHT after.
|
||||
void render(DisplayDriver& d, int x, int y) {
|
||||
char buf[16];
|
||||
snprintf(buf, sizeof(buf), "%.*f", (int)dec_digits, value);
|
||||
// Zero-pad the integer part to int_digits so the glyph under the cursor is
|
||||
// always the place it addresses: the cursor maps place values (100, 10, 1,
|
||||
// 0.1…), so a value with fewer integer digits than int_digits would shift
|
||||
// every glyph left and misplace the highlight (e.g. "62.500" vs "062.500").
|
||||
const int width = (int)int_digits + (dec_digits > 0 ? 1 + (int)dec_digits : 0);
|
||||
snprintf(buf, sizeof(buf), "%0*.*f", width, (int)dec_digits, value);
|
||||
const int cw = d.getCharWidth();
|
||||
const int char_idx = cursor < int_digits ? cursor : cursor + 1; // skip '.'
|
||||
for (int k = 0; buf[k]; k++) {
|
||||
|
||||
Reference in New Issue
Block a user