feat: use any source for expo/weight/offset etc
Fixes #4452
Time to continue with this change, now that source invert has been implemented.
Allows any source to be used in inputs and mixes for fields like weight, offset, expo, etc (not just GVars).
TODO
Radio:
- [x] Data structures
- [x] Save and load to YAML files
- [x] Mix calculations
- [x] Color UI
- [ ] B&W UI
- [x] Fix tests
Companion:
- [ ] Data structures
- [ ] Save and load YAML files
- [ ] UI for settings fields
- [ ] Binary file conversion (is this needed?)
I guess on BW UI, we can keep the long enter used previously to switch between value and gvar, to now switch between value and source
I guess on BW UI, we can keep the long enter used previously to switch between value and gvar, to now switch between value and source
I'm not sure how best to do this. Once you've switched to 'Source' mode then you should be able to use the long press to open the popup menu to select source type. So how to switch back to non-source mode?
There is a discrepancy with 128x64 B&W radios. Color and 212x64 radios allow the input/mix line Curve parameter to be set to a GV when the type is Diff or Expo. This is not available on 128x64 B&W radios.
This is not available on 128x64 B&W radios.
Yes it is. You need to have the edit field active in order for the long press to toggle between value and GV works.
Once you've switched to 'Source' mode then you should be able to use the long press to open the popup menu to select source type. So how to switch back to non-source mode?
How about same way the Adjust GV source menu works... add it as another option to the popup menu?
This is not available on 128x64 B&W radios.
Yes it is. You need to have the edit field active in order for the long press to toggle between value and GV works.
Ok, so different to 212x64 B&W then. Long press always works.
How about using long press to bring the choice list and add "Values" as a first entry
How about using long press to bring the choice list and add "Values" as a first entry
Yeah, that's what pfeerick suggested too. I think 'Constant' would be better as that is what is used now for the Adjust SF.
Now I just have to figure out how to do it in the B&W UI.
Your are obviously much better at English than me, but as a non native speaker, I associate "constant" more to things like MAX,MIN then a value you can change, but that's a detail really
Your are obviously much better at English than me, but as a non native speaker, I associate "constant" more to things like MAX,MIN then a value you can change, but that's a detail really
I would agree that 'Constant' is probably not the best choice; but it's already used for pretty much the same purpose.
I agree that "Constant" is not ideal, but consistency is important, so is the best fit. It could make even more sense here if a long press brings up a popup with constant, mixer source, gvar as options... although not sure that is needed - on second thoughts, it probably is... going from two choices (fixed value, GV) to three (fixed value, mixer source, GV) so no longer a simple long press to toggle.
Starts to look really great, that's going to be a great addition for users. I guess that will require drawSource to support RIGHT alignement on 128 😨
I guess that will require drawSource to support RIGHT alignement on 128 😨
I'm assuming you used the popup on an Input weight/offset/curve and selected Inputs 😄 I've fixed it so this should no longer be possible.
It's getting there :)
I'm still seeing this:
when using POT for weight (which is most likely scenario), it looks fine
but when using an input, it overwrites the (i)
Also,
creates
I've changed the drawSource calls to be left justified (too complex to try and add right justification).
Yeah, first column invert for input and mix is a very nice change @philmoz Ok, flashing this on my MT12, I want to use pot as weight for throttle, testing report soon
The feature is really nice, I have setup a input with S1 as a source, with weight 25 and offset 55, which give me an output from 30 to 80.
I then assign the input as weight for Throttle, and I can adjust how much throttle I have directly from S1, not need for any special function or gvar use !
@elecpower Your expertise with Companion would be appreciated here.
@philmoz ok
I'm thinking to extend the RawSource class to allow a 'numeric value' type; but not sure how complex this would be or if there is a better way.
That was my 1st thought then quickly dismissed it as the global lookup list would need to include every possible numeric value and every one would have to be listed so totally unworkable.
My initial idea is to create a new shared group widget based on the existing one that handles the value, checkbox and combo. In source mode populate combo from global rawsource with context filter.
This will break binary import but it can be cajoled to map to a rawsource. So looking forward to dropping this legacy beast.
Give me a few days to get some time to work up a poc.
@philmoz Hi Phil, I believe I have found a bug in the radio yaml encode/decode of negative custom curves. This also affects decoding Companion generated value of -n. Positive curves are okay.
I believe I have found a bug in the radio yaml encode/decode of negative custom curves.
Good catch - should be fixed now.
Better but not quite. Mixes list needs a fix too.
Mixes list needs a fix too.
Hopefully fixed now (brain is really not functional right now).
Hopefully fixed now (brain is really not functional right now).
Know where you're coming from.
Tested okay. However a new issue around changing the curve type.
For an Input or Mix line when you edit a curve and change the type the value for the original type is attempted to mapped rather than setting to a suitable default for the new type.
The screen shot was the result of changing a Custom curve set to CV28 and to curve type Function.
If you switch from a Function to a Custom curve the CV is the previous function index. Same for Diff and Expo types.
If you change the type and do no other edits, exit the editor and then re-edit the same line the value/index is 0.
If you change the type then change the value/reference to a valid entry, exit the editor and re-edit the same line the value is that set on exiting the editor.
Tested okay. However a new issue around changing the curve type.
UI not refreshing correctly. Value is reset to 0 when type is changed.
Func to Cstm and Cstm to Func now okay.
Func or Curve to Diff or Expo is not refreshing the numeric value to 0%
Confirm refresh fixed
Currently this covers Inputs and Mixes.
There are three similar values in Outputs - Subtrim, Min and Max.
However the range for these is -1000 - 1000 which requires all 11 bits so they can't be changed to use the same code as Inputs and Mixes.
There are enough spare bits in the LimitData structure to implement this; but it will require additional code changes to handle.
I'm thinking to leave this PR at Inputs and Mixes, iron out any issues and see if there is any feedback for Outputs.