From 584329a6c0ba231d0cdd4fc151a1ae39b7bcf86d Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 9 May 2024 13:52:07 +0200 Subject: [PATCH 1/5] ESP8266 removed SPI check for valid SPI Chip Select (#21393) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/tasmota_support/support_tasmota.ino | 2 ++ 3 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0ec099f9..216cbed3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ All notable changes to this project will be documented in this file. - TLS Letsencrypt replace R3 CA with long-term ISRG_Root_X1 CA, which works with R3 and R10-R14 (#21352) - GPIOViewer from v1.5.0 to v1.5.2 - ESP32 Core3 platform update from 2024.05.10 to 2024.05.11 (#21381) +- ESP8266 removed SPI check for valid SPI Chip Select (#21393) ### Fixed - HASPmota `align` attribute and expand PNG cache (#21228) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index d4d9ac289..e456efaaf 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -185,6 +185,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Refactor I2S [#21291](https://github.com/arendst/Tasmota/issues/21291) - Zigbee startup event triggered after plugins are loaded [#21320](https://github.com/arendst/Tasmota/issues/21320) - Refactor Tensorflow [#21327](https://github.com/arendst/Tasmota/issues/21327) +- ESP8266 removed SPI check for valid SPI Chip Select [#21393](https://github.com/arendst/Tasmota/issues/21393) - ESP32 refactored Wifi for ESP32 Core3 release [#21106](https://github.com/arendst/Tasmota/issues/21106) - ESP32 WiFi phy modes 11n and 11ax represented as HT20, HT40 and HE20 [#19350](https://github.com/arendst/Tasmota/issues/19350) - berry.exe (pre-compiled for Windows) updated to latest Berry patches [#21024](https://github.com/arendst/Tasmota/issues/21024) diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index c8e3de1b9..216e13b4e 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -2121,6 +2121,7 @@ void GpioInit(void) uint32_t spi_mosi = (14 == Pin(GPIO_SPI_CLK)) && (13 == Pin(GPIO_SPI_MOSI)) ? SPI_MOSI : SPI_NONE; uint32_t spi_miso = (14 == Pin(GPIO_SPI_CLK)) && (12 == Pin(GPIO_SPI_MISO)) ? SPI_MISO : SPI_NONE; TasmotaGlobal.spi_enabled = spi_mosi + spi_miso; +/* if (!TasmotaGlobal.spi_enabled) { bool valid_cs = (ValidSpiPinUsed(GPIO_SPI_CS) || ValidSpiPinUsed(GPIO_RC522_CS) || @@ -2141,6 +2142,7 @@ void GpioInit(void) // If SPI_CS and/or SPI_DC is used they must be valid TasmotaGlobal.spi_enabled = (valid_cs) ? SPI_MOSI_MISO : SPI_NONE; } +*/ if (TasmotaGlobal.spi_enabled) { TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO); SetPin(12, AGPIO(GPIO_SPI_MISO)); From 141a4086b3f054bac973074a1121b8d5dfc1aefa Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 9 May 2024 14:11:57 +0200 Subject: [PATCH 2/5] Revert "ESP8266 removed SPI check for valid SPI Chip Select (#21393)" This reverts commit 584329a6c0ba231d0cdd4fc151a1ae39b7bcf86d. --- CHANGELOG.md | 1 - RELEASENOTES.md | 1 - tasmota/tasmota_support/support_tasmota.ino | 2 -- 3 files changed, 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 216cbed3c..b0ec099f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,6 @@ All notable changes to this project will be documented in this file. - TLS Letsencrypt replace R3 CA with long-term ISRG_Root_X1 CA, which works with R3 and R10-R14 (#21352) - GPIOViewer from v1.5.0 to v1.5.2 - ESP32 Core3 platform update from 2024.05.10 to 2024.05.11 (#21381) -- ESP8266 removed SPI check for valid SPI Chip Select (#21393) ### Fixed - HASPmota `align` attribute and expand PNG cache (#21228) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index e456efaaf..d4d9ac289 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -185,7 +185,6 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Refactor I2S [#21291](https://github.com/arendst/Tasmota/issues/21291) - Zigbee startup event triggered after plugins are loaded [#21320](https://github.com/arendst/Tasmota/issues/21320) - Refactor Tensorflow [#21327](https://github.com/arendst/Tasmota/issues/21327) -- ESP8266 removed SPI check for valid SPI Chip Select [#21393](https://github.com/arendst/Tasmota/issues/21393) - ESP32 refactored Wifi for ESP32 Core3 release [#21106](https://github.com/arendst/Tasmota/issues/21106) - ESP32 WiFi phy modes 11n and 11ax represented as HT20, HT40 and HE20 [#19350](https://github.com/arendst/Tasmota/issues/19350) - berry.exe (pre-compiled for Windows) updated to latest Berry patches [#21024](https://github.com/arendst/Tasmota/issues/21024) diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index 216e13b4e..c8e3de1b9 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -2121,7 +2121,6 @@ void GpioInit(void) uint32_t spi_mosi = (14 == Pin(GPIO_SPI_CLK)) && (13 == Pin(GPIO_SPI_MOSI)) ? SPI_MOSI : SPI_NONE; uint32_t spi_miso = (14 == Pin(GPIO_SPI_CLK)) && (12 == Pin(GPIO_SPI_MISO)) ? SPI_MISO : SPI_NONE; TasmotaGlobal.spi_enabled = spi_mosi + spi_miso; -/* if (!TasmotaGlobal.spi_enabled) { bool valid_cs = (ValidSpiPinUsed(GPIO_SPI_CS) || ValidSpiPinUsed(GPIO_RC522_CS) || @@ -2142,7 +2141,6 @@ void GpioInit(void) // If SPI_CS and/or SPI_DC is used they must be valid TasmotaGlobal.spi_enabled = (valid_cs) ? SPI_MOSI_MISO : SPI_NONE; } -*/ if (TasmotaGlobal.spi_enabled) { TasmotaGlobal.my_module.io[12] = AGPIO(GPIO_SPI_MISO); SetPin(12, AGPIO(GPIO_SPI_MISO)); From 178b11196a70647ec58d33a2fd6e18f11aeee107 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 9 May 2024 14:34:25 +0200 Subject: [PATCH 3/5] Fix default compile --- tasmota/tasmota_xsns_sensor/xsns_29_mcp230xx.ino | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasmota/tasmota_xsns_sensor/xsns_29_mcp230xx.ino b/tasmota/tasmota_xsns_sensor/xsns_29_mcp230xx.ino index 29a25c182..66c1a982a 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_29_mcp230xx.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_29_mcp230xx.ino @@ -31,6 +31,10 @@ #define XSNS_29 29 #define XI2C_22 22 // See I2CDEVICES.md +#ifndef USE_MCP230xx_ADDR +#define USE_MCP230xx_ADDR 0x20 // Enable MCP23008/MCP23017 I2C Address to use (Must be within range 0x20 through 0x27 - set according to your wired setup) +#endif + /* Default register locations for MCP23008 - They change for MCP23017 in default bank mode */ From c7a5cd58f42fed56f0c1493e7cc5b1946f97c6c4 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 10 May 2024 10:18:46 +0200 Subject: [PATCH 4/5] Fix a compile error --- tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino b/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino index 262355e13..8f1e7fe6f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino @@ -562,8 +562,10 @@ void MESHevery50MSecond(void) { // AddLog(LOG_LEVEL_INFO, PSTR("MSH: %*_H), MESH.packetToConsume.front().chunkSize, (uint8_t *)&MESH.packetToConsume.front().payload); } break; +#ifdef USE_TASMESH_HEARTBEAT case PACKET_TYPE_HEARTBEAT: break; +#endif // USE_TASMESH_HEARTBEAT default: AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t *)&MESH.packetToConsume.front(), MESH.packetToConsume.front().chunkSize +5); From 3e8ca44681088f81e7af42dd6b4349490050554d Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 10 May 2024 10:34:58 +0200 Subject: [PATCH 5/5] Attempt to fix TasMesh (#21395) --- tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino b/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino index 8f1e7fe6f..e3b111229 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino @@ -51,11 +51,16 @@ void CB_MESHDataSent(const uint8_t *MAC, esp_now_send_status_t sendStatus) { AddLog(LOG_LEVEL_DEBUG, PSTR("MSH: Sent to %s status %d"), _destMAC, sendStatus); } -void CB_MESHDataReceived(const uint8_t *MAC, const uint8_t *packet, int len) { +//void CB_MESHDataReceived(const uint8_t *MAC, const uint8_t *packet, int len) { +void CB_MESHDataReceived(const esp_now_recv_info_t *esp_now_info, const uint8_t *packet, int len); +void CB_MESHDataReceived(const esp_now_recv_info_t *esp_now_info, const uint8_t *packet, int len) { static bool _locked = false; if (_locked) { return; } _locked = true; + + uint8_t *MAC = esp_now_info->src_addr; + char _srcMAC[18]; ToHex_P(MAC, 6, _srcMAC, 18, ':'); AddLog(LOG_LEVEL_DEBUG, PSTR("MSH: Rcvd from %s"), _srcMAC);