diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f7eabdb5b..b3b5c8c2d 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -54,6 +54,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c ### Version 8.1.0.1 +- Fix Sonoff Bridge, Sc, L1, iFan03 and CSE7766 serial interface to forced speed, config and disable logging - Fix commands ``Display`` and ``Counter`` from overruling command processing (#7322) - Add SerialConfig to ``Status 1`` - Add WifiPower to ``Status 5`` diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index a6bc376b6..321d405c5 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -2,6 +2,7 @@ ### 8.1.0.1 20191225 +- Fix Sonoff Bridge, Sc, L1, iFan03 and CSE7766 serial interface to forced speed, config and disable logging - Fix commands ``Display`` and ``Counter`` from overruling command processing (#7322) - Add SerialConfig to ``Status 1`` - Add WifiPower to ``Status 5`` diff --git a/tasmota/support.ino b/tasmota/support.ino index 9b66fbc2a..32ef55731 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -790,14 +790,9 @@ String GetSerialConfig(void) void SetSerialBegin(uint32_t baudrate) { - if (seriallog_level) { - AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "Set Serial to %s %d bit/s"), GetSerialConfig().c_str(), baudrate); - delay(100); - } + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "Set Serial to %s %d bit/s"), GetSerialConfig().c_str(), baudrate); Serial.flush(); Serial.begin(baudrate, (SerialConfig)pgm_read_byte(kTasmotaSerialConfig + Settings.serial_config)); - delay(10); - Serial.println(); } void SetSerialConfig(uint32_t serial_config) @@ -812,11 +807,17 @@ void SetSerialConfig(uint32_t serial_config) void SetSerialBaudrate(int baudrate) { Settings.baudrate = baudrate / 300; - if (Serial.baudRate() == baudrate) { return; } - SetSerialBegin(baudrate); } +void PrepSerial(int prep_baudrate, uint32_t serial_config) +{ + Settings.flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG + Settings.serial_config = serial_config; + baudrate = prep_baudrate; + SetSeriallog(LOG_LEVEL_NONE); +} + void ClaimSerial(void) { serial_local = true; diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index c649d9379..153d8a1fd 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -1296,20 +1296,16 @@ void GpioInit(void) // devices_present = 1; } else if (SONOFF_DUAL == my_module_type) { - Settings.flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG devices_present = 2; - baudrate = 19200; + PrepSerial(19200, TS_SERIAL_8N1); } else if (CH4 == my_module_type) { - Settings.flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG devices_present = 4; - baudrate = 19200; + PrepSerial(19200, TS_SERIAL_8N1); } #ifdef USE_SONOFF_SC else if (SONOFF_SC == my_module_type) { - Settings.flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG - devices_present = 0; - baudrate = 19200; + PrepSerial(19200, TS_SERIAL_8N1); } #endif // USE_SONOFF_SC diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index e80331366..e2866347e 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -194,8 +194,6 @@ void setup(void) RtcRebootSave(); Serial.begin(baudrate); - delay(10); - Serial.println(); seriallog_level = LOG_LEVEL_INFO; // Allow specific serial messages until config loaded snprintf_P(my_version, sizeof(my_version), PSTR("%d.%d.%d"), VERSION >> 24 & 0xff, VERSION >> 16 & 0xff, VERSION >> 8 & 0xff); // Release version 6.3.0 diff --git a/tasmota/xdrv_06_snfbridge.ino b/tasmota/xdrv_06_snfbridge.ino index 9f8a852d5..56ba3dabc 100644 --- a/tasmota/xdrv_06_snfbridge.ino +++ b/tasmota/xdrv_06_snfbridge.ino @@ -578,8 +578,7 @@ bool Xdrv06(uint8_t function) SonoffBridgeSendCommand(0xA7); // Stop reading RF signals enabling iTead default RF handling break; case FUNC_PRE_INIT: - Settings.flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG - baudrate = 19200; + PrepSerial(19200, TS_SERIAL_8N1); break; } } diff --git a/tasmota/xdrv_22_sonoff_ifan.ino b/tasmota/xdrv_22_sonoff_ifan.ino index b260952f4..125800367 100644 --- a/tasmota/xdrv_22_sonoff_ifan.ino +++ b/tasmota/xdrv_22_sonoff_ifan.ino @@ -217,9 +217,7 @@ void CmndFanspeed(void) bool SonoffIfanInit(void) { if (SONOFF_IFAN03 == my_module_type) { - Settings.flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG - baudrate = 9600; - SetSeriallog(LOG_LEVEL_NONE); + PrepSerial(9600, TS_SERIAL_8N1); } return false; // Continue init chain } diff --git a/tasmota/xlgt_05_sonoff_l1.ino b/tasmota/xlgt_05_sonoff_l1.ino index 3fef84576..11059f6ff 100644 --- a/tasmota/xlgt_05_sonoff_l1.ino +++ b/tasmota/xlgt_05_sonoff_l1.ino @@ -222,8 +222,7 @@ void SnfL1ModuleSelected(void) { if (SONOFF_L1 == my_module_type) { if ((pin[GPIO_RXD] < 99) && (pin[GPIO_TXD] < 99)) { - Settings.flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG - baudrate = 19200; + PrepSerial(19200, TS_SERIAL_8N1); light_type = LT_RGB; light_flg = XLGT_05; diff --git a/tasmota/xnrg_02_cse7766.ino b/tasmota/xnrg_02_cse7766.ino index d52ee9ca3..a10f6cc9d 100644 --- a/tasmota/xnrg_02_cse7766.ino +++ b/tasmota/xnrg_02_cse7766.ino @@ -210,8 +210,7 @@ void CseEverySecond(void) void CseDrvInit(void) { if ((3 == pin[GPIO_CSE7766_RX]) && (1 == pin[GPIO_CSE7766_TX])) { // As it uses 8E1 currently only hardware serial is supported - baudrate = 4800; - Settings.serial_config = TS_SERIAL_8E1; + PrepSerial(4800, TS_SERIAL_8E1); if (0 == Settings.param[P_CSE7766_INVALID_POWER]) { Settings.param[P_CSE7766_INVALID_POWER] = CSE_MAX_INVALID_POWER; // SetOption39 1..255 } diff --git a/tasmota/xsns_04_snfsc.ino b/tasmota/xsns_04_snfsc.ino index 060321349..7f83f4e06 100644 --- a/tasmota/xsns_04_snfsc.ino +++ b/tasmota/xsns_04_snfsc.ino @@ -159,9 +159,6 @@ bool Xsns04(uint8_t function) if (SONOFF_SC == my_module_type) { switch (function) { - case FUNC_INIT: - SonoffScInit(); - break; case FUNC_JSON_APPEND: SonoffScShow(1); break; @@ -170,6 +167,9 @@ bool Xsns04(uint8_t function) SonoffScShow(0); break; #endif // USE_WEBSERVER + case FUNC_INIT: + SonoffScInit(); + break; } } return result;