Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
Help with Simpl+ Undefined variable error
Heather Baiman
Using the Delay below in the first example the code runs fine, if I change the Delay to a Wait in the second example I get error 1001 for Underfined Variable TempSetp$. Can someone please explain to me why?
DIGITAL_INPUT Cool1Call[Array] DIGITAL_INPUT Heat2Call[Array] STRING_INPUT CrestronSetp$[Array][4]; ANALOG_OUTPUT MitsuSetp[Array]; INTEGER_PARAMETER OffsetSetp; Example 1: * String_Function FormatTemp() { STRING TempSetp$[4]; If (len(CrestronSetp$[i]) = 4) TempSetp$ = Left(CrestronSetp$[i],3); Else If (len(CrestronSetp$[i]) = 3) TempSetp$ = Left(CrestronSetp$[i],2); Delay(250); //Wait for ramping up or down of setp to finish before passing on to Mitsu If (Cool1Call[i]) MitsuSetp[i] = Atoi(TempSetp$) - OffsetSetp; If (Heat2Call[i]) MitsuSetp[i] = Atoi(TempSetp$) + OffsetSetp; } Example 2: * String_Function FormatTemp() { STRING TempSetp$[4]; If (len(CrestronSetp$[i]) = 4) TempSetp$ = Left(CrestronSetp$[i],3); Else If (len(CrestronSetp$[i]) = 3) TempSetp$ = Left(CrestronSetp$[i],2); Wait(250) //Wait for ramping up or down of setp to finish before passing on to Mitsu { If (Cool1Call[i]) MitsuSetp[i] = Atoi(TempSetp$) - OffsetSetp; If (Heat2Call[i]) MitsuSetp[i] = Atoi(TempSetp$) + OffsetSetp; } } Heather Baiman, Head of Programming Electronic Environments Inc. 247 W. 37th Street, Suite 704, New York, NY 10018 Phone: 212-997-1110 | Fax: 212-997-0474 |
slip.cougan
variables have to be global in a wait - TempSetp$[4]
toggle quoted message
Show quoted text
regards slip --- In Crestron@..., Heather Baiman <heather@...> wrote:
|
Heather Baiman
If I change the STRING TempSetp$[4]; to a global variable it works with the Wait.
And that tidbit is buried in the help.... Nevermind, thanks guys! From: Heather Baiman Sent: Tuesday, June 18, 2013 12:44 PM To: Crestron@... Subject: Help with Simpl+ Undefined variable error Using the Delay below in the first example the code runs fine, if I change the Delay to a Wait in the second example I get error 1001 for Underfined Variable TempSetp$. Can someone please explain to me why? DIGITAL_INPUT Cool1Call[Array] DIGITAL_INPUT Heat2Call[Array] STRING_INPUT CrestronSetp$[Array][4]; ANALOG_OUTPUT MitsuSetp[Array]; INTEGER_PARAMETER OffsetSetp; Example 1: * String_Function FormatTemp() { STRING TempSetp$[4]; If (len(CrestronSetp$[i]) = 4) TempSetp$ = Left(CrestronSetp$[i],3); Else If (len(CrestronSetp$[i]) = 3) TempSetp$ = Left(CrestronSetp$[i],2); Delay(250); //Wait for ramping up or down of setp to finish before passing on to Mitsu If (Cool1Call[i]) MitsuSetp[i] = Atoi(TempSetp$) - OffsetSetp; If (Heat2Call[i]) MitsuSetp[i] = Atoi(TempSetp$) + OffsetSetp; } Example 2: * String_Function FormatTemp() { STRING TempSetp$[4]; If (len(CrestronSetp$[i]) = 4) TempSetp$ = Left(CrestronSetp$[i],3); Else If (len(CrestronSetp$[i]) = 3) TempSetp$ = Left(CrestronSetp$[i],2); Wait(250) //Wait for ramping up or down of setp to finish before passing on to Mitsu { If (Cool1Call[i]) MitsuSetp[i] = Atoi(TempSetp$) - OffsetSetp; If (Heat2Call[i]) MitsuSetp[i] = Atoi(TempSetp$) + OffsetSetp; } } Heather Baiman, Head of Programming Electronic Environments Inc. 247 W. 37th Street, Suite 704, New York, NY 10018 Phone: 212-997-1110 | Fax: 212-997-0474 |
And that tidbit is buried in the help....Which reminds me of something vaguely related that I thought worth posting wait() (and iirc cancelwait/retimewait) functions do not "take effect" immediately; they manipulate a queue that is processed when the calling task is switched out [disclaimer: cant be bothered to hunt for the exact wording]. So for example, if you manipulate wait() tasks in a loop, they may not end up working as you had planned. Not as I had once planned, anyway. During heavy load on a direct socket it would all of a sudden execute a wait codeblock that had "clearly" been cancelled long before the time expired. And that tidbit is buried in the help...... and I clearly remember the moment, hours in to the debugging, where it dawned on me that I had read this in the help. It happens to me every now and then :) TL;DR: some times you want ProcessLogic() after your wait()-related function calls. cheers --- In Crestron@..., Heather Baiman <heather@...> wrote:
|
to navigate to use esc to dismiss