Description
I am in my first LVGL project and trying to start with the ebike tutorial from SquareLine Studio. It’s beautiful stuff! I am running it with an ESP32 and ILI9488 inside the Arduino environment. After getting LVGL set up and tft_eSPI setup (at least to the best of my ability), I’m able to get everything running. For processing new data, I made a timer job that I call every 50 ms that just calls “lv_label_set_text_static” and points to some C character arrays in my code to update the GUI. As long as I do just that, all the numbers on the GUI update really quickly.
But in the ebike demo there are two sliders. If I call “lv_slider_set_value” to set the value on one of them inside that same timer, then all of the text updates get really janky and stuttery. I’m trying to figure out if there is anything I can do to get rid of that jankiness. For now, I’ve split my timer job into 2 timers… a fast one that runs every 50ms for the text fields, and a “mid” one that runs every 500ms for one of the sliders. But even with that setup, its obvious that when the mid timer fires, the text updates still get really slow.
Now, I may have tons of things enabled from SquareLine studio that I don’t need… I’m not using a touchscreen so perhaps there are events or things I can disable to speed it up? Or are there properties on elements which may be making the slider update slow such as scrollable stuff or any extra properties that I don’t need?
I was running on v8.2.0 but before writing this post I tried upgrading v8.3.5 but it has the same result.
What MCU/Processor/Board and compiler are you using?
ESP32 dev kit inside the Arduino environment. Also hooked up to an ILI9488 using setup 21.
What LVGL version are you using?
I’ve tried v8.2.0 and v8.3.5
What do you want to achieve?
All I really need is to find a way to speed up the slider update. Right now I’m calling lv_slider_set_value with new data obtained in the background. But if there is a faster way to do it that can ignore other properties that might solve my issue.
What have you tried so far?
I’ve tried moving the calls to lv_slider_set_value into slower timers, but that isn’t really helping much. I’ve also tried calling it with animation on and off. Didn’t seem to make a difference.
Code to reproduce
The full code from SquareLine has a ton of files so I can’t post something that can completely compile here. However it is the ebike demo if that helps.
/* Inside my main program I set up my timers like this:*/
display_update_task_fast = lv_timer_create(update_display_values_fast, 50, NULL);
display_update_task_mid = lv_timer_create(update_display_values_mid, 500, NULL);
lv_timer_ready(display_update_task_fast);
lv_timer_ready(display_update_task_mid);
// Then, my fast and mid timers looks like this, although I'd be perfectly fine if I could have them run
// all in one timer job. This was my attempt at a workaround.
void update_display_values_fast( lv_timer_t * task ) {
// Update our global character arrays for text with the values from the CAN bus
dtostrf(torque_cmd, 1, 1, torque_cmd_str);
dtostrf(eff_torque, 1, 1, eff_torque_str);
dtostrf(motor_rpm, 1, 0, motor_rpm_str);
// Update the labels on the GUI pointing to our own memory
lv_label_set_text_static(ui_Label_Torque_Req_Value, torque_cmd_str);
lv_label_set_text_static(ui_Label_Torque_Eff_Value, eff_torque_str);
lv_label_set_text_static(ui_Speed_Number_1, motor_rpm_str);
}
void update_display_values_mid( lv_timer_t * task ) {
// Update sliders
lv_slider_set_value(ui_Slider_Speed, (int)motor_rpm, LV_ANIM_OFF);
}