ezeio2:scriptref:getsystemitem

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ezeio2:scriptref:getsystemitem [2019-08-17 20:58] – created andrehezeio2: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 16: Line 14:
  
 ^ Parameter ^ Description ^ ^ Parameter ^ Description ^
-| ''SYSITEM_GPSX'' | GPS latitude in degrees x 10^6 | +| ''SYSITEM_GPSX'' | GPS latitude in degrees x 10<sup>6</sup>
-| ''SYSITEM_GPSY'' | GPS longitude in degrees x 10^6 |+| ''SYSITEM_GPSY'' | GPS longitude in degrees x 10<sup>6</sup> |
 | ''SYSITEM_GPSZ'' | GPS elevation in meters x 10 | | ''SYSITEM_GPSZ'' | GPS elevation in meters x 10 |
-| ''SYSITEM_GPSSIGNAL''0=no signal. 31=max signal strength |+| ''SYSITEM_GPSSIGNAL''Received signal level from GPS |
 | ''SYSITEM_UPTIME'' | Number of seconds since last restart | | ''SYSITEM_UPTIME'' | Number of seconds since last restart |
-| ''SYSITEM_CELLINHIBIT'' | 0=normal operation. 1=cellular modem is off | +| ''SYSITEM_CELLINHIBIT'' | 0=normal operation. >0 cellular modem is off, remaining seconds 
-| ''SYSITEM_RSSI'' | Received signal level for cellular modem ( |+| ''SYSITEM_RSSI'' | Received signal level for cellular modem (0=no signal. 31=max signal strength) |
 | ''SYSITEM_ETHLINK'' | 0=No Ethernet connection. 1=Ethernet connection detected | | ''SYSITEM_ETHLINK'' | 0=No Ethernet connection. 1=Ethernet connection detected |
 | ''SYSITEM_ETHCONN'' | 0=Not using Ethernet connection. 1=Using Ethernet connection | | ''SYSITEM_ETHCONN'' | 0=Not using Ethernet connection. 1=Using Ethernet connection |
Line 37: Line 35:
 | ''SYSITEM_EPOCH'' | Real time clock, Epoch (number of seconds since 1970-01-01) | | ''SYSITEM_EPOCH'' | Real time clock, Epoch (number of seconds since 1970-01-01) |
 | ''SYSITEM_RND'' | Random number | | ''SYSITEM_RND'' | Random number |
 +| ''SYSITEM_OUT3RCPWM'' | Output 3 mode (0=0-100%, 1=1-2ms servo) |
 +| ''SYSITEM_RESETCAUSE'' | Cause of last hardware reset, bitmap or RESETCAUSE flags defined below |
 +| ''SYSITEM_SCRIPT_RESETCAUSE'' | Cause of last script restart, current script (see below) |
 +| ''SYSITEM_HIBERNATE'' | Nonzero if running as part of sleep cycle |
 +| ''SYSITEM_EXPn'' | ezeio-CAN Expander status (0=no comm, 1=comm ok), where n=1 through 7 |
 +
 +== 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)
        
-   // x is not 2019 (as of this writing)+   if( GetSystemItem( SYSITEM_RESETCAUSE ) & RESETCAUSE_HIB ) { 
 +     // this code will run if board came back from a hibernation cycle 
 +   }
 </code> </code>
  
  • ezeio2/scriptref/getsystemitem.1566075518.txt.gz
  • Last modified: 2019-08-17 20:58
  • by andreh