fix(settings): add input validation for BLE PIN, LoRa modem, and ambient lighting#5477
Merged
Merged
Conversation
…ent lighting - BLE fixed_pin: treat as string to preserve leading zeros; show error state for invalid pins instead of silently discarding input - LoRa spread_factor: reject values outside 7-12 with error indicator - LoRa coding_rate: reject values outside 5-8 with error indicator - Ambient lighting current: clamp to 0-31 range with error indicator - Ambient lighting RGB: clamp to 0-255 range with error indicator Fixes silent data loss bugs found during cross-platform validation audit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
garthvh
added a commit
to meshtastic/design
that referenced
this pull request
May 20, 2026
Reflects fixes merged May 2026: - BLE fixed_pin: now string input, preserves leading zeros, shows error indicator - LoRa spread_factor: now enforces 7–12 with error indicator - LoRa coding_rate: now enforces 5–8 with error indicator - Ambient lighting current: now enforces 0–31 with error indicator - Ambient lighting RGB: now enforces 0–255 with error indicators Ref: meshtastic/Meshtastic-Android#5477
thebentern
pushed a commit
to meshtastic/design
that referenced
this pull request
May 20, 2026
…xes (#106) * Add tracking issue numbers for tab alignment canonical order Apple: meshtastic/Meshtastic-Apple#1840 Android: meshtastic/Meshtastic-Android#5543 * Add tracking issues for context menu alignment; standardise on 'Remove' - Changed canonical label from 'Delete / Remove' to 'Remove' (matches Android + firmware API) - Apple: meshtastic/Meshtastic-Apple#1841 - Android: meshtastic/Meshtastic-Android#5544 * Update settings validation audit with Android PR #5477 fixes Reflects fixes merged May 2026: - BLE fixed_pin: now string input, preserves leading zeros, shows error indicator - LoRa spread_factor: now enforces 7–12 with error indicator - LoRa coding_rate: now enforces 5–8 with error indicator - Ambient lighting current: now enforces 0–31 with error indicator - Ambient lighting RGB: now enforces 0–255 with error indicators Ref: meshtastic/Meshtastic-Android#5477
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
A cross-platform settings validation audit (meshtastic/design
standards/audits/settings-validation-matrix.md) identified several Android settings fields that accept invalid input silently -- either discarding it with no user feedback or allowing out-of-range values to be written to the device.Changes
BLE fixed_pin (leading-zero bug): The PIN field used
EditTextPreference(Int)which converts text to a UInt internally, stripping leading zeros. Entering "000100" silently became100, failed the 6-digit length check, and was discarded with no error shown. Now treated as a string input withKeyboardType.NumberPassword, preserving leading zeros and showing an error indicator for incomplete/invalid PINs.LoRa spread_factor and coding_rate: Previously accepted any unsigned integer. Now rejects values outside the valid ranges (SF: 7-12, CR: 5-8) and shows an error indicator when the current value is out of range.
Ambient lighting current and RGB: Previously accepted any unsigned integer for LED current (valid: 0-31) and RGB channels (valid: 0-255). Now enforces these ranges with error indicators.
Approach
All fixes use the same pattern: reject out-of-range values in the
onValueChangedcallback (preventing invalid writes) and passisError = trueto the text field when the current value is invalid (giving visual feedback). Extracted helper composables where needed to stay within detekt's method-length and cyclomatic-complexity thresholds.