Commit Graph

148 Commits

Author SHA1 Message Date
Arksine c22d5b2444 toolhead: report velocity and accel via get_status
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-08-01 15:56:51 -04:00
Kevin O'Connor 9850dc75f4 toolhead: Handle flush_step_generation() call after dwell()
If self.kin_flush_delay changes after a G4 dwell command (or other
non-kinematic time update) then it could lead to "internal step
compression" errors.  Make sure to handle this case in
flush_step_generation().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-01 15:29:20 -04:00
Kevin O'Connor 787ed452c2 klippy: Rename try_load_module() to load_object()
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>
2020-05-08 11:05:14 -04:00
Kevin O'Connor ec0e3e710c toolhead: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor acd165cbea stepcompress: Implement a step+dir+step filter
Some stepper motor drivers do not respond well to rapid "step +
direction change + step" events.  In particular, it is believed this
can cause "over current" events on the tmc2208 drivers when they are
in "stealthchop" mode.  Detect these events and remove them from the
generated step times.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-13 21:53:48 -04:00
Kevin O'Connor e872290c47 Revert "itersolve: Implement a step+dir+step filter"
This reverts commit c9cb462f90.

The step flushing for this commit was not complete.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-05 18:37:02 -05:00
Kevin O'Connor c9cb462f90 itersolve: Implement a step+dir+step filter
Some stepper motor drivers do not respond well to rapid "step +
direction change + step" events.  In particular, it is believed this
can cause "over current" events on the tmc2208 drivers when they are
in "stealthchop" mode.  Detect these events and remove them from the
generated step times.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-04 19:43:47 -05:00
Kevin O'Connor 1c06ea8afe toolhead: Minor comment addition to calc_junction()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-28 22:27:23 -05:00
Kevin O'Connor fbbbbc85cf homing: Replace notify callback with a completion
Update the endstop code to return its trigger completion object during
home_start().  Update the toolhead class to take a completion object
(instead of creating its own).  This reduces the number of
intermediate callbacks needed during a homing operation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-19 11:45:44 -05:00
Kevin O'Connor 8158dbcc21 toolhead: Add register_lookahead_callback() method
Add a mechanism for obtaining the print_time via a callback instead of
by flushing the look-ahead queue.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-03 18:13:57 -05:00
Kevin O'Connor 3683273936 toolhead: Report which axes are homed via get_status()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-24 20:21:13 -05:00
Kevin O'Connor 282af0220e toolhead: Report the current extruder from the get_status() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-24 20:21:13 -05:00
Kevin O'Connor ade65b90af force_move: Make sure to flush step generation queue after each move
Add toolhead.note_kinematic_activity() call and use it to force the
step generation to be flushed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-24 11:55:30 -05:00
Kevin O'Connor 89d1ab7c04 extruder: Remove support for lookahead() method
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>
2019-11-21 13:18:21 -05:00
Kevin O'Connor d00023f3bb toolhead: Support step generation in lead up to and after stepper activity
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>
2019-11-21 13:17:45 -05:00
Kevin O'Connor 2843c85019 toolhead: Rename _full_flush() to flush_step_generation() and use globally
Update code that modifies the low-level kinematics handlers to first
call toolhead.flush_step_generation().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-21 13:17:45 -05:00
Kevin O'Connor 7c80e8d533 toolhead: No need to transition to Flushed state before entering Drip state
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-21 13:17:45 -05:00
Kevin O'Connor e1919e3731 toolhead: Don't report buffer_time stat during homing
The buffer_time info is misleading during a homing operation - just
report zero instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-15 12:21:23 -05:00
Kevin O'Connor 503891cd0e toolhead: Don't call _process_moves() if no moves present
Don't transition to the normal movement state if there aren't any
moves actually ready to be processed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-15 11:55:15 -05:00
Kevin O'Connor 0a39c339c7 gcode: Remove explicit active extruder tracking
There's no need to have special logic in gcode.py to track the active
extruder.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-13 11:02:26 -05:00
Kevin O'Connor bfb34e0701 stepper_enable: Move motor_off() logic to stepper_enable.py
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>
2019-11-12 17:32:18 -05:00
Kevin O'Connor 2d5c761101 toolhead: Clear any pending pauses when a shutdown occurs
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 18:06:46 -05:00
Kevin O'Connor 5500538fc5 toolhead: Rename register_move_handler() to register_step_generator()
Rename the function so it is more clear what the step generation code
path is.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 10:59:35 -05:00
Kevin O'Connor 86121ff79e toolhead: Calculate and store axes_r in move class
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>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 257058981e toolhead: Simplify set_junction() code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 076a66f791 trapq: Use separate 'move' entries for accel, cruise, and decel phases
Only track a single acceleration movement in a 'struct move' instance.
Break the classic trapezoid movement (accel, cruise, decel) into three
separate movements.  This simplifies the calculation logic.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 7ca86f1723 toolhead: Flush trapezoid velocity queue in batches
Load all items from the look-ahead queue into the trapezoid velocity
queue, and then flush that queue by time.  This prevents the host cpu
from being starved on very long moves (which may require a large
number of steps to be generated).  It also improves the overall
performance.

