Add M114 position report in statusbar

parent 3eee6f47
......@@ -156,6 +156,7 @@ class pronsole(cmd.Cmd):
self.userm114 = 0
self.userm105 = 0
self.m105_waitcycles = 0
self.m114_waitcycles = 5
self.macros = {}
self.history_file = "~/.pronsole-history"
self.rc_loaded = False
......@@ -862,7 +863,10 @@ class pronsole(cmd.Cmd):
self.p.send_now("M27")
if self.m105_waitcycles % 10 == 0:
self.p.send_now("M105")
if self.m114_waitcycles % 10 == 0:
self.p.send_now("M114")
self.m105_waitcycles += 1
self.m114_waitcycles += 1
cur_time = time.time()
wait_time = 0
while time.time() < cur_time + self.monitor_interval - 0.25:
......@@ -1232,6 +1236,8 @@ class pronsole(cmd.Cmd):
if self.userm114 > 0:
self.userm114 -= 1
isreport |= REPORT_MANUAL
else:
self.m114_waitcycles = 0
if "ok T:" in l or tempreading_exp.findall(l) or 'ok COOL:' in l:
self.tempreadings = l
isreport = REPORT_TEMP
......
......@@ -219,6 +219,10 @@ class PronterWindow(MainWindow, pronsole.pronsole):
# disable all printer controls until we connect to a printer
self.gui_set_disconnected()
self.statusbar = self.CreateStatusBar()
self.statusbar.SetFieldsCount(3)
self.statusbar.SetStatusWidths([-1, 30, 250] )
self.statusbar.SetStatusText(" || ", 1)
self.statusbar.SetStatusText(_("Not connected to printer."))
self.t = ConsoleOutputHandler(self.catchprint, self.settings.log_path)
......@@ -1761,6 +1765,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self.logError(traceback.format_exc())
def update_pos(self):
self.statusbar.SetStatusText(str(self.posreport).split(" E:")[0], 2)
bits = gcoder.m114_exp.findall(self.posreport)
x = None
y = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment