Instead of calculating min/max_corner_v in the toolhead class,
calculate it in the extruder class. This keeps the extruder specific
code together.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The junction speeds are tracked in velocity squared - introduce the
common suffix "_v2" to track that instead of using a prefix of
"junction_".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of requiring the user enter velocity and accel parameters for
extrude only moves, calculate sane defaults from the printer's maximum
velocity and accel.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a is_kinematic_move flag to the Move class and clear it on extrude
only moves. Don't call the kinematic check_move() or move() methods
for extrude only moves.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the config file so the maximum accel and velocity are specified
in the "printer" section instead of the individual "stepper" sections.
The underlying code limits the velocity and accel of the toolhead
relative to the print object, so it makes sense to configure the
system that was as well.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the storage of the stepper location from the kinematic classes to
the low-level mcu_stepper class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow an EndstopError to be raised without a destination position.
Introduce EndstopMoveError wrapper so that current callers can
continue to pass in a move destination.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create the QueryEndstops in the gcode handler instead of in the
kinematic classes. This simplifies the gcode handler as it can
directly register its response callback.
Also, store the stepper name in the stepper class. Also, propagate
the print_time of the query request to the mcu_endstop class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commits f0cefebf and 8f331f08 changed the way the code determined what
steps to take on fractional steps. Unfortunately, it was possible in
some situations for the C code to round differently from the python
code which could result in warnings and lost steps.
Change the code so that all fractional step handling is done in the C
code. Implementing the step rounding logic in one location avoids any
conflicts.
In order to efficiently handle the step rounding in the C code, the C
code has also been extended to directly send the "set_next_step_dir"
command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Invert the default meaning of the stepper direction pin. Instead of
treating a low value as position motion, treat a high value as
positive motion. This matches what other firmwares do, and it matches
what common stepper motor drivers document.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Due to the lookahead, small changes in the direction of the toolhead
cause minor changes in toolhead velocity. These "cornering" velocity
changes cause the current extruder code to trigger pressure advance
and its associated pressure retract. This causes the extruder to
rapidly "jerk" the filament.
This code change updates the extruder to detect velocity changes due
solely to cornering and avoid pressure advance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Due to minor differences in the extrude ratio, the last end velocity
of the filament may not exactly match the next move's start velocity
of the filament. Implement more precise calculations for pressure
advance to take this into account.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid mixing the travel distance of the head (and its associated
velocity and acceleration) with the distance the filament moves.
Instead, use the filament travel distance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The existing code calculates the number of steps in a move and then
spreads them out evenly throughout that move. Change the code so that
step timing is based on where the head is commanded to be relative to
the stepper step locations. This makes the timing more accurate - in
particular the stepper velocities will be more accurate during
cornering introduced by the lookahead code. It also results in
slightly smoother stepper motion which results in better step
compression.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't use step_dist for the "distance along the line of movement per
step" as it's too similar to the stepper.step_dist variable. Use the
name "move_step_d" instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Store the start position (in addition to the existing end position) in
the Move class. The start position can be useful to the kinematic
classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the config file to specify the minimum temperature for the
extruder and check for that temperature prior to moving the extruder
motor.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce a check_move() method in the extruder and cartesian
kinematic classes. This allows the lower level classes to verify the
contents of the move prior to queing that move.
The speed and acceleration handling for special Z and extrude only
moves are also moved from the generic toolhead class to the low-level
classes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a config option to define an amount of additional filament to feed
into the extruder during acceleration and deceleration of the
extruder. This can help ensure plastic is deposited in the correct
places during a print.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the owner of the stepper object to cacluate the maximum step
jerk velocity. This is used to ensure there is no communication error
between mcu and host.
Disable checking of jerk velocity for extruder stepper motors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a new python file (extruder.py) to control the extruder heater
and stepper motors. This separates the extruder control logic from
the cartesian robot code - making it easier to customize both the
kinematic control of the robot as well as the extruder.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>