Appendix B: Lua extensions
76 Miscellaneous functions
tcu_get_sw_start_cause
Purpose: Get reason for latest start-up.
Format: tcu_get_sw_start_cause ()
Return values:
1) Start-up reason flags.
1 = Power on
2 = CAN activity
4 = Timeout
8 = Remote on
16 = Power save
2) AVR start-up reason flags.
1 = Power on
2 = External reset
4 = Brown out
8 = Watchdog
Example: tcu_get_sw_start_cause ()
tcu_get_power_signals
Purpose: Get current status of the power control signals
(REMOTE_ON and POWER_SAVE).
Normally these signals are handled automatically by the Terminal Control
Unit: If REMOTE_ON is high, the Terminal Control Unit powers down.
Calling this function can be used to replace the automatic remote power
control in the Terminal Control Unit by Lua functionality. The function
returns the state of the two power control signals and the Lua script may
respond to power down requests by calling tcu_power_off_for.
The automatic handling of the power signals is re-enabled when the LUA
script terminates; it may also be re-enabled by calling this function with
automatic=1 (see below).
Format: tcu_get_sw_start_cause (automatic)