Hello, I use PID controller with Squareline project for HMI in ESP32 code (arduino IDE and touch screen display ILI9488 480x320 pixels). PID cycle is 20ms. My motor jerks, when I touch elements on HMI (for example, change screen).
What settings I need use?
I call lv_timer_handler() in LOOP in different period, also tried change delay 3…20ms:
if (millis() - tmrDisplay > 25) {
tmrDisplay = millis();
lv_timer_handler();
delay(3);
}
PID running in the same task as LVGL in one sketch.
When you touch an item on screen, LVGL is likely to redraw that item, then send the updates to the display, which will take more time than when LVGL has nothing to do.
Richard is right about the timing jitter which a redraw can cause in a loosely timed loop like this. Maybe your PID controller code needs strict timing and cannot live together with this 3ms (and occasionally more) jitter. Motor control (and our ears) are really sensitive to frequency-changes, and usually you really need a higher-priority timer-based interrupt for those controls, especially if the PID controller can’t even out the jitter somehow through tracking the system time in a high temporal resulotion.