mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	No walruses were harmed in the committing of this commit
This commit is contained in:
		| @@ -4,8 +4,9 @@ namespace esphome { | |||||||
| namespace ota { | namespace ota { | ||||||
|  |  | ||||||
| #ifdef USE_OTA_STATE_CALLBACK | #ifdef USE_OTA_STATE_CALLBACK | ||||||
| OTAGlobalCallback *global_ota_component = | OTAGlobalCallback *global_ota_component = nullptr;  // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) | ||||||
|     new OTAGlobalCallback;  // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) |  | ||||||
|  | OTAGlobalCallback::OTAGlobalCallback() { global_ota_component = this; } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| }  // namespace ota | }  // namespace ota | ||||||
|   | |||||||
| @@ -68,6 +68,7 @@ class OTAComponent : public Component { | |||||||
| #ifdef USE_OTA_STATE_CALLBACK | #ifdef USE_OTA_STATE_CALLBACK | ||||||
| class OTAGlobalCallback { | class OTAGlobalCallback { | ||||||
|  public: |  public: | ||||||
|  |   OTAGlobalCallback(); | ||||||
|   void register_ota(OTAComponent *ota_caller) { |   void register_ota(OTAComponent *ota_caller) { | ||||||
|     ota_caller->add_on_state_callback([this, ota_caller](OTAState state, float progress, uint8_t error) { |     ota_caller->add_on_state_callback([this, ota_caller](OTAState state, float progress, uint8_t error) { | ||||||
|       this->state_callback_.call(state, progress, error, ota_caller); |       this->state_callback_.call(state, progress, error, ota_caller); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user