mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 16:20:42 +00:00
fix(network): enable USE_SETUP_PRIORITY_OVERRIDE when priority is configured
PR #14255 generates calls to Component::set_setup_priority(float) from ethernet/wifi to_code(), but that method's body in core/component.cpp is gated by #ifdef USE_SETUP_PRIORITY_OVERRIDE. Without the define the declaration exists but no implementation is linked, producing: undefined reference to `esphome::Component::set_setup_priority(float)` The existing convention in cpp_helpers.register_component() is to add the define whenever CONF_SETUP_PRIORITY appears in a component's YAML. Mirror that here: when the user declares `network: priority:`, the priority-driven setup_priority overrides will be emitted, so the define must be on.
This commit is contained in:
@@ -335,6 +335,10 @@ async def to_code(config):
|
||||
if CONF_PRIORITY in config:
|
||||
priority_list = config[CONF_PRIORITY]
|
||||
CORE.data[KEY_NETWORK_PRIORITY] = priority_list
|
||||
# Enable Component::set_setup_priority() so the per-interface to_code
|
||||
# calls below have a defined symbol to link against. Without this define
|
||||
# the implementation in core/component.cpp is compiled out.
|
||||
cg.add_define("USE_SETUP_PRIORITY_OVERRIDE")
|
||||
|
||||
def _fmt(entry):
|
||||
if entry["timeout"] is not None:
|
||||
|
||||
Reference in New Issue
Block a user