Fix Sonoff Bridge data length

Fix Sonoff Bridge data reception when using Portisch EFM8 firmware and in data buffer length (#3605)
This commit is contained in:
Theo Arends 2018-08-27 18:16:28 +02:00
parent 9b54ab9038
commit 04c81e31d1
2 changed files with 9 additions and 1 deletions

View File

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

View File

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