mirror of
https://github.com/esphome/esphome.git
synced 2024-12-24 14:34:54 +01:00
openthread: apply clang-tidy suggestions
This commit is contained in:
parent
0b8b82ba09
commit
51e1651992
2 changed files with 13 additions and 13 deletions
|
@ -31,25 +31,25 @@ class OpenThreadComponent : public Component {
|
|||
void ot_main();
|
||||
|
||||
protected:
|
||||
void srp_setup();
|
||||
std::optional<otIp6Address> get_omr_address(std::optional<OpenThreadLockGuard> &lock);
|
||||
std::string host_name;
|
||||
void *pool_alloc(size_t size);
|
||||
void srp_setup_();
|
||||
std::optional<otIp6Address> get_omr_address_(std::optional<OpenThreadLockGuard> &lock);
|
||||
std::string host_name_;
|
||||
void *pool_alloc_(size_t size);
|
||||
|
||||
private:
|
||||
// void platform_init();
|
||||
|
||||
esphome::mdns::MDNSComponent *mdns_{nullptr};
|
||||
std::vector<esphome::mdns::MDNSService> mdns_services_;
|
||||
std::vector<std::unique_ptr<uint8_t[]>> _memory_pool;
|
||||
std::vector<std::unique_ptr<uint8_t[]>> memory_pool_;
|
||||
};
|
||||
|
||||
extern OpenThreadComponent *global_openthread_component;
|
||||
|
||||
class OpenThreadLockGuard {
|
||||
public:
|
||||
static std::optional<OpenThreadLockGuard> TryAcquire(int delay);
|
||||
static std::optional<OpenThreadLockGuard> Acquire();
|
||||
static std::optional<OpenThreadLockGuard> try_acquire(int delay);
|
||||
static std::optional<OpenThreadLockGuard> acquire();
|
||||
~OpenThreadLockGuard();
|
||||
|
||||
// Returns the global openthread instance guarded by this lock
|
||||
|
|
|
@ -45,14 +45,14 @@ void OpenThreadComponent::setup() {
|
|||
xTaskCreate(
|
||||
[](void *arg) {
|
||||
static_cast<OpenThreadComponent *>(arg)->ot_main();
|
||||
vTaskDelete(NULL);
|
||||
vTaskDelete(nullptr);
|
||||
},
|
||||
"ot_main", 10240, this, 5, nullptr);
|
||||
|
||||
xTaskCreate(
|
||||
[](void *arg) {
|
||||
static_cast<OpenThreadComponent *>(arg)->srp_setup();
|
||||
vTaskDelete(NULL);
|
||||
static_cast<OpenThreadComponent *>(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> OpenThreadLockGuard::TryAcquire(int delay) {
|
||||
std::optional<OpenThreadLockGuard> OpenThreadLockGuard::try_acquire(int delay) {
|
||||
if (esp_openthread_lock_acquire(delay)) {
|
||||
return OpenThreadLockGuard();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<OpenThreadLockGuard> OpenThreadLockGuard::Acquire() {
|
||||
std::optional<OpenThreadLockGuard> OpenThreadLockGuard::acquire() {
|
||||
while (!esp_openthread_lock_acquire(100)) {
|
||||
esp_task_wdt_reset();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue