Commit Graph

28 Commits

Author SHA1 Message Date
Theo Arends 54149497b9
Merge pull request #8185 from gemu2015/scripter-update
Scripter update
2020-04-15 17:42:03 +02:00
Theo Arends 57f836cc9e Remove possible Webserver naming ambuigity 2020-04-15 09:58:38 +02:00
gemu2015 7d85ccb793 Update xdrv_10_scripter.ino 2020-04-15 08:21:43 +02:00
gemu2015 5f6c106507 scripter esp32 script size expansion 2020-04-15 08:11:54 +02:00
Theo Arends a52d4c5208 Revert "Merge pull request #8174 from gemu2015/scripter_update"
This reverts commit e66b961a54, reversing
changes made to 07ce431538.
2020-04-14 14:58:17 +02:00
gemu2015 f3b1497875 update scripter script size on esp32 2020-04-14 12:11:15 +02:00
gemu2015 a5d3974c56 sendmail ESP32 2020-04-12 19:28:19 +02:00
gemu2015 b796607264 update for esp32 2020-04-12 13:22:23 +02:00
Theo Arends 17c605ac6a Make checkbox and radiobox label clickable
Make checkbox and radio label clickable (#8066)
2020-04-05 14:11:49 +02:00
gemu2015 61b97350da ed300L support 2020-03-29 16:29:22 +02:00
Alexander Schliebner 2335f2fedd
Bugfix in function 'mp'
If optional parameter v2 was omitted, evaluation failed.
2020-03-07 18:52:24 +01:00
Alexander Schliebner 7df46f051d
Optimized function 'mp'
Leaner syntax of function `mp` and simplified implementation.
New documentation:
Mapping function `mp`

It addresses a standard task with less code and much flexibility: mapping an arbitrary incoming numeric value into a defined schema of allowed/reasonable ranges.
The numeric value `x` passed as the first parameter is compared to the mprules in the order they are provided as subsequent parameters. If the value matches the criteria, the defined value is returned. Subsequent mprules are skipped. If `x` matches none of the mprules, `x` is returned unchanged. 
```
mp(x mprule1 mprule2 ... mprule<n>)
```

An mprule starts with one of the comparison operators `<`, `>` or `=`, followed by a numeric value `v1`, optionally followed by a second numeric value `v2`:
```
<|>|=v1[ v2]
```

Example 1: `<8 0` - this rule reads: If x is less than 8, return 0.
Example 2: `>100` - this rule reads: If x is greater than 100, return 100. 

Example 3:
```
y=mp(x <8 0 >100)
```
Assigns 0 to y if x is less than 8.
Assigns 100 to y if x is greater than 100.
Assigns x to y for all values of x that do not meet the above criteria (8 to 100).

The above code of example 3 does the same as the following code - with just one line of code and 19 characters less:
```
y=x
if x<8 {
y=0
}
if x>100 {
y=100
}
```

Every of the above mentioned numeric values `x`, `v1` and `v2` can be a literal, an expression or a variable.
2020-03-07 16:53:49 +01:00
Alexander Schliebner cd14bde1f7
Update xdrv_10_scripter.ino
Added mapping function `mp`
´´´
mp(x str1 str2 ... str<n>)
´´´
It addresses a standard task with less code and much flexibility: mapping an arbitrary incoming numeric value into the allowed range.
The numeric value `x` passed as the first parameter is compared to the rules in the order they are provided as subsequent sting parameters. If the value matches the criteria, the defined value is returned. Subsequent rules are skipped. If `x` matches none of the rules, `x` is returned unchanged. 

Rules consist of one of the comparison operators `< > =` followed by a numeric value `v1`, optionally followed by a colon and another numeric value `v2`.
```
<|>|=v1[:v2] 
```
Example 1: `"<8:0"` - this rule reads: If x is less than 8, return 0.
Example 2: `">100"` - this rule reads: If x is greater than 100, return 100. 

Example 3:
```
y=mp(x "<8:0" ">100")
```
Assigns 0 to y if x is less than 8.
Assigns 100 to y if x is greater than 100.
Assigns x to y for all values of x that do not meet the above criteria (8 to 100).

The above code of example 3 does the same as the following code - with just one line of code and 15 characters less:
```
y=x
if x<8 {
y=0
}
if x>100 {
y=100
}
```
2020-03-06 21:13:12 +01:00
Theo Arends d779a2b9b4 Add switch modes 11 and 12
Add switch modes 11 (PUSHHOLDMULTI) and 12 (PUSHHOLDMULTI_INV) (#7603)
2020-02-06 14:53:35 +01:00
gemu2015 fc92896ef5 sml dynamic baud and transmit support 2020-02-04 07:07:56 +01:00
Leonid Muravjev e03a14ce21 i2c: I2cSetDevice wrong behavior
Most drivers do not expect address blocking after calling i2cSetDevice.
I2cSetActive removed from I2cSetDevice. All drivers waiting for this call are fixed.

refs #7556
2020-01-19 16:15:18 +03:00
Theo Arends 8aa9109656 Happy New Year
Happy New Year
2019-12-31 14:23:34 +01:00
Bohdan Kmit 7a49f523e7 Make scripter configuration interface localizable
Add tasmota-script build environment and travis entry
2019-12-28 22:32:26 +02:00
gemu2015 72f2e944d5 scripter pram update 2019-12-25 09:04:54 +01:00
Theo Arends a2478f9569 Change number of ``FriendlyName``s from 4 to 8
Change number of ``FriendlyName``s from 4 to 8
2019-12-24 15:06:19 +01:00
Theo Arends 35e51918e3 Document Settings changes 2019-12-22 16:53:51 +01:00
Theo Arends ad4a7e91ac Add support for max 150 characters
Add support for max 150 characters in most command parameter strings (#3686, #4754)
2019-12-22 15:23:52 +01:00
Theo Arends aae86a6718 Add fallback functionality
Add fallback functionality from next version 7.1.2.7
2019-12-16 15:13:57 +01:00
gemu2015 d4c2e92fd5 scripter FUNC_SET_POWER into separate section >P 2019-12-16 06:52:25 +01:00
gemu2015 4ea287eb5b scripter math functions 2019-11-27 17:15:41 +01:00
Theo Arends f32b64d5de Refactor I2C driver detection phase 2 2019-11-07 16:56:05 +01:00
Theo Arends 5f4e38023d Add SetOption comments to code 2019-11-03 12:33:36 +01:00
Theo Arends 0e07397ff7 Change Sonoff-Tasmota to Tasmota 2019-10-27 12:04:08 +01:00