Store the pressure_advance value in "struct extruder_stepper" instead
of in the trapq's "struct move". This makes it possible for multiple
stepper motors to have different pressure advance values while still
using the same trapq.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert stepper.get_past_commanded_position() to the more general
stepper.mcu_to_commanded_position().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Sometimes an automated filament load is implemented,
but extruder might not always extrude filament.
This adds a flag to check if this operation is possible.
Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
Pass a print_time instead of a clock to get_past_commanded_position().
Fix calculation on steppers that home and use an inverted direction
pin.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The min_stop_interval safety check is fragile and leads to a notable
amount of complexity. Avoid these issues by not programming this
safety check.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce a heaters.set_temperature() command and call that from
commands that set a heater temperature. This new function calls
toolhead.register_lookahead_callback() so that the idle_timeout gets
notification that activity has occurred.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The stepper positions will only be in sync after the step generation
code has been flushed. This fixes an "internal error in stepcompress"
error during a SYNC_STEPPER_TO_EXTRUDER command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update callers to use the printer.command_error reference instead of
directly using homing.CommandError() when raising or catching errors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There's no reason to distinguish between an EndstopError and a
CommandError, so just use CommandError.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rework extruder.get_trapq() into extruder.sync_stepper() so that
extruder_stepper.py does not need to directly access the extruder
internals.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename try_load_module() so that it uses consistent naming for
"printer objects". Change the function to raise an error by default
if the specified module does not exist.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The heater logic is an independent module that does not need to be
treated as part of the "core" klipper code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The print_time parameter of heater.set_temp() is not currently used
and it isn't necessary to flush the look-ahead queue just get the
print_time. Remove the parameter from heater.set_temp() to avoid
flushing the look-ahead queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Implement the pressure advance calculations while performing the
definitive integral calculations. This simplifies both the
extruder.py and kin_extruder.c code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the extruder lookahead method is no longer used it can be
removed from the toolhead and extruder classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support averaging the extruder position over a time range to "smooth
out" the velocity changes that occur during pressure advance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for kinematic functions that calculate step times based on
a range of the motion queue. This requires adding additional pause
times when fully flushing the motion queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Directly disable all the stepper motors on a global motor_off() from
the StepperEnable() class in stepper_enable.py. This simplifies the
toolhead and kinematic classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
No longer allow the primary extruder to be named "extruder0". This
avoids internal and external confusion between the printer objects and
config section names.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Do not apply max_extrude_cross_section check, and do apply
extrude_only_xxx checks to Z only moves that also extrude. Some
printer start scripts will prime the extruder while moving the Z.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Calculate the ratio of axis distance to total move distance (axis_d /
move_d) and store in a new member variable axes_r. This avoids
needing to recalculate the value in other code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that all callers use the trapq system to queue moves, it is no
longer necessary to individually allocate and fill a 'struct move'.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow an arbitrary gcode_id to be supplied during heater setup. This allows future extras to register additional IDs beyond B, and T#.
Signed-off-by: John Jardine <john@gprime.net>
Some users increase max_extrude_cross_section to avoid issues with
some slicers. However, increasing that value also increases the
defaults for the max_extrude_only parameters which is not obvious.
Base the max_extrude_only defaults only on the configured nozzle
diameter.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allocate the stepper_kinematics directly in mcu.py - that way the
kinematic classes don't have to interact with the chelper code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>