feat: migrate to ZMK main (Zephyr 4.1 + LVGL 9) - #37
Conversation
|
I only test my nice_oled and passed |
ramb0t
left a comment
There was a problem hiding this comment.
Tested this branch on a Sofle Choc RGB wireless (nice!nano v2, both halves nice!view,
sofle_left/right nice_view_adapter nice_epaper) against ZMK main
641514a9 / zephyr fork 10ba6d0c. It builds and renders correctly —
thanks for doing the LVGL 9 work.
It did not run, though, until I overrode two Kconfig values. Both halves
drew one correct frame and then froze about a second later, every boot.
The resolved .config from CI shows:
CONFIG_NICE_EPAPER_ON=y
CONFIG_LV_Z_VDB_SIZE=64
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=3072
NICE_OLED_ON is unset in that same .config, so Kconfig.defconfig:23-26
should have selected default 100 if NICE_EPAPER_ON and :59-61 / :257-258
should have given 4096. Neither default took effect. LV_Z_MEM_POOL_SIZE is
unaffected and keeps the intended 8192 central / 4096 peripheral split.
Adding these two to my own .conf fixes it completely — no freezes since:
CONFIG_LV_Z_VDB_SIZE=100
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=4096
4096 exactly, so this is the number the module already asks for rather than
me padding it.
Two things that may point at the cause:
nice_epaper.conf already carries both lines under the "modo dongle" TODO
block, but commented out:
# CONFIG_LV_Z_MEM_POOL_SIZE=8192
# CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=4096
And ZMK's own boards/shields/nice_view/nice_view.conf sets
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=4096 as a .conf
assignment. Swapping nice_view for nice_epaper drops that, and the
Kconfig.defconfig default does not appear to replace it — ZMK declares an
unconditional default 3072 in app/src/display/Kconfig.
So the fix may be as simple as uncommenting those two lines in
nice_epaper.conf and adding CONFIG_LV_Z_VDB_SIZE=100 alongside them,
since a .conf assignment wins where the default did not.
Summary
Migrate the
nice_oled/nice_epaper/nice_customshields from ZMK v0.3.0 (Zephyr 3.5 + LVGL 8.2) to ZMK main (Zephyr 4.1 + LVGL 9).Changes
LVGL 8 → 9 migration
lv_canvas_transform()(removed in LVGL 9) →lv_draw_sw_rotate()withLV_DISPLAY_ROTATION_270LV_COLOR_FORMAT_L8(the smallest format supported bylv_draw_sw_rotate), mirroring ZMK's ownnice_viewimplementationlv_canvas_draw_*(removed) → layer-basedcanvas_draw_*wrappers (lv_canvas_init_layer→lv_draw_*→lv_canvas_finish_layer)LV_IMG_CF_INDEXED_1BIT→LV_COLOR_FORMAT_I1; dropped the removed.header.always_zero/.header.reservedfieldslv_draw_img_dsc_t/_init→lv_draw_image_dsc_t/_init,lv_anim_set_time→lv_anim_set_duration,LV_LABEL_LONG_SCROLL_CIRCULAR→LV_LABEL_LONG_MODE_SCROLL_CIRCULARZMK API changes
zmk_endpoints_selected()→zmk_endpoint_get_selected()Fixes
ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZEfrom 2560 to 4096 — LVGL 9 rendering needs more stack; the old 2560 caused a hard fault on the split peripheral (broken display and unresponsive keyboard)lv_color_t cbuf[]parameter fromdraw_canvas(type mismatch after the buffer becameuint8_t[])Cleanup
weather.c/media_player.c— they referenced the removedzmk/events/raw_hid.hAPI; weather and Spotify are already implemented viasrc/raw_hid+screen.csleep_status_bootloader.cvariant behind a newCONFIG_NICE_OLED_SLEEP_STATUS_BOOTLOADERflag, and fixed its periodic-timer leak (now one-shot)SHOW_SLEEP_ART_ON_IDLE OR SHOW_SLEEP_ART_ON_IDLE→..._ON_SLEEP(the_ON_SLEEPoption never took effect)CMakeLists.txtNotes
lv_img_dsc_t,LV_IMG_DECLARE,lv_img_set_src,lv_obj_del,lv_obj_clear_flag,lv_txt_get_sizeetc. are intentionally kept as-is — they are auto-mapped by LVGL 9'ssrc/lv_api_map_v8.h(the same mechanism ZMK's ownnice_viewrelies on)Testing
nice_view(authoritative reference for the same 68×160 → 160×68 rotation)nice_oled) and nice!view (nice_epaper) both render correctly