Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| ezeio2:scriptref:getsystemitem [2019-08-17 20:58] – created andreh | ezeio2:scriptref:getsystemitem [2025-02-11 23:18] (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 16: | Line 14: | ||
| ^ Parameter ^ Description ^ | ^ Parameter ^ Description ^ | ||
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| | '' | | '' | ||
| - | | '' | + | | '' |
| | '' | | '' | ||
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| | '' | | '' | ||
| | '' | | '' | ||
| Line 36: | Line 34: | ||
| | '' | | '' | ||
| | '' | | '' | ||
| - | | '' | + | | '' |
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | == 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 === | ||
| + | Depends on parameter requested. See above. | ||
| === Example usage === | === Example usage === | ||
| Line 47: | 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 | ||
| + | } | ||
| </ | </ | ||