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-09-02 21:39] – andreh | ezeio2:scriptref:getsystemitem [2025-02-11 23:18] (current) – andreh | ||
|---|---|---|---|
| Line 19: | Line 19: | ||
| | '' | | '' | ||
| | '' | | '' | ||
| - | | '' | + | | '' |
| | '' | | '' | ||
| | '' | | '' | ||
| Line 34: | 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 === | ||
| Line 46: | 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 | ||
| + | } | ||
| </ | </ | ||