mirror of
https://github.com/esphome/esphome.git
synced 2025-09-15 09:42:19 +01:00
more debug
This commit is contained in:
@@ -79,8 +79,22 @@ void ESP32TouchComponent::setup() {
|
|||||||
touch_pad_set_charge_discharge_times(this->meas_cycle_);
|
touch_pad_set_charge_discharge_times(this->meas_cycle_);
|
||||||
touch_pad_set_measurement_interval(this->sleep_cycle_);
|
touch_pad_set_measurement_interval(this->sleep_cycle_);
|
||||||
|
|
||||||
// Register ISR handler
|
// Set FSM mode before starting
|
||||||
esp_err_t err = touch_pad_isr_register(touch_isr_handler, this);
|
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
|
||||||
|
|
||||||
|
// Configure which pads to scan
|
||||||
|
uint16_t channel_mask = 0;
|
||||||
|
for (auto *child : this->children_) {
|
||||||
|
channel_mask |= BIT(child->get_touch_pad());
|
||||||
|
}
|
||||||
|
touch_pad_set_channel_mask(channel_mask);
|
||||||
|
|
||||||
|
// Configure timeout if needed
|
||||||
|
touch_pad_timeout_set(true, TOUCH_PAD_THRESHOLD_MAX);
|
||||||
|
|
||||||
|
// Register ISR handler with interrupt mask
|
||||||
|
esp_err_t err =
|
||||||
|
touch_pad_isr_register(touch_isr_handler, this, static_cast<touch_pad_intr_mask_t>(TOUCH_PAD_INTR_MASK_ALL));
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to register touch ISR: %s", esp_err_to_name(err));
|
ESP_LOGE(TAG, "Failed to register touch ISR: %s", esp_err_to_name(err));
|
||||||
vQueueDelete(this->touch_queue_);
|
vQueueDelete(this->touch_queue_);
|
||||||
@@ -92,9 +106,6 @@ void ESP32TouchComponent::setup() {
|
|||||||
// Enable interrupts
|
// Enable interrupts
|
||||||
touch_pad_intr_enable(static_cast<touch_pad_intr_mask_t>(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE));
|
touch_pad_intr_enable(static_cast<touch_pad_intr_mask_t>(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE));
|
||||||
|
|
||||||
// Set FSM mode
|
|
||||||
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
|
|
||||||
|
|
||||||
// Start FSM
|
// Start FSM
|
||||||
touch_pad_fsm_start();
|
touch_pad_fsm_start();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user