mirror of https://github.com/Desuuuu/klipper.git
extruder: Allow an extruder object to be created without a stepper
This may be useful for dual hotend printers that have only one stepper. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
4a8aece6a7
commit
6627d036ac
|
@ -638,10 +638,11 @@ max_accel: 1
|
|||
|
||||
### [extruder]
|
||||
|
||||
The extruder section is used to describe both the stepper controlling
|
||||
the printer extruder and the heater parameters for the nozzle. See the
|
||||
[pressure advance guide](Pressure_Advance.md) for information on
|
||||
tuning pressure advance.
|
||||
The extruder section is used to describe the heater parameters for the
|
||||
nozzle hotend along with the stepper controlling the extruder. See the
|
||||
[command reference](G-Codes.md#extruder) for additional information.
|
||||
See the [pressure advance guide](Pressure_Advance.md) for information
|
||||
on tuning pressure advance.
|
||||
|
||||
```
|
||||
[extruder]
|
||||
|
@ -652,7 +653,10 @@ microsteps:
|
|||
rotation_distance:
|
||||
#full_steps_per_rotation:
|
||||
#gear_ratio:
|
||||
# See the "stepper" section for a description of the above parameters.
|
||||
# See the "stepper" section for a description of the above
|
||||
# parameters. If none of the above parameters are specified then no
|
||||
# stepper will be associated with the nozzle hotend (though a
|
||||
# SYNC_EXTRUDER_MOTION command may associate one at run-time).
|
||||
nozzle_diameter:
|
||||
# Diameter of the nozzle orifice (in mm). This parameter must be
|
||||
# provided.
|
||||
|
|
|
@ -79,6 +79,8 @@ class ExtruderStepper:
|
|||
cmd_SET_PRESSURE_ADVANCE_help = "Set pressure advance parameters"
|
||||
def cmd_default_SET_PRESSURE_ADVANCE(self, gcmd):
|
||||
extruder = self.printer.lookup_object('toolhead').get_extruder()
|
||||
if extruder.extruder_stepper is None:
|
||||
raise gcmd.error("Active extruder does not have a stepper")
|
||||
extruder.extruder_stepper.cmd_SET_PRESSURE_ADVANCE(gcmd)
|
||||
def cmd_SET_PRESSURE_ADVANCE(self, gcmd):
|
||||
pressure_advance = gcmd.get_float('ADVANCE', self.pressure_advance,
|
||||
|
@ -181,12 +183,16 @@ class PrinterExtruder:
|
|||
self.trapq_append = ffi_lib.trapq_append
|
||||
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
|
||||
# Setup extruder stepper
|
||||
self.extruder_stepper = ExtruderStepper(config)
|
||||
self.extruder_stepper.stepper.set_trapq(self.trapq)
|
||||
pa = config.getfloat('pressure_advance', 0., minval=0.)
|
||||
smooth_time = config.getfloat('pressure_advance_smooth_time',
|
||||
0.040, above=0., maxval=.200)
|
||||
self.extruder_stepper._set_pressure_advance(pa, smooth_time)
|
||||
self.extruder_stepper = None
|
||||
if (config.get('step_pin', None) is not None
|
||||
or config.get('dir_pin', None) is not None
|
||||
or config.get('rotation_distance', None) is not None):
|
||||
self.extruder_stepper = ExtruderStepper(config)
|
||||
self.extruder_stepper.stepper.set_trapq(self.trapq)
|
||||
pa = config.getfloat('pressure_advance', 0., minval=0.)
|
||||
smooth_time = config.getfloat('pressure_advance_smooth_time',
|
||||
0.040, above=0., maxval=.200)
|
||||
self.extruder_stepper._set_pressure_advance(pa, smooth_time)
|
||||
# Register commands
|
||||
gcode = self.printer.lookup_object('gcode')
|
||||
if self.name == 'extruder':
|
||||
|
@ -201,7 +207,8 @@ class PrinterExtruder:
|
|||
def get_status(self, eventtime):
|
||||
sts = self.heater.get_status(eventtime)
|
||||
sts['can_extrude'] = self.heater.can_extrude
|
||||
sts.update(self.extruder_stepper.get_status(eventtime))
|
||||
if self.extruder_stepper is not None:
|
||||
sts.update(self.extruder_stepper.get_status(eventtime))
|
||||
return sts
|
||||
def get_name(self):
|
||||
return self.name
|
||||
|
@ -259,6 +266,8 @@ class PrinterExtruder:
|
|||
start_v, cruise_v, accel)
|
||||
self.last_position = move.end_pos[3]
|
||||
def find_past_position(self, print_time):
|
||||
if self.extruder_stepper is None:
|
||||
return 0.
|
||||
return self.extruder_stepper.find_past_position(print_time)
|
||||
def cmd_M104(self, gcmd, wait=False):
|
||||
# Set Extruder Temperature
|
||||
|
|
Loading…
Reference in New Issue