mirror of
https://github.com/esphome/esphome.git
synced 2025-01-30 23:02:14 +01:00
[HX711] stop/start poller on powerdown/powerup
This commit is contained in:
parent
84cbaca1b1
commit
a4024216ae
@ -16,12 +16,20 @@ template<typename... Ts> class HX711SensorActionBase : public Action<Ts...> {
|
||||
|
||||
template<typename... Ts> class PowerUpAction : public HX711SensorActionBase<Ts...> {
|
||||
public:
|
||||
void play(Ts... x) override { this->parent_->power_up(); }
|
||||
void play(Ts... x) override {
|
||||
if (!this->parent_->is_ready())
|
||||
return;
|
||||
this->parent_->power_up();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class PowerDownAction : public HX711SensorActionBase<Ts...> {
|
||||
public:
|
||||
void play(Ts... x) override { this->parent_->power_down(); }
|
||||
void play(Ts... x) override {
|
||||
if (!this->parent_->is_ready())
|
||||
return;
|
||||
this->parent_->power_down();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace hx711
|
||||
|
Loading…
Reference in New Issue
Block a user