Skip to content

Marlin SD: refresh the list after a delete - #463

Merged
luc-github merged 2 commits into
luc-github:3.1from
Mainfurr:upstream-sd-delete
Oct 26, 2026
Merged

luc-github merged 2 commits into
luc-github:3.1from
Mainfurr:upstream-sd-delete

Conversation

@Mainfurr

Copy link
Copy Markdown
Contributor

Deleting a file from the Marlin SD list in the Files panel deletes it on the card, but the list isn't refreshed, and an error toast can appear even though the delete worked.

Cause

The SD delete query ends on the first plain ok. The default delete command is M21;M30 #, so the ok of M21 (or of a polling command such as M105;M114;M27) arrives before File deleted. The processor then sees "end without start", reports an error, and the success branch that refreshes the list never runs.

Changes

  • Printer3D/Marlin/SD-source.js: the delete query ends on File deleted, which is Marlin's fixed serial message (it isn't translated). Besides Deletion failed, a missing card (echo:No SD card, echo:No media) or an unknown M21/M30 now ends it at once as an error instead of after the 30 s timeout. These are the same messages the list query already checks.
  • Panels/Files.js: the list is refreshed after every delete or createdir result, errors and timeouts included, so it always shows what is on the card.

dist/ is not rebuilt in this PR.

Testing

On an Ender-3 Pro (SKR Mini E3 V3.0, Marlin bugfix-2.1.x) through ESP3D 3.1.3 on an ESP32-C3, with polling enabled: deleting a file from the SD list removes it from the list within about 2 s, with no error toast. Before the change, the list kept the file until a manual Refresh. npm run printer-marlin builds.

The delete query ended on the first plain "ok". The default delete
command is "M21;M30 #", so the ok of M21 (or of a polling command)
arrived before "File deleted" and the query ended as "end without
start", which is reported as an error. The list was then not refreshed.
End the query on "File deleted" instead.
A missing card or an unknown M21/M30 now ends the delete query at once
as an error instead of after the 30 s timeout, using the same messages
the list query already checks. The Files panel refreshes the list after
every delete or createdir result, also on errors and timeouts, so it
always shows what is on the card.
@luc-github
luc-github merged commit da3c304 into luc-github:3.1 Oct 26, 2026
1 check passed
@luc-github

Copy link
Copy Markdown
Owner

Merged - thank you

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