mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Fix braceless else statements
This commit is contained in:
parent
122ff731ef
commit
666267fd83
17 changed files with 55 additions and 35 deletions
|
@ -37,8 +37,9 @@ void ClimateIR::setup() {
|
||||||
this->publish_state();
|
this->publish_state();
|
||||||
});
|
});
|
||||||
this->current_temperature = this->sensor_->state;
|
this->current_temperature = this->sensor_->state;
|
||||||
} else
|
} else {
|
||||||
this->current_temperature = NAN;
|
this->current_temperature = NAN;
|
||||||
|
}
|
||||||
// restore set points
|
// restore set points
|
||||||
auto restore = this->restore_state_();
|
auto restore = this->restore_state_();
|
||||||
if (restore.has_value()) {
|
if (restore.has_value()) {
|
||||||
|
|
|
@ -131,8 +131,9 @@ bool CoolixClimate::on_coolix(climate::Climate *parent, remote_base::RemoteRecei
|
||||||
} else {
|
} else {
|
||||||
parent->mode = climate::CLIMATE_MODE_FAN_ONLY;
|
parent->mode = climate::CLIMATE_MODE_FAN_ONLY;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
parent->mode = climate::CLIMATE_MODE_COOL;
|
parent->mode = climate::CLIMATE_MODE_COOL;
|
||||||
|
}
|
||||||
|
|
||||||
// Fan Speed
|
// Fan Speed
|
||||||
if ((remote_state & COOLIX_FAN_AUTO) == COOLIX_FAN_AUTO || parent->mode == climate::CLIMATE_MODE_HEAT_COOL ||
|
if ((remote_state & COOLIX_FAN_AUTO) == COOLIX_FAN_AUTO || parent->mode == climate::CLIMATE_MODE_HEAT_COOL ||
|
||||||
|
|
|
@ -118,8 +118,9 @@ std::unique_ptr<Command> CircularCommandQueue::dequeue() {
|
||||||
if (front_ == rear_) {
|
if (front_ == rear_) {
|
||||||
front_ = -1;
|
front_ = -1;
|
||||||
rear_ = -1;
|
rear_ = -1;
|
||||||
} else
|
} else {
|
||||||
front_ = (front_ + 1) % COMMAND_QUEUE_SIZE;
|
front_ = (front_ + 1) % COMMAND_QUEUE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
return dequeued_cmd;
|
return dequeued_cmd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,10 +156,11 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r
|
||||||
if (bit == 0) {
|
if (bit == 0) {
|
||||||
bit = 7;
|
bit = 7;
|
||||||
byte++;
|
byte++;
|
||||||
} else
|
} else {
|
||||||
bit--;
|
bit--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!report_errors && error_code != 0)
|
if (!report_errors && error_code != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -266,9 +266,10 @@ void Display::filled_gauge(int center_x, int center_y, int radius1, int radius2,
|
||||||
if (dymax < float(-dxmax) * tan_a) {
|
if (dymax < float(-dxmax) * tan_a) {
|
||||||
upd_dxmax = ceil(float(dymax) / tan_a);
|
upd_dxmax = ceil(float(dymax) / tan_a);
|
||||||
hline_width = -dxmax - upd_dxmax + 1;
|
hline_width = -dxmax - upd_dxmax + 1;
|
||||||
} else
|
} else {
|
||||||
hline_width = 0;
|
hline_width = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (hline_width > 0)
|
if (hline_width > 0)
|
||||||
this->horizontal_line(center_x + dxmax, center_y - dymax, hline_width, color);
|
this->horizontal_line(center_x + dxmax, center_y - dymax, hline_width, color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,9 +90,10 @@ void Rect::info(const std::string &prefix) {
|
||||||
if (this->is_set()) {
|
if (this->is_set()) {
|
||||||
ESP_LOGI(TAG, "%s [%3d,%3d,%3d,%3d] (%3d,%3d)", prefix.c_str(), this->x, this->y, this->w, this->h, this->x2(),
|
ESP_LOGI(TAG, "%s [%3d,%3d,%3d,%3d] (%3d,%3d)", prefix.c_str(), this->x, this->y, this->w, this->h, this->x2(),
|
||||||
this->y2());
|
this->y2());
|
||||||
} else
|
} else {
|
||||||
ESP_LOGI(TAG, "%s ** IS NOT SET **", prefix.c_str());
|
ESP_LOGI(TAG, "%s ** IS NOT SET **", prefix.c_str());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace display
|
} // namespace display
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
|
@ -112,7 +112,7 @@ void ESP32ImprovComponent::loop() {
|
||||||
this->set_state_(improv::STATE_AUTHORIZED);
|
this->set_state_(improv::STATE_AUTHORIZED);
|
||||||
} else
|
} else
|
||||||
#else
|
#else
|
||||||
this->set_state_(improv::STATE_AUTHORIZED);
|
{ this->set_state_(improv::STATE_AUTHORIZED); }
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (!this->check_identify_())
|
if (!this->check_identify_())
|
||||||
|
|
|
@ -97,8 +97,9 @@ void GCJA5Component::parse_data_() {
|
||||||
if (this->rx_message_[0] != 0x02 || this->rx_message_[31] != 0x03 || !this->calculate_checksum_()) {
|
if (this->rx_message_[0] != 0x02 || this->rx_message_[31] != 0x03 || !this->calculate_checksum_()) {
|
||||||
ESP_LOGVV(TAG, "Discarding bad packet - failed checks.");
|
ESP_LOGVV(TAG, "Discarding bad packet - failed checks.");
|
||||||
return;
|
return;
|
||||||
} else
|
} else {
|
||||||
ESP_LOGVV(TAG, "Good packet found.");
|
ESP_LOGVV(TAG, "Good packet found.");
|
||||||
|
}
|
||||||
|
|
||||||
this->have_good_data_ = true;
|
this->have_good_data_ = true;
|
||||||
uint8_t status = this->rx_message_[29];
|
uint8_t status = this->rx_message_[29];
|
||||||
|
|
|
@ -342,9 +342,10 @@ bool HaierClimateBase::prepare_pending_action() {
|
||||||
this->action_request_.reset();
|
this->action_request_.reset();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ClimateTraits HaierClimateBase::traits() { return traits_; }
|
ClimateTraits HaierClimateBase::traits() { return traits_; }
|
||||||
|
|
||||||
|
|
|
@ -701,9 +701,10 @@ void HonClimate::process_alarm_message_(const uint8_t *packet, uint8_t size, boo
|
||||||
alarm_code++;
|
alarm_code++;
|
||||||
}
|
}
|
||||||
active_alarms_[i] = packet[2 + i];
|
active_alarms_[i] = packet[2 + i];
|
||||||
} else
|
} else {
|
||||||
alarm_code += 8;
|
alarm_code += 8;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
float alarm_count = 0.0f;
|
float alarm_count = 0.0f;
|
||||||
static uint8_t nibble_bits_count[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
|
static uint8_t nibble_bits_count[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
|
||||||
|
|
|
@ -87,9 +87,10 @@ void HeatpumpIRClimate::setup() {
|
||||||
this->publish_state();
|
this->publish_state();
|
||||||
});
|
});
|
||||||
this->current_temperature = this->sensor_->state;
|
this->current_temperature = this->sensor_->state;
|
||||||
} else
|
} else {
|
||||||
this->current_temperature = NAN;
|
this->current_temperature = NAN;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HeatpumpIRClimate::transmit_state() {
|
void HeatpumpIRClimate::transmit_state() {
|
||||||
uint8_t power_mode_cmd;
|
uint8_t power_mode_cmd;
|
||||||
|
|
|
@ -25,6 +25,7 @@ void I2SAudioMicrophone::setup() {
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
if (this->pdm_) {
|
if (this->pdm_) {
|
||||||
if (this->parent_->get_port() != I2S_NUM_0) {
|
if (this->parent_->get_port() != I2S_NUM_0) {
|
||||||
ESP_LOGE(TAG, "PDM only works on I2S0!");
|
ESP_LOGE(TAG, "PDM only works on I2S0!");
|
||||||
|
@ -33,6 +34,7 @@ void I2SAudioMicrophone::setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void I2SAudioMicrophone::start() {
|
void I2SAudioMicrophone::start() {
|
||||||
if (this->is_failed())
|
if (this->is_failed())
|
||||||
|
|
|
@ -11,16 +11,18 @@ void MicroNovaSwitch::write_state(bool state) {
|
||||||
if (this->micronova_->get_current_stove_state() == 0) {
|
if (this->micronova_->get_current_stove_state() == 0) {
|
||||||
this->micronova_->write_address(this->memory_location_, this->memory_address_, this->memory_data_on_);
|
this->micronova_->write_address(this->memory_location_, this->memory_address_, this->memory_data_on_);
|
||||||
this->publish_state(true);
|
this->publish_state(true);
|
||||||
} else
|
} else {
|
||||||
ESP_LOGW(TAG, "Unable to turn stove on, invalid state: %d", micronova_->get_current_stove_state());
|
ESP_LOGW(TAG, "Unable to turn stove on, invalid state: %d", micronova_->get_current_stove_state());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// don't send power-off when status is Off or Final cleaning
|
// don't send power-off when status is Off or Final cleaning
|
||||||
if (this->micronova_->get_current_stove_state() != 0 && micronova_->get_current_stove_state() != 6) {
|
if (this->micronova_->get_current_stove_state() != 0 && micronova_->get_current_stove_state() != 6) {
|
||||||
this->micronova_->write_address(this->memory_location_, this->memory_address_, this->memory_data_off_);
|
this->micronova_->write_address(this->memory_location_, this->memory_address_, this->memory_data_off_);
|
||||||
this->publish_state(false);
|
this->publish_state(false);
|
||||||
} else
|
} else {
|
||||||
ESP_LOGW(TAG, "Unable to turn stove off, invalid state: %d", micronova_->get_current_stove_state());
|
ESP_LOGW(TAG, "Unable to turn stove off, invalid state: %d", micronova_->get_current_stove_state());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this->micronova_->update();
|
this->micronova_->update();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,9 @@ void ToshibaClimate::setup() {
|
||||||
this->publish_state();
|
this->publish_state();
|
||||||
});
|
});
|
||||||
this->current_temperature = this->sensor_->state;
|
this->current_temperature = this->sensor_->state;
|
||||||
} else
|
} else {
|
||||||
this->current_temperature = NAN;
|
this->current_temperature = NAN;
|
||||||
|
}
|
||||||
// restore set points
|
// restore set points
|
||||||
auto restore = this->restore_state_();
|
auto restore = this->restore_state_();
|
||||||
if (restore.has_value()) {
|
if (restore.has_value()) {
|
||||||
|
|
|
@ -120,8 +120,9 @@ light::LightTraits TuyaLight::get_traits() {
|
||||||
traits.set_supported_color_modes(
|
traits.set_supported_color_modes(
|
||||||
{light::ColorMode::RGB_COLOR_TEMPERATURE, light::ColorMode::COLOR_TEMPERATURE});
|
{light::ColorMode::RGB_COLOR_TEMPERATURE, light::ColorMode::COLOR_TEMPERATURE});
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
traits.set_supported_color_modes({light::ColorMode::COLOR_TEMPERATURE});
|
traits.set_supported_color_modes({light::ColorMode::COLOR_TEMPERATURE});
|
||||||
|
}
|
||||||
traits.set_min_mireds(this->cold_white_temperature_);
|
traits.set_min_mireds(this->cold_white_temperature_);
|
||||||
traits.set_max_mireds(this->warm_white_temperature_);
|
traits.set_max_mireds(this->warm_white_temperature_);
|
||||||
} else if (this->color_id_.has_value()) {
|
} else if (this->color_id_.has_value()) {
|
||||||
|
@ -131,8 +132,9 @@ light::LightTraits TuyaLight::get_traits() {
|
||||||
} else {
|
} else {
|
||||||
traits.set_supported_color_modes({light::ColorMode::RGB_WHITE});
|
traits.set_supported_color_modes({light::ColorMode::RGB_WHITE});
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
traits.set_supported_color_modes({light::ColorMode::RGB});
|
traits.set_supported_color_modes({light::ColorMode::RGB});
|
||||||
|
}
|
||||||
} else if (this->dimmer_id_.has_value()) {
|
} else if (this->dimmer_id_.has_value()) {
|
||||||
traits.set_supported_color_modes({light::ColorMode::BRIGHTNESS});
|
traits.set_supported_color_modes({light::ColorMode::BRIGHTNESS});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -104,8 +104,9 @@ void YashimaClimate::setup() {
|
||||||
this->publish_state();
|
this->publish_state();
|
||||||
});
|
});
|
||||||
this->current_temperature = this->sensor_->state;
|
this->current_temperature = this->sensor_->state;
|
||||||
} else
|
} else {
|
||||||
this->current_temperature = NAN;
|
this->current_temperature = NAN;
|
||||||
|
}
|
||||||
// restore set points
|
// restore set points
|
||||||
auto restore = this->restore_state_();
|
auto restore = this->restore_state_();
|
||||||
if (restore.has_value()) {
|
if (restore.has_value()) {
|
||||||
|
|
|
@ -126,6 +126,7 @@ uint16_t crc16(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t reverse
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
if (reverse_poly == 0xa001) {
|
if (reverse_poly == 0xa001) {
|
||||||
while (len--) {
|
while (len--) {
|
||||||
uint8_t combo = crc ^ (uint8_t) *data++;
|
uint8_t combo = crc ^ (uint8_t) *data++;
|
||||||
|
@ -143,6 +144,7 @@ uint16_t crc16(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t reverse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return refout ? (crc ^ 0xffff) : crc;
|
return refout ? (crc ^ 0xffff) : crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue