diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f85f4ad3..32a3a9b4f 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ## [15.5.0.2] ### Added +- Support for baudrate 74880 replacing 74700 (#24924) ### Breaking Changed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 4778c0ded..ee1e400e5 100755 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -114,6 +114,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ## Changelog v15.5.0.2 ### Added +- Support for baudrate 74880 replacing 74700 [#24924](https://github.com/arendst/Tasmota/issues/24924) - TLS support for EC P-384 curve in server certificate [#24909](https://github.com/arendst/Tasmota/issues/24909) - MagicSwitch configurable masking window fixing problems with multiple false triggering [#24888](https://github.com/arendst/Tasmota/issues/24888) - Berry `bytes` methods `setbits`/`getbits` transposed to native and support for big endian [#24857](https://github.com/arendst/Tasmota/issues/24857) diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index b2aeddca5..4c4587e17 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -476,7 +476,7 @@ void setup(void) { if (RtcSettingsLoad(0)) { uint32_t baudrate = (RtcSettings.baudrate / 300) * 300; // Make it a valid baudrate - if (baudrate) { TasmotaGlobal.baudrate = baudrate; } + if (baudrate) { SetTasmotaGlobalBaudrate(baudrate); } } // Init settings and logging preparing for AddLog use diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index 909ed2154..68bc09baa 100644 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -2175,8 +2175,18 @@ void SetSerialSwap(void) { } #endif +void SetTasmotaGlobalBaudrate(uint32_t baudrate) { + TasmotaGlobal.baudrate = baudrate; + if (Settings != nullptr) { // May not have been initialized yet + Settings->baudrate = TasmotaGlobal.baudrate / 300; + } + if (74700 == TasmotaGlobal.baudrate) { // 74880 / 300 = 249,6. 249 * 300 = 74700 + TasmotaGlobal.baudrate = 74880; // ESP8266 ROM baudrate + } +} + void SetSerialBegin(void) { - TasmotaGlobal.baudrate = Settings->baudrate * 300; + SetTasmotaGlobalBaudrate(Settings->baudrate * 300); AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "Set to %s %d bit/s"), GetSerialConfig().c_str(), TasmotaGlobal.baudrate); Serial.flush(); #ifdef ESP8266 @@ -2199,7 +2209,7 @@ void SetSerialBegin(void) { } void SetSerialInitBegin(void) { - TasmotaGlobal.baudrate = Settings->baudrate * 300; + SetTasmotaGlobalBaudrate(Settings->baudrate * 300); if ((GetSerialBaudrate() != TasmotaGlobal.baudrate) || (TS_SERIAL_8N1 != Settings->serial_config)) { SetSerialBegin(); } @@ -2216,8 +2226,7 @@ void SetSerialConfig(uint32_t serial_config) { } void SetSerialBaudrate(uint32_t baudrate) { - TasmotaGlobal.baudrate = baudrate; - Settings->baudrate = TasmotaGlobal.baudrate / 300; + SetTasmotaGlobalBaudrate(baudrate); if (GetSerialBaudrate() != TasmotaGlobal.baudrate) { SetSerialBegin(); } @@ -2226,8 +2235,7 @@ void SetSerialBaudrate(uint32_t baudrate) { void SetSerial(uint32_t baudrate, uint32_t serial_config) { Settings->flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG Settings->serial_config = serial_config; - TasmotaGlobal.baudrate = baudrate; - Settings->baudrate = TasmotaGlobal.baudrate / 300; + SetTasmotaGlobalBaudrate(baudrate); SetSeriallog(LOG_LEVEL_NONE); SetSerialBegin(); } @@ -2245,8 +2253,7 @@ void ClaimSerial(void) { TasmotaGlobal.serial_local = true; AddLog(LOG_LEVEL_INFO, PSTR("SNS: Hardware Serial")); SetSeriallog(LOG_LEVEL_NONE); - TasmotaGlobal.baudrate = GetSerialBaudrate(); - Settings->baudrate = TasmotaGlobal.baudrate / 300; + SetTasmotaGlobalBaudrate(GetSerialBaudrate()); } void SerialSendRaw(char *codes) diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index ddb8a0c0d..35df2c76c 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -2270,7 +2270,7 @@ void CmndBaudrate(void) { if (XdrvMailbox.payload >= 300) { XdrvMailbox.payload /= 300; // Make it a valid baudrate - TasmotaGlobal.baudrate = (XdrvMailbox.payload & 0xFFFF) * 300; + SetTasmotaGlobalBaudrate((XdrvMailbox.payload & 0xFFFF) * 300); SetSerialBaudrate(TasmotaGlobal.baudrate); } ResponseCmndNumber(TasmotaGlobal.baudrate);