edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

feat: use any source for expo/weight/offset etc

Open philmoz opened this issue 1 year ago • 10 comments

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?)

philmoz avatar Jun 27 '24 04:06 philmoz

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

3djc avatar Jun 27 '24 07:06 3djc

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?

philmoz avatar Jun 27 '24 21:06 philmoz

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.

philmoz avatar Jun 27 '24 23:06 philmoz

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.

image image image

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?

pfeerick avatar Jun 27 '24 23:06 pfeerick

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.

philmoz avatar Jun 28 '24 00:06 philmoz

How about using long press to bring the choice list and add "Values" as a first entry

3djc avatar Jun 29 '24 06:06 3djc

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.

philmoz avatar Jun 29 '24 06:06 philmoz

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

3djc avatar Jun 29 '24 06:06 3djc

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. screenshot_t20v2_24-06-29_16-32-14

philmoz avatar Jun 29 '24 06:06 philmoz

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.

pfeerick avatar Jun 29 '24 07:06 pfeerick

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 😨

3djc avatar Jul 04 '24 11:07 3djc

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.

philmoz avatar Jul 05 '24 02:07 philmoz

It's getting there :) I'm still seeing this: when using POT for weight (which is most likely scenario), it looks fine image

but when using an input, it overwrites the (i) image

Also, image

creates image

3djc avatar Jul 05 '24 06:07 3djc

I've changed the drawSource calls to be left justified (too complex to try and add right justification).

philmoz avatar Jul 05 '24 08:07 philmoz

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

3djc avatar Jul 05 '24 09:07 3djc

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 !

3djc avatar Jul 05 '24 12:07 3djc

@elecpower Your expertise with Companion would be appreciated here.

philmoz avatar Jul 06 '24 00:07 philmoz

@philmoz ok

elecpower avatar Jul 06 '24 01:07 elecpower

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.

philmoz avatar Jul 06 '24 01:07 philmoz

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.

elecpower avatar Jul 06 '24 02:07 elecpower

@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.

screenshot_tx16s_24-07-16_20-59-27

Screenshot from 2024-07-16 21-02-16

elecpower avatar Jul 16 '24 11:07 elecpower

I believe I have found a bug in the radio yaml encode/decode of negative custom curves.

Good catch - should be fixed now.

philmoz avatar Jul 16 '24 22:07 philmoz

Better but not quite. Mixes list needs a fix too.

screenshot_tx16s_24-07-17_09-42-05

screenshot_tx16s_24-07-17_09-43-36

Screenshot from 2024-07-17 09-44-11

elecpower avatar Jul 16 '24 23:07 elecpower

Mixes list needs a fix too.

Hopefully fixed now (brain is really not functional right now).

philmoz avatar Jul 17 '24 00:07 philmoz

Hopefully fixed now (brain is really not functional right now).

Know where you're coming from.

elecpower avatar Jul 17 '24 01:07 elecpower

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.

screenshot_tx16s_24-07-17_13-45-32

elecpower avatar Jul 17 '24 04:07 elecpower

Tested okay. However a new issue around changing the curve type.

UI not refreshing correctly. Value is reset to 0 when type is changed.

philmoz avatar Jul 17 '24 05:07 philmoz

Func to Cstm and Cstm to Func now okay.

Func or Curve to Diff or Expo is not refreshing the numeric value to 0%

elecpower avatar Jul 17 '24 05:07 elecpower

Confirm refresh fixed

elecpower avatar Jul 17 '24 07:07 elecpower

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.

philmoz avatar Jul 19 '24 23:07 philmoz