mirror of
https://github.com/esphome/esphome.git
synced 2026-05-30 15:28:34 +08:00
[light] Store log_percent parameter strings in flash on ESP8266 (#12174)
This commit is contained in:
@@ -74,11 +74,11 @@ static const LogString *color_mode_to_human(ColorMode color_mode) {
|
|||||||
|
|
||||||
// Helper to log percentage values
|
// Helper to log percentage values
|
||||||
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG
|
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG
|
||||||
static void log_percent(const char *name, const char *param, float value) {
|
static void log_percent(const LogString *param, float value) {
|
||||||
ESP_LOGD(TAG, " %s: %.0f%%", param, value * 100.0f);
|
ESP_LOGD(TAG, " %s: %.0f%%", LOG_STR_ARG(param), value * 100.0f);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define log_percent(name, param, value)
|
#define log_percent(param, value)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void LightCall::perform() {
|
void LightCall::perform() {
|
||||||
@@ -104,11 +104,11 @@ void LightCall::perform() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this->has_brightness()) {
|
if (this->has_brightness()) {
|
||||||
log_percent(name, "Brightness", v.get_brightness());
|
log_percent(LOG_STR("Brightness"), v.get_brightness());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->has_color_brightness()) {
|
if (this->has_color_brightness()) {
|
||||||
log_percent(name, "Color brightness", v.get_color_brightness());
|
log_percent(LOG_STR("Color brightness"), v.get_color_brightness());
|
||||||
}
|
}
|
||||||
if (this->has_red() || this->has_green() || this->has_blue()) {
|
if (this->has_red() || this->has_green() || this->has_blue()) {
|
||||||
ESP_LOGD(TAG, " Red: %.0f%%, Green: %.0f%%, Blue: %.0f%%", v.get_red() * 100.0f, v.get_green() * 100.0f,
|
ESP_LOGD(TAG, " Red: %.0f%%, Green: %.0f%%, Blue: %.0f%%", v.get_red() * 100.0f, v.get_green() * 100.0f,
|
||||||
@@ -116,7 +116,7 @@ void LightCall::perform() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this->has_white()) {
|
if (this->has_white()) {
|
||||||
log_percent(name, "White", v.get_white());
|
log_percent(LOG_STR("White"), v.get_white());
|
||||||
}
|
}
|
||||||
if (this->has_color_temperature()) {
|
if (this->has_color_temperature()) {
|
||||||
ESP_LOGD(TAG, " Color temperature: %.1f mireds", v.get_color_temperature());
|
ESP_LOGD(TAG, " Color temperature: %.1f mireds", v.get_color_temperature());
|
||||||
|
|||||||
Reference in New Issue
Block a user