🤖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

    Scheduled Pinned Locked Moved PRODUCTS
    2 Posts 1 Posters 1.5k Views 1 Watching
    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 Offline
      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 Offline
        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

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post