6static const char *
const TAG =
"fan.hbridge";
11 ESP_LOGD(TAG,
"Setting speed: a: %.2f, b: %.2f", a_level, b_level);
20 ESP_LOGD(TAG,
"Setting speed: a: %.2f, b: %.2f, enable: %.2f", a_level, b_level, enable);
24 ESP_LOGD(TAG,
"Braking");
34 if (restore.has_value()) {
35 restore->apply(*
this);
41 LOG_FAN(
"",
"H-Bridge Fan",
this);
43 ESP_LOGCONFIG(TAG,
" Decay Mode: Slow");
45 ESP_LOGCONFIG(TAG,
" Decay Mode: Fast");
50 auto call_state =
call.get_state();
51 if (call_state.has_value())
52 this->
state = *call_state;
53 auto call_speed =
call.get_speed();
54 if (call_speed.has_value())
55 this->
speed = *call_speed;
56 auto call_oscillating =
call.get_oscillating();
57 if (call_oscillating.has_value())
59 auto call_direction =
call.get_direction();
60 if (call_direction.has_value())
FanCall & set_state(bool binary_state)
void apply_preset_mode_(const FanCall &call)
Apply preset mode from a FanCall (handles speed-clears-preset convention)
FanDirection direction
The current direction of the fan.
bool oscillating
The current oscillation state of the fan.
bool state
The current on/off state of the fan.
int speed
The current fan speed level.
optional< FanRestoreState > restore_state_()
output::FloatOutput * pin_a_
void dump_config() override
output::BinaryOutput * oscillating_
void set_hbridge_levels_(float a_level, float b_level)
output::FloatOutput * enable_
void control(const fan::FanCall &call) override
output::FloatOutput * pin_b_
virtual void set_state(bool state)
Enable or disable this binary output.
void set_level(float state)
Set the level of this float output, this is called from the front-end.