Fixed heated bed temperature setting during slicing with Cura

This commit is contained in:
Gina Häußge 2015-01-16 19:58:46 +01:00
parent 98a28cc4e9
commit 9452ba4c24
2 changed files with 18 additions and 11 deletions

View file

@ -100,6 +100,7 @@
* [#683](https://github.com/foosel/OctoPrint/issues/683) - Fixed heated bed option not being properly displayed in * [#683](https://github.com/foosel/OctoPrint/issues/683) - Fixed heated bed option not being properly displayed in
printer profiles printer profiles
* [#714](https://github.com/foosel/OctoPrint/issues/714) - Fixed type validation of printer profiles * [#714](https://github.com/foosel/OctoPrint/issues/714) - Fixed type validation of printer profiles
* Heating up the heated bed (if present) was not properly configured in CuraEngine plugin
* Various fixes without tickets: * Various fixes without tickets:
* GCODE viewer now doesn't stumble over completely extrusionless GCODE files * GCODE viewer now doesn't stumble over completely extrusionless GCODE files
* Do not deliver the API key on settings API unless user has admin rights * Do not deliver the API key on settings API unless user has admin rights

View file

@ -562,6 +562,9 @@ class Profile(object):
else: else:
return 0.0 return 0.0
elif key == "has_heated_bed":
return self._printer_profile["heatedBed"]
elif key.startswith("filament_diameter"): elif key.startswith("filament_diameter"):
match = Profile.regex_filament_diameter.match(key) match = Profile.regex_filament_diameter.match(key)
if not match: if not match:
@ -723,13 +726,13 @@ class Profile(object):
prefix += "M92 E{e_steps}\n" % (e_steps) prefix += "M92 E{e_steps}\n" % (e_steps)
temp = self.get_float("print_temperature") temp = self.get_float("print_temperature")
bedTemp = 0 bed_temp = 0
if self.get_boolean("has_heated_bed"): if self.get_boolean("has_heated_bed"):
bedTemp = self.get_float("print_bed_temperature") bed_temp = self.get_float("print_bed_temperature")
include_bed_temps = bedTemp > 0 and not "{print_bed_temperature}" in Profile.regex_strip_comments.sub("", contents) include_bed_temp = bed_temp > 0 and not "{print_bed_temperature}" in Profile.regex_strip_comments.sub("", contents)
if include_bed_temps: if include_bed_temp:
prefix += "M140 S{print_bed_temperature}\n" prefix += "M140 S{bed_temp}\n".format(bed_temp=bed_temp)
if temp > 0 and not "{print_temperature}" in Profile.regex_strip_comments.sub("", contents): if temp > 0 and not "{print_temperature}" in Profile.regex_strip_comments.sub("", contents):
if extruder_count > 0: if extruder_count > 0:
@ -740,16 +743,19 @@ class Profile(object):
if print_temp > 0: if print_temp > 0:
t = print_temp t = print_temp
return template.format(extruder=extruder, temp=t) return template.format(extruder=extruder, temp=t)
for n in xrange(1, extruder_count):
prefix += temp_line(temp, n, "M104 T{extruder} S{temp}\n") prefix_preheat = ""
prefix_waitheat = ""
for n in xrange(0, extruder_count): for n in xrange(0, extruder_count):
prefix += temp_line(temp, n, "M109 T{extruder} S{temp}\n") if n > 0:
prefix += "T0\n" prefix_preheat += temp_line(temp, n, "M104 T{extruder} S{temp}\n")
prefix_waitheat += temp_line(temp, n, "M109 T{extruder} S{temp}\n")
prefix += prefix_preheat + prefix_waitheat + "T0\n"
else: else:
prefix += "M109 S{temp}\n".format(temp=temp) prefix += "M109 S{temp}\n".format(temp=temp)
if include_bed_temps: if include_bed_temp:
prefix += "M190 S{print_bed_temperature}\n".format(bedTemp=bedTemp) prefix += "M190 S{bed_temp}\n".format(bed_temp=bed_temp)
else: else:
contents = self.get_gcode_template(key) contents = self.get_gcode_template(key)