Weird Behav on Recursive DO_PUSH with PLK-DMS
youstra
Posts: 135
Weird thing going on...in a button_event, I try to do a redirect with do_push. So if someone pushes channel 15, I want that to be as if they pushed channel 32. (It's to enable high-level shortcuts of an otherwise nested menu item. Big system, 50+ DMS with big menu tree...)
In reality, when someone pushes 15, it shows up in the Notifications tab of Studio as a push on the virtual KP (say 34121, as defined in the code). But the ensuing do_push shows up in Notifications as an entirely different virtual device (say 36893). The new virtual
device (36893) is not defined in code, but does appear in device tree inside studio.
Simplified code is below. A couple of questions:
1. Am I breaking a rule by recursing a do_push on the PLK-DMS?
2. Where/why did this undefined virtual device 36893 come from? Some other module? All the code I mention here is in the master source file.
Continuing...
The Notifications tab shows
Bizarre to me - I'd expect all 4 lines to be on device 34121.
Anyone got ideas?
-Bill
In reality, when someone pushes 15, it shows up in the Notifications tab of Studio as a push on the virtual KP (say 34121, as defined in the code). But the ensuing do_push shows up in Notifications as an entirely different virtual device (say 36893). The new virtual
device (36893) is not defined in code, but does appear in device tree inside studio.
Simplified code is below. A couple of questions:
1. Am I breaking a rule by recursing a do_push on the PLK-DMS?
2. Where/why did this undefined virtual device 36893 come from? Some other module? All the code I mention here is in the master source file.
BUTTON_EVENT[avKP, 0] { PUSH: { integer iKP integer iButton dev vdvKP iKP = get_last(avKP); iButton = button.input.channel; vdvKP = button.input.device; send_string 0, "'Button pressed kpd/btn: ', itoa(vdvKP.number), '/', itoa(iButton)";This command shows the results you'd expect, i.e., 34121/15
Continuing...
do_push(vdvKP, aiKPShortcutLookup[iKP][iButton - KP_CH_SHORTCUT_MIN + 1]);
The Notifications tab shows
Line 19 :: Input Status:Released [34121:1:1] - Channel 15 - 13:10:07
Line 20 :: Input Status:Released [34121:1:1] - Channel 15 - 13:10:07
Line 21 :: Input Status:Released [36893:1:1] - Channel 32 - 13:10:08
Line 22 :: Input Status:Released [36893:1:1] - Channel 32 - 13:10:08
Bizarre to me - I'd expect all 4 lines to be on device 34121.
Anyone got ideas?
-Bill
0
Comments
If you want to do_push avTP, why are you copying button.input.device into a local variable vdvTP and then pushing that? It is evidently acquiring the wrong value somehow, so a workaround would be to do_push avTP.
Is the do_push code within the button_event - if not it won't see the local variable vdvTP, maybe it's seeing something else. Unlikely I agree.
I wonder what button.sourcedev contains.
I did try a sendstring on sourcedev.number and it showed up as device 0.
Instead of using the button.device.input you'd be better off using a reference to the avKP array that you got using get_last.
So
do_push(avKP[iKP], blah blah blah)
would probably do the trick
At this point, I suppose I should just assume that this ain't do-able ...unless anyone can confirm that it's worked for them.
-Bill
The other thing I just thought of, you could just put the code you want to execute in place of the DO_PUSH. If you are worried about maintaining the code in multiple places, you could always create a CALL or a FUNCTION to consolidate the code.
Hope this helps,
Jeff
This is kind of a big system, so I don't want to re-create the code...I'll just have to go back and encapsulate it better elsewhere so I can make simple single-line calls.
Sometimes this stuff feels like shareware...