
TECHNICAL MANUAL
Telit GM862-GPS
Quad Band GPS Data Terminal Module
Pag.48 of 79
Rev. 0
Wait for download result: OK.
3.13.12
Enable Python script
Select the Python script which will be executed (the enabled script) from the next start-up
and on using the AT#ESCRIPT command.
First choose the script you want to enable between the ones you downloaded:
AT#LSCRIPT? can help you checking the names of the scripts;
for example:
AT#ESCRIPT=”a.py”
Wait for enable result: OK.
3.13.13
Execute Python script
The Python script you downloaded to module and enabled is executed at every module
power on if the DTR line is sensed LOW (2.8V at the GM862-GPS DTR pin - RS232
signals are inverted -) at start-up, (then no AT command interface is connected to the
modem port) and if the script name you enabled matches one of the script names of the
scripts you downloaded.
The Python script is executed with –v -S -OO options.
In order to gain again the AT command interface on the modem physical port (for example
to update locally a new script) the module shall be powered on with the DTR line HIGH (0V
at the GM862-GPS DTR pin) so that the script is not executed and the Python engine is
stopped.
The real execution of the Python script is delayed from the power on due to the time
needed by Python to parse the script. The longer is the script, the longer is this delay.
Note that only the running script is compiled at run time, all the others that this script may
include are compiled once and the compiled result is saved in the NVM as a file with
extension .pyo.
This delay can be greatly reduced with a simple stratagem:
- type your script normally, and include the main loop in a function, for example
"main()", save it to the NVM of the module with a known name, for example appl.py
- write a new script that includes the previous file object, for example "include appl",
and this file should call only the main function of the appl.py script, for example
appl.main().
In this way the first time the script is executed the imported files will be compiled and the
result saved as compiled .pyo files (don't delete them during normal operations, but
remember to delete them if you change the corresponding .py script otherwise your
changes will not take effect). From the next start-up and on the imported files will not be
anymore compiled and script execution delay is greatly reduced.
This stratagem is useful also for long complex scripts, that may run out of memory during
compilation; splitting the script into several smaller scripts containing part of the
functions/objects definitions will separate the compilation and allow for much bigger
script usage.