Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_lr1121_controls.cpp
Go to the documentation of this file.
1/// @file platform_lr1121_controls.cpp
2/// @brief Hub-level LR1121 firmware-update entities: out-of-line bodies for the
3/// bootloader-rewrite arming switch. The flash button is header-inline; this translation unit
4/// pulls its class in (via the header), so clang-tidy analyzes the button too whenever it runs
5/// against a config that enables `lr1121_firmware_update:`
6/// (`scripts/run-clang-tidy.sh config/tests/test-esp32-lr1121-fwupdate.yaml`) — the default
7/// clang-tidy target sets neither define, so both classes expand to nothing there.
8/// @ingroup hioc_platforms
9
11
12#ifdef IOHOME_LR1121_BOOTLOADER_UPDATE
13
14#include "esphome/core/log.h"
15
16namespace esphome {
17namespace home_io_control {
18
19static const char *const TAG = "home_io_control.lr1121_bootloader_switch";
20
21void IOHomeLr1121BootloaderRewriteSwitch::setup() { this->publish_state(false); }
22
23void IOHomeLr1121BootloaderRewriteSwitch::write_state(bool state) {
24 if (this->parent_ != nullptr)
25 this->parent_->set_bootloader_rewrite_allowed(state);
26 this->publish_state(state);
27}
28
29void IOHomeLr1121BootloaderRewriteSwitch::dump_config() {
30 // No irreversibility warning here on purpose: the config dump is not where it lands. The warning
31 // is already on the boot-time AVAILABLE line, on the switch-off refusal, and in the sequence
32 // itself -- i.e. every place a user is about to act on it. Repeating it in a startup dump only
33 // adds noise, and the entity name already carries "(Irreversible)".
34 LOG_SWITCH("", "LR1121 Bootloader Rewrite (Irreversible)", this);
35}
36
37} // namespace home_io_control
38} // namespace esphome
39
40#endif // IOHOME_LR1121_BOOTLOADER_UPDATE
static constexpr const char * TAG
Hub-level LR1121 firmware-update entities: the transceiver-flash button and the bootloader-rewrite ar...