virtual_sdcard: prepare for pause_resume implementation

- Add is_active() member function to return the active printing status of the virtual sdcard
- M27 now reports current file position when file has been opened. See http://marlinfw.org/docs/gcode/M027.html

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2019-01-21 12:41:42 -05:00 committed by KevinOConnor
parent 0d4544e72a
commit e69742df8f
1 changed files with 3 additions and 1 deletions

View File

@ -57,6 +57,8 @@ class VirtualSD:
if self.work_timer is not None and self.file_size:
progress = float(self.file_position) / self.file_size
return {'progress': progress}
def is_active(self):
return self.work_timer is not None
# G-Code commands
def cmd_error(self, params):
raise self.gcode.error("SD write not supported")
@ -123,7 +125,7 @@ class VirtualSD:
self.file_position = pos
def cmd_M27(self, params):
# Report SD print status
if self.current_file is None or self.work_timer is None:
if self.current_file is None:
self.gcode.respond("Not SD printing.")
return
self.gcode.respond("SD printing byte %d/%d" % (