1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-04 19:03:47 +01:00

Always use brackets around single log macros (#4072)

This commit is contained in:
Jesse Hills
2022-11-23 10:32:51 +13:00
committed by GitHub
parent 91925b1826
commit ef26677b67
29 changed files with 133 additions and 68 deletions

View File

@@ -20,14 +20,18 @@ const LogString *fan_direction_to_string(FanDirection direction) {
void FanCall::perform() {
ESP_LOGD(TAG, "'%s' - Setting:", this->parent_.get_name().c_str());
this->validate_();
if (this->binary_state_.has_value())
if (this->binary_state_.has_value()) {
ESP_LOGD(TAG, " State: %s", ONOFF(*this->binary_state_));
if (this->oscillating_.has_value())
}
if (this->oscillating_.has_value()) {
ESP_LOGD(TAG, " Oscillating: %s", YESNO(*this->oscillating_));
if (this->speed_.has_value())
}
if (this->speed_.has_value()) {
ESP_LOGD(TAG, " Speed: %d", *this->speed_);
if (this->direction_.has_value())
}
if (this->direction_.has_value()) {
ESP_LOGD(TAG, " Direction: %s", LOG_STR_ARG(fan_direction_to_string(*this->direction_)));
}
this->parent_.control(*this);
}
@@ -90,12 +94,15 @@ void Fan::publish_state() {
ESP_LOGD(TAG, "'%s' - Sending state:", this->name_.c_str());
ESP_LOGD(TAG, " State: %s", ONOFF(this->state));
if (traits.supports_speed())
if (traits.supports_speed()) {
ESP_LOGD(TAG, " Speed: %d", this->speed);
if (traits.supports_oscillation())
}
if (traits.supports_oscillation()) {
ESP_LOGD(TAG, " Oscillating: %s", YESNO(this->oscillating));
if (traits.supports_direction())
}
if (traits.supports_direction()) {
ESP_LOGD(TAG, " Direction: %s", LOG_STR_ARG(fan_direction_to_string(this->direction)));
}
this->state_callback_.call();
this->save_state_();
@@ -147,10 +154,12 @@ void Fan::dump_traits_(const char *tag, const char *prefix) {
ESP_LOGCONFIG(tag, "%s Speed: YES", prefix);
ESP_LOGCONFIG(tag, "%s Speed count: %d", prefix, this->get_traits().supported_speed_count());
}
if (this->get_traits().supports_oscillation())
if (this->get_traits().supports_oscillation()) {
ESP_LOGCONFIG(tag, "%s Oscillation: YES", prefix);
if (this->get_traits().supports_direction())
}
if (this->get_traits().supports_direction()) {
ESP_LOGCONFIG(tag, "%s Direction: YES", prefix);
}
}
} // namespace fan