Can a call call a call?
Tryll
Posts: 33
Quick question: Should I be able to call a call from a call, in Netlinx? I have a problem program which uses logic to first make a call to a DEFINE CALL, which then in turn may call a separate DEFINE CALL. This doesn't seem to work in practice. Is it the case that this just doesn't work? Or are there some rules which must be followed? It compiles just fine, but any call after the first does not seem to be getting run.
Thanks for any and all input on this subject.
Thanks for any and all input on this subject.
0
Comments
If you can post the code that you're having issues with, perhaps someone can help.
Do you know why the crow landed on top of the telephone line? -- He wanted to make a long distance caw.
This is a code that works just fine... My TH_ON Callis at the top of the Sub-routines section, while my Source switches are lower inthe code...
TH_ON Checks to see if the theater is in an ON State, and if not, turns it on before running the source selection call.
I'm much more of a function person.
Yes, an exit strategy is always important otherwise you get caught in a function that eats up your resources and prevents your processor for doing anything else effectively - just like real life! :-D
BTW congrats on post 1000 Dave!
I'll probably put together an example of what I was doing, which now sounds like it wasn't the cause. Strangely, unrolling the call stack seemed to resolve the issue... obviously _something_ wasn't right that got fixed in the process.
For the moment, I'm moving on, but I'll probably still put a sample up here so you can set me straight.
DEFINE_CONSTANT
SOURCE_DVD = 20
SOURCE_VCR = 21
SOURCE_CABLE = 22
SOURCE_SAT = 23
SOURCE_ATC = 24
DEFINE_CALL 'SWITCH_SOURCE' (SOURCE_SELECT)
{
CURRENT_SOURCE = SOURCE_SELECT
IF (SOURCE_SELECT <> SOURCE_ATC)
{
IF (VPROJ_STATUS <> 'COOLING')
{
Call 'PROJECTOR' (POWERON)
PULSE[LIFT_DN]
PULSE[SCREEN_DN]
Wait 20
CALL 'PROJECTOR' (RGB)
}
}
SWITCH(SOURCE_SELECT)
{
CASE SOURCE_ATC: {}
CASE SOURCE_CABLE:
{
SEND_STRING EXTRONSW,'1*2&'
WAIT 5
SEND_STRING EXTRONSW, '1*1$'
SEND_STRING EXTRONDVS, '2!'
}
CASE SOURCE_DVD:
{
PULSE[DVD_VCR,DVD_DVD_Mode]
SEND_STRING EXTRONSW,'3*2&'
WAIT 5
SEND_STRING EXTRONSW, '2*1$'
SEND_STRING EXTRONDVS, '2!'
}
CASE SOURCE_VCR:
{
PULSE[DVD_VCR,DVD_VCR_Mode]
SEND_STRING EXTRONSW,'2*1&'
WAIT 5
SEND_STRING EXTRONSW, '2*1$'
SEND_STRING EXTRONDVS, '1!'
}
CASE SOURCE_SAT:
{
SEND_STRING EXTRONSW,'8*1&'
WAIT 5
SEND_STRING EXTRONSW, '7*1$'
SEND_STRING EXTRONDVS, '1!'
}
}
}
DEFINE_EVENT
BUTTON_EVENT[TP,14]// audio conference
BUTTON_EVENT[TP,15]// cable & DSS
BUTTON_EVENT[TP,16]// Computers
BUTTON_EVENT[TP,17]// DVD
BUTTON_EVENT[TP,18]// VCR
BUTTON_EVENT[TP,19]// Room
BUTTON_EVENT[TP,20]// Power page
BUTTON_EVENT[TP,21]// DSS Page
{
PUSH:
{
SWITCH (BUTTON.INPUT.CHANNEL)
{
CASE 14: {CALL 'SWITCH_SOURCE' (SOURCE_ATC)}
CASE 15: {CALL 'SWITCH_SOURCE' (SOURCE_CABLE)}
CASE 16: {CALL 'SWITCH_SOURCE' (SOURCE_COMP_1)}
CASE 17: {CALL 'SWITCH_SOURCE' (SOURCE_DVD)}
CASE 18: {CALL 'SWITCH_SOURCE' (SOURCE_VCR)}
CASE 19: {} // Do Nothing
CASE 20: {} // Do nothing
CASE 21: {CALL 'SWITCH_SOURCE' (SOURCE_SAT)}
}
}
}
OK, the next part will be part two. But should the above concept function in theory?
Thanks guys.
I would offer a suggestion unrelated to your original question though. You are rightly blocking the projector from turning on when it is in a cooldown state, but you are still switching sources. You should block the entire operation rather than have the rest of the system come on with no projector . I would also recommend a popup on the panel warning the end user that they tried to turn it back on too soon. This may not matter with a relatively fast projector, but I am seeing more and more of them with cooldowns of as long as 3 minutes. For those, you have to make it very clear why nothing is happening because the consumer doesn't necessarily understand cooldowns.
Yes, there is actually a cooldown message being displayed at the time. Obviously, the sample doesn't include all the logic involved, but I was trying to get the overall concept of the process into it. You are right though, it DOES currently do the switching even if the projector is locked out. Cooldown is polled via 232, so no matter how long it takes, we should be set there.
Still, the guys doing the installs seem to be running into logic issues. One thing I haven't yet figured with Netlinx... how can I "trace" messages into Netlinx studio? The install guys don't really understand debugging, so I would love to write messages into the notifications tab during a troubleshooting run. Can you tell me how I could do this?
Send_String 0,"'<whatever you want to say>'"
This will display in the diagnostics tab. you could put almost anything in the string, including variables. (as long as it is in the 'ASCII' format).
Don't get me wrong - the notification tab is very useful under some circumstance. But it can be overloaded (crashing Studio or NetLinx Diagnostics), and it's difficult at time to filter exactly the messages you need. And, and you have noticed, the learning curve can be steep for a non-programmer. The telnet window overcomes quite a lot of that, and if you set the customer's router to forward the telnet port to your master, you can do it remotely.
Oh, and the SEND_STRING 0 output will show up in notifications as well, if you have all devices turned on, or port 0 explictily set for string messages.
I'll probably attach the trace statements to a variable, so that they are easy to globally turn on and off.
Thanks again guys. Without the help of this forum, I'd probably toss in the towel on Netlinx.