Sorry for the posting to an old thread, but I'm currently struggling with using memory function. And this thread was the only one found by Google on that.
I was trying to set up blinker input config as I described here:
viewtopic.php?p=1996111#p1996111. Even though it's a thread about Hori wheel, the approach should be applicable to any configuration of blinker controls.
Quoting my idea for reference:
is there a way to set up controls (using config files) to make left blinker button turn off right blinker (if it's turned on) and only on second click turn on right blinker (and vice versa, ofc)
First, I realized that it's probably "one per-mix" memory slot. You don't have an "address" parameter and having only one global memory slot would not make sense.
I tried to type the desired configs using memory function... and realized that it's not achievable with
memory function: in "mix rblinker" you'd have to peek into lblinker's memory (to not trigger rblinker event if the lblinker is turned on which seems to be impossible.
So, my first question would be:
what's the way to achieve the desired behavior?
Then, out of curiosity (well, I typed the config and then tried it out, finding out it doesn't work), I decided to proceed with logic for only one blinker, keeping the rblinker unassigned.
Here is an expression which I came up with:
config_lines[392]: "mix lblinker `(!memory(0.0, 0.0) & (joy.b40?0 & memory(1.0, 1.0))) | (memory(0.0, 0.0) & ((joy.b40?0 | joy.b41?0) & !memory(1.0, 0.0)))`"
memory(0.0, 0.0) is a pattern for reading from memory slot, as described by OP (well, given the docs it seems right)
How I expect it to work:
if
memory(0.0, 0.0) is false (!
memory(0.0, 0.0) is true), proceed to the
second part of short-circuit AND:
config_lines[392]: "mix lblinker `(!memory(0.0, 0.0) & (joy.b40?0 & memory(1.0, 1.0))) | (memory(0.0, 0.0) & ((joy.b40?0 | joy.b41?0) & !memory(1.0, 0.0)))`"
which will activate if Button 40 is pressed and (with short-circuit AND) write 1.0 to the memory slot (short-circuit will ensure that that happens only when the button is pressed). The value returned from this part of expression (if the button is pressed is 1.0, returned from memory(1.0, 1.0) (a fresh value which was just written)
Now if the first part was evaluated to 0.0 (if 1.0 is in the memory slot or of button is not pressed), we go to the second check
config_lines[392]: "mix lblinker `(!memory(0.0, 0.0) & (joy.b40?0 & memory(1.0, 1.0))) | (memory(0.0, 0.0) & ((joy.b40?0 | joy.b41?0) & !memory(1.0, 0.0)))`"
The second part
config_lines[392]: "mix lblinker `(!memory(0.0, 0.0) & (joy.b40?0 & memory(1.0, 1.0))) | (memory(0.0, 0.0) & ((joy.b40?0 | joy.b41?0) & !memory(1.0, 0.0)))`"
is pretty much the same as for turned-off blinker whith the following differences:
- The expression which triggers the mix is OR-expression of two buttons now: joy.b40?0 | joy.b41?0
- we write 0.0 to memory now, which means memory(1.0, 0.0) will return 0.0 and we'd want 1.0 to be returned. Luckily, we can reverse it
Now that I did explanation to a rubber duck here (and even fixed a mistake while typing it), it still does not work as expected which leads me to crying for help here:
what's wrong with my config?
Bonus question (was not able to find an answer anywhere: what is
semantical.lblinker?0 notation widely present in the config?