virtual_sdcard: various additions - #3132
Conversation
|
Thanks. I have some comments:
Looks fine, but I'd suggest a more descriptive name - maybe SDCARD_RESET_FILE or SDCARD_CANCEL_PRINT or PRINT_FILE_CANCEL. Also, might be nice to add an internal
As near as I can tell, the M20 and M23 commands do not "normally" support directories (eg, https://www.reprap.org/wiki/G-code#M20:_List_SD_card ). Also, I'm not sure it's valid to limit the file extensions of the M20/M23 commands. I'm leery of "enhancing" the old g-code commands in "novel" ways. I'm fine with adding support for directories, but FWIW I'd prefer new commands like
Looks fine to me. It may be worthwhile to add a note to Config_Changes.md .
If I understand this correctly, it adds some useful statistics that are inferred from the print. I think that's fine, but I'd suggest adding it to its own top level "extra" module. (Or, perhaps add to the existing display_status.py module.) The virtual_sdcard.py module can auto-load the new module, so it can continue to unconditionally call its note_xxx() methods. I think a separate "extras" module may keep the low-level file code better separated from the high-level "stats interpretation" code. Thanks again, |
|
Sounds good. I'll get to work on the suggested changes. |
This allows the user to close a currently loaded file and reset the virtual_sdcard's state. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
aa5fd22 to
e80988a
Compare
|
Ok, I have made the following changes:
I thought that Also, if you prefer I can separate the |
KevinOConnor
left a comment
There was a problem hiding this comment.
Thanks. I have a couple of minor comments below.
-Kevin
| - List all gcode files (including those in subdirectories): `GET_FILE_LIST` | ||
| - Load a file and start SD print: `PRINT_FILE_START FILENAME=<filename>` | ||
| - Unload File and Clear SD state: `SDCARD_RESET_FILE` |
There was a problem hiding this comment.
I think it would be preferable if we could use a common prefix for all the commands of the module. For example, "SDCARD_LIST_FILES,SDCARD_PRINT_FILE,SDCARD_RESET_FILE" or "PRINT_FILE_LIST,PRINT_FILE_START,PRINT_FILE_RESET", or something similar.
There was a problem hiding this comment.
Ok, I will change to SDCARD_LIST_FILES and SDCARD_PRINT_FILE. I think that verbiage is most clear on what it does.
| if self.current_file is not None: | ||
| self.print_stats.note_pause() | ||
| else: | ||
| self.file_position = self.file_size = 0 | ||
| self.print_stats.reset() |
There was a problem hiding this comment.
I don't understand this change. How could self.currentfile == None in this context?
EDIT: Oops - it can be assigned to None in the function itself. Shouldn't this call self._reset_file() though?
There was a problem hiding this comment.
Yes, I should change that to use reset_file.
e80988a to
49177fe
Compare
|
Suggested changes made. The virtual_sdcard's extended gcodes are now: Thanks! |
|
Thanks. Looks good to me. If there are no further comments, I'll commit in a couple of days. -Kevin |
|
Hi Kevin, it recently occurred to me that if the print exits the timer due to an error there is currently to method of notifying clients than an error occured. What I thought I could is add a "state" value to the print_stats |
|
It sounds fine to me. Does that mean I should hold off on committing this series? BTW, what's the value in the new SDCARD_GET_FILES command? Wouldn't it be simpler for a user to just list the directory using ls or some file management gui? -Kevin |
|
Yes, please hold off. I'll push a commit, let you review it, then squash it back into the original series. My thought was that SDCARD_GET_FILES would give Octoprint users (and the like) an easy way to list what files are available via the terminal. Now that you mention it, I suppose those users wouldn't use the extended command anyway. Would you like me to remove it? |
|
Sounds good.
The reason I asked was because it occurred to me that if the command iterates through sub-directories it may create a lot of data, which may overload the pseudo-terminal between Klipper and OctoPrint. So, I guess, if there isn't a defined use case, it may be better to not "open that can of worms". Thanks, |
|
I think that makes sense. I just pushed a commit with the changes to print_stats. I'll remove SDCARD_GET_FILES shortly. |
SDCARD_PRINT_FILE allows Klipper to load and start the print for any gcode file within the virtual_sdcard path, including subdirectories. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Do not reset progress to zero while paused. Report 'is_active' and 'file_position'. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
f4ba7eb to
d31b7cc
Compare
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
d31b7cc to
f275c19
Compare
|
Thanks. I'm fine with merging. After the discussion in #3149 a question occurred to me - is SDCARD_RESET_FILE and SDCARD_PRINT_FILE primarily intended to be used by moonraker/mainsail? If so, would a webhook make more sense than a gcode command? The reason I ask is that the M24 and M25 commands are kinda goofy - it's unclear what they should do if they are contained in a gcode file, it's unclear what M24 should do if called when a print is already in progress, and error handling is difficult with them. I wonder if we'll look back and think SDCARD_RESET_FILE and SDCARD_PRINT_FILE are kinda goofy for similar reasons. I'm fine with merging though. Just figured I'd ask. Thanks again, |
|
I think
|
|
Sounds good. Thanks! -Kevin |
This request proposes the following changes to the virtual_sdcard module:
M23 subdir/myfile.gcodeorM23 /subdir/myfile.gcodeThis functionality is currently used by Moonraker/Mainsail, however it may also be useful for displays or gcode_macros.
Signed-off-by: Eric Callahan arksine.code@gmail.com