1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-13 16:52:18 +01:00

Merge branch 'pre_preserve_looping_components' into integration

This commit is contained in:
J. Nick Koston
2025-06-22 22:57:38 +02:00
7 changed files with 28 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ repos:
# Run the formatter. # Run the formatter.
- id: ruff-format - id: ruff-format
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 7.2.0 rev: 7.3.0
hooks: hooks:
- id: flake8 - id: flake8
additional_dependencies: additional_dependencies:

View File

@@ -41,6 +41,6 @@ CONFIG_SCHEMA = cv.All(
async def to_code(config): async def to_code(config):
cg.add_build_flag("-DUSE_HOST") cg.add_build_flag("-DUSE_HOST")
cg.add_define("USE_ESPHOME_HOST_MAC_ADDRESS", config[CONF_MAC_ADDRESS].parts) cg.add_define("USE_ESPHOME_HOST_MAC_ADDRESS", config[CONF_MAC_ADDRESS].parts)
cg.add_build_flag("-std=c++17") cg.add_build_flag("-std=gnu++17")
cg.add_define("ESPHOME_BOARD", "host") cg.add_define("ESPHOME_BOARD", "host")
cg.add_platformio_option("platform", "platformio/native") cg.add_platformio_option("platform", "platformio/native")

View File

@@ -261,6 +261,17 @@ void Application::teardown_components(uint32_t timeout_ms) {
} }
void Application::calculate_looping_components_() { void Application::calculate_looping_components_() {
// Count total components that need looping
size_t total_looping = 0;
for (auto *obj : this->components_) {
if (obj->has_overridden_loop()) {
total_looping++;
}
}
// Pre-reserve vector to avoid reallocations
this->looping_components_.reserve(total_looping);
// First add all active components // First add all active components
for (auto *obj : this->components_) { for (auto *obj : this->components_) {
if (obj->has_overridden_loop() && if (obj->has_overridden_loop() &&

View File

@@ -616,6 +616,12 @@ def add_build_unflag(build_unflag: str) -> None:
def set_cpp_standard(standard: str) -> None: def set_cpp_standard(standard: str) -> None:
"""Set C++ standard with compiler flag `-std={standard}`.""" """Set C++ standard with compiler flag `-std={standard}`."""
CORE.add_build_unflag("-std=gnu++11") CORE.add_build_unflag("-std=gnu++11")
CORE.add_build_unflag("-std=gnu++14")
CORE.add_build_unflag("-std=gnu++20")
CORE.add_build_unflag("-std=gnu++23")
CORE.add_build_unflag("-std=gnu++2a")
CORE.add_build_unflag("-std=gnu++2b")
CORE.add_build_unflag("-std=gnu++2c")
CORE.add_build_flag(f"-std={standard}") CORE.add_build_flag(f"-std={standard}")

View File

@@ -50,6 +50,12 @@ build_flags =
-std=gnu++17 -std=gnu++17
build_unflags = build_unflags =
-std=gnu++11 -std=gnu++11
-std=gnu++14
-std=gnu++20
-std=gnu++23
-std=gnu++2a
-std=gnu++2b
-std=gnu++2c
src_filter = src_filter =
+<./> +<./>
+<../tests/dummy_main.cpp> +<../tests/dummy_main.cpp>

View File

@@ -10,10 +10,10 @@ tzlocal==5.3.1 # from time
tzdata>=2021.1 # from time tzdata>=2021.1 # from time
pyserial==3.5 pyserial==3.5
platformio==6.1.18 # When updating platformio, also update /docker/Dockerfile platformio==6.1.18 # When updating platformio, also update /docker/Dockerfile
esptool==4.8.1 esptool==4.9.0
click==8.1.7 click==8.1.7
esphome-dashboard==20250514.0 esphome-dashboard==20250514.0
aioesphomeapi==32.2.4 aioesphomeapi==33.1.0
zeroconf==0.147.0 zeroconf==0.147.0
puremagic==1.29 puremagic==1.29
ruamel.yaml==0.18.14 # dashboard_import ruamel.yaml==0.18.14 # dashboard_import

View File

@@ -1,5 +1,5 @@
pylint==3.3.7 pylint==3.3.7
flake8==7.2.0 # also change in .pre-commit-config.yaml when updating flake8==7.3.0 # also change in .pre-commit-config.yaml when updating
ruff==0.12.0 # also change in .pre-commit-config.yaml when updating ruff==0.12.0 # also change in .pre-commit-config.yaml when updating
pyupgrade==3.20.0 # also change in .pre-commit-config.yaml when updating pyupgrade==3.20.0 # also change in .pre-commit-config.yaml when updating
pre-commit pre-commit