mirror of https://github.com/arendst/Tasmota.git
Fix Sonoff Bridge learned key recognition
* Fix Sonoff Bridge missed learned key if learned data contains 0x55 (End of Transmission) flag (#1095, #1294)
This commit is contained in:
parent
253d60fd2b
commit
25a0e5bf7f
|
@ -3,6 +3,7 @@
|
|||
* Add (experimental) support for iTead SI7021 temperature and humidity sensor (#735)
|
||||
* Change ADS1115 default voltage range from +/-2V to +/-6V (#1289)
|
||||
* Add multipress support and more user configurable options to Sonoff Dual R2 (#1291)
|
||||
* Fix missed learned key if learned data contains 0x55 (End of Transmission) flag (#1095, #1294)
|
||||
*
|
||||
* 5.10.0 20171201
|
||||
* Upgrade library ArduinoJson to 5.11.2
|
||||
|
|
|
@ -31,6 +31,7 @@ const char kSonoffBridgeCommands[] PROGMEM =
|
|||
uint8_t sonoff_bridge_receive_flag = 0;
|
||||
uint8_t sonoff_bridge_learn_key = 1;
|
||||
uint8_t sonoff_bridge_learn_active = 0;
|
||||
uint8_t sonoff_bridge_expected_bytes = 0;
|
||||
uint32_t sonoff_bridge_last_received_id = 0;
|
||||
uint32_t sonoff_bridge_last_send_code = 0;
|
||||
unsigned long sonoff_bridge_last_time = 0;
|
||||
|
@ -112,10 +113,17 @@ void SonoffBridgeReceived()
|
|||
|
||||
boolean SonoffBridgeSerialInput()
|
||||
{
|
||||
// iTead Rf Universal Transceiver Module Serial Protocol Version 1.0 (20170420)
|
||||
if (sonoff_bridge_receive_flag) {
|
||||
if (!((serial_in_byte_counter == 0) && (serial_in_byte == 0))) { // Skip leading 0
|
||||
if (!serial_in_byte_counter) {
|
||||
sonoff_bridge_expected_bytes = 2; // 0xA0, 0xA1, 0xA2
|
||||
if (serial_in_byte >= 0xA3) {
|
||||
sonoff_bridge_expected_bytes = 11; // 0xA3, 0xA4, 0xA5
|
||||
}
|
||||
}
|
||||
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte;
|
||||
if (0x55 == serial_in_byte) { // 0x55 - End of text
|
||||
if ((sonoff_bridge_expected_bytes == serial_in_byte_counter) && (0x55 == serial_in_byte)) { // 0x55 - End of text
|
||||
SonoffBridgeReceived();
|
||||
sonoff_bridge_receive_flag = 0;
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue