Problems using lvgl with touchscreen
-
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.
-
-
@felmue Thank you, I've learn a lot from it
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