Plugin is even more fit for human consumption, but the code is growing
less and less fit (global variables, static gcode, the agony)
* Disable fan when reheating. Keeping the fan on the corner of the
priming tower made it detach from my bed and reheating is a little
faster without it off.
* Restore behavior of not reheating during a very short layer. If
layers end up short for both hotends, ooze returned and the effect of
the plugin was negated.
* Only hop z on the first layer to prevent a blob from forming at the
edge of the priming tower.
+def wipeNozzle (f):
+ f.write ("""
+G91
+G0 X{d} Y{d} F{rate}
+G0 X-{d} Y-{d} F{rate}
+G0 X-{d} Y-{d} F{rate}
+G0 X{d} Y{d} F{rate}
+G90
+""".format (d=3, rate=float(profile.getProfileSetting('travel_speed')) * 60))
+
+fanOnCommand = None
+
+def disableFan(f):
+ if fanOnCommand is not None:
+ f.write ("M107\n")
+
+def enableFan(f):
+ if fanOnCommand is not None:
+ # ensure fan actually kicks back on
+ f.write ("M106 S255\n")
+ f.write (fanOnCommand)
+
with open(filename, "r") as f:
lines = f.readlines()
with open(filename, "r") as f:
lines = f.readlines()
wipeTowerP = profile.getProfileSetting('wipe_tower') == 'True'
currentSectionType = 'CUSTOM'
activeExtruder = -1
wipeTowerP = profile.getProfileSetting('wipe_tower') == 'True'
currentSectionType = 'CUSTOM'
activeExtruder = -1
-
-# todo: move custom gcode to here
-# detect priming tower and inject reheat there
-
-# grab setting from the profile, add a tag at the end of postSwitch,
-# inject right before the move that sets E0
-
# todo: use 2nd/3rd/etc extruder temp if available (arrays are alright...)
printTemperature = float(profile.getProfileSetting('print_temperature'))
coolTemperature = printTemperature - coolTemperatureDifference
# todo: use 2nd/3rd/etc extruder temp if available (arrays are alright...)
printTemperature = float(profile.getProfileSetting('print_temperature'))
coolTemperature = printTemperature - coolTemperatureDifference
with open(filename, "w") as f:
# skip start gcode
idx = lines.index (';LAYER:0\n')
startIdx = idx
with open(filename, "w") as f:
# skip start gcode
idx = lines.index (';LAYER:0\n')
startIdx = idx
- for line in lines[0:idx+1]:
+ for line in lines[0:idx]:
if getValue(line, 'T', None) is not None and getValue(line, 'M', None) is None:
activeExtruder = getValue(line, 'T', None)
f.write (line)
if getValue(line, 'T', None) is not None and getValue(line, 'M', None) is None:
activeExtruder = getValue(line, 'T', None)
f.write (line)
- heatupTime = max (printTime - heatupTimeDelay, 0.0)
- heatupBlocked = True # do not reheat until active extruder is heated
+
+ heatupTime = printTime - heatupTimeDelay
+ if heatupTime < 0.0:
+ heatupTime = None
+ heatupBlocked = not firstLayer # do not reheat until active extruder is heated
if line.startswith(';'):
f.write(line)
continue
if line.startswith(';'):
f.write(line)
continue
+ if getValue(line, 'M', 666) == 107:
+ fanOnCommand = None
+ f.write(line)
+ continue
+ if getValue(line, 'M', 666) == 106:
+ fanOnCommand = line
+ f.write(line)
+ continue
# find where the newly activated extruder is unspooled and block until fully reheated
# find where the newly activated extruder is unspooled and block until fully reheated
- if getValue(line, 'G', None) is not None and getValue (line, 'E', 666) == 0.0:
+ if (getValue(line, 'G', 666) == 0 or getValue(line, 'G', 666) == 1) and getValue (line, 'E', 666) == 0.0 and (heatupBlocked or firstLayer):
# todo: if wipeTowerP, only
# wait for a few degrees below
# printTemperature and allow
# it to finish heating while
# priming
if zHop > 0.0:
# todo: if wipeTowerP, only
# wait for a few degrees below
# printTemperature and allow
# it to finish heating while
# priming
if zHop > 0.0:
- f.write ("G91\nG0 Z%.3f\n" % zHop)
+ f.write ("G91\nG0 Z%.3f\nG90\n" % zHop)
+
+ disableFan(f)
f.write("M109 T%d S%d\n" % (activeExtruder, printTemperature))
f.write("M109 T%d S%d\n" % (activeExtruder, printTemperature))
+ wipeNozzle(f)
+ enableFan(f)
+
- f.write ("G0 Z%.3f\nG90\n" % -zHop)
+ f.write ("G91\nG0 Z%.3f\nG90\n" % -zHop)
+ zHop = -1
heatupBlocked = False
if heatupTime is not None:
g = getValue(line, 'G', None)
heatupBlocked = False
if heatupTime is not None:
g = getValue(line, 'G', None)
f.write(lines[idx])
startIdx = idx + 1
activeExtruder = nextExtruder
f.write(lines[idx])
startIdx = idx + 1
activeExtruder = nextExtruder
idx += 1
for n in xrange(startIdx, idx):
f.write(lines[n])
idx += 1
for n in xrange(startIdx, idx):
f.write(lines[n])