With the batch flushing logic in place, it is no longer necessary to
split homing moves up.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 1acaaa98c2 trapq: Remove move_fill()
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>
2019-11-06 15:51:51 -05:00
Kevin O'Connor befd263260 toolhead: Remove kinematic move() call
Now that all kinematics use the trapq system, there is no need to call
into the kinematics on each g-code move.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor d3afe4f1d8 trapq: Initial support for building a queue of trapezoidal velocity moves
Add support for building a list of moves in the trapq.c code.  Update
the toolhead code so that moves generated from the look-ahead code are
added to that list.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 698159921f tuning_tower: Tool for tuning parameters based on print Z height
This adds a testing tool that can run a command on each Z layer of a
print.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-01 14:46:24 -04:00
Kevin O'Connor 9fcd3e75cd toolhead: Fix velocity jumps in accel_to_decel lookahead processing
When reducing the maximum speed due to the max_accel_to_decel setting,
move velocity limits must still be propagated.  Otherwise, the
trapezoid move planner may produce moves with velocity jumps.

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-26 11:10:36 -04:00
Kevin O'Connor 05edd556c3 toolhead: Fix homing moves not apply kinematic acceleration limits
During a "drip feed" move, both the move's maximum speed and maximum
acceleration may be limited by the kinematics.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-01 18:21:05 -04:00
Kevin O'Connor bf23302918 toolhead: No need to build entire look-ahead queue before homing
It's not necessary to fully build up the look-ahead queue prior to
starting a "drip move" homing operation.  Instead, allow the
look-ahead queue to flush normally.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-18 10:50:04 -04:00
Kevin O'Connor 977d0cf711 toolhead: Delay calculating homing print_time until ready to move
If the homing move is exceptionally long, it could take a long time
for the host to process the look-ahead queue.  Delay the print_time
calculation until moves are ready to be sent.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-12 13:52:33 -04:00
Kevin O'Connor 07e8925e08 toolhead: Remove no longer needed reset_print_time()
Now that homing is implemented via "drip moves", it is no longer
necessary to move the print_time backwards.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor 43064d197d homing: Implement homing via new toolhead "drip" movement
Rework the low-level implementation of homing movement.  The existing
mechanism buffers all homing movement into the micro-controller prior
to starting the home.  Replace with a system that buffers all movement
into the host look-ahead buffer and then "drip feed" those moves to
the micro-controllers.  Then clear the host look-ahead buffer when all
endstops trigger.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor d6cce8a557 toolhead: Change the code to use more explicit state transitions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor f6e9db2d05 toolhead: Just warn if M204 doesn't contain valid S, P, or T
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 12:53:47 -04:00
Kevin O'Connor 61fc57e659 toolhead: Commands should still pause even when sync_print_time
If commands are slowly fed to the printer it could cause the number of
queued commands to grow without bound.  Be sure to pause the incoming
command stream even if the lookahead queue is empty.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-09 12:35:54 -04:00
Kevin O'Connor 6e88320d62 gcode: "gcode_position" and toolhead "position" as get_status() named tuple
Add "gcode_position" named tuple to gcode.get_status(). Add a
"position" named tuple to toolhead.get_status().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 09:50:30 -04:00
Kevin O'Connor 1731fbbca4 gcode: Change respond_info() to log by default
It makes sense to log most respond_info() content, so do that by
default.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-04 13:04:18 -05:00
Kevin O'Connor ee1236805e toolhead: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 13:11:12 -05:00
Kevin O'Connor adf6040e9e gcode: Use an event to handle restart request actions
Instead of directly turning off motors, heaters, and fans from
gcode.py, raise a new event and allow the heater, fan, and toolhead to
handle the event as needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-25 21:26:27 -05:00
Kevin O'Connor 2d7c3a84ee manual_stepper: Add an "extras" module for manually controlling a stepper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-12 13:38:13 -05:00
Kevin O'Connor d14a53e160 manual_probe: Add a helper script for performing manual Z probing
Add MANUAL_PROBE and Z_ENDSTOP_CALIBRATE commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-12 13:20:32 -05:00
Kevin O'Connor fb7fe282c8 klippy: Convert printer_state("shutdown") to an event handler
Convert all users of the printer_state("shutdown") handler to register
a "klippy:shutdown" event handler instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-08 10:59:43 -05:00
Kevin O'Connor 24fe606d4d toolhead: Do not apply main printer accel/velocity to extrude only moves
Limit speed and acceleration of extrude only moves to just the
max_extrude_only_velocity and max_extrude_only_accel config settings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-04 12:47:45 -05:00
Kevin O'Connor a2f0c36e7d toolhead: Don't report an error if request too high in SET_VELOCITY_LIMIT
If a requested value is higher than the configured maximum, then just
limit the value to the configured maximum instead of raising an error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-04 12:47:40 -05:00
Kevin O'Connor d25e02144c idle_timeout: Add printing/ready/idle tracking
Internally track the overall printer state.  Generate events on state
transitions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-10-28 18:39:45 -04:00