gcode: Remove builtin T0/T1/T2/... command support
The builtin Tn command is not sufficiently flexible to control some multi-extruder printers. Remove the command and encourage users to define individual gcode_macros for each Tn instance. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -433,11 +433,7 @@ class GCodeParser:
|
||||
if not cmd:
|
||||
logging.debug(params['#original'])
|
||||
return
|
||||
if cmd[0] == 'T' and len(cmd) > 1 and cmd[1].isdigit():
|
||||
# Tn command has to be handled specially
|
||||
self.cmd_Tn(params)
|
||||
return
|
||||
elif cmd.startswith("M117 "):
|
||||
if cmd.startswith("M117 "):
|
||||
# Handle M117 gcode with numeric and special characters
|
||||
handler = self.gcode_handlers.get("M117", None)
|
||||
if handler is not None:
|
||||
@@ -448,27 +444,6 @@ class GCodeParser:
|
||||
# Don't warn about requests to turn off fan when fan not present
|
||||
return
|
||||
self.respond_info('Unknown command:"%s"' % (cmd,))
|
||||
def cmd_Tn(self, params):
|
||||
# Select Tool
|
||||
index = self.get_int('T', params, minval=0)
|
||||
section = 'extruder'
|
||||
if index:
|
||||
section = 'extruder%d' % (index,)
|
||||
new_extruder = self.printer.lookup_object(section, None)
|
||||
if new_extruder is None:
|
||||
raise self.error("Unknown extruder %d on Tn command" % (index,))
|
||||
old_extruder = self.toolhead.get_extruder()
|
||||
if old_extruder is new_extruder:
|
||||
return
|
||||
self.run_script_from_command(old_extruder.get_activate_gcode(False))
|
||||
print_time = self.toolhead.get_last_move_time()
|
||||
old_extruder.set_active(print_time, False)
|
||||
extrude_pos = new_extruder.set_active(print_time, True)
|
||||
self.toolhead.set_extruder(new_extruder, extrude_pos)
|
||||
self.reset_last_position()
|
||||
self.extrude_factor = 1.
|
||||
self.base_position[3] = self.last_position[3]
|
||||
self.run_script_from_command(new_extruder.get_activate_gcode(True))
|
||||
def _cmd_mux(self, params):
|
||||
key, values = self.mux_commands[params['#command']]
|
||||
if None in values:
|
||||
|
||||
@@ -41,11 +41,6 @@ class PrinterExtruder:
|
||||
'max_extrude_only_distance', 50., minval=0.)
|
||||
self.instant_corner_v = config.getfloat(
|
||||
'instantaneous_corner_velocity', 1., minval=0.)
|
||||
gcode_macro = self.printer.try_load_module(config, 'gcode_macro')
|
||||
self.activate_gcode = gcode_macro.load_template(
|
||||
config, 'activate_gcode', '')
|
||||
self.deactivate_gcode = gcode_macro.load_template(
|
||||
config, 'deactivate_gcode', '')
|
||||
self.pressure_advance = self.pressure_advance_smooth_time = 0.
|
||||
pressure_advance = config.getfloat('pressure_advance', 0., minval=0.)
|
||||
smooth_time = config.getfloat('pressure_advance_smooth_time',
|
||||
@@ -99,12 +94,6 @@ class PrinterExtruder:
|
||||
return self.name
|
||||
def get_heater(self):
|
||||
return self.heater
|
||||
def set_active(self, print_time, is_active):
|
||||
return self.extrude_pos
|
||||
def get_activate_gcode(self, is_active):
|
||||
if is_active:
|
||||
return self.activate_gcode.render()
|
||||
return self.deactivate_gcode.render()
|
||||
def stats(self, eventtime):
|
||||
return self.heater.stats(eventtime)
|
||||
def check_move(self, move):
|
||||
@@ -184,8 +173,6 @@ class PrinterExtruder:
|
||||
|
||||
# Dummy extruder class used when a printer has no extruder at all
|
||||
class DummyExtruder:
|
||||
def set_active(self, print_time, is_active):
|
||||
return 0.
|
||||
def update_move_time(self, flush_time):
|
||||
pass
|
||||
def check_move(self, move):
|
||||
|
||||
Reference in New Issue
Block a user