Repository navigation
Conversation
|
I have a refactor that does this and goes even further for Companion as part of the work on radio conversions that has stalled waiting on firmware and boards refactor. |
|
This combined with #2096 will be a much needed major overhaul for GVs across the board... both in how they are written to file, and how used (from telemetry sensors through to everywhere else)... I look forward to trying it out! :) This "out of scope" point is a little misleading...
... as this OpenTX UI code was never enabled, but is still material for it's own cleanup PR though - it is not used, and won't compile anyway. |
Isn't this going to potentially break existing Lua scripts? |
|
True. However, a major version change is when any backward incompatible and API breaking changes are expected and allowed. |
11d0684 to
1a7c7c5
Compare
These targets were added on main after this branch was started, so they still used the old LimitData layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@3djc Do you think perhaps on bw it should behave like the weight/offsets options (i.e long press when source or constant brings up the popup menu, which lets you pick source/constant/invert, etc)? i.e. something like this? Is fine as it is on colorlcd pfeerick.user/0001-fix-bw-long-press-on-output-limit-source-opens-sourc.patch
From 14f04b3279190c8d2121bbd4c533d0c794ad755a Mon Sep 17 00:00:00 2001
From: Peter Feerick <5500713+pfeerick@users.noreply.github.com>
Date: Sat, 31 Oct 2026 00:03:18 +0000
Subject: [PATCH] fix(bw): long press on output limit source opens source popup
Min, max and subtrim on B&W radios hard-toggled between a constant and
GV1 on long press, so there was no way to invert a source or pick
Constant via the menu. Route them through the same SourceNumVal popup
used for weight and offset.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
.../src/gui/common/stdlcd/widgets_common.cpp | 29 ++++++++++---------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/radio/src/gui/common/stdlcd/widgets_common.cpp b/radio/src/gui/common/stdlcd/widgets_common.cpp
index 57c11d890f..339d950345 100644
--- a/radio/src/gui/common/stdlcd/widgets_common.cpp
+++ b/radio/src/gui/common/stdlcd/widgets_common.cpp
@@ -85,32 +85,33 @@ uint16_t editSrcVarFieldValue(coord_t x, coord_t y, const char* title, uint16_t
return value;
}
+extern int checkIncDecSelection;
+
bool editLimitNumSource(coord_t x, coord_t y, uint16_t& value, LcdFlags attr,
event_t event)
{
LimitNumVal v;
v.rawValue = value;
- if ((attr & INVERS) && event == EVT_KEY_LONG(KEY_ENTER)) {
- killEvents(event);
- s_editMode = !s_editMode;
- value = v.isSource ? makeLimitNumVal(0)
- : makeLimitNumVal(modelGVEnabled() ? MIXSRC_FIRST_GVAR : 1, true);
- v.rawValue = value;
- storageDirty(EE_MODEL);
+ // Constants are edited by the caller, only handle the source popup here
+ if ((attr & INVERS) && (v.isSource || event == EVT_KEY_LONG(KEY_ENTER) ||
+ checkIncDecSelection != 0)) {
+ SourceNumVal s;
+ s.rawValue = checkIncDec(event, makeSourceNumVal(v.isSource ? v.value : 0, v.isSource),
+ 0, 0, 1, MIXSRC_LAST,
+ EE_MODEL | INCDEC_SOURCE_VALUE | INCDEC_SOURCE_INVERT |
+ NO_INCDEC_MARKS,
+ isSourceAvailable);
+ if (v.isSource || s.isSource) {
+ value = makeLimitNumVal(s.isSource ? s.value : 0, s.isSource);
+ v.rawValue = value;
+ }
}
if (!v.isSource) return false;
attr &= ~PREC1;
drawSource(x, y, v.value, attr);
- if (attr & INVERS) {
- v.value = checkIncDec(event, v.value, 1, MIXSRC_LAST,
- EE_MODEL | INCDEC_SOURCE | INCDEC_SOURCE_INVERT |
- NO_INCDEC_MARKS,
- isSourceAvailable);
- value = v.rawValue;
- }
return true;
}
--
2.54.0 |

Why
On the Outputs screen, gvars were handled differently from everywhere else. Instead of being a source like in mixes and inputs, a gvar was hidden inside the number: a few values at the top of the field's range secretly meant "GV1", "GV2" and so on, with their own special code in every screen. This makes a gvar in Min, Max and Subtrim an ordinary source, the same way mix weight and offset already work (#5220). Only the Outputs screen was affected; mixes, inputs and curves are unchanged.
What you'll notice
GV1, or an inverted gvar). Switching between the two works the same as in mixes.Good to know
G1).model.getOutput()/model.setOutput()get a source as ±(2048 + source number). Plain numbers are unchanged.Format (for reviewers)
LimitDatastays the same size."gv(2)"or"!gv(8)". The old 1-basedGV1/-GV1forms are still read, so no file conversion is needed.GV_RANGEmacros,GET_GVARandGVarNumberEditare removed, so the gvar count no longer has to fit inside the limit fields' value range.Also fixed
Size
About 2.3 KB smaller on color radios, 190 bytes smaller on X7 ACCESS, and no change in RAM use.
Testing
Unit tests were added for the mixer, YAML, Lua and Companion. They pass on 19 radio targets, and I checked the B&W and colorlcd output screens in the test harness. It has been lightly tested on colorlcd
Miscelaneous
Beyond Outputs, the change touches shared code in three ways:
Things I didn't touch to avoid scope creep, but that could be added based on feedbacks:
- The curves screen lists gvars at the end of the curves, as a quirk of the B&W menu.