extruder_stepper: Support configuring pressure advance from config

Also added status report for extruder_stepper objects with the
current pressure advance parameters values.

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
This commit is contained in:
Dmitry Butyugin 2022-08-26 01:40:03 +02:00 committed by KevinOConnor
parent 2e1b649617
commit 5d9ff75d02
3 changed files with 13 additions and 4 deletions

View File

@ -120,6 +120,13 @@ The following information is available in the
- `excluded_objects`: An array of strings listing the names of excluded objects.
- `current_object`: The name of the object currently being printed.
## extruder_stepper
The following information is available for extruder_stepper objects (as well as
[extruder](Config_Reference.md#extruder) objects):
- `pressure_advance`: The current [pressure advance](Pressure_Advance.md) value.
- `smooth_time`: The current pressure advance smooth time.
## fan
The following information is available in

View File

@ -15,6 +15,8 @@ class PrinterExtruderStepper:
self.handle_connect)
def handle_connect(self):
self.extruder_stepper.sync_to_extruder(self.extruder_name)
def get_status(self, eventtime):
return self.extruder_stepper.get_status(eventtime)
def load_config_prefix(config):
return PrinterExtruderStepper(config)

View File

@ -11,6 +11,9 @@ class ExtruderStepper:
self.printer = config.get_printer()
self.name = config.get_name().split()[-1]
self.pressure_advance = self.pressure_advance_smooth_time = 0.
self.config_pa = config.getfloat('pressure_advance', 0., minval=0.)
self.config_smooth_time = config.getfloat(
'pressure_advance_smooth_time', 0.040, above=0., maxval=.200)
# Setup stepper
self.stepper = stepper.PrinterStepper(config)
ffi_main, ffi_lib = chelper.get_ffi()
@ -43,6 +46,7 @@ class ExtruderStepper:
def _handle_connect(self):
toolhead = self.printer.lookup_object('toolhead')
toolhead.register_step_generator(self.stepper.generate_steps)
self._set_pressure_advance(self.config_pa, self.config_smooth_time)
def get_status(self, eventtime):
return {'pressure_advance': self.pressure_advance,
'smooth_time': self.pressure_advance_smooth_time}
@ -192,10 +196,6 @@ class PrinterExtruder:
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':