mirror of
https://github.com/esphome/esphome.git
synced 2025-10-24 12:43:51 +01:00
fixes
This commit is contained in:
@@ -17,7 +17,7 @@ from esphome.const import (
|
|||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_NAME_ADD_MAC_SUFFIX,
|
CONF_NAME_ADD_MAC_SUFFIX,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, TimePeriod
|
from esphome.core import CORE, CoroPriority, TimePeriod, coroutine_with_priority
|
||||||
import esphome.final_validate as fv
|
import esphome.final_validate as fv
|
||||||
|
|
||||||
DEPENDENCIES = ["esp32"]
|
DEPENDENCIES = ["esp32"]
|
||||||
@@ -421,6 +421,16 @@ def final_validation(config):
|
|||||||
# For newer chips (C3/S3/etc), different configs are used automatically
|
# For newer chips (C3/S3/etc), different configs are used automatically
|
||||||
add_idf_sdkconfig_option("CONFIG_BTDM_CTRL_BLE_MAX_CONN", max_connections)
|
add_idf_sdkconfig_option("CONFIG_BTDM_CTRL_BLE_MAX_CONN", max_connections)
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
FINAL_VALIDATE_SCHEMA = final_validation
|
||||||
|
|
||||||
|
|
||||||
|
# This needs to be run as a job with very low priority so that all components have
|
||||||
|
# a chance to register their handlers before the counts are added to defines.
|
||||||
|
@coroutine_with_priority(CoroPriority.FINAL)
|
||||||
|
async def _add_ble_handler_defines():
|
||||||
# Add defines for StaticVector sizing based on handler registration counts
|
# Add defines for StaticVector sizing based on handler registration counts
|
||||||
# Only define if count > 0 to avoid allocating unnecessary memory
|
# Only define if count > 0 to avoid allocating unnecessary memory
|
||||||
if _handler_counts.gap_event > 0:
|
if _handler_counts.gap_event > 0:
|
||||||
@@ -446,11 +456,6 @@ def final_validation(config):
|
|||||||
_handler_counts.ble_status_event,
|
_handler_counts.ble_status_event,
|
||||||
)
|
)
|
||||||
|
|
||||||
return config
|
|
||||||
|
|
||||||
|
|
||||||
FINAL_VALIDATE_SCHEMA = final_validation
|
|
||||||
|
|
||||||
|
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
@@ -506,6 +511,9 @@ async def to_code(config):
|
|||||||
cg.add_define("USE_ESP32_BLE_ADVERTISING")
|
cg.add_define("USE_ESP32_BLE_ADVERTISING")
|
||||||
cg.add_define("USE_ESP32_BLE_UUID")
|
cg.add_define("USE_ESP32_BLE_UUID")
|
||||||
|
|
||||||
|
# Schedule the handler defines to be added after all components register
|
||||||
|
CORE.add_job(_add_ble_handler_defines)
|
||||||
|
|
||||||
|
|
||||||
@automation.register_condition("ble.enabled", BLEEnabledCondition, cv.Schema({}))
|
@automation.register_condition("ble.enabled", BLEEnabledCondition, cv.Schema({}))
|
||||||
async def ble_enabled_to_code(config, condition_id, template_arg, args):
|
async def ble_enabled_to_code(config, condition_id, template_arg, args):
|
||||||
|
|||||||
Reference in New Issue
Block a user