Skip to content

Improves time for setting touch interrupt #7099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 11, 2022
Merged

Conversation

SuGlider
Copy link
Collaborator

@SuGlider SuGlider commented Aug 8, 2022

Description of Change

Fixes and improves the time it takes to set an interrupt with Touchpads in ESP32.

Tests scenarios

With ESP32 as reported in #7097

long beginDur = 0;

void IRAM_ATTR gotTouch() {}

void setup() {
    Serial.begin(115200);
}

void loop() {
    beginDur = millis();
    touchAttachInterrupt(4, gotTouch, 30);
    Serial.println("dur: " + String(millis() - beginDur));
}

Espected output shall report 0 as time.

Related links

Fixes #7097

@SuGlider SuGlider added the Area: BT&Wifi BT & Wifi related issues label Aug 8, 2022
@SuGlider SuGlider added this to the 2.0.5 milestone Aug 8, 2022
@SuGlider SuGlider self-assigned this Aug 8, 2022
@SuGlider SuGlider requested a review from P-R-O-C-H-Y August 8, 2022 23:52
@P-R-O-C-H-Y
Copy link
Member

@SuGlider With this PR, the Touch Interrupt no longer works for me on ESP32. It initialised fast (0ms) but it does not work.

Check it with this sketch:

long beginDur = 0;

void IRAM_ATTR gotTouch() {
    Serial.println("GOT TOUCH");
  }

void setup() {
    Serial.begin(115200);

    for(int i = 0; i<10 ; i++)
    {
      beginDur = millis();
      touchAttachInterrupt(2, gotTouch, 40);
      Serial.println("dur: " + String(millis() - beginDur));
    }
}

void loop() {

}

@P-R-O-C-H-Y
Copy link
Member

@SuGlider I think the threshold is not working anymore, because we still use TOUCH_V1 but the threshold uses the function from TOUCH_V2.

Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look on comments above

@VojtechBartoska VojtechBartoska added the Status: In Progress ⚠️ Issue is in progress label Aug 10, 2022
@SuGlider
Copy link
Collaborator Author

Fixed. Thanks!

Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@P-R-O-C-H-Y P-R-O-C-H-Y merged commit 0130856 into master Aug 11, 2022
@P-R-O-C-H-Y P-R-O-C-H-Y deleted the SuGlider-patch-2 branch August 11, 2022 09:34
@P-R-O-C-H-Y P-R-O-C-H-Y added Status: Solved and removed Status: In Progress ⚠️ Issue is in progress labels Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BT&Wifi BT & Wifi related issues Status: Solved
Projects
Development

Successfully merging this pull request may close these issues.

touchAttachInterrupt takes 25ms for each pin!!!
3 participants