🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    [SOLVED} PaperS3 Touch Screen Latency

    PRODUCTS
    1
    2
    33
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wsanders
      last edited by wsanders

      I'm trying to make some progress on making the PaperS3 touch screen useful. I have the following code:

      void loop(void)
      {
          // necessary:
          M5.update();
          t = M5.Touch.getDetail(0);
          if (t.state > 0) { 
            Serial.printf("Index:%d Count:%d IsPressed:%d Touch:%s\n",eventindex,eventcount,t.isPressed(), state_name[t.state]);
          }
          if (t.state == 14 || t.state == 10) {                   
            // on flick end or drag end
            drawSomeTextOnScreen();
          } 
          delay(2);
      }
      

      The code properly detects the flick end or drag end event, but then there is about a 10 second delay before anything happens and the text is drawn on the screen.

      Am I doing this right?
      What is the device doing in the 10 seconds between the flick end or drag end and the time the screen starts to update?

      (FWIW delays in the loop of up to 50 msec seem reasonable. M5.Power.lightSleep disables interrupts and the device losts its mind (including serial output.) Does using the arduino delay call save any power anyway? )

      The sample drawing program works fine, but it is just testing for t.isPressed():

      void loop() {
        M5.update();
        delay(20);
        t = M5.Touch.getDetail();
        if (t.isPressed()) {
          M5.Display.fillCircle(t.x, t.y, 15, BLACK);
        }
      }
      
      W 1 Reply Last reply Reply Quote 0
      • W
        wsanders @wsanders
        last edited by

        @wsanders This problem was caused by a reference to an uninitialized variable in that drawSomeTextOnScreen() function. As usual, the invalid reference caused weird behavior that was unrelated to the actual problem.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post