mirror of
https://github.com/esphome/esphome.git
synced 2025-03-01 00:08:15 +00:00
clang-format
This commit is contained in:
parent
f4e4586404
commit
15addeb46e
@ -86,7 +86,7 @@ void ADCSensor::setup() {
|
|||||||
cali_config.unit_id = unit_id;
|
cali_config.unit_id = unit_id;
|
||||||
cali_config.atten = this->attenuation_;
|
cali_config.atten = this->attenuation_;
|
||||||
cali_config.bitwidth = ADC_BITWIDTH_DEFAULT;
|
cali_config.bitwidth = ADC_BITWIDTH_DEFAULT;
|
||||||
|
|
||||||
err = adc_cali_create_scheme_curve_fitting(&cali_config, &handle);
|
err = adc_cali_create_scheme_curve_fitting(&cali_config, &handle);
|
||||||
if (err == ESP_OK) {
|
if (err == ESP_OK) {
|
||||||
this->calibration_handle_ = handle;
|
this->calibration_handle_ = handle;
|
||||||
@ -151,7 +151,7 @@ float ADCSensor::sample() {
|
|||||||
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
for (uint8_t sample = 0; sample < this->sample_count_; sample++) {
|
||||||
int raw;
|
int raw;
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
|
|
||||||
if (this->is_adc1_) {
|
if (this->is_adc1_) {
|
||||||
err = adc_oneshot_read(this->adc1_handle_, this->channel_, &raw);
|
err = adc_oneshot_read(this->adc1_handle_, this->channel_, &raw);
|
||||||
} else {
|
} else {
|
||||||
@ -200,7 +200,7 @@ float ADCSensor::sample() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sum * 3.3f / 4095.0f;
|
return sum * 3.3f / 4095.0f;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -215,7 +215,7 @@ float ADCSensor::sample() {
|
|||||||
ESP_LOGW(TAG, "Error configuring ADC1 channel for autorange: %d", err);
|
ESP_LOGW(TAG, "Error configuring ADC1 channel for autorange: %d", err);
|
||||||
return {-1, 0.0f};
|
return {-1, 0.0f};
|
||||||
}
|
}
|
||||||
|
|
||||||
int raw;
|
int raw;
|
||||||
err = adc_oneshot_read(this->adc1_handle_, this->channel_, &raw);
|
err = adc_oneshot_read(this->adc1_handle_, this->channel_, &raw);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
@ -242,7 +242,7 @@ float ADCSensor::sample() {
|
|||||||
ESP_LOGW(TAG, "Error configuring ADC2 channel for autorange: %d", err);
|
ESP_LOGW(TAG, "Error configuring ADC2 channel for autorange: %d", err);
|
||||||
return {-1, 0.0f};
|
return {-1, 0.0f};
|
||||||
}
|
}
|
||||||
|
|
||||||
int raw;
|
int raw;
|
||||||
err = adc_oneshot_read(this->adc2_handle_, this->channel_, &raw);
|
err = adc_oneshot_read(this->adc2_handle_, this->channel_, &raw);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user