Skip to content

Commit 59bed21

Browse files
committed
require two sequential matching sec+1 door states
1 parent 0cbc1ad commit 59bed21

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/static_code.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include "static_code.h"
33

44
void readStaticCode(byte rxSP1StaticCode[SECPLUS1_CODE_LEN], uint8_t &door, uint8_t &light, uint8_t &lock){
5+
static uint8_t prevDoor;
6+
57
uint8_t obs = 0; // experiement to figure out what key 0x39 is for
68
uint8_t key = 0;
79
uint8_t val = 0;
@@ -35,6 +37,13 @@ void readStaticCode(byte rxSP1StaticCode[SECPLUS1_CODE_LEN], uint8_t &door, uint
3537
// 101 0x5 closed
3638
// 110 0x6 stopped
3739

40+
// sec+1 doors sometimes report wrong door status
41+
// require two sequential matching door states
42+
if(prevDoor != val){
43+
prevDoor = val;
44+
return;
45+
}
46+
3847
if(val == 0x2){
3948
// door open
4049
door = 1;

0 commit comments

Comments
 (0)