Hi all,
I have done more tests and created a minimal code to reproduce the reboot.
However, to be sure that the problem didn’t come from my lv_micropython source code, I cloned in a new clean directory the last master branch of lv_micropython.
Finally, it works with the master repository.
The only difference is that I had added a new font, it is the montserrat_14 but with “Latin-1 Supplement” characters for accents.
Then I updated the new master directory with my font.
I added the file lv_montserrat_medium_14.c
in the \lib\lv_bindings\lvgl\src\lv_font
directory. This file has been generated with the lvgl online font converter.
I added the following line in lv_conf.h
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_montserrat_medium_14)
If I declare this font, in lv_conf.h" as LV_THEME_DEFAULT_FONT or if I use it in my script with a set_style_local_text_font()
, I reproduce the reboot, always with the last version of lv_binding only.
The minimal code is :
import lvgl as lv
import lvesp32
import time
import machine
class GaugePage:
def __init__(self,scr):
self.scr= scr
self.value = 0
self.gauge = lv.gauge(self.scr)
self.gauge.set_size(210,210)
self.gauge.set_range(0,4095)
self.gauge.set_critical_value(2048)
self.gauge.set_scale(270,35,7)
self.gauge.set_angle_offset(45)
self.gauge.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
self.gauge.set_value(0,self.value)
def set_value(self, value):
self.value=value
self.gauge.set_value(0,int(self.value))
self.gauge.refresh_style(lv.gauge.PART.NEEDLE,1)
def load_screen(self):
lv.scr_load(self.scr)
class main_screen:
def __init__(self):
# from ili99341 import ili9341
from ili9XXX import ili9341,COLOR_MODE_BGR,MADCTL_MV
self.disp = ili9341(spihost=1, miso=19, mosi=23, clk=18, cs=5,
dc=17, rst=2, power=-1, backlight=4, backlight_on=1,
hybrid=True, mhz=40, factor=16, width=320, height=240,
colormode=COLOR_MODE_BGR,
rot=MADCTL_MV, invert=True, double_buffer=False)
# colormode=ili9341.COLOR_MODE_BGR,
# rot=ili9341.MADCTL_MV, invert=True, double_buffer=False)
self.scr0 = lv.obj()
self.page0= GaugePage(self.scr0)
lv.scr_load(self.scr0)
self.page0.gauge.set_style_local_text_font(lv.gauge.PART.MAIN,lv.STATE.DEFAULT,lv.font_montserrat_medium_14)
Potentiometer = machine.ADC(machine.Pin(33))
Potentiometer.atten(Potentiometer.ATTN_6DB)
lcd=main_screen()
while True :
lcd.page0.set_value(Potentiometer.read())
time.sleep_ms(100)
Now with this minimal script, it takes 20 seconds to have the reboot.
If I increase the time.sleep()
in the loop, it increases the time delay of reboot.
If I delete the refresh_style
in the set_value()
, the reboot happens later (but the needle display is not fine).
By the end of my tests, I tried to not change lv_conf.h
and I replaced the original lv_font_montserrat_14.c
code by my own font code. Like this, it works, no reboot 
My ESP32 board uses an ESP32_WROOM-32D.
I tried to run import gc; gc.collect()
but it didn’t reproduce the problem.
Here is the font code if needed :
lv_font_montserrat_medium_14.c (83.0 KB)
Thank you for your great efforts.