mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-07 13:24:56 +02:00
Updates for 1.13 (#546)
* Update CI matcher * Check Executable bit * Quicklint * Updates * Allow pm1.0 and pm10.0 for PMS5003ST Fixes https://github.com/esphome/feature-requests/issues/225 * PowerSupplyRequester * Lint * Include debug data in generated main.cpp * Updates * Auto-select bit_depth * Updates
This commit is contained in:
@@ -39,5 +39,26 @@ class PowerSupply : public Component {
|
||||
int16_t active_requests_{0}; // use signed integer to make catching negative requests easier.
|
||||
};
|
||||
|
||||
class PowerSupplyRequester {
|
||||
public:
|
||||
void set_parent(PowerSupply *parent) { parent_ = parent; }
|
||||
void request() {
|
||||
if (!this->requested_ && this->parent_ != nullptr) {
|
||||
this->parent_->request_high_power();
|
||||
this->requested_ = true;
|
||||
}
|
||||
}
|
||||
void unrequest() {
|
||||
if (this->requested_ && this->parent_ != nullptr) {
|
||||
this->parent_->unrequest_high_power();
|
||||
this->requested_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
PowerSupply *parent_{nullptr};
|
||||
bool requested_{false};
|
||||
};
|
||||
|
||||
} // namespace power_supply
|
||||
} // namespace esphome
|
||||
|
||||
Reference in New Issue
Block a user