Commit Graph

43 Commits

Author SHA1 Message Date
Kevin O'Connor 969485c754 fan: Add support for heater_fan objects
Add support for fans designed to cool the components of an extruder or
heater.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-07-17 11:35:52 -04:00
Kevin O'Connor d093200966 gcode: Support running arbitrary gcode on extruder change
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-09 18:55:33 -04:00
Kevin O'Connor 24b8f4ebc1 extruder: Add initial support for multi-extruders
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-09 18:54:38 -04:00
Kevin O'Connor 136dccbcdf klippy: Allow each module to define their config sections
Create add_printer_objects() functions in the fan, heater, extruder,
and toolhead modules.  Create the necessary printer component objects
from this call instead of placing the code directly in klippy.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-09 18:54:34 -04:00
Kevin O'Connor 98f2adbcb5 extruder: Rework maximum retraction check
On a retract move (which are common during "wipe" operations), treat
the move as if it were an extrude only move.  It's valid for a retract
move to reverse more filament then it would be practical to push.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-02 08:57:38 -04:00
Kevin O'Connor 253517096e extruder: Extend over extrusion checks to retractions
Ensure a move with a retraction (negative extrude) is also checked for
sane extrusion rates.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-02 07:54:48 -04:00
Kevin O'Connor 7b03b04c78 klippy: Support minimum/maximum value checks on configuration variables
Verify that numeric parameters are in a sane range when reading the
config.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-04-11 11:42:55 -04:00
Kevin O'Connor 98add22891 stepcompress: Merge stepcompress_push_accel() and stepcompress_push_const()
It's not necessary to have separate C functions for constant
acceleration and constant velocity as constant velocity can be
obtained by using a constant acceleration of zero.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-04-07 14:43:25 -04:00
Kevin O'Connor c4b1a79db2 mcu: Pass constant velocity and acceleration directly to mcu_stepper
Rename step_sqrt/step_factor to step_accel/step_const and have them
directly take the velocity and acceleration in millimeters and
seconds.  This simplifies the kinematic classes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-04-07 13:43:56 -04:00
Kevin O'Connor 9bf73cd72d extruder: Make sure EXTRUDE_DIFF_IGNORE doesn't trigger due to rounding
The code disables lookahead between two extruding moves with
significantly different extrude ratios.  Unfortunately, it was
possible for very tiny moves to show different extrude ratios just due
to how the slicer implements rounding when it produces the gcode.
Allow lookahead to be enabled between moves with extrude ratios that
are different if they don't noticeably produce more or less extrusion.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-20 14:39:06 -04:00
Kevin O'Connor f97cf5c3b6 extruder: Avoid maximum extrude cross section errors on infinitesimal moves
Be less likely to raise a "Move exceeds maximum extrusion cross
section" error on very short moves.  It's okay to extrude a little
extra plastic on moves shorter than the nozzle diameter.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-19 21:38:59 -04:00
Kevin O'Connor d21b9280f0 klippy: Eliminate high-level build_config phase
Now that the mcu objects can be created prior to connecting to the
mcu, it is no longer necessary to separate the init and build_config
phases in the high-level code.  Move the mcu objection creation from
the build_config phase to the init phase and eliminate the
build_config phase.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-13 00:38:17 -04:00
Kevin O'Connor 54002c4391 extruder: Pressure advance lookahead time should start after decel
The pressure advance lookahead time should start after any full
deceleration moves.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-03 14:20:41 -05:00
Kevin O'Connor 6a53eaefc0 extruder: Allow configuration of pressure advance lookahead time
Instead of defaulting the pressure advance lookahead time to be the
same as the pressure_advance variable, allow it to be configured.
Default the new config setting (pressure_advance_lookahead_time) to
10ms.

