Skip to content

Optimize LVGL rendering performance, disable DMA, add PNG/BMP/GIF support#16

Merged
shiftz300 merged 5 commits into
mainfrom
copilot/refactor-editpr-chunk-logic
Mar 14, 2026
Merged

Optimize LVGL rendering performance, disable DMA, add PNG/BMP/GIF support#16
shiftz300 merged 5 commits into
mainfrom
copilot/refactor-editpr-chunk-logic

Conversation

Copilot AI commented Mar 14, 2026

Copy link
Copy Markdown

Maximize UI fluidity on ESP32-2432S028R hardware (user explicitly does not care about firmware size). Also disables DMA (causes screen corruption on this CYD) and enables additional image format decoders for the viewer.

Rendering performance

  • -Os-O2: Speed-optimized codegen for rendering hot paths
  • LVGL_DRAW_BUF_DIV 4→2: Half-screen draw buffer reduces flush calls per frame
  • SPI 55→80 MHz: ILI9341 max write clock, ~2× flush throughput
  • Shadow cache 128, circle cache 32: Avoid recomputing rounded-corner and shadow gradients
  • Layer buffer 12→24 KB, image cache 32→64 KB: Smoother compositing and decode reuse
  • All SW color format renderers re-enabled (no size constraint)

DMA fix

  • Commented out ESP32_DMA — causes screen corruption on this board
  • Reverted flush callback to pushColors() (blocking SPI, no DMA)

Image format support

  • Enabled LV_USE_LODEPNG, LV_USE_BMP, LV_USE_GIF decoders
  • Extended isImageFile() to recognize .png, .bmp, .gif:
return (ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "bmp" || ext == "gif");

Viewer now supports JPEG, PNG, BMP, GIF via LVGL's built-in decoders and the existing D: filesystem driver.

Build impact

Before After
Flash 89.2% 91.0%
RAM 15.6% 20.8%

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@netlify

netlify Bot commented Mar 14, 2026

Copy link
Copy Markdown

Deploy Preview for cydnote ready!

Name Link
🔨 Latest commit 8dc4ddf
🔍 Latest deploy log https://app.netlify.com/projects/cydnote/deploys/69b564bfe137b70008620223
😎 Deploy Preview https://deploy-preview-16--cydnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

…t swap

- Extract TEXTAREA_SCROLL_ANIM_MS constant (was magic 260)
- Refactor setReadChunkText to accept nav state (has_prev, has_next)
  and perform text swap + scroll positioning atomically
- Temporarily set anim_duration=0 before lv_textarea_set_text() to
  prevent LVGL internal auto-scroll animation from conflicting with
  the explicit scroll target
- Simplify loadReadChunkAtIndex: compute nav state locally and pass
  to editor in a single call, removing separate setReadChunkNavigationState

Co-authored-by: shiftz300 <130174875+shiftz300@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor editpr chunking logic to improve page scrolling Fix editor chunk scroll jump by suppressing LVGL auto-scroll animation during text swap Mar 14, 2026
Copilot AI requested a review from shiftz300 March 14, 2026 10:55
- Disable unused SW color format renderers (RGB565A8, XRGB8888, L8,
  AL88, I1) saving ~28KB flash; keep RGB565/RGB888/ARGB8888/A8
- Enable LV_OBJ_STYLE_CACHE for faster style property lookups (+8B/widget)
- Increase LV_DRAW_SW_CIRCLE_CACHE_SIZE 4→8 for rounded-corner perf
- Enable LV_CACHE_DEF_SIZE=32KB for JPEG image decode caching
- Enable LV_IMAGE_HEADER_CACHE_DEF_CNT=8 for image header caching
- Disable LV_THEME_DEFAULT_GROW to reduce press animation redraws

Co-authored-by: shiftz300 <130174875+shiftz300@users.noreply.github.com>
Copilot AI changed the title Fix editor chunk scroll jump by suppressing LVGL auto-scroll animation during text swap Optimize LVGL performance for ESP32-2432S028R hardware Mar 14, 2026
Copilot AI and others added 2 commits March 14, 2026 13:35
Co-authored-by: shiftz300 <130174875+shiftz300@users.noreply.github.com>
- Comment out ESP32_DMA define — causes screen corruption on this CYD
- Revert pushPixelsDMA() to pushColors() in flush callback
- Enable LV_USE_LODEPNG=1 for PNG image support
- Enable LV_USE_BMP=1 for BMP image support
- Enable LV_USE_GIF=1 for GIF image support
- Update isImageFile() to recognize .png, .bmp, .gif extensions

Co-authored-by: shiftz300 <130174875+shiftz300@users.noreply.github.com>
Copilot AI changed the title Optimize LVGL performance for ESP32-2432S028R hardware Optimize LVGL rendering performance, disable DMA, add PNG/BMP/GIF support Mar 14, 2026
@shiftz300 shiftz300 marked this pull request as ready for review March 14, 2026 13:47
Copilot AI review requested due to automatic review settings March 14, 2026 13:47
@shiftz300 shiftz300 merged commit f5ec412 into main Mar 14, 2026
5 checks passed
@shiftz300 shiftz300 deleted the copilot/refactor-editpr-chunk-logic branch March 14, 2026 13:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes LVGL rendering performance on the ESP32-2432S028R board and adds support for additional image formats. It trades firmware size for speed, which is explicitly acceptable for this hardware target.

Changes:

  • Performance tuning: switches to -O2, doubles draw buffer size, increases SPI to 80 MHz, enables shadow/circle/style caches, and increases layer and image cache sizes
  • Disables DMA (causes screen corruption on this CYD board) and enables PNG, BMP, and GIF image decoders
  • Refactors setReadChunkText() to atomically set navigation state and suppress LVGL scroll animations during content swap, fixing the visible "scroll-up jump" on chunk switches

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
platformio.ini Switch from -Os to -O2 and reduce LVGL_DRAW_BUF_DIV from 4 to 2
src/lv_conf.h Increase cache sizes, enable style cache, disable grow-on-press, enable LODEPNG/BMP/GIF decoders
src/Setup_ESP32_2432S028R_ILI9341.h Increase SPI to 80 MHz, disable ESP32_DMA
src/app.h Extend isImageFile() for png/bmp/gif; pass nav state into setReadChunkText()
src/ui/editor.h Extract TEXTAREA_SCROLL_ANIM_MS constant; refactor setReadChunkText() to suppress scroll animation and batch nav state

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants