Stephan3 / dwc2-for-klipper

A translator between DWC2 and Klipper
GNU General Public License v3.0
160 stars 38 forks source link

Handle virtual sdcard more gracefully #65

Closed trevjonez closed 4 years ago

trevjonez commented 4 years ago

This pr does a few things, first it allows listing gcode files in the gcodes dir like virtual sd card typically would. second, it makes virtual_sdcard.py own all of the file operations. third registers M32 so the lcd menu can be directed to web_dwc2 to start jobs which allows DWC2 to handle it properly.

This pr depends on one on the mainline: https://github.com/KevinOConnor/klipper/pull/2767

at the very least the rework of the select/clear needs to be done so that virtual_sdcard can own all selection stateful mutations.

I am fairly certain file handles were being leaked by DWC2 because the last used was not explicitly closed when starting the next print. you can use ls -l /proc/`pidof python`/fd to print the list of current open descriptors. (assuming the only python process is klippy) so by having virtual_sdcard own the file operations you no longer need to worry about cleaning up, it should JustWork™

Stephan3 commented 4 years ago

Thanks for contributing. I will try to check that soon.

rafaljot commented 4 years ago

It works. I can start printing both from LCD an DWC2 without any issue.

Stephan3 commented 4 years ago

I tried this today. Only a basic LCD. i was not able to make it happen, sorry.