From 0426be928016de7879347c08db5bd63fcb4f6c59 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 9 Jun 2021 08:45:51 +1200 Subject: [PATCH] Fixes for BLE/improv (#1878) --- esphome/components/esp32_ble/ble.cpp | 36 +++++++++---------- esphome/components/esp32_ble/ble.h | 2 +- esphome/components/esp32_ble/ble_2901.cpp | 4 +-- esphome/components/esp32_ble/ble_2901.h | 4 +-- .../esp32_ble/ble_characteristic.cpp | 8 ++--- .../components/esp32_ble/ble_characteristic.h | 8 ++--- .../components/esp32_ble/ble_descriptor.cpp | 8 ++--- esphome/components/esp32_ble/ble_descriptor.h | 4 +-- esphome/components/esp32_ble/ble_server.cpp | 6 ++-- esphome/components/esp32_ble/ble_server.h | 8 ++--- esphome/components/esp32_ble/ble_service.cpp | 14 ++++---- esphome/components/esp32_ble/ble_service.h | 2 +- esphome/components/esp32_ble/ble_uuid.cpp | 2 +- esphome/components/esp32_ble/ble_uuid.h | 2 +- .../esp32_improv/esp32_improv_component.cpp | 14 +++++--- .../esp32_improv/esp32_improv_component.h | 2 +- esphome/components/improv/improv.cpp | 27 ++++++++++++-- esphome/components/improv/improv.h | 6 ++-- esphome/core/defines.h | 1 + esphome/core/helpers.h | 2 -- 20 files changed, 95 insertions(+), 65 deletions(-) diff --git a/esphome/components/esp32_ble/ble.cpp b/esphome/components/esp32_ble/ble.cpp index 9ce9eaec7e..2200d3cef1 100644 --- a/esphome/components/esp32_ble/ble.cpp +++ b/esphome/components/esp32_ble/ble.cpp @@ -119,24 +119,24 @@ bool ESP32BLE::ble_setup_() { return true; } -void ESP32BLE::loop() { - BLEEvent *ble_event = this->ble_events_.pop(); - while (ble_event != nullptr) { - switch (ble_event->type_) { - case ble_event->GATTS: - this->real_gatts_event_handler_(ble_event->event_.gatts.gatts_event, ble_event->event_.gatts.gatts_if, - &ble_event->event_.gatts.gatts_param); - break; - case ble_event->GAP: - this->real_gap_event_handler_(ble_event->event_.gap.gap_event, &ble_event->event_.gap.gap_param); - break; - default: - break; - } - delete ble_event; - ble_event = this->ble_events_.pop(); - } -} +// void ESP32BLE::loop() { +// BLEEvent *ble_event = this->ble_events_.pop(); +// while (ble_event != nullptr) { +// switch (ble_event->type_) { +// case ble_event->GATTS: +// this->real_gatts_event_handler_(ble_event->event_.gatts.gatts_event, ble_event->event_.gatts.gatts_if, +// &ble_event->event_.gatts.gatts_param); +// break; +// case ble_event->GAP: +// this->real_gap_event_handler_(ble_event->event_.gap.gap_event, &ble_event->event_.gap.gap_param); +// break; +// default: +// break; +// } +// delete ble_event; +// ble_event = this->ble_events_.pop(); +// } +// } void ESP32BLE::gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) { global_ble->real_gap_event_handler_(event, param); diff --git a/esphome/components/esp32_ble/ble.h b/esphome/components/esp32_ble/ble.h index 8eaa7068fd..8850f10d85 100644 --- a/esphome/components/esp32_ble/ble.h +++ b/esphome/components/esp32_ble/ble.h @@ -23,7 +23,7 @@ typedef struct { class ESP32BLE : public Component { public: void setup() override; - void loop() override; + // void loop() override; void dump_config() override; float get_setup_priority() const override; void mark_failed() override; diff --git a/esphome/components/esp32_ble/ble_2901.cpp b/esphome/components/esp32_ble/ble_2901.cpp index d62c67c4cf..952d82d5f0 100644 --- a/esphome/components/esp32_ble/ble_2901.cpp +++ b/esphome/components/esp32_ble/ble_2901.cpp @@ -6,8 +6,8 @@ namespace esphome { namespace esp32_ble { -BLE2901::BLE2901(const std::string value) : BLE2901((uint8_t *) value.data(), value.length()) {} -BLE2901::BLE2901(uint8_t *data, size_t length) : BLEDescriptor(ESPBTUUID::from_uint16(0x2901)) { +BLE2901::BLE2901(const std::string &value) : BLE2901((uint8_t *) value.data(), value.length()) {} +BLE2901::BLE2901(const uint8_t *data, size_t length) : BLEDescriptor(ESPBTUUID::from_uint16(0x2901)) { this->set_value(data, length); this->permissions_ = ESP_GATT_PERM_READ; } diff --git a/esphome/components/esp32_ble/ble_2901.h b/esphome/components/esp32_ble/ble_2901.h index 6f72f38fd0..e606b6271a 100644 --- a/esphome/components/esp32_ble/ble_2901.h +++ b/esphome/components/esp32_ble/ble_2901.h @@ -9,8 +9,8 @@ namespace esp32_ble { class BLE2901 : public BLEDescriptor { public: - BLE2901(const std::string value); - BLE2901(uint8_t *data, size_t length); + BLE2901(const std::string &value); + BLE2901(const uint8_t *data, size_t length); }; } // namespace esp32_ble diff --git a/esphome/components/esp32_ble/ble_characteristic.cpp b/esphome/components/esp32_ble/ble_characteristic.cpp index cee15ce6a8..240b57eb38 100644 --- a/esphome/components/esp32_ble/ble_characteristic.cpp +++ b/esphome/components/esp32_ble/ble_characteristic.cpp @@ -32,10 +32,10 @@ void BLECharacteristic::set_value(std::vector value) { this->value_ = value; xSemaphoreGive(this->set_value_lock_); } -void BLECharacteristic::set_value(std::string value) { +void BLECharacteristic::set_value(const std::string &value) { this->set_value(std::vector(value.begin(), value.end())); } -void BLECharacteristic::set_value(uint8_t *data, size_t length) { +void BLECharacteristic::set_value(const uint8_t *data, size_t length) { this->set_value(std::vector(data, data + length)); } void BLECharacteristic::set_value(uint8_t &data) { @@ -105,7 +105,7 @@ bool BLECharacteristic::do_create(BLEService *service) { esp_attr_control_t control; control.auto_rsp = ESP_GATT_RSP_BY_APP; - xSemaphoreTake(this->create_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreTake(this->create_lock_, portMAX_DELAY); ESP_LOGV(TAG, "Creating characteristic - %s", this->uuid_.to_string().c_str()); esp_bt_uuid_t uuid = this->uuid_.get_uuid(); @@ -117,7 +117,7 @@ bool BLECharacteristic::do_create(BLEService *service) { return false; } - xSemaphoreWait(this->create_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreWait(this->create_lock_, portMAX_DELAY); for (auto *descriptor : this->descriptors_) { descriptor->do_create(this); diff --git a/esphome/components/esp32_ble/ble_characteristic.h b/esphome/components/esp32_ble/ble_characteristic.h index b181b98e8c..076f5c1a5f 100644 --- a/esphome/components/esp32_ble/ble_characteristic.h +++ b/esphome/components/esp32_ble/ble_characteristic.h @@ -22,9 +22,9 @@ class BLECharacteristic { public: BLECharacteristic(const ESPBTUUID uuid, uint32_t properties); - void set_value(uint8_t *data, size_t length); + void set_value(const uint8_t *data, size_t length); void set_value(std::vector value); - void set_value(std::string value); + void set_value(const std::string &value); void set_value(uint8_t &data); void set_value(uint16_t &data); void set_value(uint32_t &data); @@ -45,7 +45,7 @@ class BLECharacteristic { bool do_create(BLEService *service); void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param); - void on_write(const std::function &)> &func) { this->on_write_ = func; } + void on_write(const std::function &)> &func) { this->on_write_ = func; } void add_descriptor(BLEDescriptor *descriptor); @@ -74,7 +74,7 @@ class BLECharacteristic { std::vector descriptors_; - std::function &)> on_write_; + std::function &)> on_write_; esp_gatt_perm_t permissions_ = ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE; }; diff --git a/esphome/components/esp32_ble/ble_descriptor.cpp b/esphome/components/esp32_ble/ble_descriptor.cpp index a6cf4c707e..4c4e3968e8 100644 --- a/esphome/components/esp32_ble/ble_descriptor.cpp +++ b/esphome/components/esp32_ble/ble_descriptor.cpp @@ -28,7 +28,7 @@ bool BLEDescriptor::do_create(BLECharacteristic *characteristic) { esp_attr_control_t control; control.auto_rsp = ESP_GATT_AUTO_RSP; - xSemaphoreTake(this->create_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreTake(this->create_lock_, portMAX_DELAY); ESP_LOGV(TAG, "Creating descriptor - %s", this->uuid_.to_string().c_str()); esp_bt_uuid_t uuid = this->uuid_.get_uuid(); esp_err_t err = esp_ble_gatts_add_char_descr(this->characteristic_->get_service()->get_handle(), &uuid, @@ -37,13 +37,13 @@ bool BLEDescriptor::do_create(BLECharacteristic *characteristic) { ESP_LOGE(TAG, "esp_ble_gatts_add_char_descr failed: %d", err); return false; } - xSemaphoreWait(this->create_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreWait(this->create_lock_, portMAX_DELAY); return true; } -void BLEDescriptor::set_value(const std::string value) { this->set_value((uint8_t *) value.data(), value.length()); } -void BLEDescriptor::set_value(uint8_t *data, size_t length) { +void BLEDescriptor::set_value(const std::string &value) { this->set_value((uint8_t *) value.data(), value.length()); } +void BLEDescriptor::set_value(const uint8_t *data, size_t length) { if (length > this->value_.attr_max_len) { ESP_LOGE(TAG, "Size %d too large, must be no bigger than %d", length, this->value_.attr_max_len); return; diff --git a/esphome/components/esp32_ble/ble_descriptor.h b/esphome/components/esp32_ble/ble_descriptor.h index a0f92dc929..ffbb9645bd 100644 --- a/esphome/components/esp32_ble/ble_descriptor.h +++ b/esphome/components/esp32_ble/ble_descriptor.h @@ -18,8 +18,8 @@ class BLEDescriptor { virtual ~BLEDescriptor(); bool do_create(BLECharacteristic *characteristic); - void set_value(const std::string value); - void set_value(uint8_t *data, size_t length); + void set_value(const std::string &value); + void set_value(const uint8_t *data, size_t length); void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param); diff --git a/esphome/components/esp32_ble/ble_server.cpp b/esphome/components/esp32_ble/ble_server.cpp index 0b0105cd4d..a63312dd62 100644 --- a/esphome/components/esp32_ble/ble_server.cpp +++ b/esphome/components/esp32_ble/ble_server.cpp @@ -46,14 +46,14 @@ void BLEServer::setup() { } void BLEServer::setup_server_() { - xSemaphoreTake(this->register_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreTake(this->register_lock_, portMAX_DELAY); esp_err_t err = esp_ble_gatts_app_register(0); if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ble_gatts_app_register failed: %d", err); this->mark_failed(); return; } - xSemaphoreWait(this->register_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreWait(this->register_lock_, portMAX_DELAY); this->device_information_service = this->create_service(DEVICE_INFORMATION_SERVICE_UUID); @@ -96,7 +96,7 @@ BLEService *BLEServer::create_service(const uint8_t *uuid, bool advertise) { BLEService *BLEServer::create_service(uint16_t uuid, bool advertise) { return this->create_service(ESPBTUUID::from_uint16(uuid), advertise); } -BLEService *BLEServer::create_service(const std::string uuid, bool advertise) { +BLEService *BLEServer::create_service(const std::string &uuid, bool advertise) { return this->create_service(ESPBTUUID::from_raw(uuid), advertise); } BLEService *BLEServer::create_service(ESPBTUUID uuid, bool advertise, uint16_t num_handles, uint8_t inst_id) { diff --git a/esphome/components/esp32_ble/ble_server.h b/esphome/components/esp32_ble/ble_server.h index b6e3f203ed..0713816ad3 100644 --- a/esphome/components/esp32_ble/ble_server.h +++ b/esphome/components/esp32_ble/ble_server.h @@ -34,17 +34,17 @@ class BLEServer : public Component { void teardown(); - void set_manufacturer(const std::string manufacturer) { this->manufacturer_ = manufacturer; } - void set_model(const std::string model) { this->model_ = model; } + void set_manufacturer(const std::string &manufacturer) { this->manufacturer_ = manufacturer; } + void set_model(const std::string &model) { this->model_ = model; } BLEService *create_service(const uint8_t *uuid, bool advertise = false); BLEService *create_service(uint16_t uuid, bool advertise = false); - BLEService *create_service(const std::string uuid, bool advertise = false); + BLEService *create_service(const std::string &uuid, bool advertise = false); BLEService *create_service(ESPBTUUID uuid, bool advertise = false, uint16_t num_handles = 15, uint8_t inst_id = 0); esp_gatt_if_t get_gatts_if() { return this->gatts_if_; } uint32_t get_connected_client_count() { return this->connected_clients_; } - std::map get_clients() { return this->clients_; } + const std::map &get_clients() { return this->clients_; } BLEAdvertising *get_advertising() { return this->advertising_; } void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param); diff --git a/esphome/components/esp32_ble/ble_service.cpp b/esphome/components/esp32_ble/ble_service.cpp index 9f837175ed..af8fe00a1d 100644 --- a/esphome/components/esp32_ble/ble_service.cpp +++ b/esphome/components/esp32_ble/ble_service.cpp @@ -38,7 +38,7 @@ BLECharacteristic *BLEService::get_characteristic(uint16_t uuid) { BLECharacteristic *BLEService::create_characteristic(uint16_t uuid, esp_gatt_char_prop_t properties) { return create_characteristic(ESPBTUUID::from_uint16(uuid), properties); } -BLECharacteristic *BLEService::create_characteristic(const std::string uuid, esp_gatt_char_prop_t properties) { +BLECharacteristic *BLEService::create_characteristic(const std::string &uuid, esp_gatt_char_prop_t properties) { return create_characteristic(ESPBTUUID::from_raw(uuid), properties); } BLECharacteristic *BLEService::create_characteristic(ESPBTUUID uuid, esp_gatt_char_prop_t properties) { @@ -50,7 +50,7 @@ BLECharacteristic *BLEService::create_characteristic(ESPBTUUID uuid, esp_gatt_ch bool BLEService::do_create(BLEServer *server) { this->server_ = server; - xSemaphoreTake(this->create_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreTake(this->create_lock_, portMAX_DELAY); esp_gatt_srvc_id_t srvc_id; srvc_id.is_primary = true; srvc_id.id.inst_id = this->inst_id_; @@ -61,7 +61,7 @@ bool BLEService::do_create(BLEServer *server) { ESP_LOGE(TAG, "esp_ble_gatts_create_service failed: %d", err); return false; } - xSemaphoreWait(this->create_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreWait(this->create_lock_, portMAX_DELAY); return true; } @@ -72,23 +72,23 @@ void BLEService::start() { characteristic->do_create(this); } - xSemaphoreTake(this->start_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreTake(this->start_lock_, portMAX_DELAY); esp_err_t err = esp_ble_gatts_start_service(this->handle_); if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ble_gatts_start_service failed: %d", err); return; } - xSemaphoreWait(this->start_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreWait(this->start_lock_, portMAX_DELAY); } void BLEService::stop() { - xSemaphoreTake(this->stop_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreTake(this->stop_lock_, portMAX_DELAY); esp_err_t err = esp_ble_gatts_stop_service(this->handle_); if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ble_gatts_stop_service failed: %d", err); return; } - xSemaphoreWait(this->stop_lock_, SEMAPHORE_MAX_DELAY); + xSemaphoreWait(this->stop_lock_, portMAX_DELAY); } void BLEService::gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, diff --git a/esphome/components/esp32_ble/ble_service.h b/esphome/components/esp32_ble/ble_service.h index c87415be13..9a88d4e1e7 100644 --- a/esphome/components/esp32_ble/ble_service.h +++ b/esphome/components/esp32_ble/ble_service.h @@ -23,7 +23,7 @@ class BLEService { BLECharacteristic *get_characteristic(ESPBTUUID uuid); BLECharacteristic *get_characteristic(uint16_t uuid); - BLECharacteristic *create_characteristic(const std::string uuid, esp_gatt_char_prop_t properties); + BLECharacteristic *create_characteristic(const std::string &uuid, esp_gatt_char_prop_t properties); BLECharacteristic *create_characteristic(uint16_t uuid, esp_gatt_char_prop_t properties); BLECharacteristic *create_characteristic(ESPBTUUID uuid, esp_gatt_char_prop_t properties); diff --git a/esphome/components/esp32_ble/ble_uuid.cpp b/esphome/components/esp32_ble/ble_uuid.cpp index 63633e2c43..cb0b99c62b 100644 --- a/esphome/components/esp32_ble/ble_uuid.cpp +++ b/esphome/components/esp32_ble/ble_uuid.cpp @@ -25,7 +25,7 @@ ESPBTUUID ESPBTUUID::from_raw(const uint8_t *data) { ret.uuid_.uuid.uuid128[i] = data[i]; return ret; } -ESPBTUUID ESPBTUUID::from_raw(const std::string data) { +ESPBTUUID ESPBTUUID::from_raw(const std::string &data) { ESPBTUUID ret; if (data.length() == 4) { ret.uuid_.len = ESP_UUID_LEN_16; diff --git a/esphome/components/esp32_ble/ble_uuid.h b/esphome/components/esp32_ble/ble_uuid.h index 96e9b126d4..0e3c9b0d0a 100644 --- a/esphome/components/esp32_ble/ble_uuid.h +++ b/esphome/components/esp32_ble/ble_uuid.h @@ -20,7 +20,7 @@ class ESPBTUUID { static ESPBTUUID from_raw(const uint8_t *data); - static ESPBTUUID from_raw(const std::string data); + static ESPBTUUID from_raw(const std::string &data); static ESPBTUUID from_uuid(esp_bt_uuid_t uuid); diff --git a/esphome/components/esp32_improv/esp32_improv_component.cpp b/esphome/components/esp32_improv/esp32_improv_component.cpp index 3fc5e6acf2..a407d819b7 100644 --- a/esphome/components/esp32_improv/esp32_improv_component.cpp +++ b/esphome/components/esp32_improv/esp32_improv_component.cpp @@ -27,7 +27,7 @@ void ESP32ImprovComponent::setup_service() { this->rpc_ = this->service_->create_characteristic(improv::RPC_COMMAND_UUID, esp32_ble::BLECharacteristic::PROPERTY_WRITE); - this->rpc_->on_write([this](std::vector &data) { + this->rpc_->on_write([this](const std::vector &data) { if (data.size() > 0) { this->incoming_data_.insert(this->incoming_data_.end(), data.begin(), data.end()); } @@ -123,13 +123,17 @@ void ESP32ImprovComponent::loop() { std::string url = "https://my.home-assistant.io/redirect/config_flow_start?domain=esphome"; std::vector data = improv::build_rpc_response(improv::WIFI_SETTINGS, {url}); this->send_response(data); + this->set_timeout("end-service", 1000, [this] { + this->service_->stop(); + this->set_state_(improv::STATE_STOPPED); + }); } break; } case improv::STATE_PROVISIONED: { this->incoming_data_.clear(); if (this->status_indicator_ != nullptr) - this->status_indicator_->turn_on(); + this->status_indicator_->turn_off(); break; } } @@ -188,8 +192,10 @@ void ESP32ImprovComponent::start() { } void ESP32ImprovComponent::end() { - this->set_state_(improv::STATE_STOPPED); - this->service_->stop(); + this->set_timeout("end-service", 1000, [this] { + this->service_->stop(); + this->set_state_(improv::STATE_STOPPED); + }); } float ESP32ImprovComponent::get_setup_priority() const { diff --git a/esphome/components/esp32_improv/esp32_improv_component.h b/esphome/components/esp32_improv/esp32_improv_component.h index 820951f18d..498a443ec3 100644 --- a/esphome/components/esp32_improv/esp32_improv_component.h +++ b/esphome/components/esp32_improv/esp32_improv_component.h @@ -26,7 +26,7 @@ class ESP32ImprovComponent : public Component, public esp32_ble::BLEServiceCompo float get_setup_priority() const override; void start(); void end(); - bool is_active() const { return this->state_ == improv::STATE_AUTHORIZED; } + bool is_active() const { return this->state_ != improv::STATE_STOPPED; } void set_authorizer(binary_sensor::BinarySensor *authorizer) { this->authorizer_ = authorizer; } void set_status_indicator(output::BinaryOutput *status_indicator) { this->status_indicator_ = status_indicator; } diff --git a/esphome/components/improv/improv.cpp b/esphome/components/improv/improv.cpp index 6bda79a2c1..d1fee72866 100644 --- a/esphome/components/improv/improv.cpp +++ b/esphome/components/improv/improv.cpp @@ -2,7 +2,9 @@ namespace improv { -ImprovCommand parse_improv_data(std::vector &data) { return parse_improv_data(data.data(), data.size()); } +ImprovCommand parse_improv_data(const std::vector &data) { + return parse_improv_data(data.data(), data.size()); +} ImprovCommand parse_improv_data(const uint8_t *data, size_t length) { Command command = (Command) data[0]; @@ -42,7 +44,28 @@ ImprovCommand parse_improv_data(const uint8_t *data, size_t length) { }; } -std::vector build_rpc_response(Command command, std::vector datum) { +std::vector build_rpc_response(Command command, const std::vector &datum) { + std::vector out; + uint32_t length = 0; + out.push_back(command); + for (auto str : datum) { + uint8_t len = str.length(); + length += len; + out.push_back(len); + out.insert(out.end(), str.begin(), str.end()); + } + out.insert(out.begin() + 1, length); + + uint32_t calculated_checksum = 0; + + for (uint8_t byte : out) { + calculated_checksum += byte; + } + out.push_back(calculated_checksum); + return out; +} + +std::vector build_rpc_response(Command command, const std::vector &datum) { std::vector out; uint32_t length = 0; out.push_back(command); diff --git a/esphome/components/improv/improv.h b/esphome/components/improv/improv.h index c13c68c90e..8a44812cec 100644 --- a/esphome/components/improv/improv.h +++ b/esphome/components/improv/improv.h @@ -2,6 +2,7 @@ #include #include +#include "WString.h" #include namespace improv { @@ -45,9 +46,10 @@ struct ImprovCommand { std::string password; }; -ImprovCommand parse_improv_data(std::vector &data); +ImprovCommand parse_improv_data(const std::vector &data); ImprovCommand parse_improv_data(const uint8_t *data, size_t length); -std::vector build_rpc_response(Command command, std::vector datum); +std::vector build_rpc_response(Command command, const std::vector &datum); +std::vector build_rpc_response(Command command, const std::vector &datum); } // namespace improv diff --git a/esphome/core/defines.h b/esphome/core/defines.h index fe10a42baa..597cd5e31f 100644 --- a/esphome/core/defines.h +++ b/esphome/core/defines.h @@ -19,6 +19,7 @@ #define USE_JSON #ifdef ARDUINO_ARCH_ESP32 #define USE_ESP32_CAMERA +#define USE_IMPROV #endif #define USE_TIME #define USE_DEEP_SLEEP diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 499ca8f832..d49415ca6b 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -27,8 +27,6 @@ namespace esphome { -static const uint32_t SEMAPHORE_MAX_DELAY = 4294967295UL; - /// The characters that are allowed in a hostname. extern const char *HOSTNAME_CHARACTER_ALLOWLIST;