Increase display and camera FPS

This commit is contained in:
Thomas Farstrike
2025-05-09 17:49:16 +02:00
parent 9740cbbd48
commit abf8005bec
3 changed files with 24 additions and 4 deletions
+15 -1
View File
@@ -42,8 +42,22 @@ display_bus = lcd_bus.SPIBus(
dc=LCD_DC,
cs=LCD_CS,
)
# lv.color_format_get_size(lv.COLOR_FORMAT.RGB565) = 2 bytes per pixel * 320 * 240 px = 153600 bytes
# The default was /10 so 15360 bytes.
# /2 = 76800 shows something on display and then hangs the board
# /2 = 38400 works and pretty high framerate but camera gets ESP_FAIL
# /2 = 19200 works, including camera at 9FPS
# 28800 is between the two and still works with camera!
# 30720 is /5 and is already too much
BUFFER_SIZE = const(28800)
fb1 = display_bus.allocate_framebuffer(_BUFFER_SIZE, lcd_bus.MEMORY_INTERNAL | lcd_bus.MEMORY_DMA)
fb2 = display_bus.allocate_framebuffer(_BUFFER_SIZE, lcd_bus.MEMORY_INTERNAL | lcd_bus.MEMORY_DMA)
display = st7789.ST7789(
data_bus=display_bus,
frame_buffer1=fb1,
frame_buffer2=fb2,
display_width=TFT_VER_RES,
display_height=TFT_HOR_RES,
backlight_pin=LCD_BL,
@@ -62,7 +76,7 @@ touch_dev = i2c.I2C.Device(bus=i2c_bus, dev_id=TP_ADDR, reg_bits=TP_REGBITS)
indev=cst816s.CST816S(touch_dev,startup_rotation=lv.DISPLAY_ROTATION._180) # button in top left, good
lv.init()
display.set_rotation(lv.DISPLAY_ROTATION._90)
display.set_rotation(lv.DISPLAY_ROTATION._90) # must be done after initializing display and creating the touch drivers, to ensure proper handling
# Gesture IDs:
# 0: press
+6 -3
View File
@@ -3,7 +3,7 @@ import task_handler
import machine
# Constants
CURRENT_OS_VERSION = "0.0.3"
CURRENT_OS_VERSION = "0.0.4"
TFT_HOR_RES=320
TFT_VER_RES=240
NOTIFICATION_BAR_HEIGHT=24
@@ -18,7 +18,7 @@ SLIDER_MIN_VALUE=1
SLIDER_MAX_VALUE=100
SLIDER_DEFAULT_VALUE=100
CLOCK_UPDATE_INTERVAL = 100 # 10 or even 1 ms doesn't seem to change the framerate but 100ms is enough
CLOCK_UPDATE_INTERVAL = 1000 # 10 or even 1 ms doesn't seem to change the framerate but 100ms is enough
WIFI_ICON_UPDATE_INTERVAL = 1500
TEMPERATURE_UPDATE_INTERVAL = 2000
MEMFREE_UPDATE_INTERVAL = 5000 # not too frequent because there's a forced gc.collect() to give it a reliable value
@@ -29,7 +29,10 @@ wifi_screen=None
drawer_open=False
bar_open=True
th = task_handler.TaskHandler(duration=6)
# lowering the duration from default 33 to 6 seems to increase the camera framerate from 5.5 to 9 and the UI framerate from 15 to 20fps
# lowering to 1 doesn't seem to help out the camera framerate (so it's maxed out) but the UI goes to 26 FPS with it!
#th = task_handler.TaskHandler()
th = task_handler.TaskHandler(duration=1)
rootscreen = lv.screen_active()
rootlabel = lv.label(rootscreen)
+3
View File
@@ -22,4 +22,7 @@ fi
python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE="/home/user/sources/micropython-camera-API/src/micropython.cmake" "$manifest"
# build for unix:
#python3 make.py unix DISPLAY=sdl_display INDEV=sdl_pointer
popd