Fixing A Lockout Problem
Table of Contents
Overview:
If your code has a variable that can lock out functionality, there always needs to be a way to clear it if the power goes out when the variable is set. At the very least, it should be turned off in DEFINE_START. Even better, if it's cleared in mainline the program will fix itself, without cycling power, if the variable gets stuck "on" somehow.
Variable Solution
IF (LOCKOUT_VAR)
{
WAIT HOWEVER_LONG_I_NEED_TO_WAIT 'CLEAR LOCKOUT'
OFF[LOCKOUT_VAR]
}
ELSE
CANCEL_WAIT ‘CLEAR LOCKOUT’
Channel Assignment Solution
A simpler solution is to assign a channel on the device as a lockout (instead of a variable). This way, whenever the system is reset or the device has power cycled, it will turn off without adding any additional code. This same idea may be used with debug messaging information to the terminal window.
Additionally using a channel allows you to look at (and change) the status without having the exact same version of the code compiled as the running code. OpenAxcess can tell you what's going on.
Add the idea of clearing the channel without a power down to that, as in the following mainline code:
IF ([dev,LOCKOUT_ch])
{
WAIT HOWEVER_LONG_I_NEED_TO_WAIT 'CLEAR LOCKOUT'
OFF[ [dev,LOCKOUT_ch] ]
}
ELSE
CANCEL_WAIT 'CLEAR LOCKOUT'
Inside your PUSHes or other conditionals, simply turn ON the lockout channel. When Tech Support needs to change the timing there will be only ONE place it needs to be changed. Also, the mainline routine cancels the wait anytime the channel turns off, such as a device reset or terminal mode OFF command.
Note: Only use a device channel when the lockout is specific to that device only.
Table of Contents