-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed as not planned
Labels
Description
Context
PR #4863 adds adjustmentCenter and adjustmentScale numeric inputs to the Adjustments Tab. During review, it was noted that these inputs use v-model.number with min/max HTML attributes but no explicit JavaScript clamping at save time.
Current Behavior
- HTML
minandmaxattributes serve as browser UI hints only v-model.numberwill bind values typed outside the range (e.g., typing300whenmax="255")- Save functions assign values directly without
Math.min/Math.maxclamping - Out-of-range values are passed to MSP encoding
Codebase Pattern
This behavior is consistent across the entire codebase:
- ConfigurationTab.vue:
fpvCamAngleDegrees,small_angle,boardAlignmentangles saved directly - AuxiliaryTab.vue, MotorsTab.vue, ReceiverTab.vue: Same pattern
Math.min/Math.maxused only for UI calculations (drag logic, percentages), not data validation
Affected Fields in PR #4863
adjustment.adjustmentCenter(range: 0–255)adjustment.adjustmentScale(range: 0–255)
Currently backed by uint16_t in firmware but UI constrained to 0–255.
Recommendation
This is technical debt that could be addressed in a future refactor:
- Add explicit clamping in save functions across all tabs
- Or add
@inputhandlers to clamp on user input - Consider a reusable validation composable for numeric inputs
Not required for PR #4863 since it follows the established pattern.
References
- PR Add adjCenter and adjScale to Adjustments Tab #4863: Add adjCenter and adjScale to Adjustments Tab #4863
- Comment thread: Add adjCenter and adjScale to Adjustments Tab #4863 (comment)
- Betaflight firmware PR #14920 (MSP adjCenter/adjScale support)
Reactions are currently unavailable