From 35427d9b36a0b993f8dc09f1ac926be9a28c919f Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 27 Feb 2021 16:58:50 +0100 Subject: [PATCH 1/2] Fix PN532 on ESP32 Serial flush both Tx and Rx buffers (#10910) Fix PN532 on ESP32 Serial flush both Tx and Rx buffers (#10910) --- CHANGELOG.md | 13 +++++++++++++ RELEASENOTES.md | 13 +++++++++++++ .../TasmotaSerial-3.2.0/src/TasmotaSerial.cpp | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66156b59a..b5a3ca3c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - Development ## [9.3.1.1] +### Added +- Allow MCP230xx pinmode from output to input (#11104) +- SML VBUS support (#11125) + +### Changed +- TuyaMcu dimmer timeout (#11121) + +### Fixed +- Refactor acceleration function for shutter stepper and servo (#11088) +- LM75AD detection on different addresses (#11096) +- Timer loop when console is scrolled up regression from v9.3.0 (#11108) +- Display exception when no file system is present (#11125) +- PN532 on ESP32 Serial flush both Tx and Rx buffers (#10910) ## [Released] diff --git a/RELEASENOTES.md b/RELEASENOTES.md index fc39668fb..2ae0f984a 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -79,3 +79,16 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota [Complete list](BUILDS.md) of available feature and sensors. ## Changelog v9.3.1.1 +### Added +- Allow MCP230xx pinmode from output to input [#11104](https://github.com/arendst/Tasmota/issues/11104) +- SML VBUS support [#11125](https://github.com/arendst/Tasmota/issues/11125) + +### Changed +- TuyaMcu dimmer timeout [#11121](https://github.com/arendst/Tasmota/issues/11121) + +### Fixed +- Refactor acceleration function for shutter stepper and servo [#11088](https://github.com/arendst/Tasmota/issues/11088) +- LM75AD detection on different addresses [#11096](https://github.com/arendst/Tasmota/issues/11096) +- Timer loop when console is scrolled up regression from v9.3.0 [#11108](https://github.com/arendst/Tasmota/issues/11108) +- Display exception when no file system is present [#11125](https://github.com/arendst/Tasmota/issues/11125) +- PN532 on ESP32 Serial flush both Tx and Rx buffers [#10910](https://github.com/arendst/Tasmota/issues/10910) diff --git a/lib/default/TasmotaSerial-3.2.0/src/TasmotaSerial.cpp b/lib/default/TasmotaSerial-3.2.0/src/TasmotaSerial.cpp index c3eff150a..d49a5ff2a 100644 --- a/lib/default/TasmotaSerial-3.2.0/src/TasmotaSerial.cpp +++ b/lib/default/TasmotaSerial-3.2.0/src/TasmotaSerial.cpp @@ -173,7 +173,8 @@ void TasmotaSerial::flush(void) { Serial.flush(); #endif // ESP8266 #ifdef ESP32 - TSerial->flush(); + TSerial->flush(); // Flushes Tx only https://github.com/espressif/arduino-esp32/pull/4263 + while (TSerial->available()) { TSerial->read(); } #endif // ESP32 } else { m_in_pos = m_out_pos = 0; From c3c0a069614bef093c9d507dedeab0773a4dd27e Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 27 Feb 2021 17:54:21 +0100 Subject: [PATCH 2/2] Add command ``Sensor80 1 <0..7>`` Add command ``Sensor80 1 <0..7>`` to control MFRC522 RFID antenna gain from 18dB (0) to 48dB (7) (#11073) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/xsns_80_mfrc522.ino | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a3ca3c2..8762f4b97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Added - Allow MCP230xx pinmode from output to input (#11104) - SML VBUS support (#11125) +- Command ``Sensor80 1 <0..7>`` to control MFRC522 RFID antenna gain from 18dB (0) to 48dB (7) (#11073) ### Changed - TuyaMcu dimmer timeout (#11121) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 2ae0f984a..aebea7960 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -82,6 +82,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota ### Added - Allow MCP230xx pinmode from output to input [#11104](https://github.com/arendst/Tasmota/issues/11104) - SML VBUS support [#11125](https://github.com/arendst/Tasmota/issues/11125) +- Command ``Sensor80 1 <0..7>`` to control MFRC522 RFID antenna gain from 18dB (0) to 48dB (7) [#11073](https://github.com/arendst/Tasmota/issues/11073) ### Changed - TuyaMcu dimmer timeout [#11121](https://github.com/arendst/Tasmota/issues/11121) diff --git a/tasmota/xsns_80_mfrc522.ino b/tasmota/xsns_80_mfrc522.ino index 29207819c..3ad92f4d9 100644 --- a/tasmota/xsns_80_mfrc522.ino +++ b/tasmota/xsns_80_mfrc522.ino @@ -126,6 +126,36 @@ void RC522Show(void) { } #endif // USE_WEBSERVER +/*********************************************************************************************\ + * Supported commands for Sensor80: + * + * Sensor80 1 - Show antenna gain + * Sensor80 1 - Set antenna gain 0..7 (default 4) +\*********************************************************************************************/ + +bool RC522Command(void) { + bool serviced = true; + char argument[XdrvMailbox.data_len]; + + for (uint32_t ca = 0; ca < XdrvMailbox.data_len; ca++) { + if ((' ' == XdrvMailbox.data[ca]) || ('=' == XdrvMailbox.data[ca])) { XdrvMailbox.data[ca] = ','; } + } + + switch (XdrvMailbox.payload) { + case 1: // Antenna gain + uint8_t gain; + if (strchr(XdrvMailbox.data, ',') != nullptr) { + gain = strtol(ArgV(argument, 2), nullptr, 10) & 0x7; + Mfrc522->PCD_SetAntennaGain(gain << 4); + } + gain = Mfrc522->PCD_GetAntennaGain() >> 4; // 0..7 + Response_P(PSTR("{\"Sensor80\":{\"Gain\":%d}}"), gain); + break; + } + + return serviced; +} + /*********************************************************************************************\ * Interface \*********************************************************************************************/ @@ -145,6 +175,11 @@ bool Xsns80(uint8_t function) { RC522ScanForTag(); } break; + case FUNC_COMMAND_SENSOR: + if (XSNS_80 == XdrvMailbox.index) { + result = RC522Command(); + } + break; #ifdef USE_WEBSERVER case FUNC_WEB_SENSOR: RC522Show();