DO_PUSH & DEVICE ARRAYS
Rich Abel
Posts: 104
I'm adapting some existing code to some new equipment and have run into an issue with DO_PUSH
Generally I find I can use a Device Array in any situation that calls for a device; e.g. Button_events.
So,
BUTTON_EVENT[DEVICE_ARRAY, 10] can replace BUTTON_EVENT[DEVICE,10], with the former effecting each member of the device array.
However, if I try: DO_PUSH(DEVICE_ARRAY,10), I get dimension mismatch compilier errors.
Substituting DO_PUSH(DEVICE_ARRAY[],10) eliminates the compilier errors.
I'm not sure its a great idea to use DO_PUSH this way and may just rewrite that section of the old code, but I'm curious what causes this behavior. Does anyone know?
Thanks,
Rich Abel
ACE Programmer
Cello Technologies
Seattle
Generally I find I can use a Device Array in any situation that calls for a device; e.g. Button_events.
So,
BUTTON_EVENT[DEVICE_ARRAY, 10] can replace BUTTON_EVENT[DEVICE,10], with the former effecting each member of the device array.
However, if I try: DO_PUSH(DEVICE_ARRAY,10), I get dimension mismatch compilier errors.
Substituting DO_PUSH(DEVICE_ARRAY[],10) eliminates the compilier errors.
I'm not sure its a great idea to use DO_PUSH this way and may just rewrite that section of the old code, but I'm curious what causes this behavior. Does anyone know?
Thanks,
Rich Abel
ACE Programmer
Cello Technologies
Seattle
0
Comments
you cannot use a dev array in a do_push as you describe. However, there is another way to do it.
do_push(dev_tp[1],100) works.
So if you throw the whole thing in a for loop you can get it done easy enough.
something like that...
Thanks Eric.
You can also create a virtual TP and include that in your TP array so it works in all your button event handlers just like all the real TPs and any time you need to use a do_push you can do it on the virtual.
That won't always work will if there are variables that get set from the pushes since the code will run immediately but the button events get queued up and then executed (in your case every 5/10ths sec).
Do you really need to push a button on every touch panel? There is usually a way to avoid using do_push if you find it irksome.
Paul
Do_push is one of those strange commands that can seem a bit hard to get your head around. I do use it. I've even used it as you described. I had an audio switcher that didn't have an 'all zones off' command. It was easier to make a slow loop that hit all the 'zone off' buttons in the program since there was a whole bunch of condition already built into those.
Perhaps you could let us know what you're trying to do and we can suggest an alternative. while what I showed you will work, perhaps there's a better way of doing it. There doesn't seem to be a need to slam on all those buttons that fast. As a_riot suggests, it can have some sloppy results
only problem is...
"error: SYMBOL DO_PUSH NOT DEFINED."
eh?
here's the code
Where Button 606 is part of a larger array thus:
OR am I interpreting the use of DO-PUSH completely wrongly?
Do_Push uses '( )' not '[ ]'
it should be
there ya go.
e
compiles OK....I'll let you know in the morning if it works. I'm sure if I wasn't as tired as I am I'd be able to shorten it but I was up watching the Ashes! B-)
Legendary cricket contest between England and Australia. Australia usually win it. England won it this time! 2-1 out of 5-match series.
wiki it!
Worked...kinda! I ended up having to take it out of the function and putting it directly in the button event, and also removed the IFs and WAITs, just stacked the DO_PUSHes, and it also didnt work with the virtual (probably my coding) so I used BUTTON.INPUT.DEVICE - I didnt have much time on site so I left it at that.