mirror of
https://github.com/esphome/esphome.git
synced 2024-12-29 08:51:43 +01:00
Fixing a bug when issuing the stop command just after the start (between the transition from STATE_IDLE to STATE_MOVING).
Now the STOP command always stops the cover even during recalibration.
This commit is contained in:
parent
6e87770ae2
commit
a7d9152204
1 changed files with 7 additions and 5 deletions
|
@ -72,8 +72,12 @@ void TimeBasedTiltCover::loop() {
|
||||||
|
|
||||||
if ( this->fsm_state_ == STATE_STOPPING ) {
|
if ( this->fsm_state_ == STATE_STOPPING ) {
|
||||||
this->stop_trigger_->trigger();
|
this->stop_trigger_->trigger();
|
||||||
this->interlocked_time = millis();
|
if (this->current_operation != COVER_OPERATION_IDLE){
|
||||||
this->interlocked_direction = this->current_operation == COVER_OPERATION_CLOSING ? COVER_OPERATION_OPENING : COVER_OPERATION_CLOSING;
|
this->interlocked_time = millis();
|
||||||
|
this->interlocked_direction = this->current_operation == COVER_OPERATION_CLOSING ? COVER_OPERATION_OPENING : COVER_OPERATION_CLOSING;
|
||||||
|
} else {
|
||||||
|
this->interlocked_direction = COVER_OPERATION_IDLE;
|
||||||
|
}
|
||||||
this->fsm_state_ = STATE_IDLE;
|
this->fsm_state_ = STATE_IDLE;
|
||||||
this->last_operation_ = this->current_operation;
|
this->last_operation_ = this->current_operation;
|
||||||
this->current_operation = COVER_OPERATION_IDLE;
|
this->current_operation = COVER_OPERATION_IDLE;
|
||||||
|
@ -200,9 +204,7 @@ void TimeBasedTiltCover::control(const CoverCall &call) {
|
||||||
if (call.get_stop()) {
|
if (call.get_stop()) {
|
||||||
this->target_position_ = TARGET_NONE;
|
this->target_position_ = TARGET_NONE;
|
||||||
this->target_tilt_= TARGET_NONE;
|
this->target_tilt_= TARGET_NONE;
|
||||||
if (this->fsm_state_ == STATE_MOVING) {
|
this->fsm_state_ = STATE_STOPPING;
|
||||||
this->fsm_state_ = STATE_STOPPING;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (call.get_position().has_value() && call.get_tilt().has_value() ) {
|
if (call.get_position().has_value() && call.get_tilt().has_value() ) {
|
||||||
|
|
Loading…
Reference in a new issue