mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	help with setup
This commit is contained in:
		| @@ -171,7 +171,7 @@ void ESP32TouchComponent::loop() { | |||||||
|     // If we've never seen this pad touched (last_time == 0) and enough time has passed |     // If we've never seen this pad touched (last_time == 0) and enough time has passed | ||||||
|     // since startup, publish OFF state and mark as published with value 1 |     // since startup, publish OFF state and mark as published with value 1 | ||||||
|     if (last_time == 0 && now > this->release_timeout_ms_) { |     if (last_time == 0 && now > this->release_timeout_ms_) { | ||||||
|       child->publish_state(false); |       child->publish_initial_state(false); | ||||||
|       this->last_touch_time_[pad] = 1;  // Mark as "initial state published" |       this->last_touch_time_[pad] = 1;  // Mark as "initial state published" | ||||||
|       ESP_LOGV(TAG, "Touch Pad '%s' state: OFF (initial)", child->get_name().c_str()); |       ESP_LOGV(TAG, "Touch Pad '%s' state: OFF (initial)", child->get_name().c_str()); | ||||||
|     } else if (child->last_state_ && last_time > 1) {  // last_time > 1 means it's a real timestamp |     } else if (child->last_state_ && last_time > 1) {  // last_time > 1 means it's a real timestamp | ||||||
|   | |||||||
| @@ -309,21 +309,16 @@ void ESP32TouchComponent::loop() { | |||||||
|   // In setup mode, periodically log all pad values |   // In setup mode, periodically log all pad values | ||||||
|   if (this->setup_mode_ && now - this->setup_mode_last_log_print_ > SETUP_MODE_LOG_INTERVAL_MS) { |   if (this->setup_mode_ && now - this->setup_mode_last_log_print_ > SETUP_MODE_LOG_INTERVAL_MS) { | ||||||
|     for (auto *child : this->children_) { |     for (auto *child : this->children_) { | ||||||
|       uint32_t raw = 0; |       uint32_t value = 0; | ||||||
|       uint32_t benchmark = 0; |  | ||||||
|       uint32_t smooth = 0; |  | ||||||
|  |  | ||||||
|       touch_pad_read_raw_data(child->get_touch_pad(), &raw); |  | ||||||
|       touch_pad_read_benchmark(child->get_touch_pad(), &benchmark); |  | ||||||
|  |  | ||||||
|  |       // Read the value being used for touch detection | ||||||
|       if (this->filter_configured_()) { |       if (this->filter_configured_()) { | ||||||
|         touch_pad_filter_read_smooth(child->get_touch_pad(), &smooth); |         touch_pad_filter_read_smooth(child->get_touch_pad(), &value); | ||||||
|         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 { |       } else { | ||||||
|         ESP_LOGD(TAG, "  Pad T%d: raw=%d, benchmark=%d, threshold=%d", child->get_touch_pad(), raw, benchmark, |         touch_pad_read_raw_data(child->get_touch_pad(), &value); | ||||||
|                  child->get_threshold()); |  | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |       ESP_LOGD(TAG, "Touch Pad '%s' (T%d): %d", child->get_name().c_str(), child->get_touch_pad(), value); | ||||||
|     } |     } | ||||||
|     this->setup_mode_last_log_print_ = now; |     this->setup_mode_last_log_print_ = now; | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user