1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-14 17:22:20 +01:00

help with setup

This commit is contained in:
J. Nick Koston
2025-06-12 17:27:09 -05:00
parent b3c43ce31f
commit 1d90388ffc
2 changed files with 7 additions and 12 deletions

View File

@@ -171,7 +171,7 @@ void ESP32TouchComponent::loop() {
// 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
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"
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

View File

@@ -309,21 +309,16 @@ void ESP32TouchComponent::loop() {
// 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;
uint32_t smooth = 0;
touch_pad_read_raw_data(child->get_touch_pad(), &raw);
touch_pad_read_benchmark(child->get_touch_pad(), &benchmark);
uint32_t value = 0;
// Read the value being used for touch detection
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());
touch_pad_filter_read_smooth(child->get_touch_pad(), &value);
} else {
ESP_LOGD(TAG, " Pad T%d: raw=%d, benchmark=%d, threshold=%d", child->get_touch_pad(), raw, benchmark,
child->get_threshold());
touch_pad_read_raw_data(child->get_touch_pad(), &value);
}
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;
}