diff --git a/esphome/components/openthread/openthread.h b/esphome/components/openthread/openthread.h index 8569a9823e..d08a008059 100644 --- a/esphome/components/openthread/openthread.h +++ b/esphome/components/openthread/openthread.h @@ -31,25 +31,25 @@ class OpenThreadComponent : public Component { void ot_main(); protected: - void srp_setup(); - std::optional get_omr_address(std::optional &lock); - std::string host_name; - void *pool_alloc(size_t size); + void srp_setup_(); + std::optional get_omr_address_(std::optional &lock); + std::string host_name_; + void *pool_alloc_(size_t size); private: // void platform_init(); esphome::mdns::MDNSComponent *mdns_{nullptr}; std::vector mdns_services_; - std::vector> _memory_pool; + std::vector> memory_pool_; }; extern OpenThreadComponent *global_openthread_component; class OpenThreadLockGuard { public: - static std::optional TryAcquire(int delay); - static std::optional Acquire(); + static std::optional try_acquire(int delay); + static std::optional acquire(); ~OpenThreadLockGuard(); // Returns the global openthread instance guarded by this lock diff --git a/esphome/components/openthread/openthread_esp.cpp b/esphome/components/openthread/openthread_esp.cpp index a6d48a0cde..a117ae36ae 100644 --- a/esphome/components/openthread/openthread_esp.cpp +++ b/esphome/components/openthread/openthread_esp.cpp @@ -45,14 +45,14 @@ void OpenThreadComponent::setup() { xTaskCreate( [](void *arg) { static_cast(arg)->ot_main(); - vTaskDelete(NULL); + vTaskDelete(nullptr); }, "ot_main", 10240, this, 5, nullptr); xTaskCreate( [](void *arg) { - static_cast(arg)->srp_setup(); - vTaskDelete(NULL); + static_cast(arg)->srp_setup_(); + vTaskDelete(nullptr); }, "ot_srp_setup", 10240, this, 5, nullptr); @@ -62,7 +62,7 @@ void OpenThreadComponent::setup() { static esp_netif_t *init_openthread_netif(const esp_openthread_platform_config_t *config) { esp_netif_config_t cfg = ESP_NETIF_DEFAULT_OPENTHREAD(); esp_netif_t *netif = esp_netif_new(&cfg); - assert(netif != NULL); + assert(netif != nullptr); ESP_ERROR_CHECK(esp_netif_attach(netif, esp_openthread_netif_glue_init(config))); return netif; @@ -149,14 +149,14 @@ network::IPAddresses OpenThreadComponent::get_ip_addresses() { return addresses; } -std::optional OpenThreadLockGuard::TryAcquire(int delay) { +std::optional OpenThreadLockGuard::try_acquire(int delay) { if (esp_openthread_lock_acquire(delay)) { return OpenThreadLockGuard(); } return {}; } -std::optional OpenThreadLockGuard::Acquire() { +std::optional OpenThreadLockGuard::acquire() { while (!esp_openthread_lock_acquire(100)) { esp_task_wdt_reset(); }