Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ezeio2:scriptref:getsystemitem [2019-08-17 21:03] – andreh | ezeio2:scriptref:getsystemitem [2023-08-08 23:05] (current) – andreh | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Script reference ====== | + | ==== GetSystemItem ==== |
- | + | ||
- | ==== GetSystemItem( item ) ==== | + | |
Fetch the value of a given system parameter | Fetch the value of a given system parameter | ||
Line 21: | Line 19: | ||
| '' | | '' | ||
| '' | | '' | ||
- | | '' | + | | '' |
| '' | | '' | ||
| '' | | '' | ||
Line 37: | Line 35: | ||
| '' | | '' | ||
| '' | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | |||
+ | == Flags returned by SYSITEM_RESETCAUSE == | ||
+ | ^ constant ^ meaning ^ | ||
+ | | RESETCAUSE_EXT | Any external reset | | ||
+ | | RESETCAUSE_POR | Board was powered on | | ||
+ | | RESETCAUSE_BOR | Board detected brown-out (voltage dip) | | ||
+ | | RESETCAUSE_BOR | Software caused the reset | | ||
+ | | RESETCAUSE_WDOG | Internal watchdog caused the reset | | ||
+ | | RESETCAUSE_HIB | Board woke up from hibernation | | ||
+ | |||
+ | == Flags returned by SYSITEM_SCRIPT_RESETCAUSE == | ||
+ | ^ constant ^ meaning ^ | ||
+ | | SCRIPT_BOOT | Script started due to board reset | | ||
+ | | SCRIPT_ERROR | Script restarted due to script error | | ||
+ | | SCRIPT_USER | Script restarted by user | | ||
+ | | SCRIPT_CHANGE | Script restarted due to config change | | ||
+ | | SCRIPT_BUTTON | Script restarted with hardware button | | ||
=== Return value === | === Return value === | ||
Line 48: | Line 68: | ||
x = GetSystemItem(SYSITEM_YEAR); | x = GetSystemItem(SYSITEM_YEAR); | ||
+ | // x is now 2019 (as of this writing) | ||
- | // | + | if( GetSystemItem( SYSITEM_RESETCAUSE ) & RESETCAUSE_HIB ) { |
+ | // this code will run if board came back from a hibernation cycle | ||
+ | } | ||
</ | </ | ||