From 5035a1f40e3850aaa572065514124f188e0a42e6 Mon Sep 17 00:00:00 2001 From: Anton Sergunov Date: Thu, 9 May 2024 03:48:16 +0000 Subject: [PATCH] Compilation error 2 --- esphome/components/sntp/sntp_component.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/esphome/components/sntp/sntp_component.cpp b/esphome/components/sntp/sntp_component.cpp index 3a83e05aad..9ecf694b56 100644 --- a/esphome/components/sntp/sntp_component.cpp +++ b/esphome/components/sntp/sntp_component.cpp @@ -54,7 +54,13 @@ void SNTPComponent::setup() { sntp_set_sync_interval(this->get_update_interval()); #endif - g_sync_callback = [this](struct timeval *tv) { callback_args_.push_back({tv ? *tv : {}, sntp_get_sync_status()}); }; + g_sync_callback = [](struct timeval *tv) { + callback_args_.push_back({}); + if (tv) + callback_args_.back().first = *tv; + callback_args_.back().second = sntp_get_sync_status(); + }; + ESP_LOGD(TAG, "Set notification callback"); sntp_set_time_sync_notification_cb(sntp_sync_time_cb);