Skip to content

Commit da3c304

Browse files
Mainfurrclaude
andauthored
Marlin SD: refresh the list after a delete (#463)
* 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. * 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. --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent eb10609 commit da3c304

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

‎src/components/Panels/Files.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,10 @@ const FilesPanel = () => {
181181
: T("S84").replace("%s", feedback.arg),
182182
type: "error",
183183
})
184-
} else {
185-
//Success now refresh content"
186-
onRefresh(null, false)
187-
return
188184
}
185+
//Refresh content either way, the list shows what is really there
186+
onRefresh(null, false)
187+
return
189188
}
190189
}
191190
setIsLoading(false)

‎src/targets/Printer3D/Marlin/SD-source.js‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,17 @@ const responseSteps = {
168168
},
169169
delete: {
170170
start: (data) => data.startsWith("File deleted"),
171-
end: (data) => data.startsWith("ok") && !data.startsWith("ok T:"),
171+
// An "ok" from M21 or from polling can come before "File deleted"
172+
// and would end the query as an error, so end on the message itself
173+
end: (data) => data.startsWith("File deleted"),
172174
error: (data) => {
173-
return data.startsWith("Deletion failed")
175+
return (
176+
data.startsWith("Deletion failed") ||
177+
data.indexOf("echo:No SD card") != -1 ||
178+
data.indexOf("echo:No media") != -1 ||
179+
data.indexOf('echo:Unknown command: "M21"') != -1 ||
180+
data.indexOf('echo:Unknown command: "M30"') != -1
181+
)
174182
},
175183
},
176184
}

0 commit comments

Comments
 (0)