From 10f9c20078b27cf6ef625acc8b21dade698b4baf Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 23 May 2023 14:34:47 +0200 Subject: [PATCH] Fix ESP32 SPI initialization for MFRC522 Fix ESP32 SPI initialization for MFRC522 (#18711) --- CHANGELOG.md | 4 ++-- RELEASENOTES.md | 12 +++++++----- tasmota/tasmota_xsns_sensor/xsns_80_mfrc522.ino | 7 ++++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83c31ccfc..7b6890e91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,6 @@ All notable changes to this project will be documented in this file. - Command ``WifiPower 1`` to restore default wifi power - HASPmota `meta` attribute and improved `berry_run` - ### Breaking Changed ### Changed @@ -23,7 +22,8 @@ All notable changes to this project will be documented in this file. - AIThinker webcam issues (#18652) - Berry `tasmota.wifi()` would wrongly report wifi as up - Inverted shutter now reflect status also in WEBGUI and several minor fixes to make "inverted" consistant (#18701) -- Matter fix fabric provisioning from CASE session for iOS 16.5 +- Matter fix fabric provisioning from CASE session for iOS 16.5 (#18709) +- ESP32 SPI initialization for MFRC522 (#18711) ### Removed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index d0378915d..12a7eb682 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -142,13 +142,15 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Shutter sliders in WEBGUI automatically appear and disappear during configuration and update during movement [#18701](https://github.com/arendst/Tasmota/issues/18701) ### Fixed -- ESP8266 Energy Export Active no update regression from v12.3.1.3 -- ESP32 InfluxDb initial connection delays using HTTPClient [#18015](https://github.com/arendst/Tasmota/issues/18015) +- ESP8266 no update on Energy Export Active regression from v12.3.1.3 - NovaSDS GUI values [#18444](https://github.com/arendst/Tasmota/issues/18444) - LED PWM ac_dimmer curve was wrongly applied instead of Gamma regression from v12.2.0.5 [#18666](https://github.com/arendst/Tasmota/issues/18666) -- AIThinker webcam issues [#18652](https://github.com/arendst/Tasmota/issues/18652) - Shutter bootloop using more than 4 shutters [#18673](https://github.com/arendst/Tasmota/issues/18673) - Inverted shutter now reflect status also in WEBGUI and several minor fixes to make "inverted" consistant [#18701](https://github.com/arendst/Tasmota/issues/18701) -- Berry rules for string comparisons [#18464](https://github.com/arendst/Tasmota/issues/18464) -- Berry a rare condition when a GC causes a memory corruption - ESP32 Partition_Manager.tapp +- ESP32 InfluxDb initial connection delays using HTTPClient [#18015](https://github.com/arendst/Tasmota/issues/18015) +- ESP32 AIThinker webcam issues [#18652](https://github.com/arendst/Tasmota/issues/18652) +- ESP32 SPI initialization for MFRC522 [#18711](https://github.com/arendst/Tasmota/issues/18711) +- Berry a rare condition when a GC causes a memory corruption +- Berry rules for string comparisons [#18464](https://github.com/arendst/Tasmota/issues/18464) +- Matter fix fabric provisioning from CASE session for iOS 16.5 [#18709](https://github.com/arendst/Tasmota/issues/18709) diff --git a/tasmota/tasmota_xsns_sensor/xsns_80_mfrc522.ino b/tasmota/tasmota_xsns_sensor/xsns_80_mfrc522.ino index dcd9f5d3a..037ded6da 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_80_mfrc522.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_80_mfrc522.ino @@ -98,9 +98,14 @@ void RC522ScanForTag(void) { } void RC522Init(void) { - if (PinUsed(GPIO_RC522_CS) && PinUsed(GPIO_RC522_RST) && TasmotaGlobal.spi_enabled) { + if (PinUsed(GPIO_RC522_CS) && PinUsed(GPIO_RC522_RST) && (SPI_MOSI_MISO == TasmotaGlobal.spi_enabled)) { Mfrc522 = new MFRC522(Pin(GPIO_RC522_CS), Pin(GPIO_RC522_RST)); +#ifdef EPS8266 SPI.begin(); +#endif // EPS8266 +#ifdef ESP32 + SPI.begin(Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), -1); +#endif // ESP32 Mfrc522->PCD_Init(); // if (Mfrc522->PCD_PerformSelfTest()) { // Saves 0k5 code uint8_t v = Mfrc522->PCD_ReadRegister(Mfrc522->VersionReg);