mirror of
https://github.com/esphome/esphome.git
synced 2024-11-16 10:45:48 +01:00
No walruses were harmed in the committing of this commit
This commit is contained in:
parent
33b36425a4
commit
68cb348a8b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user