← Back to archive

Repo of the Day

andrej-g/crm4_klipper_touchscreen

Published: Nov 23, 2026

Open repository ↗

Make the CR-M4 touchscreen work with Klipper

Summary

crm4_klipper_touchscreen makes the stock Creality CR-M4 4.3-inch resistive serial touchscreen usable with Klipper and Moonraker. It provides a Python bridge that translates Moonraker state and actions onto the screen's DGUS-II UI, a crm4ui tool for inspecting, rebuilding and uploading the screen's private/ UI files, and a browser emulator with a mock Moonraker for work without printer hardware. The repository distributes no Creality firmware — you must obtain the official CR-M4 package separately, and custom builds target V2.0.3 "new UI" (V1.2.2 is only an analysis reference).

What it is useful for

  • Reusing hardware you already own instead of buying a Klipper-native touchscreen.
  • Inspecting a stock UI: crm4ui dump writes ui_map.json/ui_map.md listing pages, buttons and virtual pages; crm4ui render produces a PNG of every page with English labels plus touch/VP overlays; crm4ui export extracts upright PNGs of backgrounds and icons for editing.
  • Applying changes through a YAML spec. Shipped examples include a boot splash, a cyan-to-amber recolor, redrawn "KLIPPER" wordmarks, tappable nozzle/bed/speed/Z-offset tiles on the Print page, keypad copies titled "Nozzle temperature" and "Hot bed temperature", an English-only start with the Language tile removed, a 0–300 °C nozzle target so 0 disables the heater, fan tiles taking a percentage instead of on/off, a Firmware restart tile, a Spoolman spool panel, a custom machine page with Klipper restart, host reboot/shutdown and E-STOP, and examples/klipper_ui, which composes all of these.
  • Testing without hardware: python -m crm4bridge.mock_moonraker plus python -m crm4ui.emulator $STOCK on http://127.0.0.1:8090.

How engineers can use it

Bridge install on a Pi (Raspberry Pi OS 64-bit, Python 3.9+, configured UART; wiring details in docs/raspberry-pi.md):

sudo apt-get install -y git
git clone https://github.com/andrej-g/crm4_klipper_touchscreen.git
cd crm4_klipper_touchscreen
bash scripts/install.sh --install-deps

The script creates a .venv and a user systemd service, but does not enable or start it. Edit ~/.config/crm4bridge/crm4bridge.cfg with your host and screen = serial:/dev/serial0@115200, leave dry_run = true, then validate with .venv/bin/python -m crm4bridge -c ~/.config/crm4bridge/crm4bridge.cfg --dry-run. Once the screen answers, set dry_run = false and run systemctl --user start crm4bridge.

Build and flash a UI:

crm4ui build $STOCK examples/splash/spec.yaml build/splash --changed-only --preview build/splash-prev
crm4ui flash build/klipper --port serial:/dev/ttyAMA0

Stop the bridge before flashing. Keep an untouched stock private/ and firmware.zlib on a separate FAT32 card as the recovery path, and never modify firmware.zlib.

Documented limits: the 921600 baud data phase is unverified, front-USB flashing is untested under Klipper, the bridge stays read-only until the screen responds, and the MIT license covers only project code — not Creality firmware or artwork.