mirror of
https://github.com/esphome/esphome.git
synced 2025-10-29 22:24:26 +00:00
Fix clang-tidy header filter (#2385)
* Fix clang-tidy header filter * Allow private members * Fix clang-tidy detections * Run clang-format * Fix remaining detections * Fix graph * Run clang-format
This commit is contained in:
@@ -13,7 +13,7 @@ namespace esphome {
|
||||
namespace uart {
|
||||
|
||||
static const char *const TAG = "uart.arduino_esp8266";
|
||||
bool ESP8266UartComponent::serial0InUse = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
bool ESP8266UartComponent::serial0_in_use = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
uint32_t ESP8266UartComponent::get_config() {
|
||||
uint32_t config = 0;
|
||||
@@ -55,7 +55,7 @@ void ESP8266UartComponent::setup() {
|
||||
// is 1 we still want to use Serial.
|
||||
SerialConfig config = static_cast<SerialConfig>(get_config());
|
||||
|
||||
if (!ESP8266UartComponent::serial0InUse && (tx_pin_ == nullptr || tx_pin_->get_pin() == 1) &&
|
||||
if (!ESP8266UartComponent::serial0_in_use && (tx_pin_ == nullptr || tx_pin_->get_pin() == 1) &&
|
||||
(rx_pin_ == nullptr || rx_pin_->get_pin() == 3)
|
||||
#ifdef USE_LOGGER
|
||||
// we will use UART0 if logger isn't using it in swapped mode
|
||||
@@ -66,8 +66,8 @@ void ESP8266UartComponent::setup() {
|
||||
this->hw_serial_ = &Serial;
|
||||
this->hw_serial_->begin(this->baud_rate_, config);
|
||||
this->hw_serial_->setRxBufferSize(this->rx_buffer_size_);
|
||||
ESP8266UartComponent::serial0InUse = true;
|
||||
} else if (!ESP8266UartComponent::serial0InUse && (tx_pin_ == nullptr || tx_pin_->get_pin() == 15) &&
|
||||
ESP8266UartComponent::serial0_in_use = true;
|
||||
} else if (!ESP8266UartComponent::serial0_in_use && (tx_pin_ == nullptr || tx_pin_->get_pin() == 15) &&
|
||||
(rx_pin_ == nullptr || rx_pin_->get_pin() == 13)
|
||||
#ifdef USE_LOGGER
|
||||
// we will use UART0 swapped if logger isn't using it in regular mode
|
||||
@@ -79,7 +79,7 @@ void ESP8266UartComponent::setup() {
|
||||
this->hw_serial_->begin(this->baud_rate_, config);
|
||||
this->hw_serial_->setRxBufferSize(this->rx_buffer_size_);
|
||||
this->hw_serial_->swap();
|
||||
ESP8266UartComponent::serial0InUse = true;
|
||||
ESP8266UartComponent::serial0_in_use = true;
|
||||
} else if ((tx_pin_ == nullptr || tx_pin_->get_pin() == 2) && (rx_pin_ == nullptr || rx_pin_->get_pin() == 8)) {
|
||||
this->hw_serial_ = &Serial1;
|
||||
this->hw_serial_->begin(this->baud_rate_, config);
|
||||
|
||||
@@ -70,7 +70,7 @@ class ESP8266UartComponent : public UARTComponent, public Component {
|
||||
ESP8266SoftwareSerial *sw_serial_{nullptr};
|
||||
|
||||
private:
|
||||
static bool serial0InUse;
|
||||
static bool serial0_in_use; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
};
|
||||
|
||||
} // namespace uart
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace esphome {
|
||||
namespace uart {
|
||||
static const char *const TAG = "uart.idf";
|
||||
|
||||
uart_config_t IDFUARTComponent::get_config() {
|
||||
uart_config_t IDFUARTComponent::get_config_() {
|
||||
uart_parity_t parity = UART_PARITY_DISABLE;
|
||||
if (this->parity_ == UART_CONFIG_PARITY_EVEN)
|
||||
parity = UART_PARITY_EVEN;
|
||||
@@ -70,7 +70,7 @@ void IDFUARTComponent::setup() {
|
||||
|
||||
xSemaphoreTake(this->lock_, portMAX_DELAY);
|
||||
|
||||
uart_config_t uart_config = this->get_config();
|
||||
uart_config_t uart_config = this->get_config_();
|
||||
esp_err_t err = uart_param_config(this->uart_num_, &uart_config);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "uart_param_config failed: %s", esp_err_to_name(err));
|
||||
|
||||
@@ -26,7 +26,7 @@ class IDFUARTComponent : public UARTComponent, public Component {
|
||||
protected:
|
||||
void check_logger_conflict() override;
|
||||
uart_port_t uart_num_;
|
||||
uart_config_t get_config();
|
||||
uart_config_t get_config_();
|
||||
SemaphoreHandle_t lock_;
|
||||
|
||||
bool has_peek_{false};
|
||||
|
||||
Reference in New Issue
Block a user