Add support for "coolers"

parent 0657d73f
...@@ -73,6 +73,9 @@ def find_specific_code(line, code): ...@@ -73,6 +73,9 @@ def find_specific_code(line, code):
def S(line): def S(line):
return find_specific_code(line, "S") return find_specific_code(line, "S")
def C(line):
return " C " in line.raw
def P(line): def P(line):
return find_specific_code(line, "P") return find_specific_code(line, "P")
......
...@@ -44,7 +44,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -44,7 +44,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
gauges_base_line = base_line + 7 gauges_base_line = base_line + 7
else: else:
gauges_base_line = base_line + 6 gauges_base_line = base_line + 6
tempdisp_line = gauges_base_line + (2 if root.display_gauges else 0) tempdisp_line = gauges_base_line + (4 if root.display_gauges else 0)
if mini_mode and root.display_graph: if mini_mode and root.display_graph:
e_base_line = base_line + 3 e_base_line = base_line + 3
else: else:
...@@ -59,13 +59,18 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -59,13 +59,18 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
"btemp_off": (base_line + 1, 2), "btemp_off": (base_line + 1, 2),
"btemp_val": (base_line + 1, 3), "btemp_val": (base_line + 1, 3),
"btemp_set": (base_line + 1, 4), "btemp_set": (base_line + 1, 4),
"ebuttons": (e_base_line + 0, 0), "ctemp_label": (base_line + 2, 0),
"esettings": (e_base_line + 1, 0), "ctemp_off": (base_line + 2, 2),
"speedcontrol": (e_base_line + 2, 0), "ctemp_val": (base_line + 2, 3),
"flowcontrol": (e_base_line + 3, 0), "ctemp_set": (base_line + 2, 4),
"htemp_gauge": (gauges_base_line + 0, 0), "ebuttons": (e_base_line + 1, 0),
"btemp_gauge": (gauges_base_line + 1, 0), "esettings": (e_base_line + 2, 0),
"tempdisp": (tempdisp_line, 0), "speedcontrol": (e_base_line + 3, 0),
"flowcontrol": (e_base_line + 4, 0),
"htemp_gauge": (gauges_base_line + 1, 0),
"btemp_gauge": (gauges_base_line + 2, 0),
"ctemp_gauge": (gauges_base_line + 3, 0),
"tempdisp": (tempdisp_line, 3),
"extrude": (3, 0), "extrude": (3, 0),
"reverse": (3, 2), "reverse": (3, 2),
} }
...@@ -79,12 +84,17 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -79,12 +84,17 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
"btemp_off": (1, 1), "btemp_off": (1, 1),
"btemp_val": (1, 1), "btemp_val": (1, 1),
"btemp_set": (1, 1 if root.display_graph else 2), "btemp_set": (1, 1 if root.display_graph else 2),
"ctemp_label": (1, 2),
"ctemp_off": (1, 1),
"ctemp_val": (1, 1),
"ctemp_set": (1, 1 if root.display_graph else 2),
"ebuttons": (1, 5 if root.display_graph else 6), "ebuttons": (1, 5 if root.display_graph else 6),
"esettings": (1, 5 if root.display_graph else 6), "esettings": (1, 5 if root.display_graph else 6),
"speedcontrol": (1, 5 if root.display_graph else 6), "speedcontrol": (1, 5 if root.display_graph else 6),
"flowcontrol": (1, 5 if root.display_graph else 6), "flowcontrol": (1, 5 if root.display_graph else 6),
"htemp_gauge": (1, 5 if mini_mode else 6), "htemp_gauge": (1, 5 if mini_mode else 6),
"btemp_gauge": (1, 5 if mini_mode else 6), "btemp_gauge": (1, 5 if mini_mode else 6),
"ctemp_gauge": (1, 5 if mini_mode else 6),
"tempdisp": (1, 5 if mini_mode else 6), "tempdisp": (1, 5 if mini_mode else 6),
"extrude": (1, 2), "extrude": (1, 2),
"reverse": (1, 3), "reverse": (1, 3),
...@@ -167,13 +177,37 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -167,13 +177,37 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
root.printerControls.append(root.setbbtn) root.printerControls.append(root.setbbtn)
add("btemp_set", root.setbbtn, flag = wx.EXPAND) add("btemp_set", root.setbbtn, flag = wx.EXPAND)
# Cooler temp // NEXTIME
add("ctemp_label", wx.StaticText(parentpanel, -1, _("Cooler:")), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
ctemp_choices = [root.coolertemps[i] + " (" + i + ")" for i in sorted(root.coolertemps.keys(), key = lambda x:root.temps[x])]
root.setcoff = make_button(parentpanel, _("Off"), lambda e: root.do_coolertemp("off"), _("Switch Cooler Off"), size = (38, -1), style = wx.BU_EXACTFIT)
root.printerControls.append(root.setcoff)
add("ctemp_off", root.setcoff)
if root.settings.last_cooler_temperature not in map(float, root.coolertemps.values()):
ctemp_choices = [str(root.settings.last_cooler_temperature)] + ctemp_choices
root.ctemp = wx.ComboBox(parentpanel, -1, choices = ctemp_choices,
style = wx.CB_DROPDOWN, size = (80, -1))
root.ctemp.SetToolTip(wx.ToolTip(_("Select Temperature for Cooler")))
root.ctemp.Bind(wx.EVT_COMBOBOX, root.ctemp_change)
add("ctemp_val", root.ctemp)
root.setcbtn = make_button(parentpanel, _("Set"), root.do_coolertemp, _("Switch Cooler"), size = (38, -1), style = wx.BU_EXACTFIT)
root.printerControls.append(root.setcbtn)
add("ctemp_set", root.setcbtn, flag = wx.EXPAND)
root.ctemp.SetValue(str(root.settings.last_cooler_temperature))
root.btemp.SetValue(str(root.settings.last_bed_temperature)) root.btemp.SetValue(str(root.settings.last_bed_temperature))
root.htemp.SetValue(str(root.settings.last_temperature)) root.htemp.SetValue(str(root.settings.last_temperature))
# added for an error where only the bed would get (pla) or (abs). # added for an error where only the bed would get (pla) or (abs).
# This ensures, if last temp is a default pla or abs, it will be marked so. # This ensures, if last temp is a default pla or abs, it will be marked so.
# if it is not, then a (user) remark is added. This denotes a manual entry # if it is not, then a (user) remark is added. This denotes a manual entry
for i in ctemp_choices:
if i.split()[0] == str(root.settings.last_cooler_temperature).split('.')[0] or i.split()[0] == str(root.settings.last_cooler_temperature):
root.ctemp.SetValue(i)
for i in btemp_choices: for i in btemp_choices:
if i.split()[0] == str(root.settings.last_bed_temperature).split('.')[0] or i.split()[0] == str(root.settings.last_bed_temperature): if i.split()[0] == str(root.settings.last_bed_temperature).split('.')[0] or i.split()[0] == str(root.settings.last_bed_temperature):
root.btemp.SetValue(i) root.btemp.SetValue(i)
...@@ -181,6 +215,8 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -181,6 +215,8 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
if i.split()[0] == str(root.settings.last_temperature).split('.')[0] or i.split()[0] == str(root.settings.last_temperature): if i.split()[0] == str(root.settings.last_temperature).split('.')[0] or i.split()[0] == str(root.settings.last_temperature):
root.htemp.SetValue(i) root.htemp.SetValue(i)
if '(' not in root.ctemp.Value:
root.btemp.SetValue(root.ctemp.Value + ' (user)')
if '(' not in root.btemp.Value: if '(' not in root.btemp.Value:
root.btemp.SetValue(root.btemp.Value + ' (user)') root.btemp.SetValue(root.btemp.Value + ' (user)')
if '(' not in root.htemp.Value: if '(' not in root.htemp.Value:
...@@ -261,6 +297,8 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -261,6 +297,8 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
add("htemp_gauge", root.hottgauge, flag = wx.EXPAND) add("htemp_gauge", root.hottgauge, flag = wx.EXPAND)
root.bedtgauge = TempGauge(parentpanel, size = (-1, 24), title = _("Bed:"), maxval = 150, bgcolor = root.bgcolor) root.bedtgauge = TempGauge(parentpanel, size = (-1, 24), title = _("Bed:"), maxval = 150, bgcolor = root.bgcolor)
add("btemp_gauge", root.bedtgauge, flag = wx.EXPAND) add("btemp_gauge", root.bedtgauge, flag = wx.EXPAND)
root.coolertgauge = TempGauge(parentpanel, size = (-1, 24), title = _("Cooler:"), maxval = 50, bgcolor = root.bgcolor)
add("ctemp_gauge", root.coolertgauge, flag = wx.EXPAND)
def hotendgauge_scroll_setpoint(e): def hotendgauge_scroll_setpoint(e):
rot = e.GetWheelRotation() rot = e.GetWheelRotation()
...@@ -275,8 +313,16 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -275,8 +313,16 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
root.do_settemp(str(root.bsetpoint + 1)) root.do_settemp(str(root.bsetpoint + 1))
elif rot < 0: elif rot < 0:
root.do_settemp(str(max(0, root.bsetpoint - 1))) root.do_settemp(str(max(0, root.bsetpoint - 1)))
def coolergauge_scroll_setpoint(e):
rot = e.GetWheelRotation()
if rot > 0:
root.do_settemp(str(root.csetpoint + 1))
elif rot < 0:
root.do_settemp(str(max(0, root.csetpoint - 1)))
root.hottgauge.Bind(wx.EVT_MOUSEWHEEL, hotendgauge_scroll_setpoint) root.hottgauge.Bind(wx.EVT_MOUSEWHEEL, hotendgauge_scroll_setpoint)
root.bedtgauge.Bind(wx.EVT_MOUSEWHEEL, bedgauge_scroll_setpoint) root.bedtgauge.Bind(wx.EVT_MOUSEWHEEL, bedgauge_scroll_setpoint)
root.coolertgauge.Bind(wx.EVT_MOUSEWHEEL, coolergauge_scroll_setpoint)
# Temperature (M105) feedback display # # Temperature (M105) feedback display #
root.tempdisp = wx.StaticText(parentpanel, -1, "", style = wx.ST_NO_AUTORESIZE) root.tempdisp = wx.StaticText(parentpanel, -1, "", style = wx.ST_NO_AUTORESIZE)
......
...@@ -49,13 +49,17 @@ class Graph(BufferedCanvas): ...@@ -49,13 +49,17 @@ class Graph(BufferedCanvas):
self.extruder1temps = parent_graph.extruder1temps self.extruder1temps = parent_graph.extruder1temps
self.extruder1targettemps = parent_graph.extruder1targettemps self.extruder1targettemps = parent_graph.extruder1targettemps
self.bedtemps = parent_graph.bedtemps self.bedtemps = parent_graph.bedtemps
self.coolertemps = parent_graph.coolertemps
self.bedtargettemps = parent_graph.bedtargettemps self.bedtargettemps = parent_graph.bedtargettemps
self.coolertargettemps = parent_graph.coolertargettemps
self.fanpowers=parent_graph.fanpowers self.fanpowers=parent_graph.fanpowers
else: else:
self.extruder0temps = [0] self.extruder0temps = [0]
self.extruder0targettemps = [0] self.extruder0targettemps = [0]
self.extruder1temps = [0] self.extruder1temps = [0]
self.extruder1targettemps = [0] self.extruder1targettemps = [0]
self.coolertemps = [0]
self.coolertargettemps = [0]
self.bedtemps = [0] self.bedtemps = [0]
self.bedtargettemps = [0] self.bedtargettemps = [0]
self.fanpowers= [0] self.fanpowers= [0]
...@@ -92,6 +96,8 @@ class Graph(BufferedCanvas): ...@@ -92,6 +96,8 @@ class Graph(BufferedCanvas):
def updateTemperatures(self, event): def updateTemperatures(self, event):
self.AddBedTemperature(self.bedtemps[-1]) self.AddBedTemperature(self.bedtemps[-1])
self.AddBedTargetTemperature(self.bedtargettemps[-1]) self.AddBedTargetTemperature(self.bedtargettemps[-1])
self.AddCoolerTemperature(self.coolertemps[-1])
self.AddCoolerTargetTemperature(self.coolertargettemps[-1])
self.AddExtruder0Temperature(self.extruder0temps[-1]) self.AddExtruder0Temperature(self.extruder0temps[-1])
self.AddExtruder0TargetTemperature(self.extruder0targettemps[-1]) self.AddExtruder0TargetTemperature(self.extruder0targettemps[-1])
self.AddExtruder1Temperature(self.extruder1temps[-1]) self.AddExtruder1Temperature(self.extruder1temps[-1])
...@@ -230,6 +236,14 @@ class Graph(BufferedCanvas): ...@@ -230,6 +236,14 @@ class Graph(BufferedCanvas):
def drawbedtargettemp(self, dc, gc): def drawbedtargettemp(self, dc, gc):
self.drawtemperature(dc, gc, self.bedtargettemps, self.drawtemperature(dc, gc, self.bedtargettemps,
"Bed Target", 2, 255, 120, 0, 128) "Bed Target", 2, 255, 120, 0, 128)
def drawcoolertemp(self, dc, gc):
self.drawtemperature(dc, gc, self.coolertemps,
"Cooler", 2, 255, 0, 0, 128)
def drawcoolertargettemp(self, dc, gc):
self.drawtemperature(dc, gc, self.coolertargettemps,
"Cooler Target", 2, 255, 120, 0, 128)
def drawextruder0temp(self, dc, gc): def drawextruder0temp(self, dc, gc):
self.drawtemperature(dc, gc, self.extruder0temps, self.drawtemperature(dc, gc, self.extruder0temps,
...@@ -259,21 +273,40 @@ class Graph(BufferedCanvas): ...@@ -259,21 +273,40 @@ class Graph(BufferedCanvas):
def SetBedTemperature(self, value): def SetBedTemperature(self, value):
self.bedtemps.pop() self.bedtemps.pop()
self.bedtemps.append(value) self.bedtemps.append(value)
def SetCoolerTemperature(self, value):
self.coolertemps.pop()
self.coolertemps.append(value)
def AddBedTemperature(self, value): def AddBedTemperature(self, value):
self.bedtemps.append(value) self.bedtemps.append(value)
if float(len(self.bedtemps) - 1) / self.xsteps > 1: if float(len(self.bedtemps) - 1) / self.xsteps > 1:
self.bedtemps.pop(0) self.bedtemps.pop(0)
def AddCoolerTemperature(self, value):
self.coolertemps.append(value)
if float(len(self.coolertemps) - 1) / self.xsteps > 1:
self.coolertemps.pop(0)
def SetBedTargetTemperature(self, value): def SetBedTargetTemperature(self, value):
self.bedtargettemps.pop() self.bedtargettemps.pop()
self.bedtargettemps.append(value) self.bedtargettemps.append(value)
def SetCoolerTargetTemperature(self, value):
self.coolertargettemps.pop()
self.coolertargettemps.append(value)
def AddBedTargetTemperature(self, value): def AddBedTargetTemperature(self, value):
self.bedtargettemps.append(value) self.bedtargettemps.append(value)
if float(len(self.bedtargettemps) - 1) / self.xsteps > 1: if float(len(self.bedtargettemps) - 1) / self.xsteps > 1:
self.bedtargettemps.pop(0) self.bedtargettemps.pop(0)
def AddCoolerTargetTemperature(self, value):
self.coolertargettemps.append(value)
if float(len(self.coolertargettemps) - 1) / self.xsteps > 1:
self.coolertargettemps.pop(0)
def SetExtruder0Temperature(self, value): def SetExtruder0Temperature(self, value):
self.extruder0temps.pop() self.extruder0temps.pop()
self.extruder0temps.append(value) self.extruder0temps.append(value)
...@@ -329,6 +362,8 @@ class Graph(BufferedCanvas): ...@@ -329,6 +362,8 @@ class Graph(BufferedCanvas):
self.drawgrid(dc, gc) self.drawgrid(dc, gc)
self.drawbedtargettemp(dc, gc) self.drawbedtargettemp(dc, gc)
self.drawbedtemp(dc, gc) self.drawbedtemp(dc, gc)
self.drawcoolertargettemp(dc, gc)
self.drawcoolertemp(dc, gc)
self.drawfanpower(dc, gc) self.drawfanpower(dc, gc)
self.drawextruder0targettemp(dc, gc) self.drawextruder0targettemp(dc, gc)
self.drawextruder0temp(dc, gc) self.drawextruder0temp(dc, gc)
...@@ -393,6 +428,10 @@ class Graph(BufferedCanvas): ...@@ -393,6 +428,10 @@ class Graph(BufferedCanvas):
bed_min = min(self.graph.bedtemps) bed_min = min(self.graph.bedtemps)
bed_max = max(self.graph.bedtemps) bed_max = max(self.graph.bedtemps)
bed_target = self.graph.bedtargettemps[-1] bed_target = self.graph.bedtargettemps[-1]
cooler_min = min(self.graph.coolertemps)
cooler_max = max(self.graph.coolertemps)
cooler_target = self.graph.coolertargettemps[-1]
miny = min(extruder0_min, extruder0_target) miny = min(extruder0_min, extruder0_target)
maxy = max(extruder0_max, extruder0_target) maxy = max(extruder0_max, extruder0_target)
...@@ -402,6 +441,10 @@ class Graph(BufferedCanvas): ...@@ -402,6 +441,10 @@ class Graph(BufferedCanvas):
if bed_target > 0 or bed_max > 5: # use HBP if bed_target > 0 or bed_max > 5: # use HBP
miny = min(miny, bed_min, bed_target) miny = min(miny, bed_min, bed_target)
maxy = max(maxy, bed_max, bed_target) maxy = max(maxy, bed_max, bed_target)
if cooler_target > 0 or cooler_max > 5: # use HBP
miny = min(miny, cooler_min, cooler_target)
maxy = max(maxy, cooler_max, cooler_target)
miny=min(0,miny); miny=min(0,miny);
maxy=max(260,maxy); maxy=max(260,maxy);
...@@ -427,7 +470,9 @@ class Graph(BufferedCanvas): ...@@ -427,7 +470,9 @@ class Graph(BufferedCanvas):
bed_min = self.graph.bedtemps[-1] bed_min = self.graph.bedtemps[-1]
bed_max = self.graph.bedtemps[-1] bed_max = self.graph.bedtemps[-1]
bed_target = self.graph.bedtargettemps[-1] bed_target = self.graph.bedtargettemps[-1]
cooler_min = self.graph.coolertemps[-1]
cooler_max = self.graph.coolertemps[-1]
cooler_target = self.graph.coolertargettemps[-1]
miny = min(extruder0_min, extruder0_target) miny = min(extruder0_min, extruder0_target)
maxy = max(extruder0_max, extruder0_target) maxy = max(extruder0_max, extruder0_target)
if extruder1_target > 0 or extruder1_max > 5: # use extruder1 if extruder1_target > 0 or extruder1_max > 5: # use extruder1
...@@ -436,6 +481,10 @@ class Graph(BufferedCanvas): ...@@ -436,6 +481,10 @@ class Graph(BufferedCanvas):
if bed_target > 0 or bed_max > 5: # use HBP if bed_target > 0 or bed_max > 5: # use HBP
miny = min(miny, bed_min, bed_target) miny = min(miny, bed_min, bed_target)
maxy = max(maxy, bed_max, bed_target) maxy = max(maxy, bed_max, bed_target)
if cooler_target > 0 or cooler_max > 5: # use HBP
miny = min(miny, cooler_min, cooler_target)
maxy = max(maxy, cooler_max, cooler_target)
miny=min(0,miny); miny=min(0,miny);
maxy=max(260,maxy); maxy=max(260,maxy);
......
...@@ -58,7 +58,7 @@ try: ...@@ -58,7 +58,7 @@ try:
except: except:
READLINE = False # neither readline module is available READLINE = False # neither readline module is available
tempreading_exp = re.compile("(^T:| T:)") tempreading_exp = re.compile("(^T:| T:|^COOL:| COOL:)")
REPORT_NONE = 0 REPORT_NONE = 0
REPORT_POS = 1 REPORT_POS = 1
...@@ -72,6 +72,8 @@ class Status(object): ...@@ -72,6 +72,8 @@ class Status(object):
self.extruder_temp_target = 0 self.extruder_temp_target = 0
self.bed_temp = 0 self.bed_temp = 0
self.bed_temp_target = 0 self.bed_temp_target = 0
self.cooler_temp = 0
self.cooler_temp_target = 0
self.print_job = None self.print_job = None
self.print_job_progress = 1.0 self.print_job_progress = 1.0
...@@ -93,11 +95,22 @@ class Status(object): ...@@ -93,11 +95,22 @@ class Status(object):
setpoint = temps["B"][1] setpoint = temps["B"][1]
if setpoint: if setpoint:
self.bed_temp_target = float(setpoint) self.bed_temp_target = float(setpoint)
cooler_temp = float(temps["C"][0]) if "C" in temps and temps["C"][0] else None
if cooler_temp is not None:
self.cooler_temp = cooler_temp
setpoint = temps["C"][1]
if setpoint:
self.cooler_temp_target = float(setpoint)
@property @property
def bed_enabled(self): def bed_enabled(self):
return self.bed_temp != 0 return self.bed_temp != 0
@property
def cooler_enabled(self):
return self.cooler_temp != 0
@property @property
def extruder_enabled(self): def extruder_enabled(self):
return self.extruder_temp != 0 return self.extruder_temp != 0
...@@ -136,6 +149,7 @@ class pronsole(cmd.Cmd): ...@@ -136,6 +149,7 @@ class pronsole(cmd.Cmd):
self.uploading = 0 # Unused, just for pronterface generalization self.uploading = 0 # Unused, just for pronterface generalization
self.temps = {"pla": "185", "abs": "230", "off": "0"} self.temps = {"pla": "185", "abs": "230", "off": "0"}
self.bedtemps = {"pla": "60", "abs": "110", "off": "0"} self.bedtemps = {"pla": "60", "abs": "110", "off": "0"}
self.coolertemps = {"off": "0"}
self.percentdone = 0 self.percentdone = 0
self.posreport = "" self.posreport = ""
self.tempreadings = "" self.tempreadings = ""
...@@ -375,6 +389,10 @@ class pronsole(cmd.Cmd): ...@@ -375,6 +389,10 @@ class pronsole(cmd.Cmd):
if self.status.bed_temp_target != 0: if self.status.bed_temp_target != 0:
self.log("Setting bed temp to 0") self.log("Setting bed temp to 0")
self.p.send_now("M140 S0.0") self.p.send_now("M140 S0.0")
if self.status.cooler_enabled:
if self.status.cooler_temp_target != 0:
self.log("Setting cooler temp to 0")
self.p.send_now("M140 C S0.0")
self.log("Disconnecting from printer...") self.log("Disconnecting from printer...")
if self.p.printing: if self.p.printing:
self.log(_("Are you sure you want to exit while printing?\n\ self.log(_("Are you sure you want to exit while printing?\n\
...@@ -1209,7 +1227,7 @@ class pronsole(cmd.Cmd): ...@@ -1209,7 +1227,7 @@ class pronsole(cmd.Cmd):
if self.userm114 > 0: if self.userm114 > 0:
self.userm114 -= 1 self.userm114 -= 1
isreport |= REPORT_MANUAL isreport |= REPORT_MANUAL
if "ok T:" in l or tempreading_exp.findall(l): if "ok T:" in l or tempreading_exp.findall(l) or 'ok COOL:' in l:
self.tempreadings = l self.tempreadings = l
isreport = REPORT_TEMP isreport = REPORT_TEMP
if self.userm105 > 0: if self.userm105 > 0:
...@@ -1323,7 +1341,7 @@ class pronsole(cmd.Cmd): ...@@ -1323,7 +1341,7 @@ class pronsole(cmd.Cmd):
def tempcb(self, l): def tempcb(self, l):
if "T:" in l: if "T:" in l:
self.log(l.strip().replace("T", "Hotend").replace("B", "Bed").replace("ok ", "")) self.log(l.strip().replace("T", "Hotend").replace("B", "Bed").replace("C", "Cooler").replace("ok ", ""))
def do_gettemp(self, l): def do_gettemp(self, l):
if "dynamic" in l: if "dynamic" in l:
...@@ -1336,6 +1354,8 @@ class pronsole(cmd.Cmd): ...@@ -1336,6 +1354,8 @@ class pronsole(cmd.Cmd):
else: else:
self.log(_("Hotend: %s/%s") % (self.status.extruder_temp, self.status.extruder_temp_target)) self.log(_("Hotend: %s/%s") % (self.status.extruder_temp, self.status.extruder_temp_target))
self.log(_("Bed: %s/%s") % (self.status.bed_temp, self.status.bed_temp_target)) self.log(_("Bed: %s/%s") % (self.status.bed_temp, self.status.bed_temp_target))
if self.status.cooler_enabled:
self.log(_("Cooler: %s/%s") % (self.status.cooler_temp, self.status.cooler_temp_target))
def help_gettemp(self): def help_gettemp(self):
self.log(_("Read the extruder and bed temperature.")) self.log(_("Read the extruder and bed temperature."))
...@@ -1390,6 +1410,24 @@ class pronsole(cmd.Cmd): ...@@ -1390,6 +1410,24 @@ class pronsole(cmd.Cmd):
else: else:
self.logError(_("You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0.")) self.logError(_("You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0."))
def do_coolertemp(self, l):
f = None
try:
l = l.lower().replace(", ", ".")
for i in self.coolertemps.keys():
l = l.replace(i, self.coolertemps[i])
f = float(l)
except:
self.logError(_("You must enter a temperature."))
if f is not None and f >= 0:
if self.p.online:
self.p.send_now("M140 C S" + l)
self.log(_("Setting cooler temperature to %s degrees Celsius.") % f)
else:
self.logError(_("Printer is not online."))
else:
self.logError(_("You cannot set negative temperatures. To turn the cooler off entirely, set its temperature to 0."))
def help_bedtemp(self): def help_bedtemp(self):
self.log(_("Sets the bed temperature to the value entered.")) self.log(_("Sets the bed temperature to the value entered."))
self.log(_("Enter either a temperature in celsius or one of the following keywords")) self.log(_("Enter either a temperature in celsius or one of the following keywords"))
...@@ -1399,6 +1437,16 @@ class pronsole(cmd.Cmd): ...@@ -1399,6 +1437,16 @@ class pronsole(cmd.Cmd):
if (len(line.split()) == 2 and line[-1] != " ") or (len(line.split()) == 1 and line[-1] == " "): if (len(line.split()) == 2 and line[-1] != " ") or (len(line.split()) == 1 and line[-1] == " "):
return [i for i in self.bedtemps.keys() if i.startswith(text)] return [i for i in self.bedtemps.keys() if i.startswith(text)]
def help_coolertemp(self):
self.log(_("Sets the cooler temperature to the value entered."))
self.log(_("Enter either a temperature in celsius or one of the following keywords"))
self.log(", ".join([i + "(" + self.coolertemps[i] + ")" for i in self.coolertemps.keys()]))
def complete_coolertemp(self, text, line, begidx, endidx):
if (len(line.split()) == 2 and line[-1] != " ") or (len(line.split()) == 1 and line[-1] == " "):
return [i for i in self.coolertemps.keys() if i.startswith(text)]
def do_monitor(self, l): def do_monitor(self, l):
interval = 5 interval = 5
if not self.p.online: if not self.p.online:
...@@ -1635,6 +1683,8 @@ class pronsole(cmd.Cmd): ...@@ -1635,6 +1683,8 @@ class pronsole(cmd.Cmd):
self.onecmd("M104 S0") self.onecmd("M104 S0")
self.log(_("; Heatbed off")) self.log(_("; Heatbed off"))
self.onecmd("M140 S0") self.onecmd("M140 S0")
self.log(_("; Cooler off"))
self.onecmd("M140 C S0")
self.log(_("; Fan off")) self.log(_("; Fan off"))
self.onecmd("M107") self.onecmd("M107")
self.log(_("; Power supply off")) self.log(_("; Power supply off"))
......
...@@ -423,6 +423,27 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -423,6 +423,27 @@ class PronterWindow(MainWindow, pronsole.pronsole):
except Exception, x: except Exception, x:
self.logError(_("You must enter a temperature. (%s)") % (repr(x),)) self.logError(_("You must enter a temperature. (%s)") % (repr(x),))
def do_coolertemp(self, l = ""):
try:
if l.__class__ not in (str, unicode) or not len(l):
l = str(self.ctemp.GetValue().split()[0])
l = l.lower().replace(", ", ".")
for i in self.coolertemps.keys():
l = l.replace(i, self.coolertemps[i])
f = float(l)
if f >= 0:
if self.p.online:
self.p.send_now("M140 C S" + l)
self.log(_("Setting Cooler temperature to %f degrees Celsius.") % f)
self.setcoolergui(f)
else:
self.logError(_("Printer is not online."))
else:
self.logError(_("You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0."))
except Exception, x:
self.logError(_("You must enter a temperature. (%s)") % (repr(x),))
def do_setspeed(self, l = ""): def do_setspeed(self, l = ""):
try: try:
if l.__class__ not in (str, unicode) or not len(l): if l.__class__ not in (str, unicode) or not len(l):
...@@ -473,6 +494,26 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -473,6 +494,26 @@ class PronterWindow(MainWindow, pronsole.pronsole):
wx.CallAfter(self.btemp.SetBackgroundColour, "white") wx.CallAfter(self.btemp.SetBackgroundColour, "white")
wx.CallAfter(self.btemp.Refresh) wx.CallAfter(self.btemp.Refresh)
def setcoolergui(self, f):
self.csetpoint = f
if self.display_gauges: self.coolertgauge.SetTarget(int(f))
if self.display_graph: wx.CallAfter(self.graph.SetCoolerTargetTemperature, int(f))
if f > 0:
wx.CallAfter(self.ctemp.SetValue, str(f))
self.set("last_cooler_temperature", str(f))
wx.CallAfter(self.setcoff.SetBackgroundColour, None)
wx.CallAfter(self.setcoff.SetForegroundColour, None)
wx.CallAfter(self.setcbtn.SetBackgroundColour, "#FFAA66")
wx.CallAfter(self.setcbtn.SetForegroundColour, "#660000")
wx.CallAfter(self.ctemp.SetBackgroundColour, "#FFDABB")
else:
wx.CallAfter(self.setcoff.SetBackgroundColour, "#0044CC")
wx.CallAfter(self.setcoff.SetForegroundColour, "white")
wx.CallAfter(self.setcbtn.SetBackgroundColour, None)
wx.CallAfter(self.setcbtn.SetForegroundColour, None)
wx.CallAfter(self.ctemp.SetBackgroundColour, "white")
wx.CallAfter(self.ctemp.Refresh)
def sethotendgui(self, f): def sethotendgui(self, f):
self.hsetpoint = f self.hsetpoint = f
if self.display_gauges: self.hottgauge.SetTarget(int(f)) if self.display_gauges: self.hottgauge.SetTarget(int(f))
...@@ -578,6 +619,12 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -578,6 +619,12 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.do_bedtemp("") self.do_bedtemp("")
wx.CallAfter(self.btemp.SetInsertionPoint, 0) wx.CallAfter(self.btemp.SetInsertionPoint, 0)
def ctemp_change(self, event):
if self.csetpoint > 0:
self.do_coolertemp("")
wx.CallAfter(self.ctemp.SetInsertionPoint, 0)
def tool_change(self, event): def tool_change(self, event):
self.do_tool(self.extrudersel.GetValue()) self.do_tool(self.extrudersel.GetValue())
...@@ -869,6 +916,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -869,6 +916,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self.settings._add(HiddenSetting("last_window_maximized", False)) self.settings._add(HiddenSetting("last_window_maximized", False))
self.settings._add(HiddenSetting("last_sash_position", -1)) self.settings._add(HiddenSetting("last_sash_position", -1))
self.settings._add(HiddenSetting("last_bed_temperature", 0.0)) self.settings._add(HiddenSetting("last_bed_temperature", 0.0))
self.settings._add(HiddenSetting("last_cooler_temperature", 0.0))
self.settings._add(HiddenSetting("last_file_path", u"")) self.settings._add(HiddenSetting("last_file_path", u""))
self.settings._add(HiddenSetting("last_temperature", 0.0)) self.settings._add(HiddenSetting("last_temperature", 0.0))
self.settings._add(StaticTextSetting("separator_2d_viewer", _("2D viewer options"), "", group = "Viewer")) self.settings._add(StaticTextSetting("separator_2d_viewer", _("2D viewer options"), "", group = "Viewer"))
...@@ -1118,6 +1166,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1118,6 +1166,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self.p.reset() self.p.reset()
self.sethotendgui(0) self.sethotendgui(0)
self.setbedgui(0) self.setbedgui(0)
self.setcoolergui(0)
self.p.printing = 0 self.p.printing = 0
wx.CallAfter(self.printbtn.SetLabel, _("Print")) wx.CallAfter(self.printbtn.SetLabel, _("Print"))
if self.paused: if self.paused:
...@@ -1568,12 +1617,19 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1568,12 +1617,19 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
temp = gline_s temp = gline_s
if self.display_gauges: wx.CallAfter(self.hottgauge.SetTarget, temp) if self.display_gauges: wx.CallAfter(self.hottgauge.SetTarget, temp)
if self.display_graph: wx.CallAfter(self.graph.SetExtruder0TargetTemperature, temp) if self.display_graph: wx.CallAfter(self.graph.SetExtruder0TargetTemperature, temp)
elif gline.command in ["M140", "M190"]: elif gline.command in ["M140", "M190"] and not gcoder.C(gline):
gline_s = gcoder.S(gline) gline_s = gcoder.S(gline)
if gline_s is not None: if gline_s is not None:
temp = gline_s temp = gline_s
if self.display_gauges: wx.CallAfter(self.bedtgauge.SetTarget, temp) if self.display_gauges: wx.CallAfter(self.bedtgauge.SetTarget, temp)
if self.display_graph: wx.CallAfter(self.graph.SetBedTargetTemperature, temp) if self.display_graph: wx.CallAfter(self.graph.SetBedTargetTemperature, temp)
elif gline.command in ["M140", "M190"] and gcoder.C(gline):
gline_s = gcoder.S(gline)
if gline_s is not None:
temp = gline_s
if self.display_gauges: wx.CallAfter(self.coolertgauge.SetTarget, temp)
if self.display_graph: wx.CallAfter(self.graph.SetCoolerTargetTemperature, temp)
elif gline.command in ["M106"]: elif gline.command in ["M106"]:
gline_s=gcoder.S(gline) gline_s=gcoder.S(gline)
fanpow=255 fanpow=255
...@@ -1685,6 +1741,16 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1685,6 +1741,16 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
setpoint = float(setpoint) setpoint = float(setpoint)
if self.display_graph: wx.CallAfter(self.graph.SetBedTargetTemperature, setpoint) if self.display_graph: wx.CallAfter(self.graph.SetBedTargetTemperature, setpoint)
if self.display_gauges: wx.CallAfter(self.bedtgauge.SetTarget, setpoint) if self.display_gauges: wx.CallAfter(self.bedtgauge.SetTarget, setpoint)
cooler_temp = float(temps["C"][0]) if "C" in temps and temps["C"][0] else None
if cooler_temp is not None:
if self.display_graph: wx.CallAfter(self.graph.SetCoolerTemperature, cooler_temp)
if self.display_gauges: wx.CallAfter(self.coolertgauge.SetValue, cooler_temp)
setpoint = temps["C"][1]
if setpoint:
setpoint = float(setpoint)
if self.display_graph: wx.CallAfter(self.graph.SetCoolerTargetTemperature, setpoint)
if self.display_gauges: wx.CallAfter(self.coolertgauge.SetTarget, setpoint)
except: except:
self.logError(traceback.format_exc()) self.logError(traceback.format_exc())
......
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