mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +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 { | ||||
|  | ||||
| #ifdef USE_OTA_STATE_CALLBACK | ||||
| OTAGlobalCallback *global_ota_component = | ||||
|     new OTAGlobalCallback;  // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) | ||||
| OTAGlobalCallback *global_ota_component = nullptr;  // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) | ||||
|  | ||||
| OTAGlobalCallback::OTAGlobalCallback() { global_ota_component = this; } | ||||
| #endif | ||||
|  | ||||
| }  // namespace ota | ||||
|   | ||||
| @@ -68,6 +68,7 @@ class OTAComponent : public Component { | ||||
| #ifdef USE_OTA_STATE_CALLBACK | ||||
| class OTAGlobalCallback { | ||||
|  public: | ||||
|   OTAGlobalCallback(); | ||||
|   void register_ota(OTAComponent *ota_caller) { | ||||
|     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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user