1
0
mirror of https://github.com/esphome/esphome.git synced 2025-01-18 20:10:55 +00:00

clang-tidy

This commit is contained in:
Edward Firmo 2024-12-12 12:12:57 +01:00
parent 69681d0ec1
commit 7f225886c9
2 changed files with 10 additions and 10 deletions

View File

@ -204,8 +204,8 @@ class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage
bool config_complete_{false};
bool handle_init_complete_{false};
bool calibration_complete_{false};
static adc_oneshot_unit_handle_t shared_adc1_handle_;
static adc_oneshot_unit_handle_t shared_adc2_handle_;
static adc_oneshot_unit_handle_t shared_adc1_handle;
static adc_oneshot_unit_handle_t shared_adc2_handle;
#else
adc_atten_t attenuation_{ADC_ATTEN_DB_0};
adc1_channel_t channel1_{ADC1_CHANNEL_MAX};

View File

@ -10,8 +10,8 @@ namespace adc {
static const char *const TAG = "adc.esp32";
adc_oneshot_unit_handle_t ADCSensor::shared_adc1_handle_ = nullptr;
adc_oneshot_unit_handle_t ADCSensor::shared_adc2_handle_ = nullptr;
adc_oneshot_unit_handle_t ADCSensor::shared_adc1_handle = nullptr;
adc_oneshot_unit_handle_t ADCSensor::shared_adc2_handle = nullptr;
void ADCSensor::setup() {
ESP_LOGCONFIG(TAG, "Setting up ADC '%s'...", this->get_name().c_str());
@ -28,8 +28,8 @@ void ADCSensor::setup() {
if (this->is_adc1_) {
if (this->adc1_handle_ == nullptr) {
// Check if another sensor already initialized ADC1
if (shared_adc1_handle_ != nullptr) {
this->adc1_handle_ = shared_adc1_handle_;
if (shared_adc1_handle != nullptr) {
this->adc1_handle_ = shared_adc1_handle;
this->handle_init_complete_ = true;
} else {
adc_oneshot_unit_init_cfg_t init_config1 = {};
@ -45,7 +45,7 @@ void ADCSensor::setup() {
this->mark_failed();
return;
}
shared_adc1_handle_ = this->adc1_handle_;
shared_adc1_handle = this->adc1_handle_;
this->handle_init_complete_ = true;
}
}
@ -66,8 +66,8 @@ void ADCSensor::setup() {
} else {
if (this->adc2_handle_ == nullptr) {
// Check if another sensor already initialized ADC2
if (shared_adc2_handle_ != nullptr) {
this->adc2_handle_ = shared_adc2_handle_;
if (shared_adc2_handle != nullptr) {
this->adc2_handle_ = shared_adc2_handle;
this->handle_init_complete_ = true;
} else {
adc_oneshot_unit_init_cfg_t init_config2 = {};
@ -83,7 +83,7 @@ void ADCSensor::setup() {
this->mark_failed();
return;
}
shared_adc2_handle_ = this->adc2_handle_;
shared_adc2_handle = this->adc2_handle_;
this->handle_init_complete_ = true;
}
}