Description
-
LVGL keeps rebooting on WD error when refreshing labels.
E (271032) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (271032) task_wdt: - IDLE0 (CPU 0)
E (271032) task_wdt: Tasks currently running:
E (271032) task_wdt: CPU 0: wifi
E (271032) task_wdt: CPU 1: IDLE1
E (271032) task_wdt: Aborting. -
All I do is refreshing and re-aligning 14 labels every 3 sec (lv_label_set_text) and realign them.
-
If I comment out the refreshing/realigning of labels, the code runs stable.
-
I think to understand, the updating of labels keeps the CPU0 busy for seconds, and therefore doesnât let the Idle thread feed the watchdog. Why does it take that long (I think WD is 4s)? How can I feed the watchdog?
-
If I put delay(1500); in the arduino loop, the refreshing of labels works for a little while (still reboots after 30sec or so)
With any lower delay, the reboots get more frequent, about at 200 ist never updates, only reboots.
This delay makes of course the touchscreen useless, and also any animation impossible.
I am aware this is wrong, it canât take that long to update a few labels, but I cant figure anything else so far which keeps it running.
What MCU/Processor/Board and compiler are you using?
3.5" CYD, ESP32-035
VScode/Platformio/Arduino
What LVGL version are you using?
9.1.0
What do you want to achieve?
Change text on a label and center the label again.
What have you tried so far?
I have one ESP32S3 gathering data and sending them to this CYD.
When CYD receives data it refreshes the labels. I plan to add few functions to it once this works.
-
I tried adding delay(5) or yield() every other line, with no change.
-
I tried running it with LVGL 8.3, but couldnât get the code working.
-
I tried arbitrarily changing board definitions in platformio.ini, but this doesnât make any difference.
-
I tried unsing âobserversâ for changing the labels, but couldnât get that running, as I didnât understand how to implement in arduino framework. (didnât find any examples for it either)
-
This is how I refresh one label, thereâs 7 of them:
update_labels(){ dtostrf(sensorData.temp, 5, 1, txt5); strcat(txt5,"foo"); lv_label_set_text(shadow1_label, txt5); lv_label_set_text(btn1_label, txt5); lv_obj_center(btn1_label); lv_obj_align_to(shadow1_label, btn1_label, LV_ALIGN_CENTER, 2, 2); }
-
The less labels I refresh, the âless badâ it works, but even with 1 label it crashes with delay(5) in loop().
-
I also tried having only one call in update_labels() (that works OK)
update_labels(){ lv_label_set_text(shadow1_label, "foo");
//this works with delay(5) in loop for a while(30-100 update cycles) before rebooting.
}
but having a few of those, already makes it reboot:
```c
update_labels(){
lv_label_set_text(btn1_label, "foo");
lv_label_set_text(btn2_label, "foo");
lv_label_set_text(btn3_label, "foo");
lv_label_set_text(btn0_label, "foo");
lv_label_set_text(btn4_label, "foo");
lv_label_set_text(btn5_label, "foo");
lv_label_set_text(btn6_label, "foo");
// this crashes with delay(5) in loop, it works "for a while" with delay(100) but also eventually reboots.
}
I am for one not clear about how to implement the tick with arduino.
All instructions I can find are for v8.1 and older, which do not work for 9.1.
I tried many ways of doing it, but none worked.
For now I do this(from LVGL-Arduino example, except I need to change the delay to 1200)
static uint32_t my_tick(void)
{
return millis();
}
setup(){
...
lv_tick_set_cb(my_tick);
...
}
loop{
lv_task_handler();
delay(1500); // should be 5 for the rest of the code to work smooth.
}
The updating of labels is done like that (update_labels is called when new data is received):
char txt5[5];
update_labels(){
//THIS IS DONE 7 TIMES (FOR A TOTAL OF 14 BUTTON LABELS)
dtostrf(sensorData.temp, 5, 1, txt5);
strcat(txt5,"foo");
lv_label_set_text(shadow1_label, txt5);
lv_label_set_text(btn1_label, txt5);
lv_obj_center(btn1_label);
lv_obj_align_to(shadow1_label, btn1_label, LV_ALIGN_CENTER, 2, 2);
}
this is my first try with C++, I did some stuff in C# so far. Never noticed that I love strings
- Is there anything wrong with the (haphazard) way I build the char?
- Is there any âeasierâ way I can concatenate a float and a string and pass it to the label?
Any help would be really appreciated, as Iâm about to put LVGL into the âtoo difficult for meâ box.