diff --git a/esphome/components/sx127x/sx127x.cpp b/esphome/components/sx127x/sx127x.cpp index 773ac10503..167d3772cb 100644 --- a/esphome/components/sx127x/sx127x.cpp +++ b/esphome/components/sx127x/sx127x.cpp @@ -170,7 +170,7 @@ void SX127x::configure() { this->write_register_(REG_FIFO_THRESH, TX_START_FIFO_EMPTY); // config bit synchronizer - if (this->sync_value_.size() > 0) { + if (!this->sync_value_.empty()) { uint8_t polarity = (this->preamble_polarity_ == 0xAA) ? PREAMBLE_AA : PREAMBLE_55; uint8_t size = this->sync_value_.size() - 1; this->write_register_(REG_SYNC_CONFIG, SYNC_ON | polarity | size); @@ -299,15 +299,15 @@ void SX127x::dump_config() { ESP_LOGCONFIG(TAG, " Preamble Polarity: 0x%X", this->preamble_polarity_); ESP_LOGCONFIG(TAG, " Preamble Size: %" PRIu8, this->preamble_size_); ESP_LOGCONFIG(TAG, " Preamble Errors: %" PRIu8, this->preamble_errors_); - if (this->sync_value_.size() > 0) { + if (!this->sync_value_.empty()) { ESP_LOGCONFIG(TAG, " Sync Value: 0x%s", format_hex(this->sync_value_).c_str()); } if (this->modulation_ == MOD_FSK) { - static const char *SHAPING_LUT[4] = {"NO_SHAPING", "GAUSSIAN_BT_1_0", "GAUSSIAN_BT_0_5", "GAUSSIAN_BT_0_3"}; - ESP_LOGCONFIG(TAG, " Shaping: %s", SHAPING_LUT[this->shaping_ >> 5]); + static const char *shaping_lut[4] = {"NO_SHAPING", "GAUSSIAN_BT_1_0", "GAUSSIAN_BT_0_5", "GAUSSIAN_BT_0_3"}; + ESP_LOGCONFIG(TAG, " Shaping: %s", shaping_lut[this->shaping_ >> 5]); } else { - static const char *SHAPING_LUT[4] = {"NO_SHAPING", "CUTOFF_BR_X_1", "CUTOFF_BR_X_2", "ERROR"}; - ESP_LOGCONFIG(TAG, " Shaping: %s", SHAPING_LUT[this->shaping_ >> 5]); + static const char *shaping_lut[4] = {"NO_SHAPING", "CUTOFF_BR_X_1", "CUTOFF_BR_X_2", "ERROR"}; + ESP_LOGCONFIG(TAG, " Shaping: %s", shaping_lut[this->shaping_ >> 5]); } ESP_LOGCONFIG(TAG, " PA Pin: %s", this->pa_pin_ == PA_PIN_BOOST ? "BOOST" : "RFO"); ESP_LOGCONFIG(TAG, " PA Power: %" PRIu32 " dBm", this->pa_power_);