Skip to content

fix: Don't store M110 in files uploaded to SD - #1577

Open
ellensp wants to merge 1 commit into
kliment:masterfrom
ellensp:no-m110-in-uploads
Open

ellensp wants to merge 1 commit into
kliment:masterfrom
ellensp:no-m110-in-uploads

Conversation

@ellensp

@ellensp ellensp commented Nov 4, 2026

Copy link
Copy Markdown

Description

Uploads to SD run through startprint, which sends M110 N-1 at the start and end of a print. While M28 has a file open, the firmware writes those lines into the file, so an uploaded file ends up with lines that weren't in the original.

This PR adds an upload option to startprint that leaves out both, and uses it from Pronterface and pronsole. The start of an upload still needs the line number reset, so both now send M110 N-1 before M28. Normal prints still send it at the start and end.

Testing

Tested on an MKS TinyBee running Marlin bugfix-2.1.x at 250000 baud. The stored lines were read back by running each file from SD with M111 S1 echo on.

Upload of 5 G4 lines (35 bytes) master This PR
Pronterface, file size 55 bytes 35 bytes
Pronterface, M110 lines stored 2 None
pronsole, file size 45 bytes 35 bytes
pronsole, M110 lines stored 1 None

A Pronterface upload of the first 15000 lines of a PrusaSlicer file, whose stored lines come to 448969 bytes, was 448989 bytes on master and 448969 bytes with this PR.

With this PR, two uploads in a row and then a normal print all ran with no line number or checksum errors, in both Pronterface and pronsole.

tests/test_printcore.py has three new tests, with a mocked printer: a print sends both resets, an upload sends only its own lines, and a print after an upload still sends both resets. All tests in tests/ pass.

AI disclosure

Full disclosure: I don't know your policy on AI, so please treat this PR accordingly.

AI used: Claude Opus 5.5 (Anthropic), via Claude Code. It wrote the code and this description, and ran the tests above on @ellensp's board. @ellensp found the problem, directed the work and verified the result.

Uploads run through startprint, which sends M110 N-1 at the start and end
of a print. With M28 open the firmware writes those lines into the file,
so uploaded files gained lines that weren't in the original.

The start of an upload still needs the line number reset, so send it
before M28 instead. Add an upload option to startprint that leaves out
both, and use it from Pronterface and pronsole.

This branch has not been deployed

No deployments
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.

1 participant