From d8dd3148eba4fce644d434e6affddc9faae65ac0 Mon Sep 17 00:00:00 2001 From: cvwillegen Date: Tue, 28 May 2024 13:01:27 +0200 Subject: [PATCH] Handle clang feedback. --- esphome/components/stepper/stepper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/stepper/stepper.cpp b/esphome/components/stepper/stepper.cpp index 0f44eda955..b66536eb8d 100644 --- a/esphome/components/stepper/stepper.cpp +++ b/esphome/components/stepper/stepper.cpp @@ -38,7 +38,8 @@ int32_t Stepper::should_step_() { // assumes this method is called in a constant interval uint32_t dt = now - this->last_step_; if (dt >= (1 / this->current_speed_) * 1e6f) { - int32_t mag = (rotation_ == ROTATION_BOTH ? (this->target_position > this->current_position ? 1 : -1) : (rotation_ == ROTATION_CW ? 1 : -1)); + int32_t mag = (rotation_ == ROTATION_BOTH ? (this->target_position > this->current_position ? 1 : -1) + : (rotation_ == ROTATION_CW ? 1 : -1)); this->last_step_ = now; this->current_position += mag; return mag;