Files
patriandClaude Opus 5.5 4fc70f13d0 12-OBD-Speed: settings page with screen rotation (0/90/180/270)
- third tile (swipe left from the menu): rotation buttons, saved in NVS,
  applied at boot
- shared lib: setRotation() rotates only the panel and redraws; touch
  points are converted in touchpad_read() for the current rotation;
  getRotation() added

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:20:35 +02:00
..

Shared JC3636W518 code

Everything every JC3636W518 project needs, in one place:

Path What
jc3636w518.ini Common PlatformIO settings: pioarduino 51.03.05 (Arduino core 3.0.5), ESP32-S3 16 MB QIO / OPI PSRAM, huge_app.csv, -O2, LVGL 9.6.0, vendor display libraries, COM21
include/lv_conf.h LVGL 9.6 config (generated from the 9.6 template; every change is marked JC3636W518)
include/lv_attr_jc3636w518.h LVGL attribute overrides: hot functions and lv_display_flush_ready() in IRAM
lib/JC3636W518/ Board library: jc3636w518.h (display/touch/backlight init + LVGL glue), pincfg.h (pin map), perf_monitor.h (FPS/CPU monitor)

New project

; platformio.ini
[platformio]
extra_configs = ../shared/jc3636w518.ini   ; path to this folder

[shared]
dir = ../shared                            ; same path

[env:jc3636w518]
extends = jc3636w518
; project-specific overrides, e.g. board_build.partitions = default_16MB.csv
#include <Arduino.h>
#include "jc3636w518.h"
#include "perf_monitor.h"   // optional

void setup() {
  Serial.begin(115200);
  lv_display_t *disp = scr_lvgl_init();   // also does lv_init()
  perf_monitor_begin(disp);              // optional
  // ... create LVGL UI ...
}

void loop() {
  perf_timer_handler();                  // or lv_timer_handler()
  vTaskDelay(1);
  perf_monitor_print();                  // optional: FPS / refresh / other / CPU once per second
}

Add -DJC_DRAW_BUF_ROWS=<n> to build_flags (as ${jc3636w518.build_flags} + extra line) to change the draw buffer height (default 72).

Performance settings (measured with display_gif_embedded, 360×360 GIF at 23.7 fps)

Setting Effect
LVGL 9.6 (AnimatedGIF decoder) GIF decode 24 → 12 ms per frame vs LVGL 8.3
Two 72-row draw buffers in internal RAM render while the previous chunk is sent (120 rows: no gain)
LV_COLOR_FORMAT_DEFAULT = RGB565_SWAPPED renders in the ST77916 byte order → no swap pass in flush
QSPI 80 MHz (was 50) faster transfer to the panel
-O2, IRAM for hot LVGL functions faster rendering/decoding
GIF in display color format (lv_gif_set_color_format) per sketch, only when the GIF needs no transparency (plain background)

Result: CPU for the GIF 86 % → 53 % at full frame rate.

Display / LVGL facts

  • Display format is RGB565_SWAPPED. For images/canvases you create yourself, use lv_display_get_color_format(disp) or ARGB8888 when transparency is needed.
  • LVGL drive A: = SD card (LV_USE_FS_STDIO, path /sdcard/); mount the card with SD_MMC first.
  • LV_USE_STDLIB_MALLOC = CLIB: LVGL uses malloc, so large allocations land in PSRAM. lv_mem_monitor() reports 0 in this mode.