mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00: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:
		| @@ -42,7 +42,7 @@ void PowerSupply::request_high_power() { | ||||
| void PowerSupply::unrequest_high_power() { | ||||
|   this->active_requests_--; | ||||
|   if (this->active_requests_ < 0) { | ||||
|     // if asserts are disabled we're just going to use 0 as our now counter. | ||||
|     // we're just going to use 0 as our now counter. | ||||
|     this->active_requests_ = 0; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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