aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extruder.py
Commit message (Collapse)AuthorAgeFilesLines
* extruder: Remove unused variable self.configKevin O'Connor2018-01-161-3/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Fix pressure advance on tiny moves with over extrusionsKevin O'Connor2018-01-081-2/+5
| | | | | | | | | | | | The extruder check_move() code will permit moves with huge extrusion ratios if the amount extruded is tiny. (Some slicers emit these silly moves - they are allowed because they are harmless.) Unfortunately, the pressure advance code did not handle the huge extrusion ratios - it would result in a massive, near instantaneous, extruder move in an attempt to build pressure in the extruder. Catch this case and limit the impact to the pressure advance code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Store pointers to step_const and step_delta in PrinterStepperKevin O'Connor2017-11-181-7/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Calculate the stepper name directly from the config sectionKevin O'Connor2017-11-181-1/+1
| | | | | | | There is no need to pass the name to the PrinterStepper class as it can determine the name itself. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Pass print_time directly to MCU callsKevin O'Connor2017-09-191-12/+13
| | | | | | | | | Now that the print_time is always synchronized with the mcu_time, there is no longer a need to track mcu_time as a separate quantity. Eliminate references to mcu_time from the code and pass print_time directly in its place. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Remove unused set_max_jerk() callKevin O'Connor2017-09-081-2/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Allow heater_fan to work with heater_bedKevin O'Connor2017-09-071-6/+5
| | | | | | | Fix order of init error preventing heater_fan from being used with heater_bed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Provide more details on extruder errorsKevin O'Connor2017-09-051-10/+17
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Fix typo in initKevin O'Connor2017-09-051-1/+0
| | | | | | Commit 7a81bfc4 broke extrude only moves due to a typo in the commit. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Eliminate set_max_jerk() from kinematic classesKevin O'Connor2017-09-031-8/+9
| | | | | | | | Allow the kinematic classes to query the max velocity, max accel, and max halt velocity from the toolhead class instead of having the toolhead class call into the kinematic classes with those values. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Add support for heater_fan objectsKevin O'Connor2017-07-171-0/+10
| | | | | | | Add support for fans designed to cool the components of an extruder or heater. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Support running arbitrary gcode on extruder changeKevin O'Connor2017-06-091-0/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Add initial support for multi-extrudersKevin O'Connor2017-06-091-3/+25
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Allow each module to define their config sectionsKevin O'Connor2017-06-091-0/+5
| | | | | | | | 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>
* extruder: Rework maximum retraction checkKevin O'Connor2017-05-021-7/+8
| | | | | | | | 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>
* extruder: Extend over extrusion checks to retractionsKevin O'Connor2017-05-021-3/+4
| | | | | | | Ensure a move with a retraction (negative extrude) is also checked for sane extrusion rates. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Support minimum/maximum value checks on configuration variablesKevin O'Connor2017-04-111-8/+14
| | | | | | | Verify that numeric parameters are in a sane range when reading the config. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Merge stepcompress_push_accel() and stepcompress_push_const()Kevin O'Connor2017-04-071-4/+4
| | | | | | | | 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>
* mcu: Pass constant velocity and acceleration directly to mcu_stepperKevin O'Connor2017-04-071-43/+16
| | | | | | | | 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>
* extruder: Make sure EXTRUDE_DIFF_IGNORE doesn't trigger due to roundingKevin O'Connor2017-03-201-4/+9
| | | | | | | | | | | 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>
* extruder: Avoid maximum extrude cross section errors on infinitesimal movesKevin O'Connor2017-03-191-4/+6
| | | | | | | | 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>
* klippy: Eliminate high-level build_config phaseKevin O'Connor2017-03-131-3/+0
| | | | | | | | | | 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>
* extruder: Pressure advance lookahead time should start after decelKevin O'Connor2017-03-031-0/+4
| | | | | | | The pressure advance lookahead time should start after any full deceleration moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Allow configuration of pressure advance lookahead timeKevin O'Connor2017-02-221-6/+15
| | | | | | | | | | | | 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>
* extruder: Do extruder lookahead based on time instead of corneringKevin O'Connor2017-02-061-39/+36
| | | | | | | | | 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>
* extruder: Move extruder specific lookahead into extruder classKevin O'Connor2017-02-061-4/+56
| | | | | | | | 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>
* toolhead: Change variables to use suffix "_v2" instead of prefix "junction_"Kevin O'Connor2017-01-161-4/+4
| | | | | | | | 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>
* extruder: Calculate sane defaults for extrude only velocity and accelKevin O'Connor2017-01-031-2/+7
| | | | | | | | 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>
* extruder: Do sanity checks on extrusion ratesKevin O'Connor2017-01-031-1/+13
| | | | | | | 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>
* extruder: Add nozzle and filament diameter config settingsKevin O'Connor2017-01-031-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Don't call into kinematic class on extrude only movesKevin O'Connor2016-12-281-3/+1
| | | | | | | | 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>
* extruder: Fix retractKevin O'Connor2016-12-011-1/+1
| | | | | | | 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>
* toolhead: Specify maximum acceleration and velocity in toolhead classKevin O'Connor2016-12-011-2/+4
| | | | | | | | | | 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>
* mcu: Store the stepper position in the mcu_stepper classKevin O'Connor2016-11-191-8/+2
| | | | | | | 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>
* homing: Add EndstopMoveError wrapper around EndstopErrorKevin O'Connor2016-11-181-1/+2
| | | | | | | | 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>
* homing: Create QueryEndstops class from gcodeKevin O'Connor2016-11-181-1/+1
| | | | | | | | | | | 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>
* stepper: Check if the motor needs to be enabled in the kinematic classesKevin O'Connor2016-11-141-5/+11
| | | | | | | 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>
* stepcompress: Do all step rounding in C codeKevin O'Connor2016-11-131-47/+36
| | | | | | | | | | | | | | | | | 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>
* stepper: Default to a high direction pin meaning positive directionKevin O'Connor2016-11-081-3/+3
| | | | | | | | | 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>
* extruder: Don't do pressure advance on velocity changes due to corneringKevin O'Connor2016-11-051-2/+9
| | | | | | | | | | | | | 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>
* extruder: Don't assume start_v matches last end_v in pressure advanceKevin O'Connor2016-11-051-23/+30
| | | | | | | | | 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>
* extruder: Consistently use extrude distance in calculationsKevin O'Connor2016-11-051-12/+14
| | | | | | | | 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>
* extruder: Determine start step offset using last commanded positionKevin O'Connor2016-10-311-10/+16
| | | | | | | | | | | | | 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>
* cartesian: Rename step_dist to move_step_dKevin O'Connor2016-10-311-9/+9
| | | | | | | | 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>
* toolhead: Store both the start and end position in the Move classKevin O'Connor2016-10-251-1/+1
| | | | | | | | 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>
* extruder: Support a minimum extrude temperatureKevin O'Connor2016-09-301-1/+3
| | | | | | | | 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>
* extruder: Remove unnecessary getsection('extruder') callKevin O'Connor2016-09-301-3/+2
| | | | | | | The passed in config object is already pointing to the 'extruder' section. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Allow kinematics class to verify the move prior to queuing itKevin O'Connor2016-09-301-2/+6
| | | | | | | | | | | | 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>
* mcu: convert stepper, endstop, and digital_out to take mcu_timeKevin O'Connor2016-08-241-19/+18
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Add some additional commentsKevin O'Connor2016-07-261-0/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>