extruder: No need to track extrude_pos locally

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-12-17 02:01:54 -05:00
parent 46e7027bc7
commit d9cd524aec
1 changed files with 2 additions and 4 deletions

View File

@ -45,7 +45,6 @@ class PrinterExtruder:
pressure_advance = config.getfloat('pressure_advance', 0., minval=0.) pressure_advance = config.getfloat('pressure_advance', 0., minval=0.)
smooth_time = config.getfloat('pressure_advance_smooth_time', smooth_time = config.getfloat('pressure_advance_smooth_time',
0.040, above=0., maxval=.200) 0.040, above=0., maxval=.200)
self.extrude_pos = 0.
# Setup iterative solver # Setup iterative solver
ffi_main, ffi_lib = chelper.get_ffi() ffi_main, ffi_lib = chelper.get_ffi()
self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free) self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
@ -61,7 +60,7 @@ class PrinterExtruder:
# Register commands # Register commands
gcode = self.printer.lookup_object('gcode') gcode = self.printer.lookup_object('gcode')
if self.name == 'extruder': if self.name == 'extruder':
toolhead.set_extruder(self, self.extrude_pos) toolhead.set_extruder(self, 0.)
gcode.register_command("M104", self.cmd_M104) gcode.register_command("M104", self.cmd_M104)
gcode.register_command("M109", self.cmd_M109) gcode.register_command("M109", self.cmd_M109)
gcode.register_mux_command("SET_PRESSURE_ADVANCE", "EXTRUDER", None, gcode.register_mux_command("SET_PRESSURE_ADVANCE", "EXTRUDER", None,
@ -144,7 +143,6 @@ class PrinterExtruder:
move.start_pos[3], 0., 0., move.start_pos[3], 0., 0.,
1., pressure_advance, 0., 1., pressure_advance, 0.,
start_v, cruise_v, accel) start_v, cruise_v, accel)
self.extrude_pos = move.end_pos[3]
def cmd_M104(self, params, wait=False): def cmd_M104(self, params, wait=False):
# Set Extruder Temperature # Set Extruder Temperature
toolhead = self.printer.lookup_object('toolhead') toolhead = self.printer.lookup_object('toolhead')
@ -196,7 +194,7 @@ class PrinterExtruder:
return return
gcode.respond_info("Activating extruder %s" % (self.name)) gcode.respond_info("Activating extruder %s" % (self.name))
toolhead.flush_step_generation() toolhead.flush_step_generation()
toolhead.set_extruder(self, self.extrude_pos) toolhead.set_extruder(self, self.stepper.get_commanded_position())
self.printer.send_event("extruder:activate_extruder") self.printer.send_event("extruder:activate_extruder")
# Dummy extruder class used when a printer has no extruder at all # Dummy extruder class used when a printer has no extruder at all