diff --git a/.gitignore b/.gitignore index f28d51334..e9c55b5b9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ firmware.map firmware.asm tasmota*.bin tasmota*.map +platformio_override.ini ## Visual Studio Code specific ###### .vscode diff --git a/.travis.yml b/.travis.yml index ee82b6f06..911f3423e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,7 @@ install: - platformio upgrade - platformio update -cache: - directories: - - .cache - - $HOME/.platformio +cache: false env: - ENV=tasmota diff --git a/RELEASENOTES.md b/RELEASENOTES.md index a07bd3e5e..afb4c18ee 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -128,33 +128,39 @@ The following binary downloads have been compiled with ESP8266/Arduino library c ### Version 7.1.0 Betty - - Remove update support for versions before 6.0 - - Remove driver xsns_12_ads1115_i2cdev replaced by xsns_12_ads1115 - - Remove most IR protocols from non dedicated IR firmware except NEC, RC5 and RC6 - - Change repository name from Sonoff-Tasmota to Tasmota and all code references from Sonoff to Tasmota - - Change default GUI to dark theme - - Change ArduinoSlave to TasmotaSlave - - Change IRremoteESP8266 library to v2.7.0 - - Change supported PCF8574 I2C address range to 0x20 - 0x26 allowing other I2C devices with address 0x27 to be used at the same time - - Change supported PCF8574A I2C address range to 0x39 - 0x3F allowing other I2C devices with address 0x38 to be used at the same time - - Change supported MCP230xx I2C address range to 0x20 - 0x26 allowing other I2C devices with address 0x27 to be used at the same time - - Change Reset erase end address from as seen by SDK (getFlashChipSize) to full flash size (getFlashChipRealSize) - - Fix better control of RGB/White when ``SetOption37`` >128, added ``Dimmer1`` and ``Dimmer2`` commands (#6714) - - Fix random crash caused by UPNP flood - - Fix Wifi instability when light is on, due to sleep=0 (#6961, #6608) - - Add support for Tuya battery powered devices (#6735) - - Add support for Honeywell I2C HIH series Humidity and Temperetaure sensor (#6808) - - Add support for Honeywell HPMA115S0 particle concentration sensor by David Hunt (#6843) - - Add support for I2C sensor TLS2591 Light Intensity sensor (#6873) - - Add command ``SetOption73 0/1`` to re-enable HTTP Cross-Origin Resource Sharing (CORS) now default disabled (#6767) - - Add command ``SetOption74 0/1`` to enable DS18x20 internal pull-up and remove define DS18B20_INTERNAL_PULLUP (#6795) - - Add command ``SetOption75 0/1`` to switch between grouptopic (0) using fulltopic replacing %topic% or (1) is cmnd/\ (#6779) - - Add command ``SetOption76 0/1`` to enable incrementing bootcount when deepsleep is enabled (#6930) - - Add command ``I2cDriver`` for I2C driver runtime control using document I2CDEVICES.md - - Add command ``TempOffset -12.6 .. 12.6`` to set global temperature sensor offset (#6958) - - Add command ``WebColor19`` to control color of Module and Name (#6811) - - Add command ``WifiPower 0 .. 20.5`` to set Wifi Output Power which will be default set to 17dBm - - Add frequency to ADE7953 energy monitor as used in Shelly 2.5 by ljakob (#6778) - - Add hide Alexa objects with friendlyname starting with '$' (#6722, #6762) - - Add Zigbee command support, considered as v1.0 for full Zigbee support - - Add colorpicker to WebUI by Christian Staars (#6984) +- Remove update support for versions before 6.0 +- Remove driver xsns_12_ads1115_i2cdev replaced by xsns_12_ads1115 +- Remove most IR protocols from non dedicated IR firmware except NEC, RC5 and RC6 +- Change repository name from Sonoff-Tasmota to Tasmota and all code references from Sonoff to Tasmota +- Change documentation from wiki to [documentation repository](https://tasmota.github.io/docs/) by @Blakadder +- Change default GUI to dark theme +- Change ArduinoSlave to TasmotaSlave +- Change IRremoteESP8266 library to v2.7.1 +- Change supported PCF8574 I2C address range to 0x20 - 0x26 allowing other I2C devices with address 0x27 to be used at the same time +- Change supported PCF8574A I2C address range to 0x39 - 0x3F allowing other I2C devices with address 0x38 to be used at the same time +- Change supported MCP230xx I2C address range to 0x20 - 0x26 allowing other I2C devices with address 0x27 to be used at the same time +- Change Reset erase end address from as seen by SDK (getFlashChipSize) to full flash size (getFlashChipRealSize) +- Change new Fade system much smoother, Speed now up to 40 (#6942, #3714) +- Fix better control of RGB/White when ``SetOption37`` >128, added ``Dimmer1`` and ``Dimmer2`` commands (#6714) +- Fix random crash caused by UPNP flood +- Fix check deepsleep for valid values in Settings (#6961) +- Fix Wifi instability when light is on, due to ``Sleep 0`` (#6961, #6608) +- Fix auto-power on/off when setting channel to non-zero or zero value, when ``SetOption68 1`` +- Fix postpone saving settings to flash until Fade is complete, avoids pause in Fade +- Add support for Tuya battery powered devices (#6735) +- Add support for Honeywell I2C HIH series Humidity and Temperetaure sensor (#6808) +- Add support for Honeywell HPMA115S0 particle concentration sensor by David Hunt (#6843) +- Add support for I2C sensor TLS2591 Light Intensity sensor (#6873) +- Add command ``SetOption73 0/1`` to re-enable HTTP Cross-Origin Resource Sharing (CORS) now default disabled (#6767) +- Add command ``SetOption74 0/1`` to enable DS18x20 internal pull-up and remove define DS18B20_INTERNAL_PULLUP (#6795) +- Add command ``SetOption75 0/1`` to switch between grouptopic (0) using fulltopic replacing %topic% or (1) is cmnd/\ (#6779) +- Add command ``SetOption76 0/1`` to enable incrementing bootcount when deepsleep is enabled (#6930) +- Add command ``I2cDriver`` for I2C driver runtime control using document I2CDEVICES.md +- Add command ``TempOffset -12.6 .. 12.6`` to set global temperature sensor offset (#6958) +- Add command ``WebColor19`` to control color of Module and Name (#6811) +- Add command ``WifiPower 0 .. 20.5`` to set Wifi Output Power which will be default set to 17dBm +- Add frequency to ADE7953 energy monitor as used in Shelly 2.5 by ljakob (#6778) +- Add hide Alexa objects with friendlyname starting with '$' (#6722, #6762) +- Add Zigbee command support, considered as v1.0 for full Zigbee support +- Add hardware detection to be overruled with ``SetOption51`` (#6969) +- Add Colorpicker to WebUI by Christian Staars (#6984) diff --git a/platformio.ini b/platformio.ini index 7e3eaec21..cdce62e9d 100755 --- a/platformio.ini +++ b/platformio.ini @@ -11,6 +11,7 @@ src_dir = tasmota build_dir = .pioenvs build_cache_dir = .cache +extra_configs = platformio_override.ini ; *** Build/upload environment default_envs = @@ -101,6 +102,8 @@ extra_scripts = pio/strip-floats.py ; Select one core set for platform and build_flags platform = ${core_2_6_1.platform} build_flags = ${core_2_6_1.build_flags} +;platform = ${core_2_6_2.platform} +;build_flags = ${core_2_6_2.build_flags} ;platform = ${core_stage.platform} ;build_flags = ${core_stage.build_flags} @@ -113,7 +116,51 @@ build_flags = -D NDEBUG [core_2_6_1] ; *** Esp8266 core for Arduino version 2.6.1 -platform = https://github.com/platformio/platform-espressif8266.git#develop +platform = espressif8266@2.3.0 +build_flags = ${esp82xx_defaults.build_flags} + -Wl,-Teagle.flash.1m.ld + -DBEARSSL_SSL_BASIC +; NONOSDK221 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK221 +; NONOSDK22x_190313 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190313 +; NONOSDK22x_190703 = 2.2.2-dev(38a443e) (Tasmota default) + -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 +; NONOSDK22x_191024 = 2.2.2-dev(5ab15d1) +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191024 +; NONOSDK22x_191105 = 2.2.2-dev(bb83b9b) +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191105 +; NONOSDK3V0 (known issues) +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3 +; lwIP 1.4 +; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH +; lwIP 2 - Low Memory +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY +; lwIP 2 - Higher Bandwidth +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH +; lwIP 2 - Higher Bandwidth Low Memory no Features +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH +; lwIP 2 - Higher Bandwidth no Features (Tasmota default) + -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH +; lwIP 2 - Higher Bandwidth IPv6 (use ONLY if you need IPv6, experimental!) +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH +; VTABLES in Flash (Tasmota default) + -DVTABLES_IN_FLASH +; VTABLES in Heap +; -DVTABLES_IN_DRAM +; VTABLES in IRAM +; -DVTABLES_IN_IRAM +; enable one option set -> No exception recommended +; No exception code in firmware + -fno-exceptions + -lstdc++ +; Exception code in firmware /needs much space! 90k +; -fexceptions +; -lstdc++-exc + +[core_2_6_2] +; *** Esp8266 core for Arduino version 2.6.2 +platform = espressif8266@2.3.1 build_flags = ${esp82xx_defaults.build_flags} -Wl,-Teagle.flash.1m.ld -DBEARSSL_SSL_BASIC diff --git a/platformio_override_sample.ini b/platformio_override_sample.ini new file mode 100644 index 000000000..bd4ed2a13 --- /dev/null +++ b/platformio_override_sample.ini @@ -0,0 +1,37 @@ +; PlatformIO Project Configuration Override File +; +; Build options: build flags, source filter, extra scripting +; Upload options: custom port, speed and extra flags +; Library options: dependencies, extra library storages +; +; Please visit documentation for the other options and examples +; http://docs.platformio.org/en/stable/projectconf.html + +[platformio] + +; *** Build/upload environment +default_envs = +; *** Uncomment the line(s) below to select version(s) + tasmota +; tasmota-debug +; tasmota-ircustom ; alternative to 'tasmota' with full IR protocols activated, you will need to disable some features to keep code not too big +; tasmota-minimal +; tasmota-basic +; tasmota-knx +; tasmota-sensors +; tasmota-display +; tasmota-ir + + +[common] +; *** Use settings from file user_config_override.h +build_flags = ${core_active.build_flags} + -DUSE_CONFIG_OVERRIDE + +; *** Upload Serial reset method for Wemos and NodeMCU +upload_port = COM5 + +[core_active] + +platform = ${core_2_6_2.platform} +build_flags = ${core_2_6_2.build_flags} diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index 2d0acc894..5c7202aae 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -6,6 +6,8 @@ - Change new Fade system much smoother, Speed now up to 40 (#6942, #3714) - Fix Arduino IDE function prototyping compile error (#6982) - Change update lib IRremoteESP8266 updated to v2.7.1, -2.7k flash and -1.5k RAM for Tasmota-IR +- Fix auto--power on/off when setting channel to non-zero or zero value, when SetOption68 1 +- Fix postpone saving settings to flash until Fade is complete, avoids pause in Fade ### 7.0.0.5 20191118 diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 3e06446ec..695815d71 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1444,27 +1444,24 @@ void LightPreparePower(power_t channels = 0xFFFFFFFF) { // 1 = only RGB, 2 = #endif // If multi-channels, then we only switch off channels with a value of zero if (Light.pwm_multi_channels) { -// for (uint32_t i = 0; i < Light.subtype; i++) { -// // if channel is non-null, channel is supposed to be on, but it is off, do Power On -// if ((Light.current_color[i]) && (bitRead(Light.power, i)) && (0 == bitRead(power, i + Light.device - 1))) { -// ExecuteCommandPower(Light.device + i, POWER_ON_NO_STATE, SRC_LIGHT); -// //bitSet(Settings.power, i + Light.device - 1); -// #ifdef DEBUG_LIGHT -// AddLog_P2(LOG_LEVEL_DEBUG, "ExecuteCommandPower ON device=%d", Light.device + i); -// #endif -// } -// // if channel is zero and channel is on, set it off -// if ((0 == Light.current_color[i]) && bitRead(power, i + Light.device - 1)) { -// ExecuteCommandPower(Light.device + i, POWER_OFF_NO_STATE, SRC_LIGHT); -// //bitClear(Settings.power, i + Light.device - 1); -// #ifdef DEBUG_LIGHT -// AddLog_P2(LOG_LEVEL_DEBUG, "ExecuteCommandPower OFF device=%d", Light.device + i); -// #endif -// } -// #ifdef USE_DOMOTICZ -// DomoticzUpdatePowerState(Light.device + i); -// #endif // USE_DOMOTICZ -// } + for (uint32_t i = 0; i < Light.subtype; i++) { + if (bitRead(channels, i)) { + // if channel is non-null, channel is supposed to be on, but it is off, do Power On + if ((Light.current_color[i]) && (!bitRead(Light.power, i))) { + if (!Settings.flag.not_power_linked) { // SetOption20 - Control power in relation to Dimmer/Color/Ct changes + ExecuteCommandPower(Light.device + i, POWER_ON_NO_STATE, SRC_LIGHT); + } + } else { + // if channel is zero and channel is on, set it off + if ((0 == Light.current_color[i]) && bitRead(Light.power, i)) { + ExecuteCommandPower(Light.device + i, POWER_OFF_NO_STATE, SRC_LIGHT); + } + } + #ifdef USE_DOMOTICZ + DomoticzUpdatePowerState(Light.device + i); + #endif // USE_DOMOTICZ + } + } } else { if (light_controller.isCTRGBLinked()) { // linked, standard if (light_state.getBri() && !(Light.power)) { @@ -1795,6 +1792,12 @@ void LightApplyFade(void) { // Note: Settings.light_speed is the number of half-seconds for a 100% fade, // i.e. light_speed=1 means 1024 steps in 10 ticks (500ms) Light.fade_duration = (distance * Settings.light_speed * 10) / 1024; + // Also postpone the save_data for the duration of the Fade (in seconds) + uint32_t delay_seconds = 1 + (Light.fade_duration + 19) / 20; // add one more second + // AddLog_P2(LOG_LEVEL_INFO, PSTR("delay_seconds %d, save_data_counter %d"), delay_seconds, save_data_counter); + if (save_data_counter < delay_seconds) { + save_data_counter = delay_seconds; // pospone + } } else { // no fade needed, we keep the duration at zero, it will fallback directly to end of fade }