Commit f13110a6 authored by kliment's avatar kliment

Temperature setting

parent 3984c41d
...@@ -514,7 +514,9 @@ class pronsole(cmd.Cmd): ...@@ -514,7 +514,9 @@ class pronsole(cmd.Cmd):
def do_settemp(self,l): def do_settemp(self,l):
try: try:
l=l.lower().replace(",",".").replace("abs","230").replace("pla","210").replace("off","0") l=l.lower().replace(",",".")
for i in self.temps.keys():
l=l.replace(i,self.temps[i])
f=float(l) f=float(l)
if f>=0: if f>=0:
if self.p.online: if self.p.online:
...@@ -538,7 +540,9 @@ class pronsole(cmd.Cmd): ...@@ -538,7 +540,9 @@ class pronsole(cmd.Cmd):
def do_bedtemp(self,l): def do_bedtemp(self,l):
try: try:
l=l.lower().replace(",",".").replace("abs","110").replace("pla","65").replace("off","0") l=l.lower().replace(",",".")
for i in self.bedtemps.keys():
l=l.replace(i,self.bedtemps[i])
f=float(l) f=float(l)
if f>=0: if f>=0:
if self.p.online: if self.p.online:
......
...@@ -43,6 +43,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -43,6 +43,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
xcol=(255,255,128) xcol=(255,255,128)
ycol=(180,180,255) ycol=(180,180,255)
zcol=(180,255,180) zcol=(180,255,180)
self.temps={"pla":"210","abs":"230","off":"0"}
self.bedtemps={"pla":"60","abs":"110","off":"0"}
self.cpbuttons=[ self.cpbuttons=[
["X+100",("move X 100"),(0,110),xcol,(55,25)], ["X+100",("move X 100"),(0,110),xcol,(55,25)],
["X+10",("move X 10"),(0,135),xcol,(55,25)], ["X+10",("move X 10"),(0,135),xcol,(55,25)],
...@@ -69,18 +71,16 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -69,18 +71,16 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
["Z-0.1",("move Z -0.1"),(110,210),zcol,(55,25)], ["Z-0.1",("move Z -0.1"),(110,210),zcol,(55,25)],
["Z-1",("move Z -1"),(110,235),zcol,(55,25)], ["Z-1",("move Z -1"),(110,235),zcol,(55,25)],
["Z-10",("move Z -10"),(110,260),zcol,(55,25)], ["Z-10",("move Z -10"),(110,260),zcol,(55,25)],
["Home",("move Z -10"),(110,310),(250,250,250),(55,25)], ["Home",("home"),(110,310),(250,250,250),(55,25)],
] ]
self.btndict={} self.btndict={}
self.popmenu() self.popmenu()
self.popwindow() self.popwindow()
self.recvlisteners=[] self.recvlisteners=[]
self.p.recvcb=self.recvcb #self.p.recvcb=self.recvcb
self.sdfiles=[] self.sdfiles=[]
self.listing=0 self.listing=0
self.sdprinting=0 self.sdprinting=0
self.temps={"pla":"210","abs":"230","off":"0"}
self.bedtemps={"pla":"60","abs":"110","off":"0"}
self.percentdone=0 self.percentdone=0
self.t=Tee(self.catchprint) self.t=Tee(self.catchprint)
self.stdout=sys.stdout self.stdout=sys.stdout
...@@ -88,6 +88,47 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -88,6 +88,47 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#Commands to implement: #Commands to implement:
#settemp/bedtemp/extrude/reverse(control panel) #settemp/bedtemp/extrude/reverse(control panel)
def do_settemp(self,l=""):
try:
if not (l.__class__=="".__class__ or l.__class__==u"".__class__) or (not len(l)):
l=self.htemp.GetValue().split()[0]
l=l.lower().replace(",",".")
for i in self.temps.keys():
l=l.replace(i,self.temps[i])
f=float(l)
if f>=0:
if self.p.online:
self.p.send_now("M104 S"+l)
print "Setting hotend temperature to ",f," degrees Celsius."
self.htemp.SetValue(l)
else:
print "Printer is not online."
else:
print "You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0."
except:
print "You must enter a temperature."
def do_bedtemp(self,l=""):
try:
if not (l.__class__=="".__class__ or l.__class__==u"".__class__) or (not len(l)):
l=self.btemp.GetValue().split()[0]
l=l.lower().replace(",",".")
for i in self.bedtemps.keys():
l=l.replace(i,self.bedtemps[i])
f=float(l)
if f>=0:
if self.p.online:
self.p.send_now("M140 S"+l)
print "Setting bed temperature to ",f," degrees Celsius."
self.btemp.SetValue(l)
else:
print "Printer is not online."
else:
print "You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0."
except:
print "You must enter a temperature."
def catchprint(self,l): def catchprint(self,l):
wx.CallAfter(self.logbox.AppendText,l) wx.CallAfter(self.logbox.AppendText,l)
...@@ -166,6 +207,22 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -166,6 +207,22 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
btn.properties=i btn.properties=i
btn.Bind(wx.EVT_BUTTON,self.procbutton) btn.Bind(wx.EVT_BUTTON,self.procbutton)
self.btndict[i[1]]=btn self.btndict[i[1]]=btn
wx.StaticText(self.panel,-1,"Heater:",pos=(0,345))
self.htemp=wx.ComboBox(self.panel, -1,
choices=[self.temps[i]+" ("+i+")" for i in sorted(self.temps.keys())],
style=wx.CB_SIMPLE|wx.CB_DROPDOWN|wx.CB_SORT, size=(90,30),pos=(50,337))
self.htemp.SetValue("0")
self.settbtn=wx.Button(self.panel,-1,"Set",size=(40,-1),pos=(150,337))
self.settbtn.Bind(wx.EVT_BUTTON,self.do_settemp)
wx.StaticText(self.panel,-1,"Bed:",pos=(0,375))
self.btemp=wx.ComboBox(self.panel, -1,
choices=[self.temps[i]+" ("+i+")" for i in sorted(self.temps.keys())],
style=wx.CB_SIMPLE|wx.CB_DROPDOWN|wx.CB_SORT, size=(90,30),pos=(50,367))
self.btemp.SetValue("0")
self.setbbtn=wx.Button(self.panel,-1,"Set",size=(40,-1),pos=(150,367))
self.setbbtn.Bind(wx.EVT_BUTTON,self.do_bedtemp)
pass pass
def procbutton(self,e): def procbutton(self,e):
......
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