mirror of
https://github.com/esphome/esphome.git
synced 2026-09-20 03:28:41 +00:00
5f2582efcd21a99941a1d05d1772b5f85c10628b
safe_mode emits `if (should_enter_safe_mode(...)) return` via cg.add(RawExpression(...)) to short-circuit the rest of setup() and boot into safe mode. With setup() split into per-component IIFEs, that `return` was only exiting the lambda, so the rest of setup() ran anyway — breaking safe-mode recovery. Add IIFEUnsafeStatement, a Statement wrapper that marks its containing component's block for flat emission (no IIFE). safe_mode wraps its return expression in it. cpp_main_section detects any such statement in a group and emits that group flat so control-flow constructs like `return` still affect setup() itself. IIFEUnsafeStatement.__str__ routes its inner through statement() so bare Expression subclasses pick up the terminating semicolon. Reported by @swoboda1337.
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
599 MiB
Languages
C++
55.7%
Python
43.7%
C
0.3%
JavaScript
0.2%
