>b Button State section

Michael Ingraham 2019-10-15 16:30:16 -04:00
parent d7184fce0d
commit 5e1e8ad29a
1 changed files with 17 additions and 9 deletions

@ -19,11 +19,12 @@ These features are enabled by adding the following `#define` compiler directive
| Feature | Description |
| -- | -- |
USE_WEBSEND_RESPONSE | enable receiving the response of a [`WebSend`](Commands#websend) command (received in section E)
USE_SCRIPT_JSON_EXPORT | enable `>J` section
USE_SCRIPT_WEB_DISPLAY | enable `>W` section
USE_SCRIPT_JSON_EXPORT | enable `>J` section (publish JSON payload on [TelePeriod](Commands#teleperiod))
USE_SCRIPT_WEB_DISPLAY | enable `>W` section (modify web UI)
USE_SCRIPT_SUB_COMMAND | enables invoking named script subroutines via the Console or MQTT
USE_SCRIPT_HUE | enable `>H` section
USE_SCRIPT_STATUS | enable `>U` section
USE_SCRIPT_HUE | enable `>H` section (Alexa Hue emulation)
USE_SCRIPT_STATUS | enable `>U` section (receive JSON payloads)
USE_BUTTON_EVENT | enable `>b` section (detect button state changes)
SUPPORT_MQTT_EVENT | enables support for subscribe unsubscribe
USE_TOUCH_BUTTONS | enable virtual touch button support with touch displays
USE_24C256 | enables use of 24C256 I<sup>2</sup>C EEPROM to expand script buffer (defaults to 4k)
@ -33,7 +34,7 @@ SDCARD_DIR | enables support for web UI for SD card directory upload and downloa
<BR><BR>To enter a script, go to `Configuration` =\> `Edit script` in the Tasmota web UI menu
The maximum script size is 1535 bytes (uses rule set buffers).
The maximum script size is 1535 bytes (uses rule set buffers). If the pasted script is larger than 1535 characters, comments will be stripped to attempt to make the script fit.
To save code space almost no error messages are provided. However it is taken care of that at least it should not crash on syntax errors.
@ -47,6 +48,7 @@ To save code space almost no error messages are provided. However it is taken ca
- `and` , `or` support
- Hexadecimal numbers with prefix `0x` are supported
- Strings support `+` and `+=` operators
- Support for \\n \\r regular expressions on strings
- String comparison `==`, `!=`
- String size is 19 characters (default). This can be increased or decreased by the optional parameter on the `>D` section definition
@ -81,7 +83,7 @@ To save code space almost no error messages are provided. However it is taken ca
Memory is dynamically allocated as a result of the D section.
Copying a string to a number or reverse is supported
>`>B`
>`>B` _(note upper case)_
executed on BOOT time and on save script
>`>E`
@ -113,6 +115,12 @@ lamp1,E,on=pwr1,hue=hue1,sat=sat1,bri=bri1,ct=ct1
>`>U`
status JSON Messages arrive here
>`>b` _(note lower case)_
executed on button state change
`bt[x]` read button state (x = `1.. MAX_KEYS`)
example:
print button event =>\%bt[1]\%
>`>J`
The lines in this section are published via MQTT in a JSON payload on [TelePeriod](Commands#teleperiod). Requires compiling with `#define USE_SCRIPT_JSON_EXPORT `.
@ -333,16 +341,16 @@ The script itself is also stored on the SD card with a default size of 4096 char
Enable SD card directory support (+ 1,2k flash)
`#define SDCARD_DIR`
Shows a web SD card directory (submeu of scripter) where you can upload and download files to/from sd card
Shows a web SD card directory (submenu of scripter) where you can upload and download files to/from sd card
`fr=fo("fname" m)` open file fname, mode 0=read, 1=write (returns file reference (0-3) or -1 for error)
`res=fw("text" fr)` writes text to (the end of) file fr, returns number of bytes written
`res=fr(svar fr)` reads a string into svar, returns bytes read (string is read until delimiter \t \n \r or eof)
`res=fr(svar fr)` reads a string into svar, returns bytes read. String is read until delimiter (\\t \\n \\r) or eof
`fc(fr)` close file
`ff(fr)` flush file, writes cached data and updates directory
`fd("fname")` delete file fname
`flx(fname)` create download link for file (x=1 or 2) fname = file name of file to download
`fsm` return 1 if filesystem is mounted, (valid sd card found)
`fsm` return 1 if filesystem is mounted, (valid SD card found)
**Extended commands** (+0,9k flash)
`#define USE_SCRIPT_FATFS_EXT`