mirror of
https://github.com/esphome/esphome.git
synced 2024-12-25 06:54:52 +01:00
openthread: omit component is USE_OPENTHREAD isn't defined
This commit is contained in:
parent
028f24f395
commit
0b8b82ba09
4 changed files with 12 additions and 10 deletions
|
@ -57,6 +57,8 @@ def set_sdkconfig_options(config):
|
|||
add_idf_sdkconfig_option("CONFIG_OPENTHREAD_DNS64_CLIENT", True)
|
||||
add_idf_sdkconfig_option("CONFIG_OPENTHREAD_SRP_CLIENT", True)
|
||||
add_idf_sdkconfig_option("CONFIG_OPENTHREAD_SRP_CLIENT_MAX_SERVICES", 5)
|
||||
|
||||
# TODO: Add suport for sleepy end devices
|
||||
add_idf_sdkconfig_option("CONFIG_OPENTHREAD_FTD", True) # Full Thread Device
|
||||
|
||||
|
||||
|
@ -87,9 +89,5 @@ async def to_code(config):
|
|||
mdns_component = await cg.get_variable(config[CONF_MDNS_ID])
|
||||
cg.add(var.set_mdns(mdns_component))
|
||||
await cg.register_component(var, config)
|
||||
cg.add_global(cg.RawStatement('#include "esp_openthread.h"'))
|
||||
cg.add_global(cg.RawStatement('#include "esp_openthread_lock.h"'))
|
||||
cg.add_global(cg.RawStatement('#include "esp_task_wdt.h"'))
|
||||
cg.add_global(cg.RawStatement("#include <openthread/thread.h>"))
|
||||
|
||||
set_sdkconfig_options(config)
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#include "esphome/core/defines.h"
|
||||
#ifdef USE_OPENTHREAD
|
||||
#include "openthread.h"
|
||||
|
||||
#ifndef USE_ESP_IDF
|
||||
#error "OpenThread is not supported on this platform"
|
||||
#endif
|
||||
|
||||
#include <freertos/portmacro.h>
|
||||
|
||||
#include <openthread/srp_client.h>
|
||||
|
@ -204,3 +202,5 @@ void OpenThreadComponent::set_mdns(esphome::mdns::MDNSComponent *mdns) { this->m
|
|||
|
||||
} // namespace openthread
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
|
@ -1,4 +1,6 @@
|
|||
#pragma once
|
||||
#include "esphome/core/defines.h"
|
||||
#ifdef USE_OPENTHREAD
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/mdns/mdns_component.h"
|
||||
|
@ -61,3 +63,4 @@ class OpenThreadLockGuard {
|
|||
|
||||
} // namespace openthread
|
||||
} // namespace esphome
|
||||
#endif
|
|
@ -1,4 +1,5 @@
|
|||
// #ifdef USE_ESP_IDF
|
||||
#include "esphome/core/defines.h"
|
||||
#if defined(USE_OPENTHREAD) && defined(USE_ESP_IDF)
|
||||
#include "openthread.h"
|
||||
#include <openthread/logging.h>
|
||||
|
||||
|
@ -168,4 +169,4 @@ OpenThreadLockGuard::~OpenThreadLockGuard() { esp_openthread_lock_release(); }
|
|||
|
||||
} // namespace openthread
|
||||
} // namespace esphome
|
||||
// #endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue