Virtual switches

More
31 Dec 2014 14:49 #27381 by mwm
Virtual switches was created by mwm
While working on revised toggle icon code (this is working, just need to fix the editing page to create a pull request), it occurred to me that a more general solution might be adding virtual switches.

While the Tx's have hardware switches with two or three states, it's common for modern aircraft to have three flight modes, and more isn't unheard of. Other firmware deals with this with "flight modes", being able to configure the number of them, and which switch settings enable each one, then basically use those as switches in other places.

Given the flexible nature of deviationTx, that basic idea - a virtual switch with three or more settings - should be more generally applicable. Say allow a virtual channel to be a virtual switch instead. Each mixer in the channel would be a state in the switch. The options for each mix would let you combine some number of other switches. You'd probably want the standard boolean operations, but I'm not clear on the details just yet.

The win here is that your model config could explicitly describe these multistate notions, rather than having it be implicit in switch usage scattered throughout the model.

So the problem that triggered this - my 200QX config, which has four flight modes - would be look something like:

VFMODE0: true if FMODE0 is true and GEAR1 is false
VFMODE1: true if FMODE1 is true and VIRT4 is false and GEAR1 is FALSE
VFMODE2: (true if FMODE2 is true or (FMODE1 is TRUE and VIRT4 is true)) and GEAR1 is FALSE
VFMODE3: true if GEAR1 is true

My rewritten icon display code would still be needed, for the ability to handle switches with near-arbitrary number of states. But doing things with a single, multistate virtual switch instead of multiple distinct switches wouldn't be more complicated, but would be easier to maintain: changing the virtual switch definition would update everything that depend on it, rather than needing to change all of them independently.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
31 Dec 2014 19:23 #27388 by billmester
Replied by billmester on topic Virtual switches
Like it, like it, liiiike it!

Please Log in or Create an account to join the conversation.

More
31 Dec 2014 23:13 #27392 by robca
Replied by robca on topic Virtual switches
Would definitely love to have this

Please Log in or Create an account to join the conversation.

More
02 Feb 2015 23:37 #28372 by mwm
Replied by mwm on topic Flight modes instead?
I've been thinking about this, and it has a serious clash with the current way channels/switches work, requiring adding as many new channels as there are states on each for every switch. Not really possible with the current architecture.

So - how about just support for "Flight Modes" (not to be confused with the FMOD switch on the current Tx's). Basically, it's one virtual switch as above, but possibly with more support sprinkled throughout the firmware. For instance, instead of "flight mode" showing up as a switch in the mixer, there might be a "flight mode" option on each mix, allowing you to enable a mix only in a specific flight mode as well as with a switch. I've done a number of models where this would have been a great boon.

On each model, you'd set the number of flight modes you wanted for it, and then would have something mixer-like to set which set of switches (as currently defined) would enable each flight mode. Actually, the mixer would look a lot like the new toggles code I hope to get done soon, and the new toggles & flight mode patches would work well together.

So, does this sound like a reasonable alternative to having what I outlined originally?

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

Time to create page: 0.031 seconds
Powered by Kunena Forum