Skip to content

Commit

Permalink
Merge pull request #794 from SparkyCola/master
Browse files Browse the repository at this point in the history
Added progress update on printer screen
  • Loading branch information
kliment authored Mar 13, 2017
2 parents 8c700d0 + 04440d1 commit 8129830
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions printrun/pronterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def get_specific_widget(self, parent):
class PronterWindow(MainWindow, pronsole.pronsole):

_fgcode = None
printer_progress_time = time.time()

def _get_fgcode(self):
return self._fgcode
Expand Down Expand Up @@ -847,6 +848,8 @@ def _add_settings(self, size):
self.settings._add(BooleanSetting("circular_bed", False, _("Circular build platform"), _("Draw a circular (or oval) build platform instead of a rectangular one"), "Printer"), self.update_bed_viz)
self.settings._add(SpinSetting("extruders", 0, 1, 5, _("Extruders count"), _("Number of extruders"), "Printer"))
self.settings._add(BooleanSetting("clamp_jogging", False, _("Clamp manual moves"), _("Prevent manual moves from leaving the specified build dimensions"), "Printer"))
self.settings._add(BooleanSetting("display_progress_on_printer", False, _("Display progress on printer"), _("Show progress on printers display (sent via M117, might not be supported by all printers)"), "Printer"))
self.settings._add(SpinSetting("printer_progress_update_interval", 10., 0, 120, _("Printer progress update interval"), _("Interval in which pronterface sends the progress to the printer if enabled, in seconds"), "Printer"))
self.settings._add(ComboSetting("uimode", _("Standard"), [_("Standard"), _("Compact"), _("Tabbed"), _("Tabbed with platers")], _("Interface mode"), _("Standard interface is a one-page, three columns layout with controls/visualization/log\nCompact mode is a one-page, two columns layout with controls + log/visualization\nTabbed mode is a two-pages mode, where the first page shows controls and the second one shows visualization and log.\nTabbed with platers mode is the same as Tabbed, but with two extra pages for the STL and G-Code platers."), "UI"), self.reload_ui)
self.settings._add(ComboSetting("controlsmode", "Standard", ["Standard", "Mini"], _("Controls mode"), _("Standard controls include all controls needed for printer setup and calibration, while Mini controls are limited to the ones needed for daily printing"), "UI"), self.reload_ui)
self.settings._add(BooleanSetting("slic3rintegration", False, _("Enable Slic3r integration"), _("Add a menu to select Slic3r profiles directly from Pronterface"), "UI"), self.reload_ui)
Expand Down Expand Up @@ -1007,6 +1010,15 @@ def statuschecker_inner(self):
status_string += _(" Est: %s of %s remaining | ") % (format_duration(secondsremain),
format_duration(secondsestimate))
status_string += _(" Z: %.3f mm") % self.curlayer
if self.settings.display_progress_on_printer and time.time() - self.printer_progress_time >= self.settings.printer_progress_update_interval:
self.printer_progress_time = time.time()
printer_progress_string = "M117 " + str(round(100 * float(self.p.queueindex) / len(self.p.mainqueue), 2)) + "% Est " + format_duration(secondsremain)
#":" seems to be some kind of seperator for G-CODE"
self.p.send_now(printer_progress_string.replace(":", "."))
print("The progress should be updated on the printer now: " + printer_progress_string)
if len(printer_progress_string) > 25:
print("Warning: The print progress message might be too long to be displayed properly")
#13 chars for up to 99h est.
elif self.loading_gcode:
status_string = self.loading_gcode_message
wx.CallAfter(self.statusbar.SetStatusText, status_string)
Expand Down Expand Up @@ -1195,6 +1207,9 @@ def endupload(self):
def pause(self, event = None):
if not self.paused:
self.log(_("Print paused at: %s") % format_time(time.time()))
if self.settings.display_progress_on_printer:
printer_progress_string = "M117 PausedInPronterface"
self.p.send_now(printer_progress_string)
if self.sdprinting:
self.p.send_now("M25")
else:
Expand All @@ -1209,6 +1224,9 @@ def pause(self, event = None):
wx.CallAfter(self.toolbarsizer.Layout)
else:
self.log(_("Resuming."))
if self.settings.display_progress_on_printer:
printer_progress_string = "M117 Resuming"
self.p.send_now(printer_progress_string)
self.paused = False
if self.sdprinting:
self.p.send_now("M24")
Expand Down Expand Up @@ -1539,6 +1557,9 @@ def endcb(self):
pronsole.pronsole.endcb(self)
if self.p.queueindex == 0:
self.p.runSmallScript(self.endScript)
if self.settings.display_progress_on_printer:
printer_progress_string = "M117 Finished Print"
self.p.send_now(printer_progress_string)
wx.CallAfter(self.pausebtn.Disable)
wx.CallAfter(self.printbtn.SetLabel, _("Print"))
wx.CallAfter(self.toolbarsizer.Layout)
Expand Down

0 comments on commit 8129830

Please sign in to comment.