fix servo bug restoring state and starting servo detached (#1008)

This commit is contained in:
Guillermo Ruffino 2020-04-05 13:42:43 -03:00 committed by GitHub
parent 4620ad6124
commit 79248e8b74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,11 +36,11 @@ class Servo : public Component {
this->rtc_ = global_preferences.make_preference<float>(global_servo_id); this->rtc_ = global_preferences.make_preference<float>(global_servo_id);
global_servo_id++; global_servo_id++;
if (this->rtc_.load(&v)) { if (this->rtc_.load(&v)) {
this->write(v); this->output_->set_level(v);
return; return;
} }
} }
this->write(0.0f); this->detach();
} }
void dump_config() override; void dump_config() override;
float get_setup_priority() const override { return setup_priority::DATA; } float get_setup_priority() const override { return setup_priority::DATA; }