diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 7c2a84586..97822dec0 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -2,6 +2,7 @@ * Add commands ButtonDebounce 40..1000 and SwitchDebounce 40..1000 to have user control over debounce timing. Default is 50mS (#3594) * Add rule variables %sunrise%, %sunset%, %uptime% and %time% (#3608) * Fix handling use of default names when using names starting with shortcut character (#3392, #3600) + * Fix Sonoff Bridge data reception when using Portisch EFM8 firmware and in data buffer length (#3605) * * 6.1.1.11 20180826 * Change scheduler phase 1/3 - Fixed when sleep is enabled: Uptime, Delay, PulseTime and TelePeriod (#3581) diff --git a/sonoff/xdrv_06_snfbridge.ino b/sonoff/xdrv_06_snfbridge.ino index 729cd51dc..73c93d374 100644 --- a/sonoff/xdrv_06_snfbridge.ino +++ b/sonoff/xdrv_06_snfbridge.ino @@ -316,13 +316,20 @@ void SonoffBridgeReceived() boolean SonoffBridgeSerialInput() { // iTead Rf Universal Transceiver Module Serial Protocol Version 1.0 (20170420) + int8_t receive_len = 0; + if (sonoff_bridge_receive_flag) { if (sonoff_bridge_receive_raw_flag) { if (!serial_in_byte_counter) { serial_in_buffer[serial_in_byte_counter++] = 0xAA; } serial_in_buffer[serial_in_byte_counter++] = serial_in_byte; - if (0x55 == serial_in_byte) { // 0x55 - End of text + if (serial_in_byte_counter > 2) { + if ((0xA6 == serial_in_buffer[1]) || (0xAB == serial_in_buffer[1])) { // AA A6 06 023908010155 55 - 06 is receive_len + receive_len = serial_in_buffer[2] + 3 - serial_in_byte_counter; // Get at least receive_len bytes + } + } + if ((0 == receive_len) && (0x55 == serial_in_byte)) { // 0x55 - End of text SonoffBridgeReceivedRaw(); sonoff_bridge_receive_flag = 0; return 1;