I get this error when my program executes - lv_inv_area: Asserted at expression: !disp->rendering_in_progress (Invalidate area is not allowed during rendering.) lv_refr.c:274
How to reproduce?
The LVGL code that gives this error has been running correctly for months when using an older MQTT library.
Using a newer library it stops in seconds.
Just to emphasise, the code below has worked correctly up until now - same board, same Arduino IDE, and esp32 versions.
I understand WHAT is going wrong, but have no idea how to fix it.
void loop() {
LvTimerHandler(); /* let LVGL do its work */
}
...
void LvTimerHandler() {
lv_timer_handler(); // let the GUI do its work
lv_task_handler();
Alarm.delay(5);
lv_tick_inc(5);
}
First off, lv_timer_handler and lv_task_handler both do the same thing, you are basically calling the timer handler twice.
Task handler is the old name, timer handler is the new API name. So remove the second lv_task_handler call.
Secondly, lv_tick_inc() should be called in a hardware timer or some other system where you are sure it occurs (almost) exactly ever 5 ms in this case.
The first issue is the most easy to fix, see if that helps any.
Hello, sadly I have no idea how timers work on arduino but you want one that gets triggered every 5ms and only calls lv_tick_inc(5). Or better yet, one that gets triggered every 1ms and calls lv_tick_inc(1).
Alarm.delay(ms) gives a non-blocking delay, whereas delay(ms) is blocking.
The error still occurs for every combination of the above that I’ve tried.
I have a feeling that it is due to both ESP32-S3 cores being used.
This error came up once -
E (33283) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (33283) task_wdt: - IDLE0 (CPU 0)
E (33283) task_wdt: Tasks currently running:
E (33283) task_wdt: CPU 0: mqtt_task
E (33283) task_wdt: CPU 1: loopTask
E (33283) task_wdt: Aborting.
On further thought, if the MQTT process and LVGL process are running on different cores then they will be unsynchronised, and the MQTT process could well be sending updates while rendering is on-going.
This would explain why the older MQTT library works.
I could try using the rendering_in_progress flag, but this is private in lv_display_private.h
Hi Tinus,
Thanks for all your help!
I have now got a crude fix that I’ll post in a new topic.
Hopefully someone can turn my fix into a proper solution.