From a57506aebc58c2fd5a7098b0345ed3f24f56549b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 26 Oct 2026 03:56:32 +0000 Subject: [PATCH 1/2] Refresh the Marlin SD list after a delete 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. --- src/targets/Printer3D/Marlin/SD-source.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/targets/Printer3D/Marlin/SD-source.js b/src/targets/Printer3D/Marlin/SD-source.js index e77b23774..a2840fb22 100644 --- a/src/targets/Printer3D/Marlin/SD-source.js +++ b/src/targets/Printer3D/Marlin/SD-source.js @@ -168,7 +168,9 @@ const responseSteps = { }, delete: { start: (data) => data.startsWith("File deleted"), - end: (data) => data.startsWith("ok") && !data.startsWith("ok T:"), + // An "ok" from M21 or from polling can come before "File deleted" + // and would end the query as an error, so end on the message itself + end: (data) => data.startsWith("File deleted"), error: (data) => { return data.startsWith("Deletion failed") }, From ba8251db6cd90726ad6f21db21b14931cba4fe09 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 26 Oct 2026 04:11:48 +0000 Subject: [PATCH 2/2] Fail SD deletes fast on known errors and always refresh the list 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. --- src/components/Panels/Files.js | 7 +++---- src/targets/Printer3D/Marlin/SD-source.js | 8 +++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/Panels/Files.js b/src/components/Panels/Files.js index 454081180..044ecb365 100644 --- a/src/components/Panels/Files.js +++ b/src/components/Panels/Files.js @@ -181,11 +181,10 @@ const FilesPanel = () => { : T("S84").replace("%s", feedback.arg), type: "error", }) - } else { - //Success now refresh content" - onRefresh(null, false) - return } + //Refresh content either way, the list shows what is really there + onRefresh(null, false) + return } } setIsLoading(false) diff --git a/src/targets/Printer3D/Marlin/SD-source.js b/src/targets/Printer3D/Marlin/SD-source.js index a2840fb22..c5d222a7f 100644 --- a/src/targets/Printer3D/Marlin/SD-source.js +++ b/src/targets/Printer3D/Marlin/SD-source.js @@ -172,7 +172,13 @@ const responseSteps = { // and would end the query as an error, so end on the message itself end: (data) => data.startsWith("File deleted"), error: (data) => { - return data.startsWith("Deletion failed") + return ( + data.startsWith("Deletion failed") || + data.indexOf("echo:No SD card") != -1 || + data.indexOf("echo:No media") != -1 || + data.indexOf('echo:Unknown command: "M21"') != -1 || + data.indexOf('echo:Unknown command: "M30"') != -1 + ) }, }, }