mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 17:05:21 +01:00
Auto-set LEDC channel
Fixes https://github.com/esphome/issues/issues/258
This commit is contained in:
parent
c7609ba5e7
commit
295585379e
2 changed files with 6 additions and 4 deletions
|
@ -9,9 +9,13 @@
|
|||
namespace esphome {
|
||||
namespace ledc {
|
||||
|
||||
extern uint8_t next_ledc_channel;
|
||||
|
||||
class LEDCOutput : public output::FloatOutput, public Component {
|
||||
public:
|
||||
explicit LEDCOutput(GPIOPin *pin) : pin_(pin) {}
|
||||
explicit LEDCOutput(GPIOPin *pin) : pin_(pin) {
|
||||
this->channel_ = next_ledc_channel++;
|
||||
}
|
||||
|
||||
void set_channel(uint8_t channel) { this->channel_ = channel; }
|
||||
void set_bit_depth(uint8_t bit_depth) { this->bit_depth_ = bit_depth; }
|
||||
|
@ -35,8 +39,6 @@ class LEDCOutput : public output::FloatOutput, public Component {
|
|||
float frequency_{};
|
||||
};
|
||||
|
||||
extern uint8_t next_ledc_channel;
|
||||
|
||||
} // namespace ledc
|
||||
} // namespace esphome
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ float TimeBasedCover::get_setup_priority() const { return setup_priority::DATA;
|
|||
CoverTraits TimeBasedCover::get_traits() {
|
||||
auto traits = CoverTraits();
|
||||
traits.set_supports_position(true);
|
||||
traits.set_is_assumed_state(false);
|
||||
traits.set_is_assumed_state(true);
|
||||
return traits;
|
||||
}
|
||||
void TimeBasedCover::control(const CoverCall &call) {
|
||||
|
|
Loading…
Reference in a new issue