9 static const char *
const TAG =
"servo";
14 ESP_LOGCONFIG(TAG,
"Servo:");
15 ESP_LOGCONFIG(TAG,
" Idle Level: %.1f%%", this->
idle_level_ * 100.0f);
16 ESP_LOGCONFIG(TAG,
" Min Level: %.1f%%", this->
min_level_ * 100.0f);
17 ESP_LOGCONFIG(TAG,
" Max Level: %.1f%%", this->
max_level_ * 100.0f);
44 ESP_LOGD(TAG,
"Servo detached on auto_detach_time");
51 uint32_t target_runtime = abs((
int) ((travel_diff) * this->
transition_length_ * 1.0f / 2.0f));
53 float percentage_run = current_runtime * 1.0f / target_runtime * 1.0f;
54 if (percentage_run > 1.0f) {
55 percentage_run = 1.0f;
66 ESP_LOGD(TAG,
"Servo reached target");
71 value =
clamp(value, -1.0f, 1.0f);
81 ESP_LOGD(TAG,
"Servo new target: %f", value);
85 value =
clamp(value, -1.0f, 1.0f);
uint32_t transition_length_
void save_level_(float v)
float lerp(float completion, float start, float end)
Linearly interpolate between start and end by completion (between 0 and 1).
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)
uint32_t IRAM_ATTR HOT millis()
void set_level(float state)
Set the level of this float output, this is called from the front-end.
uint32_t auto_detach_time_
void internal_write(float value)
ESPPreferences * global_preferences
output::FloatOutput * output_
void dump_config() override
virtual ESPPreferenceObject make_preference(size_t length, uint32_t type, bool in_flash)=0
Implementation of SPI Controller mode.