Fix bug with opening/closing duration calibration
This commit is contained in:
parent
17fad73613
commit
b26f04a626
|
@ -428,13 +428,15 @@ namespace ratgdo {
|
|||
|
||||
this->door_action(DoorAction::OPEN);
|
||||
|
||||
// query state in case we don't get a status message
|
||||
set_timeout("door_query_state", (*this->opening_duration + 1) * 1000, [=]() {
|
||||
if (*this->door_state != DoorState::OPEN && *this->door_state != DoorState::STOPPED) {
|
||||
this->door_state = DoorState::OPEN; // probably missed a status mesage, assume it's open
|
||||
this->query_status(); // query in case we're wrong and it's stopped
|
||||
}
|
||||
});
|
||||
if (*this->opening_duration > 0) {
|
||||
// query state in case we don't get a status message
|
||||
set_timeout("door_query_state", (*this->opening_duration + 2) * 1000, [=]() {
|
||||
if (*this->door_state != DoorState::OPEN && *this->door_state != DoorState::STOPPED) {
|
||||
this->received(DoorState::OPEN); // probably missed a status mesage, assume it's open
|
||||
this->query_status(); // query in case we're wrong and it's stopped
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void RATGDOComponent::door_close()
|
||||
|
@ -458,13 +460,15 @@ namespace ratgdo {
|
|||
|
||||
this->door_action(DoorAction::CLOSE);
|
||||
|
||||
// query state in case we don't get a status message
|
||||
set_timeout("door_query_state", (*this->closing_duration + 1) * 1000, [=]() {
|
||||
if (*this->door_state != DoorState::CLOSED && *this->door_state != DoorState::STOPPED) {
|
||||
this->door_state = DoorState::CLOSED; // probably missed a status mesage, assume it's closed
|
||||
this->query_status(); // query in case we're wrong and it's stopped
|
||||
}
|
||||
});
|
||||
if (*this->closing_duration > 0) {
|
||||
// query state in case we don't get a status message
|
||||
set_timeout("door_query_state", (*this->closing_duration + 2) * 1000, [=]() {
|
||||
if (*this->door_state != DoorState::CLOSED && *this->door_state != DoorState::STOPPED) {
|
||||
this->received(DoorState::CLOSED); // probably missed a status mesage, assume it's closed
|
||||
this->query_status(); // query in case we're wrong and it's stopped
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void RATGDOComponent::door_stop()
|
||||
|
|
Loading…
Reference in New Issue