mirror of
https://github.com/esphome/esphome.git
synced 2025-09-14 17:22:20 +01:00
cleanup
This commit is contained in:
@@ -309,10 +309,9 @@ void ESP32TouchComponent::loop() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// In setup mode, periodically log all pad values
|
||||
if (this->setup_mode_ && now - this->setup_mode_last_log_print_ > SETUP_MODE_LOG_INTERVAL_MS) {
|
||||
// In setup mode, periodically log all pad values
|
||||
if (this->setup_mode_ && now - this->setup_mode_last_log_print_ > SETUP_MODE_LOG_INTERVAL_MS) {
|
||||
for (auto *child : this->children_) {
|
||||
uint32_t raw = 0;
|
||||
uint32_t benchmark = 0;
|
||||
@@ -323,20 +322,20 @@ if (this->setup_mode_ && now - this->setup_mode_last_log_print_ > SETUP_MODE_LOG
|
||||
|
||||
if (this->filter_configured_()) {
|
||||
touch_pad_filter_read_smooth(child->get_touch_pad(), &smooth);
|
||||
ESP_LOGD(TAG, " Pad T%d: raw=%d, benchmark=%d, smooth=%d, threshold=%d", child->get_touch_pad(), raw, benchmark,
|
||||
smooth, child->get_threshold());
|
||||
ESP_LOGD(TAG, " Pad T%d: raw=%d, benchmark=%d, smooth=%d, threshold=%d", child->get_touch_pad(), raw,
|
||||
benchmark, smooth, child->get_threshold());
|
||||
} else {
|
||||
ESP_LOGD(TAG, " Pad T%d: raw=%d, benchmark=%d, threshold=%d", child->get_touch_pad(), raw, benchmark,
|
||||
child->get_threshold());
|
||||
}
|
||||
}
|
||||
this->setup_mode_last_log_print_ = now;
|
||||
}
|
||||
}
|
||||
|
||||
void ESP32TouchComponent::on_shutdown() {
|
||||
void ESP32TouchComponent::on_shutdown() {
|
||||
// Disable interrupts
|
||||
touch_pad_intr_disable(static_cast<touch_pad_intr_mask_t>(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE |
|
||||
TOUCH_PAD_INTR_MASK_TIMEOUT));
|
||||
touch_pad_intr_disable(static_cast<touch_pad_intr_mask_t>(
|
||||
TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE | TOUCH_PAD_INTR_MASK_TIMEOUT));
|
||||
touch_pad_isr_deregister(touch_isr_handler, this);
|
||||
if (this->touch_queue_) {
|
||||
vQueueDelete(this->touch_queue_);
|
||||
@@ -357,9 +356,9 @@ void ESP32TouchComponent::on_shutdown() {
|
||||
if (!is_wakeup_source) {
|
||||
touch_pad_deinit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IRAM_ATTR ESP32TouchComponent::touch_isr_handler(void *arg) {
|
||||
void IRAM_ATTR ESP32TouchComponent::touch_isr_handler(void *arg) {
|
||||
ESP32TouchComponent *component = static_cast<ESP32TouchComponent *>(arg);
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
@@ -380,7 +379,7 @@ void IRAM_ATTR ESP32TouchComponent::touch_isr_handler(void *arg) {
|
||||
if (xHigherPriorityTaskWoken) {
|
||||
portYIELD_FROM_ISR();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace esp32_touch
|
||||
} // namespace esphome
|
||||
|
Reference in New Issue
Block a user