U1 Fix Pack: firmware fixes for “Move out of range” after skipping an object, and the part fan switching early

I have read and understood all rules of the Innovation Fund Phase 2

on

I consent to my project information (username, project cover, summary, etc.) being publicly displayed for review and showcase

on

Username (for public display)

alandebortolo

Project name

U1 Fix Pack

Project URL

Project cover

Project Category

Firmware

Project Summary

U1 Fix Pack takes bugs that U1 owners reported on Snapmaker’s firmware repository and still open, reproduces each one on the real firmware code with no printer on the desk, fixes it with the smallest patch I could write, and keeps a regression test that fails on firmware 2.0.0 and passes with the patch, in CI on every push.

Demo video, 2.5 minutes. The terminal output is real, taken from the evidence files in the repo; the voice is synthetic.

https://designmaster-solutions.github.io/u1-fixpack/demo.mp4

How it reaches the U1. The tests build Snapmaker’s own u1-klipper at the commit of firmware 2.0.0 (93cb12f), with the data dictionaries of the U1’s boards, and run it in Klipper batch mode with the shipped printer.cfg and fluidd.cfg. A bug counts as reproduced only when the firmware’s own output shows it: an error it raises, a position it reports, the clock of a command it sends to the MCU. Patches are plain .patch files against 93cb12f, small enough to apply on a custom firmware build.

u1-klipper#22: skip an object, Pause, and Resume fails with “Move out of range”. The test prints a file through the firmware’s own virtual_sdcard and presses Pause and Resume through the same webhook handlers Moonraker calls, with the shipped INNER_PAUSE/INNER_RESUME macros. On 2.0.0 all 3 cases fail: Resume and the end-of-print G1 E30 stop with the error from the report (Move out of range on Y axis), and after a park inside the skipped object the firmware’s own position says X33 while the head is at X45, off by the skipped object’s offset. With the patch, 3 of 3 finish and the print ends complete. Three deliberately wrong versions of the patch fail the test, including my own first version, which survived a single-leg park but not the U1’s multi-leg one.

u1-klipper#18: the part fan switches 2 to 4 seconds before the head gets to the M106/M107. The test decodes the MCU command stream of the e0 board with Klipper’s parsedump.py and compares the clock of the fan PWM command with the clock of the first extruder step of the move that follows the command. On 2.0.0, M106 turns the fan on 4,366 ms before that step, and M107 turns it off 4,266 ms before it. With the patch, both land 10 ms after it, inside a 12 ms tolerance (two 5 ms PWM periods plus 2 ms for step and scheduling quantization). The fix is the one the reporter pointed to: G-code fan changes ride the motion queue, as in mainline Klipper, and the fan speed the firmware reports (what Fluidd shows) changes when the PWM is scheduled, not when the line is read. Three deliberately wrong versions fail the test: one that leaves M107 immediate, one whose reported speed never updates, and one whose reported speed jumps ahead of the queued move.

Credit. The people who filed the issues found and described these bugs: alternativniy on #18, who also traced the root cause and pointed to the fix mainline Klipper uses, and SwineFlew931 on #22. This project adds the printer-free reproduction, the patch and the regression test, and offers each patch upstream as a draft pull request on u1-klipper (#24 for #22 and #25 for #18, linked from the project README).

