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

    Problems using lvgl with touchscreen

    Scheduled Pinned Locked Moved General
    3 Posts 2 Posters 7.3k Views
    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.
    • F Offline
      Forairaaaaa Global Moderator
      last edited by

      I ported the lvgl8 arduino to my core2 today, it can run the lvgl_demo_benchmark in 39fps, the touch was fuction too.
      Then I tried to put the lvglhandler into a task by freertos (it was in loop before), with priority 3. It worked as well.

      So I put some other task in my code, the first one is a blink (by using m5.apx.setled and vtaskdelay), It worked too. Then I tested it with demos of benchmark, music and widgets. And blink task, lvgl and touch fuction were all normal.

      Seems everything went well, I changed the blink task into serial.println sth per 1s. Then I tested those 3 demos again, I found that the serial task worked well, lvgl worked well, but the touch funtion didn't worked. The serial task is sending thing every seconds normally, but i cant move the screen by touching in those demos, lvgl is working cus in benchmark demo, every tests is going but i cant move the screen to see the marks at the end of the demo.

      So I try change the task back to blink, the touch function again. Seems it's sth about serial affect the touch function? But i dont know why.
      Part of my code:

      Task of blink or serial:

      void Taskblink( void *pvParameters )
      {
      for(;;)
      {
      M5.Axp.SetLed(1);
      vTaskDelay(800);
      M5.Axp.SetLed(0);
      vTaskDelay(800);
      // Serial.println("i'm good..");
      // vTaskDelay(1000);
      }
      }

      Task of lvglhandler:

      void Tasklvglhandler( void pvParameters )
      {
      for(;;)
      {
      lv_timer_handler(); /
      let the GUI do its work */
      vTaskDelay(5);
      }
      }

      lvgl touchpad read recall
      void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
      {
      TouchPoint_t coordinate;
      M5.Touch.getPressPoint();

      if (!M5.Touch.ispressed()){
          data->state = LV_INDEV_STATE_REL;
      } else {
          data->state = LV_INDEV_STATE_PR;
          /*Set the coordinates*/
          coordinate = M5.Touch.getPressPoint();
          data->point.x = coordinate.x;
          data->point.y = coordinate.y;
      }
      

      }

      Thanks for helping.

      1 Reply Last reply Reply Quote 0
      • felmueF Offline
        felmue
        last edited by

        Hello @Forairaaaaa

        have you seen this posting?

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        F 1 Reply Last reply Reply Quote 0
        • F Offline
          Forairaaaaa Global Moderator @felmue
          last edited by

          @felmue Thank you, I've learn a lot from it

          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