1
0
mirror of https://github.com/esphome/esphome.git synced 2024-12-03 22:38:47 +01:00

fix servo warning (#1591)

This commit is contained in:
Guillermo Ruffino 2021-03-06 19:59:06 -03:00 committed by GitHub
parent c17624adab
commit 2b60b0f1fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,7 @@ void Servo::loop() {
if (this->transition_length_) {
float new_value;
float travel_diff = this->target_value_ - this->source_value_;
uint32_t target_runtime = target_runtime = abs((int) ((travel_diff) * this->transition_length_ * 1.0f / 2.0f));
uint32_t target_runtime = abs((int) ((travel_diff) * this->transition_length_ * 1.0f / 2.0f));
uint32_t current_runtime = millis() - this->start_millis_;
float percentage_run = current_runtime * 1.0f / target_runtime * 1.0f;
if (percentage_run > 1.0f) {