Still needed on 2.1.0. The 2.1.0 release Snapmaker opened on November 3 (u1-klipper #23, head 7e565c8) does not touch the four files these patches change, and both patches apply cleanly to it.

Limits, stated up front. Batch mode has no physics and no real sensors, so a patch proven here is a fix of the firmware logic, not yet a print. #8 (runout and resume replaces the measured flow calibration) is not in the pack: it needs a real runout sensor event, and faking that would prove nothing. I built it with AI coding assistance.

If you have a U1 and hit either bug, please try the patch on a custom firmware build and tell me what happens, right or wrong. A run on a physical U1 is the one thing I cannot do from here.

Open Source Status

Open Source

Please specify the open source license used by this project

GPL-3.0

Cash Fund or U1 Hardware Sponsorship

Cash Fund

Originality

Improvement / optimization based on an existing project

If based on an existing project — your independent contribution

Based on Snapmaker’s u1-klipper (GPL-3.0). My contribution: the printer-free reproductions on the shipped firmware, the patches, and the regression tests with red/green/mutant evidence and CI. The firmware runner is reused from my own U1 Dry Run (topic 43986).

Is it a paid project?

No

Update for firmware 2.1.0. Snapmaker released 2.1.0 on November 4 (u1-klipper 7ac453b). It does not touch the files these patches change, so I re-ran every check on it. On stock 2.1.0 both bugs are still there, with the same numbers as on 2.0.0: #22 stops with the same Move out of range on Y axis, and #18 still switches the fan on 4,366 ms and off 4,266 ms early. With the patches both pass, every deliberately wrong version still fails, and CI now runs everything on 2.0.0 and 2.1.0 (2.1.0 evidence). The same note is on the upstream PRs #24 and #25.

On the Extended firmware (corrected 5 November). For #18 on Extended, use #787 by alternativniy: the same motion-queue approach, opened there on 15 October and tested on printers by its author and other users. I missed it when I first offered both of my patches there, so I took my fan patch out: #869 now carries only the #22 fix. It touches only exclude_object.py, and on 2.1.0 plus the Extended patches the #22 test still goes from 3/3 fail to 3/3 pass. Its CI builds an installable 2.1.0-paxx12-pr869 image, so a U1 owner on Extended can try the #22 fix on the real printer.

Fan status and tool change (5 November). alternativniy reviewed the #18 patch on #25 and found what my PWM test could not see: the fan speed on the screen and in Fluidd changed when the move was planned, up to the queued move time before the fan itself. Fixed with his approach from #787: the status now reports a speed only once the printer clock reaches its PWM time, and the tool change restores the last requested speed, so a tool change right after two quick M106 still restores the last one. On the real firmware (2.0.0 and 2.1.0) the status reads 0.0 up to 1 ms before the PWM and 1.0 from it on; the previous version, and a tool change that reads the status, both fail the tests (test and evidence, commit on #25).

Update: for the fan on stock firmware, until the patch ships, tools/fan_m400.py adds an M400 before every part-fan M106/M107, as a slicer post-processing script. Measured on stock 2.0.0 and 2.1.0, with no patch: the fan now switches 240 ms before the move instead of 4,566 ms. Batch mode does not wait on M400, so the harness models the wait the printer does (the README explains how). The cost is a short stop at every part-fan change (37 to 73 in three example prints). I have not tried it on a real U1: if you do, please tell me whether the fan now switches where the slicer put it, either way.

Start line refused on some heads, confirmed on a physical U1 (5 November, topic 44046). Prints stopped at the first move with Move out of range on Y axis: 84.9 -0.09 2.0 (0003-0522-0001-0013) on heads 1, 3 and 4, never on 2. There is no firmware bug here, only a 1 mm margin: the firmware sets each head’s offset from the midpoint of the four calibrated base positions (get_center_base_position() in klippy/kinematics/extruder.py), so the lowest head sits at minus half the Y spread, and the stock start G-code draws the purge line at G0 X85 Y1, 1 mm above position_min: 0: a head more than 1 mm below the midpoint is sent under zero whenever it starts the print. On the real firmware code (2.0.0 and 2.1.0), a first head at Y -1.09 gives the reporter’s exact error and passes with the line at Y5 (test and evidence). The reporter then read the four offsets from Moonraker on the printer: Y -1.129, +1.129, -1.055 and -1.010. The three below -1.0 are exactly the heads that failed, and their Y5 edit has printed normally on all heads since (post 5). The profile change is proposed to Snapmaker as snapmaker-profiles#5 (the line at Y5 in the four U1 nozzle profiles), for OrcaSlicer#1143.

Continuation of the update comment above, which the forum no longer lets me edit.

Third bug in the pack: runout and resume wipe the measured flow factor (7 November, u1-klipper#8). mmunchinski polled the live and stored flow factor every 5 seconds through a runout: the detection changes nothing, and the moment the same spool is fed back the head’s measured 0.023951 becomes the default 0.02, live and in flow_calibrator.json, so it stays wrong for the rest of that print and for the next ones. On the firmware code the wipe happens twice: the RFID reader’s answer to the switch reading “present” again runs FLOW_RESET_K (an untagged spool reads as the empty card), and for an untagged spool Resume’s reload of the backed-up filament resets once more. The patch keeps the factor while paused when the spool is untagged or its tag matches the backed-up filament; a different filament’s tag, and a filament declared on the screen, still reset. On 2.0.0 and 2.1.0, through the firmware’s own runout, reload and Resume path: stock goes 0.023951 to 0.020000 at the feed, patched keeps 0.023951, a PETG tag still resets to 0.05, and three deliberately wrong versions fail (test and evidence, upstream draft #27). Not yet tried on a physical U1: the reporter’s 5-second poll is the check, and I have asked for it on the issue.

Hardware confirmation for the exclude_object fix (8 November, u1-klipper#22). abehrman, on a stock U1 (firmware 2.0.0.205), lost two prints to the same bug with no pause involved: after an object had been skipped, the tool change’s prime in the purge chute moved the head past Y max on one print and 222 mm across the part while extruding on the other, and his offline replay of the unmodified firmware predicts both bad targets. The offset exclude_object keeps is per extruder, so the stale one at a swap is the incoming tool’s, from the last time it printed the skipped object; the tool change and the chute park are manual_moves like the pause park, which is why the one check in the patch covers both. I added that path as the fourth regression case (a two-colour file with the U1 Orca profile’s tool-change G-code plus the chute prime, one of the second tool’s objects skipped): on stock 2.0.0 and 2.1.0 the fifth swap primes with gcode X82.7 Y230.5 while the head is at X92.7 Y300.5 and drags the head 70 mm in Y while extruding; with the patch all seven swaps stay in the chute and the print completes (test and evidence, upstream draft #24). Still not run on a physical U1 with the patch: I have asked him for the two files to replay them, and for a run if he ever builds the patched firmware.

Release v1.0.0 is up: Release v1.0.0 · DesignMaster-Solutions/u1-fixpack · GitHub (zip with the three .patch files, tools/fan_m400.py, the tests and the docs). From that zip, git apply patches/<file>.patch applies cleanly on a u1-klipper checkout of 2.0.0 (93cb12f) and of 2.1.0 (7ac453b), checked today. Project site: https://designmaster-solutions.github.io/u1-fixpack/. The first post can no longer be edited, so the links go here.