mirror of https://github.com/arendst/Tasmota.git
Merge branch 'arendst/development' into development
This commit is contained in:
commit
b4ec62e803
78
README.md
78
README.md
|
@ -17,7 +17,7 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
|
||||||
[![Download Dev](https://img.shields.io/badge/download-development-yellow.svg)](http://thehackbox.org/tasmota/)
|
[![Download Dev](https://img.shields.io/badge/download-development-yellow.svg)](http://thehackbox.org/tasmota/)
|
||||||
[![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota)
|
[![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota)
|
||||||
|
|
||||||
See [RELEASENOTES.md](https://github.com/arendst/Sonoff-Tasmota/blob/development/RELEASENOTES.md) for release information and [sonoff/_changelog.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_changelog.ino) for change information.
|
See [RELEASENOTES.md](https://github.com/arendst/Sonoff-Tasmota/blob/development/RELEASENOTES.md) for release information and [sonoff/_changelog.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_changelog.ino) for detailed change information.
|
||||||
|
|
||||||
The compiled development versions from current codebase are built around 6AM GMT+2 everyday and posted at http://thehackbox.org/tasmota/ (this web address can be used for OTA too).
|
The compiled development versions from current codebase are built around 6AM GMT+2 everyday and posted at http://thehackbox.org/tasmota/ (this web address can be used for OTA too).
|
||||||
|
|
||||||
|
@ -94,82 +94,6 @@ The following devices are supported:
|
||||||
- [Luani HVIO board](https://luani.de/projekte/esp8266-hvio/)
|
- [Luani HVIO board](https://luani.de/projekte/esp8266-hvio/)
|
||||||
- Wemos D1 mini, NodeMcu and Ledunia
|
- Wemos D1 mini, NodeMcu and Ledunia
|
||||||
|
|
||||||
#### Available Features and Sensors
|
|
||||||
|
|
||||||
| Feature or Sensor | sonoff | classic | minimal | knx | sensors |
|
|
||||||
|--------------------------------|--------|---------|---------|------|---------|
|
|
||||||
| ESP/Arduino lib v2.3.0 | 472k | 476k | 340k | 491k | 497k |
|
|
||||||
| ESP/Arduino lib v2.4.2 | 490k | 490k | 360k | 508k | 513k |
|
|
||||||
| | | | | | |
|
|
||||||
| MY_LANGUAGE en-GB | x | x | x | x | x |
|
|
||||||
| USE_WPS | - | x | - | - | - |
|
|
||||||
| USE_SMARTCONFIG | - | x | - | - | - |
|
|
||||||
| USE_ARDUINO_OTA | - | - | - | - | - |
|
|
||||||
| MQTT_LIBRARY_TYPE PUBSUBCLIENT | x | x | x | x | x |
|
|
||||||
| USE_DOMOTICZ | x | x | - | x | x |
|
|
||||||
| USE_HOME_ASSISTANT | x | x | - | x | x |
|
|
||||||
| USE_MQTT_TLS | - | - | - | - | - |
|
|
||||||
| USE_KNX | - | - | - | x | - |
|
|
||||||
| USE_WEBSERVER | x | x | x | x | x |
|
|
||||||
| USE_EMULATION | x | x | - | - | x |
|
|
||||||
| USE_DISCOVERY | x | x | - | x | x |
|
|
||||||
| WEBSERVER_ADVERTISE | x | x | - | x | x |
|
|
||||||
| MQTT_HOST_DISCOVERY | x | x | - | x | x |
|
|
||||||
| USE_TIMERS | x | - | - | x | x |
|
|
||||||
| USE_TIMERS_WEB | x | - | - | x | x |
|
|
||||||
| USE_SUNRISE | x | - | - | x | x |
|
|
||||||
| USE_RULES | x | - | - | x | x |
|
|
||||||
| | | | | | |
|
|
||||||
| Feature or Sensor | sonoff | classic | minimal | knx | sensors |
|
|
||||||
| USE_ADC_VCC | x | x | x | x | x |
|
|
||||||
| USE_DS18B20 | x | x | - | x | - |
|
|
||||||
| USE_DS18x20 | - | - | - | - | x |
|
|
||||||
| USE_DS18x20_LEGACY | - | - | - | - | - |
|
|
||||||
| | | | | | |
|
|
||||||
| USE_I2C | x | - | - | x | x |
|
|
||||||
| USE_SHT | x | - | - | x | x |
|
|
||||||
| USE_HTU | x | - | - | x | x |
|
|
||||||
| USE_BMP | x | - | - | x | x |
|
|
||||||
| USE_BME680 | - | - | - | - | x |
|
|
||||||
| USE_BH1750 | x | - | - | x | x |
|
|
||||||
| USE_VEML6070 | - | - | - | - | x |
|
|
||||||
| USE_ADS1115 | - | - | - | - | x |
|
|
||||||
| USE_ADS1115_I2CDEV | - | - | - | - | - |
|
|
||||||
| USE_INA219 | - | - | - | - | x |
|
|
||||||
| USE_SHT3X | x | - | - | x | x |
|
|
||||||
| USE_TSL2561 | - | - | - | - | x |
|
|
||||||
| USE_MGS | - | - | - | - | x |
|
|
||||||
| USE_SGP30 | x | - | - | x | x |
|
|
||||||
| USE_SI1145 | - | - | - | - | x |
|
|
||||||
| USE_LM75AD | x | - | - | x | x |
|
|
||||||
| USE_APDS9960 | - | - | - | - | - |
|
|
||||||
| USE_MCP230xx | - | - | - | - | - |
|
|
||||||
| USE_MPR121 | - | - | - | - | - |
|
|
||||||
| USE_CCS811 | - | - | - | - | - |
|
|
||||||
| USE_MPU6050 | - | - | - | - | - |
|
|
||||||
| | | | | | |
|
|
||||||
| Feature or Sensor | sonoff | classic | minimal | knx | sensors |
|
|
||||||
| USE_SPI | - | - | - | - | - |
|
|
||||||
| USE_MHZ19 | x | - | - | x | x |
|
|
||||||
| USE_SENSEAIR | x | - | - | x | x |
|
|
||||||
| USE_PMS5003 | x | - | - | x | x |
|
|
||||||
| USE_NOVA_SDS | x | - | - | x | x |
|
|
||||||
| USE_PZEM004T | x | - | - | x | x |
|
|
||||||
| USE_SERIAL_BRIDGE | x | - | - | x | x |
|
|
||||||
| USE_SDM120 | - | - | - | - | x |
|
|
||||||
| USE_SDM630 | - | - | - | - | x |
|
|
||||||
| USE_IR_REMOTE | x | - | - | x | x |
|
|
||||||
| USE_IR_HVAC | - | - | - | - | x |
|
|
||||||
| USE_IR_RECEIVE | x | - | - | x | x |
|
|
||||||
| USE_WS2812 | x | x | - | x | x |
|
|
||||||
| USE_WS2812_DMA | - | - | - | - | - |
|
|
||||||
| USE_ARILUX_RF | x | - | - | x | x |
|
|
||||||
| USE_SR04 | x | - | - | x | x |
|
|
||||||
| USE_TM1638 | - | - | - | - | - |
|
|
||||||
| USE_RF_FLASH | x | - | - | x | x |
|
|
||||||
|
|
||||||
See [Tasmota ESP/Arduino library version related issues](https://github.com/arendst/Sonoff-Tasmota/wiki/Theo's-Tasmota-Tips#20180523---relation-tasmota-and-esp8266arduino-core-version) for more information.
|
|
||||||
|
|
||||||
### Contribute
|
### Contribute
|
||||||
You can contribute to Sonoff-Tasmota by
|
You can contribute to Sonoff-Tasmota by
|
||||||
- providing Pull Requests (Features, Proof of Concepts, Language files or Fixes)
|
- providing Pull Requests (Features, Proof of Concepts, Language files or Fixes)
|
||||||
|
|
140
RELEASENOTES.md
140
RELEASENOTES.md
|
@ -8,7 +8,7 @@ See [wiki migration path](https://github.com/arendst/Sonoff-Tasmota/wiki/Upgrade
|
||||||
|
|
||||||
## Release notes
|
## Release notes
|
||||||
### Change in default initial configuration tool
|
### Change in default initial configuration tool
|
||||||
Firmware binary **sonoff-classic.bin** supports **WifiManager, Wps and SmartConfig** for initial configuration. The default tools is Wps.
|
Firmware binary **sonoff-classic.bin** supports **WifiManager, Wps and SmartConfig** for initial configuration. The default tool is **Wps**.
|
||||||
|
|
||||||
To save memory space all other binaries support **WifiManager only**.
|
To save memory space all other binaries support **WifiManager only**.
|
||||||
|
|
||||||
|
@ -29,7 +29,141 @@ The following binary downloads have been compiled with ESP8266/Arduino library v
|
||||||
|
|
||||||
See [Tasmota ESP/Arduino library version related issues](https://github.com/arendst/Sonoff-Tasmota/wiki/Theo's-Tasmota-Tips#20180523---relation-tasmota-and-esp8266arduino-core-version) why these files are still released using ESP/Arduino library version v2.3.0.
|
See [Tasmota ESP/Arduino library version related issues](https://github.com/arendst/Sonoff-Tasmota/wiki/Theo's-Tasmota-Tips#20180523---relation-tasmota-and-esp8266arduino-core-version) why these files are still released using ESP/Arduino library version v2.3.0.
|
||||||
|
|
||||||
|
### Available Features and Sensors
|
||||||
|
|
||||||
|
| Feature or Sensor | minimal | classic | sonoff | knx | sensors | Remarks
|
||||||
|
|--------------------------------|---------|---------|--------|------|---------|--------
|
||||||
|
| ESP/Arduino lib v2.3.0 | 340k | 477k | 473k | 492k | 497k |
|
||||||
|
| ESP/Arduino lib v2.4.2 | 360k | 491k | 491k | 509k | 513k | No sleep
|
||||||
|
| | | | | | |
|
||||||
|
| MY_LANGUAGE en-GB | x | x | x | x | x |
|
||||||
|
| USE_WPS | - | x | - | - | - | WPS
|
||||||
|
| USE_SMARTCONFIG | - | x | - | - | - | SmartConfig
|
||||||
|
| USE_ARDUINO_OTA | - | - | - | - | - |
|
||||||
|
| MQTT_LIBRARY_TYPE PUBSUBCLIENT | x | x | x | x | x |
|
||||||
|
| USE_DOMOTICZ | - | x | x | x | x |
|
||||||
|
| USE_HOME_ASSISTANT | - | x | x | x | x |
|
||||||
|
| USE_MQTT_TLS | - | - | - | - | - |
|
||||||
|
| USE_KNX | - | - | - | x | - |
|
||||||
|
| USE_WEBSERVER | x | x | x | x | x | WifiManager
|
||||||
|
| USE_EMULATION | - | x | x | - | x |
|
||||||
|
| USE_DISCOVERY | - | x | x | x | x |
|
||||||
|
| WEBSERVER_ADVERTISE | - | x | x | x | x |
|
||||||
|
| MQTT_HOST_DISCOVERY | - | x | x | x | x |
|
||||||
|
| USE_TIMERS | - | - | x | x | x |
|
||||||
|
| USE_TIMERS_WEB | - | - | x | x | x |
|
||||||
|
| USE_SUNRISE | - | - | x | x | x |
|
||||||
|
| USE_RULES | - | - | x | x | x |
|
||||||
|
| | | | | | |
|
||||||
|
| USE_ADC_VCC | x | x | x | x | x |
|
||||||
|
| USE_DS18B20 | - | - | - | - | - | Single sensor
|
||||||
|
| USE_DS18x20 | - | x | x | x | x | Multiple sensors
|
||||||
|
| USE_DS18x20_LEGACY | - | - | - | - | - | Multiple sensors
|
||||||
|
| | | | | | |
|
||||||
|
| Feature or Sensor | minimal | classic | sonoff | knx | sensors |
|
||||||
|
| USE_I2C | - | - | x | x | x |
|
||||||
|
| USE_SHT | - | - | x | x | x |
|
||||||
|
| USE_HTU | - | - | x | x | x |
|
||||||
|
| USE_BMP | - | - | x | x | x |
|
||||||
|
| USE_BME680 | - | - | - | - | x |
|
||||||
|
| USE_BH1750 | - | - | x | x | x |
|
||||||
|
| USE_VEML6070 | - | - | - | - | x |
|
||||||
|
| USE_ADS1115 | - | - | - | - | x |
|
||||||
|
| USE_ADS1115_I2CDEV | - | - | - | - | - |
|
||||||
|
| USE_INA219 | - | - | - | - | x |
|
||||||
|
| USE_SHT3X | - | - | x | x | x |
|
||||||
|
| USE_TSL2561 | - | - | - | - | x |
|
||||||
|
| USE_MGS | - | - | - | - | x |
|
||||||
|
| USE_SGP30 | - | - | x | x | x |
|
||||||
|
| USE_SI1145 | - | - | - | - | x |
|
||||||
|
| USE_LM75AD | - | - | x | x | x |
|
||||||
|
| USE_APDS9960 | - | - | - | - | - |
|
||||||
|
| USE_MCP230xx | - | - | - | - | - |
|
||||||
|
| USE_MPR121 | - | - | - | - | - |
|
||||||
|
| USE_CCS811 | - | - | - | - | - |
|
||||||
|
| USE_MPU6050 | - | - | - | - | - |
|
||||||
|
| | | | | | |
|
||||||
|
| Feature or Sensor | minimal | classic | sonoff | knx | sensors |
|
||||||
|
| USE_SPI | - | - | - | - | - |
|
||||||
|
| USE_MHZ19 | - | - | x | x | x |
|
||||||
|
| USE_SENSEAIR | - | - | x | x | x |
|
||||||
|
| USE_PMS5003 | - | - | x | x | x |
|
||||||
|
| USE_NOVA_SDS | - | - | x | x | x |
|
||||||
|
| USE_PZEM004T | - | - | x | x | x |
|
||||||
|
| USE_SERIAL_BRIDGE | - | - | x | x | x |
|
||||||
|
| USE_SDM120 | - | - | - | - | x |
|
||||||
|
| USE_SDM630 | - | - | - | - | x |
|
||||||
|
| USE_IR_REMOTE | - | - | x | x | x |
|
||||||
|
| USE_IR_HVAC | - | - | - | - | x |
|
||||||
|
| USE_IR_RECEIVE | - | - | x | x | x |
|
||||||
|
| USE_WS2812 | - | x | x | x | x |
|
||||||
|
| USE_WS2812_DMA | - | - | - | - | - |
|
||||||
|
| USE_ARILUX_RF | - | - | x | x | x |
|
||||||
|
| USE_SR04 | - | - | x | x | x |
|
||||||
|
| USE_TM1638 | - | - | - | - | - |
|
||||||
|
| USE_RF_FLASH | - | - | x | x | x |
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
Version 6.2.0 20180901
|
Version 6.2.0 20180901
|
||||||
|
* Allow user override of define MAX_RULE_VARS and MAX_RULE_TIMERS (#3561)
|
||||||
tbd
|
* Disable wifi sleep for both Esp8266/Arduino core 2.4.1 and 2.4.2 to solve device freeze caused by Espressif SDK bug (#3554)
|
||||||
|
* Change DS18B20 driver to provide better instant results
|
||||||
|
* Change some sensor drivers to provide instant results
|
||||||
|
* Change define USE_ALL_SENSORS to USE_SENSORS as it doesn't contain all sensors due to duplicate I2C addresses
|
||||||
|
* Change some sensor update timings: AdcEvery 200 -> 250, Senseair 300 -> 250, SDM120 300 -> 250, SDM630 300 -> 250
|
||||||
|
* Change default Wifi config option from WPS to Wifi Manager if WPS is disabled or Wifi Smartconfig if webserver is disabled or Wifi Serial input if Smartconfig is disabled
|
||||||
|
* Change SHT1x driver to provide better instant results and fix I2C interference
|
||||||
|
* Change DHT driver to provide better instant results and add decimals to DHT11 (#3164)
|
||||||
|
* Change DS18x20 driver to provide better instant results (#3169)
|
||||||
|
* Change CounterType 1 from milliseconds to microseconds (#3437)
|
||||||
|
* Change scheduler for better sleep support using Uptime, Delay, PulseTime and TelePeriod, Blinktime (#3581)
|
||||||
|
* Remove unused functionality from Sonoff-minimal to save space
|
||||||
|
* Remove WPS and SmartConfig from sonoff-minimal saving 56k code space
|
||||||
|
* Remove TSL2561 debug message and update library (#2415)
|
||||||
|
* Remove forced restart when sleep command is executed (#3554)
|
||||||
|
* Fix invalid response using more than 4 switches and domoticz
|
||||||
|
* Fix sonoff-minimal not using default settings
|
||||||
|
* Fix unsecure main webpage update
|
||||||
|
* Fix DHT driver mixing values for different sensors (#1797)
|
||||||
|
* Fix EnergyReset3 regression not clearing total energy (#2723)
|
||||||
|
* Fix rules once regression from v6.1.0 (#3198, #3226)
|
||||||
|
* Fix command Scale buffer overflow (#3236)
|
||||||
|
* Fix possible WDT due to long MQTT publish handling (#3313)
|
||||||
|
* Fix command TimeDst/TimeStd invalid JSON (#3322)
|
||||||
|
* Fix handling of default names when using names starting with shortcut character ",0,1 or 2 (#3392, #3600, #3618)
|
||||||
|
* Fix LM75AD I2C sensor detection (#3408)
|
||||||
|
* Fix iFan02 power on state (#3412, #3530)
|
||||||
|
* Fix some Pow R2 and S31 checksum errors using optimized re-sync (#3425)
|
||||||
|
* Fix SDM120 reporting wrong negative values to Domoticz (#3521)
|
||||||
|
* Fix MQTT reconnection detection when using TasmotaMqtt library (#3558)
|
||||||
|
* Fix OtaMagic when file path contains a dash (-) (#3563)
|
||||||
|
* Fix Sonoff Bridge data reception when using Portisch EFM8 firmware using in data buffer length (#3605)
|
||||||
|
* Add read sensor retry to DS18B20, DS18x20, DHT, SHT1X and HTU21
|
||||||
|
* Add user selection of Wifi Smartconfig as define USE_SMARTCONFIG in user_config.h
|
||||||
|
* Add wifi and mqtt status led blinkyblinky to be disabled by SetOption31 1. Does not work when LedPower is On (deliberate) (#871, #2230, #3114, #3155)
|
||||||
|
* Add support for TM1638 switch (#2226)
|
||||||
|
* Add GPIO options ButtonXn, SwitchXn and CounterXn to select INPUT mode instead of INPUT_PULLUP (#2525)
|
||||||
|
* Add support for APDS9960 proximity sensor (#3051)
|
||||||
|
* Add support for MPR121 controller in input mode for touch buttons (#3142)
|
||||||
|
* Add support for MCP230xx for general purpose input expansion and command Sensor29 (#3188)
|
||||||
|
* Add default Wifi Configuration tool as define WIFI_CONFIG_NO_SSID in user_config.h if no SSID is configured (#3224)
|
||||||
|
* Add command Timers 0/1 to globally disable or enable armed timers (#3270)
|
||||||
|
* Add support for CCS811 sensor (#3309)
|
||||||
|
* Add Turkish language file (#3332)
|
||||||
|
* Add command SerialSend4 to send binary serial data (#3345)
|
||||||
|
* Add initial support for sensor MPU6050 (#3352)
|
||||||
|
* Add rule triggers Wifi#Connected and Wifi#Disconnected (#3359)
|
||||||
|
* Add option + to command Rule to concatenate new rule with existing rules (#3365)
|
||||||
|
* Add message when JavaScript is not enabled in webbrowser (#3388)
|
||||||
|
* Add build time setting of ButtonTopic and SwitchTopic (#3414)
|
||||||
|
* Add iFan02 Fanspeed + and Fanspeed - command options (#3415)
|
||||||
|
* Add Individual HSBColorX commands (#3430, #3615)
|
||||||
|
* Add output support on MCP23008/MCP23017 (#3436)
|
||||||
|
* Add modulo option to rules like rule1 on Time#Minute|5 do backlog power on;delay 200;power off endon (#3466)
|
||||||
|
* Add RGB support for Domoticz (#3547)
|
||||||
|
* Add all ruletimer values to command RuleTimer result message (#3571)
|
||||||
|
* Add command Publish2 for publishing retained MQTT messages (#3593)
|
||||||
|
* Add commands ButtonDebounce 40..1000 and SwitchDebounce 40..1000 to have user control over debounce timing. Default is 50mS (#3594)
|
||||||
|
* Add RuleX debug options 8,9,10 (StopOnError) to control RuleX execution status after an exception restart (#3607)
|
||||||
|
* Add rule variables %sunrise%, %sunset%, %uptime% and %time% (#3608)
|
||||||
|
* Add optional MQTT_TELE_RETAIN to Energy Margins message (#3612, 3614)
|
||||||
|
|
|
@ -270,7 +270,7 @@
|
||||||
|
|
||||||
// -- One wire sensors ----------------------------
|
// -- One wire sensors ----------------------------
|
||||||
// WARNING: Select none for default one DS18B20 sensor or enable one of the following two options for multiple sensors
|
// WARNING: Select none for default one DS18B20 sensor or enable one of the following two options for multiple sensors
|
||||||
//#define USE_DS18x20 // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code)
|
#define USE_DS18x20 // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code)
|
||||||
//#define USE_DS18x20_LEGACY // Optional for more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code)
|
//#define USE_DS18x20_LEGACY // Optional for more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code)
|
||||||
|
|
||||||
// -- I2C sensors ---------------------------------
|
// -- I2C sensors ---------------------------------
|
||||||
|
|
|
@ -1083,50 +1083,45 @@ boolean LightCommand()
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, round(light_current_color[XdrvMailbox.index -1] / 2.55));
|
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, round(light_current_color[XdrvMailbox.index -1] / 2.55));
|
||||||
}
|
}
|
||||||
else if ((CMND_HSBCOLOR == command_code) && ( light_subtype >= LST_RGB)) {
|
else if ((CMND_HSBCOLOR == command_code) && ( light_subtype >= LST_RGB)) {
|
||||||
// Implement method to "direct set" color by HSB (HSB is passed comma separated, 0<H<360 0<S<100 0<B<100 )
|
bool validHSB = (XdrvMailbox.data_len > 0);
|
||||||
uint16_t HSB[3];
|
if (validHSB) {
|
||||||
bool validHSB = true;
|
uint16_t HSB[3];
|
||||||
|
if (strstr(XdrvMailbox.data, ",")) { // Command with 3 comma separated parameters, Hue (0<H<360), Saturation (0<S<100) AND Brightness (0<B<100)
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
char *substr;
|
||||||
|
|
||||||
if (strstr(XdrvMailbox.data, ",")) { // Command with 3 comma separated parameters (Hue, Saturation AND Brightness)
|
if (0 == i) {
|
||||||
for (int i = 0; i < 3; i++) {
|
substr = strtok(XdrvMailbox.data, ",");
|
||||||
char *substr;
|
} else {
|
||||||
|
substr = strtok(NULL, ",");
|
||||||
if (0 == i) {
|
}
|
||||||
substr = strtok(XdrvMailbox.data, ",");
|
if (substr != NULL) {
|
||||||
} else {
|
HSB[i] = atoi(substr);
|
||||||
substr = strtok(NULL, ",");
|
} else {
|
||||||
|
validHSB = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (substr != NULL) {
|
} else { // Command with only 1 parameter, Hue (0<H<360), Saturation (0<S<100) OR Brightness (0<B<100)
|
||||||
HSB[i] = atoi(substr);
|
float hsb[3];
|
||||||
|
|
||||||
|
LightGetHsb(&hsb[0],&hsb[1],&hsb[2]);
|
||||||
|
HSB[0] = round(hsb[0] * 360);
|
||||||
|
HSB[1] = round(hsb[1] * 100);
|
||||||
|
HSB[2] = round(hsb[2] * 100);
|
||||||
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index < 4)) {
|
||||||
|
HSB[XdrvMailbox.index -1] = XdrvMailbox.payload;
|
||||||
} else {
|
} else {
|
||||||
validHSB = false;
|
validHSB = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // Command with only 1 parameter (Hue, Saturation OR Brightness)
|
if (validHSB) {
|
||||||
float hsb[3];
|
// Translate to fractional elements as required by LightHsbToRgb
|
||||||
|
// Keep the results <=1 in the event someone passes something out of range.
|
||||||
LightGetHsb(&hsb[0],&hsb[1],&hsb[2]);
|
LightSetHsb(( (HSB[0]>360) ? (HSB[0] % 360) : HSB[0] ) /360.0,
|
||||||
HSB[0] = round(hsb[0] * 360);
|
( (HSB[1]>100) ? (HSB[1] % 100) : HSB[1] ) /100.0,
|
||||||
HSB[1] = round(hsb[1] * 100);
|
( (HSB[2]>100) ? (HSB[2] % 100) : HSB[2] ) /100.0,
|
||||||
HSB[2] = round(hsb[2] * 100);
|
0);
|
||||||
if (XdrvMailbox.index = 1) { // Hue
|
|
||||||
HSB[0] = XdrvMailbox.payload;
|
|
||||||
} else if (XdrvMailbox.index = 2) { // Saturation
|
|
||||||
HSB[1] = XdrvMailbox.payload;
|
|
||||||
} else if (XdrvMailbox.index = 3) { // Brightness
|
|
||||||
HSB[2] = XdrvMailbox.payload;
|
|
||||||
} else {
|
|
||||||
validHSB = false;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (validHSB) {
|
|
||||||
// Translate to fractional elements as required by LightHsbToRgb
|
|
||||||
// Keep the results <=1 in the event someone passes something
|
|
||||||
// out of range.
|
|
||||||
LightSetHsb(( (HSB[0]>360) ? (HSB[0] % 360) : HSB[0] ) /360.0,
|
|
||||||
( (HSB[1]>100) ? (HSB[1] % 100) : HSB[1] ) /100.0,
|
|
||||||
( (HSB[2]>100) ? (HSB[2] % 100) : HSB[2] ) /100.0,
|
|
||||||
0);
|
|
||||||
} else {
|
} else {
|
||||||
LightState(0);
|
LightState(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue