Lv_utils.task_handler fails at usys.exc_info()

HW env: ESP32(WROVER) + ILI9341 LCD + xpt2046 touch
SW env: latest lv_micropython code to build port ESP32 firmware

My code is to upload data by a mqtt client (https://github.com/fizista/micropython-umqtt.robust2/blob/master/src/umqtt/robust2.py), the mqtt client runs in a _thread.start_new_thread(), while lvgl runs in main thread.

If use uurequests.post but not mqtt to upload data, no failure.

When call the mqtt client to publish a message, it intermittently fails with following:

Traceback (most recent call last):
  File "lv_utils.py", line 124, in task_handler
  File "lv_utils.py", line 156, in default_exception_sink
AttributeError: 'module' object has no attribute 'exc_info'

Looks usys has not function exc_info(). And lvgl task_handler takes care of cross-thread task too?

Any help would be appreciated.

Hi @amoywolf

Indeed in Micropython it’s recommend not to use exc_info.
So I’ve replaced it now with print_exception.

It looks like you are experiencing some exception thrown in your code from an LVGL event handler.
Please try again with latest lv_micropython to see what exception is being printed.

Thanks @amirgon
By replacing with usys.print_exception, got error message as following.

Traceback (most recent call last):
  File "lv_utils.py", line 119, in task_handler
  File "xpt2046.py", line 206, in read
  File "xpt2046.py", line 178, in get_coords
  File "xpt2046.py", line 167, in get_med_coords
  File "xpt2046.py", line 160, in xpt_cmds
RuntimeError: maximum recursion depth exceeded

Seems it is lack of stack size, so I set _thread.stack_size(16 * 1024), then the issue gone.

1 Like