Fix ESP32 SPI initialization for MFRC522

Fix ESP32 SPI initialization for MFRC522 (#18711)
This commit is contained in:
Theo Arends 2023-05-23 14:34:47 +02:00
parent 242eb3074a
commit 10f9c20078
3 changed files with 15 additions and 8 deletions

View File

@ -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

View File

@ -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)

View File

@ -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);