1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-07 05:42:20 +01:00

Store strings only used for logging in flash (#2274)

Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
Oxan van Leeuwen
2021-09-13 09:48:52 +02:00
committed by GitHub
parent e18dfdd656
commit d594a6fcbc
25 changed files with 241 additions and 251 deletions

View File

@@ -47,28 +47,28 @@ void GPIOSwitch::setup() {
void GPIOSwitch::dump_config() {
LOG_SWITCH("", "GPIO Switch", this);
LOG_PIN(" Pin: ", this->pin_);
const char *restore_mode = "";
const LogString *restore_mode = LOG_STR("");
switch (this->restore_mode_) {
case GPIO_SWITCH_RESTORE_DEFAULT_OFF:
restore_mode = "Restore (Defaults to OFF)";
restore_mode = LOG_STR("Restore (Defaults to OFF)");
break;
case GPIO_SWITCH_RESTORE_DEFAULT_ON:
restore_mode = "Restore (Defaults to ON)";
restore_mode = LOG_STR("Restore (Defaults to ON)");
break;
case GPIO_SWITCH_RESTORE_INVERTED_DEFAULT_ON:
restore_mode = "Restore inverted (Defaults to ON)";
restore_mode = LOG_STR("Restore inverted (Defaults to ON)");
break;
case GPIO_SWITCH_RESTORE_INVERTED_DEFAULT_OFF:
restore_mode = "Restore inverted (Defaults to OFF)";
restore_mode = LOG_STR("Restore inverted (Defaults to OFF)");
break;
case GPIO_SWITCH_ALWAYS_OFF:
restore_mode = "Always OFF";
restore_mode = LOG_STR("Always OFF");
break;
case GPIO_SWITCH_ALWAYS_ON:
restore_mode = "Always ON";
restore_mode = LOG_STR("Always ON");
break;
}
ESP_LOGCONFIG(TAG, " Restore Mode: %s", restore_mode);
ESP_LOGCONFIG(TAG, " Restore Mode: %s", LOG_STR_ARG(restore_mode));
if (!this->interlock_.empty()) {
ESP_LOGCONFIG(TAG, " Interlocks:");
for (auto *lock : this->interlock_) {