Also, make the setting more accurate if a future move is accelerating
in the middle of the lookahead window.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-02-22 15:20:22 -05:00
Kevin O'Connor 528c29c01c extruder: Do extruder lookahead based on time instead of cornering
When calculating the extruder lookahead, determine how far to
lookahead by the amount of elapsed time each move takes.  This makes
the extruder lookahead code more flexible as it is no longer limited
to the next immediate cornering moves.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-02-06 12:17:50 -05:00
Kevin O'Connor 1bb7a22115 extruder: Move extruder specific lookahead into extruder class
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>
2017-02-06 12:17:50 -05:00
Kevin O'Connor fc6a31eac8 toolhead: Change variables to use suffix "_v2" instead of prefix "junction_"
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>
2017-01-16 15:32:35 -05:00
Kevin O'Connor c87c090264 extruder: Calculate sane defaults for extrude only velocity and accel
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>
2017-01-03 18:18:30 -05:00
Kevin O'Connor b26922978a extruder: Do sanity checks on extrusion rates
Add a run-time check to ensure the incoming g-code doesn't have a
ridiculously large e move.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-01-03 18:17:43 -05:00
Kevin O'Connor 5a5bd2596a extruder: Add nozzle and filament diameter config settings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-01-03 18:12:51 -05:00
Kevin O'Connor f2b406fc5e toolhead: Don't call into kinematic class on extrude only moves
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>
2016-12-28 22:38:28 -05:00
Kevin O'Connor d2abbd8f5d extruder: Fix retract
Commit 7554c7f6 broke retract moves.  Fix by making sure extrude_r is
always a positive number.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-01 18:17:54 -05:00
Kevin O'Connor c49d3fdb17 toolhead: Specify maximum acceleration and velocity in toolhead class
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>
2016-12-01 18:17:54 -05:00
Kevin O'Connor 1e1364c3d4 mcu: Store the stepper position in the mcu_stepper class
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>
2016-11-19 11:34:42 -05:00
Kevin O'Connor 4f30dce64f homing: Add EndstopMoveError wrapper around EndstopError
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>
2016-11-18 14:17:53 -05:00
Kevin O'Connor 9e1059afb4 homing: Create QueryEndstops class from gcode
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>
2016-11-18 14:04:09 -05:00
Kevin O'Connor 5a1ec817d4 stepper: Check if the motor needs to be enabled in the kinematic classes
Check for motor enable in the kinematic classes so it doesn't need to
be checked on every move.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-14 13:40:35 -05:00
Kevin O'Connor 7554c7f694 stepcompress: Do all step rounding in C code
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>
2016-11-13 18:29:45 -05:00
Kevin O'Connor afecf7ce36 stepper: Default to a high direction pin meaning positive direction
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>
2016-11-08 10:39:32 -05:00
Kevin O'Connor 345fc41482 extruder: Don't do pressure advance on velocity changes due to cornering
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>
2016-11-05 11:06:58 -04:00
Kevin O'Connor 93dd310add extruder: Don't assume start_v matches last end_v in pressure advance
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>
2016-11-05 11:06:58 -04:00
Kevin O'Connor a201385008 extruder: Consistently use extrude distance in calculations
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>
2016-11-05 11:04:50 -04:00
Kevin O'Connor 8f331f08d2 extruder: Determine start step offset using last commanded position
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>
2016-10-31 11:14:28 -04:00
Kevin O'Connor 2904a0bbac cartesian: Rename step_dist to move_step_d
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>
2016-10-31 11:05:52 -04:00
Kevin O'Connor 6a96e83ea9 toolhead: Store both the start and end position in the Move class
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>
2016-10-25 19:19:29 -04:00
Kevin O'Connor 9faa0fbd25 extruder: Support a minimum extrude temperature
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>
2016-09-30 21:36:51 -04:00
Kevin O'Connor 3167e8ddbe extruder: Remove unnecessary getsection('extruder') call
The passed in config object is already pointing to the 'extruder'
section.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-09-30 21:36:51 -04:00
Kevin O'Connor 275b386856 toolhead: Allow kinematics class to verify the move prior to queuing it
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>
2016-09-30 21:27:46 -04:00
Kevin O'Connor e52113a319 mcu: convert stepper, endstop, and digital_out to take mcu_time
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-08-24 16:42:25 -04:00
Kevin O'Connor 170389ef14 extruder: Add some additional comments
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-26 11:17:26 -04:00
Kevin O'Connor dc37a07a8e extruder: Add support for "pressure advance" on extrusion
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>
2016-07-25 21:57:23 -04:00
Kevin O'Connor 589017a3d6 stepper: Have caller calculate max jerk velocity
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>
2016-07-22 15:42:18 -04:00
Kevin O'Connor af99ab1645 extruder: Create a new class and python file to track the printer extruder
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>
2016-07-10 22:49:02 -04:00