virtual_sdcard: update get_status method

Do not reset progress to zero while paused.  Report 'is_active' and 'file_position'.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-07-29 06:23:38 -04:00 committed by KevinOConnor
parent 963d7c247b
commit 463194b1a3
1 changed files with 4 additions and 2 deletions

View File

@ -78,9 +78,11 @@ class VirtualSD:
raise self.gcode.error("Unable to get file list")
def get_status(self, eventtime):
progress = 0.
if self.work_timer is not None and self.file_size:
if self.file_size:
progress = float(self.file_position) / self.file_size
return {'progress': progress}
is_active = self.is_active()
return {'progress': progress, 'is_active': is_active,
'file_position': self.file_position}
def is_active(self):
return self.work_timer is not None
def do_pause(self):