From 7344fd54dc80d5117349b6031833b122b580d85a Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Wed, 16 Nov 2022 21:24:57 +0100 Subject: [PATCH 1/4] Fix ArtNet crash --- tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino b/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino index 701374bd1..c2620fd9d 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino @@ -146,8 +146,12 @@ void ArtNetProcessPacket(uint8_t * buf, size_t len) { if (artnet_conf.matrix) { // Ws2812 led strip size_t pix_size = Ws2812StripGetPixelSize(); + // check that datalen does not exceed the number of columns + if (datalen > artnet_conf.cols * pix_size) { datalen = artnet_conf.cols * pix_size; } + // round to exact number of pixels datalen = datalen - (datalen % pix_size); + size_t offset_in_matrix = 0; if (artnet_conf.alt && (row % 2)) { for (int32_t i = idx, j = idx + datalen - pix_size; i < j; i += pix_size, j -= pix_size) { for (int32_t k = 0; k < pix_size; k++) { @@ -156,6 +160,7 @@ void ArtNetProcessPacket(uint8_t * buf, size_t len) { buf[j+k] = temp; } } + offset_in_matrix = artnet_conf.cols * pix_size - datalen; // add a potential offset if the frame is smaller than the columns } // process dimmer @@ -179,7 +184,7 @@ void ArtNetProcessPacket(uint8_t * buf, size_t len) { // process pixels size_t h_bytes = artnet_conf.cols * pix_size; // size in bytes of a single row - size_t offset_in_matrix = artnet_conf.offs * pix_size + row * h_bytes; + offset_in_matrix += artnet_conf.offs * pix_size + row * h_bytes; if (datalen > h_bytes) { datalen = h_bytes; } // copy at most one line Ws2812CopyPixels(&buf[idx], datalen, offset_in_matrix); @@ -366,6 +371,8 @@ bool ArtNetStart(void) { Settings->light_pixels = artnet_conf.rows * artnet_conf.cols + artnet_conf.offs; Settings->light_rotation = 0; Ws2812ReinitStrip(); + } else { + Ws2812Clear(); } } From be7581b377e1c226002eb22b5285b04b5beaa2f5 Mon Sep 17 00:00:00 2001 From: Norbert Richter Date: Thu, 17 Nov 2022 11:13:40 +0100 Subject: [PATCH 2/4] Fix linker error using undef USE_WS2812 for ESP32 --- tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino b/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino index c2620fd9d..4dd37548b 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino @@ -21,6 +21,10 @@ #ifdef USE_LIGHT #ifdef USE_LIGHT_ARTNET +#ifndef USE_WS2812 +#define USE_WS2812 // needed since USE_LIGHT_ARTNET is enabled for ESP32 by default +#endif + #ifndef WS2812_ARTNET_UDP_BUFFER_SIZE #define WS2812_ARTNET_UDP_BUFFER_SIZE 140 // Max 30 columns with 4 bytes per pixel #endif From a924e41ff36a59964151f4e5b37ca36a03fc4a2c Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 17 Nov 2022 11:44:51 +0100 Subject: [PATCH 3/4] Bump version v12.2.0.5 - Fixed ModbusBridge baudrates over 76500 baud (#17106) - Bump version v12.2.0.5 --- CHANGELOG.md | 16 +++++++++++++--- RELEASENOTES.md | 3 ++- tasmota/include/tasmota_types.h | 8 ++++++-- tasmota/include/tasmota_version.h | 2 +- tasmota/tasmota_support/settings.ino | 3 +++ 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9c253068..18ea13489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,19 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - Development -## [12.2.0.4] +## [12.2.0.5] +### Added + +### Breaking Changed + +### Changed + +### Fixed +- ModbusBridge baudrates over 76500 baud (#17106) + +### Removed + +## [12.2.0.4] 20221117 ### Added - Support for Plantower PMSx003T AQI models with temperature and humidity (#16971) - Support for Dingtian x595/x165 shift register based relay boards by Barbudor (#17032) @@ -15,8 +27,6 @@ All notable changes to this project will be documented in this file. - Command ``RgxClients`` for range extender clients list (#17048) - Command ``RgxPort [tcp|udp], gateway_port, client_mac, client_port`` for range extender port forwardings (#17092) -### Breaking Changed - ### Changed - Reverted Flash Mode back from ``DIO`` to ``DOUT`` for ESP8266/ESP8285 (#17019) - ESP32 Framework (Core) from v2.0.5.2 to v2.0.5.3 (#17034) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 72288e298..517b565d9 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -107,7 +107,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo [Complete list](BUILDS.md) of available feature and sensors. -## Changelog v12.2.0.4 +## Changelog v12.2.0.5 ### Added - Command ``SetOption47 1..255`` to delay power on relay state in seconds reducing power surge. ``SO47 1`` delays until network connected. ``SO47 2`` delays until mqtt connected - Command ``RgxClients`` for range extender clients list [#17048](https://github.com/arendst/Tasmota/issues/17048) @@ -149,6 +149,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo - Deduplicate code and fix %timer n% rule regression from v12.2.0 [#16914](https://github.com/arendst/Tasmota/issues/16914) - Serial initialization for baudrate and config [#16970](https://github.com/arendst/Tasmota/issues/16970) - ModbusBridge buffer overflow [#16979](https://github.com/arendst/Tasmota/issues/16979) +- ModbusBridge baudrates over 76500 baud [#17106](https://github.com/arendst/Tasmota/issues/17106) - SenseAir S8 module detection [#17033](https://github.com/arendst/Tasmota/issues/17033) ### Removed diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index d1dd5c9eb..fbd94f0ab 100644 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -729,7 +729,9 @@ typedef struct { WebCamCfg2 webcam_config2; // 730 #endif // ESP32 uint16_t artnet_universe; // 734 - uint8_t free_esp32_734[7]; // 736 + uint16_t modbus_sbaudrate; // 736 + + uint8_t free_esp32_738[5]; // 738 uint8_t novasds_startingoffset; // 73D uint8_t web_color[18][3]; // 73E @@ -830,7 +832,9 @@ typedef struct { uint8_t shd_warmup_time; // F5E uint8_t tcp_config; // F5F uint8_t light_step_pixels; // F60 - uint8_t modbus_sbaudrate; // F61 + + uint8_t ex_modbus_sbaudrate; // F61 - v12.2.0.5 + uint8_t modbus_sconfig; // F62 uint8_t free_f63[13]; // F63 - Decrement if adding new Setting variables just above and below diff --git a/tasmota/include/tasmota_version.h b/tasmota/include/tasmota_version.h index 360603d83..4b48759ed 100644 --- a/tasmota/include/tasmota_version.h +++ b/tasmota/include/tasmota_version.h @@ -20,6 +20,6 @@ #ifndef _TASMOTA_VERSION_H_ #define _TASMOTA_VERSION_H_ -const uint32_t VERSION = 0x0C020004; // 12.2.0.4 +const uint32_t VERSION = 0x0C020005; // 12.2.0.5 #endif // _TASMOTA_VERSION_H_ diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 9eeb09103..d3c4fd907 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -1607,6 +1607,9 @@ void SettingsDelta(void) { Settings->energy_voltage_calibration2 = Settings->energy_voltage_calibration; Settings->energy_current_calibration2 = Settings->energy_current_calibration; } + if (Settings->version < 0x0C020005) { // 12.2.0.5 + Settings->modbus_sbaudrate = Settings->ex_modbus_sbaudrate; + } Settings->version = VERSION; SettingsSave(1); From 34ededb9d8822328f3d9e4e5b6d3a59e440f65fa Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 17 Nov 2022 12:01:09 +0100 Subject: [PATCH 4/4] Add comment for future use --- tasmota/tasmota_support/support_wifi.ino | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tasmota/tasmota_support/support_wifi.ino b/tasmota/tasmota_support/support_wifi.ino index 98f11ee90..cb0e2abaa 100644 --- a/tasmota/tasmota_support/support_wifi.ino +++ b/tasmota/tasmota_support/support_wifi.ino @@ -210,13 +210,20 @@ void WifiBegin(uint8_t flag, uint8_t channel) #endif // USE_EMULATION WiFi.persistent(false); // Solve possible wifi init errors (re-add at 6.2.1.16 #4044, #4083) - if (WiFi.getMode() != WIFI_AP_STA) // Preserve range extender connections - { - WiFi.disconnect(true); // Delete SDK wifi config + +/* + // Replaced by below code (20221117) + WiFi.disconnect(true); // Delete SDK wifi config + delay(200); + WifiSetMode(WIFI_STA); // Disable AP mode +*/ + if (WiFi.getMode() != WIFI_AP_STA) { // Preserve range extender connections (#17103) + WiFi.disconnect(true); // Delete SDK wifi config delay(200); - WifiSetMode(WIFI_STA); // Disable AP mode + WifiSetMode(WIFI_STA); // Disable AP mode } + WiFiSetSleepMode(); // if (WiFi.getPhyMode() != WIFI_PHY_MODE_11N) { WiFi.setPhyMode(WIFI_PHY_MODE_11N); } // B/G/N // if (WiFi.getPhyMode() != WIFI_PHY_MODE_11G) { WiFi.setPhyMode(WIFI_PHY_MODE_11G); } // B/G