7 Scripting
39
7.7
Starting scripts
There are a few ways to start scripts:
• On power up. This feature automatically starts a specified script function when power is first applied. The
default is not to start any function, so pressing the "reset to defaults" button will disable this feature.
• By another thread. One thread can create another by using the
thread.run
function. For example,
thread.run(func1)
creates a new thread that starts executing the
func1
function. The execution of
the parent thread continues.
• By issuing an HTTP request. Follow a link
http://Your_IP/script.cgi?run=func
to start exe-
cution from function
func
. This can be conveniently used by the end users by assigning the programmable
web links on the left side of the page a target of the form
script.cgi?run=func
.
• Via AutoPing. The
can be configured to automatically start execution when IP connectivity
is lost. Select the script to run from the selection box to the right of the corresponding IP on the AutoPing
page.
• By manually clicking the Start button. Execution will start with the selected function.
7.8
Editing scripts
You don't need to disable scripting before editing scripts. If you make a syntactic error, the script won't be modified.
Instead, you'll receive an explanatory message pointing to the error.
If you modify a running script, existing threads will continue to run with the code and environment that existed when
the script was started. New threads won't interact with old ones directly. Use
and
state APIs for
that.
7.9
Stopping a thread
A thread terminates automatically when the end of its outermost function is reached. Click "Stop all running threads"
to stop everything. You can also stop all scripts via HTTP using
http://Your_IP/script.cgi?stop
7.10
Relay debounce warning
Even with the scripting step delays, it is possible to create a script which will rapidly cycle a relay. This rapid cycling
could result in a over current condition, tripped breaker, or stress to the power controller or attached equipment.
Please be reasonable!
DLI LPC9 User’s Guide: 1.7.24.0
Summary of Contents for LPC9
Page 1: ...DLI LPC9 User s Guide 1 7 24 0 ...
Page 81: ......