Inject 0x38 after 0x37 to try to fix door status issue on some wall panels

This commit is contained in:
Marius Muja 2024-01-12 08:51:56 -08:00
parent 61f6ce1d0f
commit be4d666967
2 changed files with 22 additions and 4 deletions

View File

@ -180,6 +180,15 @@ namespace secplus1 {
}
rx_packet[byte_count++] = ser_byte;
reading_msg = true;
if (ser_byte == 0x37) {
rx_packet[byte_count++] = 0;
reading_msg = false;
byte_count = 0;
ESP_LOG2(TAG, "[%d] Received command: [%02X]", millis(), rx_packet[0]);
return this->decode_packet(rx_packet);
}
break;
}
}
@ -262,7 +271,10 @@ namespace secplus1 {
this->ratgdo_->received(door_state);
}
}
else if (cmd.type == CommandType::OTHER_STATUS) {
else if (cmd.type == CommandType::DOOR_STATUS_37) {
// inject door status request
this->sw_serial_.write(0x38);
} else if (cmd.type == CommandType::OTHER_STATUS) {
LightState light_state = to_LightState((cmd.value >> 2) & 1, LightState::UNKNOWN);
if (this->light_state != light_state) {
this->light_state = light_state;
@ -281,7 +293,7 @@ namespace secplus1 {
ObstructionState obstruction_state = cmd.value == 0 ? ObstructionState::CLEAR : ObstructionState::OBSTRUCTED;
this->ratgdo_->received(obstruction_state);
}
else if (cmd.type == CommandType::WALL_PANEL_STARTING) {
else if (cmd.type == CommandType::TOGGLE_DOOR_COMMIT) {
if (cmd.value == 0x31) {
this->wall_panel_starting_ = true;
}

View File

@ -31,9 +31,15 @@ namespace secplus1 {
static const uint8_t secplus1_states[] = {0x35,0x35,0x35,0x35,0x33,0x33,0x53,0x53,0x38,0x3A,0x3A,0x3A,0x39,0x38,0x3A, 0x38,0x3A,0x39,0x3A};
ENUM(CommandType, uint16_t,
(WALL_PANEL_STARTING, 0x31),
(TOGGLE_DOOR_REQ, 0x30),
(TOGGLE_DOOR_COMMIT, 0x31),
(TOGGLE_LIGHT_REQ, 0x32),
(TOGGLE_LIGHT_COMMIT, 0x33),
(TOGGLE_LOCK_REQ, 0x34),
(TOGGLE_LOCK_COMMIT, 0x35),
(DOOR_STATUS_37, 0x37),
(DOOR_STATUS, 0x38),
(OBSTRUCTION, 0x39), //
(OBSTRUCTION, 0x39),
(OTHER_STATUS, 0x3A),
(UNKNOWN, 0xFF),
)