9static const char *
const TAG =
"servo";
16 " Idle Level: %.1f%%\n"
17 " Min Level: %.1f%%\n"
18 " Max Level: %.1f%%\n"
19 " Auto-detach time: %" PRIu32
" ms\n"
20 " Run duration: %" PRIu32
" ms",
47 ESP_LOGD(TAG,
"Detached on auto_detach_time");
54 uint32_t target_runtime = abs((
int) ((travel_diff) * this->
transition_length_ * 1.0f / 2.0f));
56 float percentage_run = current_runtime * 1.0f / target_runtime * 1.0f;
57 if (percentage_run > 1.0f) {
58 percentage_run = 1.0f;
69 ESP_LOGD(TAG,
"Reached target");
74 value =
clamp(value, -1.0f, 1.0f);
84 ESP_LOGD(TAG,
"New target: %f", value);
88 value =
clamp(value, -1.0f, 1.0f);
virtual ESPPreferenceObject make_preference(size_t length, uint32_t type, bool in_flash)=0
void set_level(float state)
Set the level of this float output, this is called from the front-end.
uint32_t transition_length_
uint32_t auto_detach_time_
void dump_config() override
output::FloatOutput * output_
void internal_write(float value)
void save_level_(float v)
Providing packet encoding functions for exchanging data with a remote host.
ESPPreferences * global_preferences
uint32_t IRAM_ATTR HOT millis()
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)