Time Based Cover: Fixed apparent race condition on ESP32 chips (#1984)

This commit is contained in:
Paul Doidge 2021-07-04 21:39:18 +02:00 committed by GitHub
parent 9e400a7857
commit 86ac7f3a59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,13 +115,13 @@ void TimeBasedCover::start_direction_(CoverOperation dir) {
this->current_operation = dir; this->current_operation = dir;
this->stop_prev_trigger_();
trig->trigger();
this->prev_command_trigger_ = trig;
const uint32_t now = millis(); const uint32_t now = millis();
this->start_dir_time_ = now; this->start_dir_time_ = now;
this->last_recompute_time_ = now; this->last_recompute_time_ = now;
this->stop_prev_trigger_();
trig->trigger();
this->prev_command_trigger_ = trig;
} }
void TimeBasedCover::recompute_position_() { void TimeBasedCover::recompute_position_() {
if (this->current_operation == COVER_OPERATION_IDLE) if (this->current_operation == COVER_OPERATION_IDLE)