Commit Graph

1944 Commits

Author SHA1 Message Date
Kevin O'Connor 3646cc0140 bltouch: Separate out pin_up_not_triggered case in raise_probe()
Simplify raise_probe() by separating out the pin_up_not_triggered
case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 87bfa06b9e bltouch: Don't raise an error in verify_state()
Return the triggered state from verify_state() and update the callers
to raise the error (if needed).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 77177582cd extruder: step_distance must be positive on SET_EXTRUDER_STEP_DISTANCE
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-28 10:06:02 -04:00
Kevin O'Connor 336af2f28d stepper: No need to pass stepper_kinematics to set_step_dist()
Also, no need to log in stepper.py as the update is already logged in
extruder.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-28 10:06:02 -04:00
David Smith d4bf61262e
Extruder: Add g-code to set extruder step_distance (#2598)
Signed off by: David Smith <davidosmith@gmail.com>
2020-03-28 09:52:46 -04:00
Kevin O'Connor 8a3233b397 stepper: Add a config check for obvious incorrect homing_positive_dir
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-24 16:04:11 -04:00
Kevin O'Connor 295fb7fc85 serialhdl: Reduce connection fail timeout from 2.5 minutes to 1.5 minutes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-24 10:00:45 -04:00
Kevin O'Connor 48237435b2 klippy: Log shutdown state in invoke_shutdown()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-24 08:37:36 -04:00
Jeremy Briffaut 6be552f6e6 Allow manual_stepper to run in parallel than an other stepper
Signed-off-by: Jeremy Briffaut <kakou@kakou.org>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-23 14:43:34 -04:00
Kevin O'Connor 6b7e917a8e statistics: Exit loop as soon as MemAvailable found
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-22 22:04:40 -04:00
Kevin O'Connor 6aae62542c statistics: Add system stats
Report os load, process cpu time, and system available memory to each
statistics report.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-22 20:02:51 -04:00
Kevin O'Connor f3667fd453 util: Try to dump mcu build information on a connection error
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-22 13:22:52 -04:00
Kevin O'Connor eeee2a9a35 mcu: Shutdown if a spontaneous restart of an mcu is observed
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-22 12:20:09 -04:00
Kevin O'Connor d3a7d992aa display: Remove unused self.lcd_type variable
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-21 12:12:29 -04:00
kakou-fr 961f68629a
manual_stepper: Fix sensorless endstop for manual_stepper (#2621)
Signed-off-by: Jeremy Briffaut <kakou@kakou.org>
2020-03-20 21:11:36 -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 d86bf0b927 stepcompress: Move code around in stepcompress.c
Just code movement - no code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-13 21:53:48 -04:00
Kevin O'Connor 5e39d346ed display: Use the active extruder in the default 16x4 screen layout
Change the default layout to show the active extruder (not always the
first extruder).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-13 21:50:38 -04:00
Kevin O'Connor f2dd4b001d display: Use a separate display group for 16x4 multiple extruders
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-13 21:46:36 -04:00
Kevin O'Connor 986e9c884a display: Fix percent progress rendering on 16x4 multi-extruder layout
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-08 17:55:53 -04:00
Arksine aa7d24b0af display: add support for multiple displays
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-03-08 17:38:24 -04:00
Kevin O'Connor 6d5ce309a5 menu: Remove the "test" menu from the default menu
It is likely only developers will be interested in testing the menu
system, so no need to have it in the default menu.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-08 17:38:24 -04:00
Kevin O'Connor d39c4fe628 menu: Disable support for "deck" and "card" menu items
Disable support for customizing the main lcd display content via the
menu system.  Advise users to use the new display_data config sections
as a replacement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-08 17:38:24 -04:00
Kevin O'Connor 2cf03ffa23 display: Replace hard-coded display with new config based display
Introduce a new config based system for specifying the on-screen
contents of an lcd screen.  The default screen configuration (found in
klippy/extras/display/display.cfg) is the same as the previous
hard-coded display, so this should not change behavior for existing
users.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-08 17:38:21 -04:00
Kevin O'Connor 5acc181624 display_status: Separate out M73 and M117 handling to new module
Move M73 and M117 handling from display.py to a new display_status.py
module.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-08 17:36:14 -04:00
Kevin O'Connor b3cfe55b39 clocksync: Remove no longer used get_adjusted_freq() function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-06 16:35:02 -05:00
Kevin O'Connor 62fcc5a56f mcu: Calculate homing rest_ticks via standard print_time_to_clock() call
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-06 16:33:54 -05:00
Kevin O'Connor a61d483e21 tmc_uart: Use nominal mcu frequency in baud calculation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-06 16:29:18 -05: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 a074af7c87 adc_temperature: Add builtin definition for PT1000 sensors
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-05 11:46:01 -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 8f8c1e2c58 itersolve: Reset bounds search on a direction change
If the stepper changes direction then the average velocity since the
last step pulse isn't a good indicator of the next step pulse.
Instead, reset the bounds checking to use a low starting guess.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-04 19:43:47 -05:00
Kevin O'Connor 271e412ae6 itersolve: Simplify main itersolve_gen_steps_range() loop
Reorder the loop to try and make the code flow a little simpler.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-04 19:43:47 -05:00
Kevin O'Connor bc6c3ba92f stepcompress: Remove "queue append" abstraction
The queue_append system predates the iterative solver - it was useful
when many different kinematic functions directly added steps to the
step compression queues.  With the iterative solver being the only
source of step generation, it is simpler to directly add steps from
the iterative solver code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-04 19:43:47 -05:00
Kevin O'Connor d6c2e24f4c tmc5160: Support setting GLOBALSCALER to fine tune current selection
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-04 19:40:32 -05:00
David Smith c0f72a2c38
safe_z_home: Support note_z_not_homed() in kinematics (#2500)
Signed-off-by: David Smith <davidosmith@gmail.com>
2020-03-01 23:00:41 -05:00
Denis Ignatenko f84542cd20
hall_filament_width_sensor: Added virtual runout sensor (#2535)
Signed-off-by: Denis Ignatenko deniss979@gmail.com
2020-03-01 22:05:12 -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 c197fdb03d heater: Fix misspelling of Celsius
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-27 11:31:51 -05:00
FanDjango 16ecf15a91
bltouch: BTLOUCH V3.0/V3.1 Enable 5V/OD mode set commands (#2540)
Signed-off-by: Mike Stiemke <fandjango@gmx.de>
2020-02-23 22:32:07 -05:00
Kevin O'Connor 245917bf03 mcu: Introduce new lookup_query_command() command wrapper
Use new mcu.lookup_query_command() for all commands that query
information from the micro-controller.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-20 13:24:53 -05:00
Kevin O'Connor 332038ea01 serialhdl: Convert queries to use new notify message ack system
Convert standard queries to use the acknowledgments of the sent
command to determine if the response was received or not.  This also
controls command retransmissions (should the response have been lost).

The tmc_uart.py will continue to use the old mechanism as the tmcuart
responses are not sent synchronously with the query command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-20 12:01:21 -05:00
Kevin O'Connor c6c360c4e1 serialqueue: Support notification of when a command is processed
Add ability for the host code to get a notification when the ack for a
command sent to the micro-controller is received.  This is in
preparation for improved detection of message loss between mcu and
host.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-20 12:01:21 -05:00
Kevin O'Connor 7b90830ae5 serialqueue: Remove unused serialqueue_encode_and_send() function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-20 12:01:21 -05:00
Kevin O'Connor e03f75e758 tmc: Revert incorrect changes to TPWMTHRS setting
It's not valid to set the TPWMTHRS in a "klippy:connect" event handler
because the TMCVirtualPinHelper and TMCCommandHelper classes were
expecting that field to be set during the config reading phase.

Revert "tmc: Fix typo preventing stealthchop threshold from being set"
This reverts commit 7d76067ff9.

Revert "tmc: Query the stepper step_distance from the stepper object"
This reverts commit 67b2852249.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-20 11:41:35 -05:00
Kevin O'Connor 15f21be5ec manual_stepper: Support ignoring errors on STOP_ON_ENDSTOP
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-19 13:38:22 -05:00
Kevin O'Connor 804f95ebe4 homing: Don't raise a TimeoutError from home_wait()
Change home_wait() to return if the homing operation completed
succesfully or not.  This simplifies the callers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-19 12:20:00 -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 e3a5e2d271 reactor: Support multiple waiting timers on a single completion
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-19 10:49:56 -05:00
Kevin O'Connor 29c6c89327 probe: Don't allow errors to propagate from "gcode:command_error" event
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-18 11:47:04 -05:00
Christian S aa0a889b04
menu: Set speed for move actions (#2520)
Signed-off-by: Christian Schnellrieder <schnellrieder.cs@gmail.com>
2020-02-17 20:52:54 -05:00
Kevin O'Connor 5304c4141c filament_switch_sensor: Query "printing" status instead of tracking it
It's simpler to query the "printing" status from the idle_timeout
module on an event than it is to track changes to the printing status.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-17 17:07:54 -05:00
Kevin O'Connor b6368173cf filament_switch_sensor: Collapse event disable flags
Introduce min_event_systime and rework the previous start_time,
last_event_time, and event_running flags into this one state tracking
variable.

This also makes a minor change to the behavior of the event_delay - it
is now calculated from the time the command completes execution
(instead of from when the event is first detected).  This may make a
difference if there is a long running g-code command occurring during
the detection event.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-17 16:57:27 -05:00
Kevin O'Connor 6716007420 filament_switch_sensor: Minor optimization to note_filament_present()
Avoid calling into the OS to obtain the system time if the filament
state hasn't changed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-17 16:51:00 -05:00
Arksine 718da75910 filament_switch_sensor: Add a get_status() method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-02-17 16:48:43 -05:00
Arksine 9415071482 filament_switch_sensor: Execute events using reactor callbacks
This removes the possibility of re-entry to callers of  note_filament_present().

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-02-17 16:48:43 -05:00
Arksine 740c0ae636 filament_switch_sensor: Replace BaseSensor with RunoutHelper
Rather than inherit from the BaseSensor, filament sensor implementatons
may instantiate the RunoutHelper and update the filament state via its
note_filament_present method.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-02-17 16:48:43 -05:00
FanDjango 086c131bbf bltouch: Add support for stow_on_each_sample
Signed-off-by: Mike Stiemke <fandjango@gmx.de>
2020-02-15 17:58:56 -05:00
Kevin O'Connor 1dd952ac65 probe: Add multi_probe_begin() / multi_probe_end() callbacks
Add support for notifying the low-level probing handlers that a
multiple probe sequence is occurring.  This is in preparation for the
bltouch code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-15 17:52:44 -05:00
Kevin O'Connor 5bca4e6fa1 gcode: Add a "command_error" event notifier
Allow other modules to be notified if there is a gcode command error
detected.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-15 17:52:44 -05:00
Kevin O'Connor 1aa11fed8c homing: Add a "home_rails_begin" event notifier
Also, rename the "homed_rails" event to "home_rails_end".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-15 17:52:44 -05:00
Kevin O'Connor feb15eaf2e homing: Merge home_prepare()/home_finalize() into move_begin/move_end events
Collapse the "homing:move_begin", "homing:move_end", home_prepare(),
and home_finalize() into two new events: "homing:homing_move_begin"
and "homing:homing_move_end".  This simplifies the homing code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-15 17:52:44 -05:00
Arksine b23346a521 bme280: handle read timeout exceptions
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-02-14 17:25:08 -05:00
test3210-d 9a65a4569b hall_filament_width_sensor: Add new filament sensor
Signed-off-by: Denis Ignatenko <deniss979@gmail.com>
2020-02-14 13:14:34 -05:00
Kevin O'Connor c3899cefa8 configfile: Add get_status() to export raw config file information
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-13 22:04:40 -05:00
Kevin O'Connor 9818055ac3 gcode_macro: Support overriding of builtin g-code commands
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-12 20:42:03 -05:00
Kevin O'Connor 0cfab84e1a gcode: Return previous handler from register_command(cmd, None)
When overriding a g-code command, allow the caller to obtain the
previous command handler.  Use this feature in homing_override and
safe_z_home.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-12 20:19:18 -05:00
Kevin O'Connor 512ad4b3a4 query_endstops: Add get_status() method that reports the last query state
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-12 19:32:48 -05:00
FanDjango 4d9a36b34f
homing: Ability to set retract speed between homing moves (#2487)
On the retract move between homing moves, use a different speed (typically a faster one).

Signed-off-by: Mike Stiemke <fandjango@gmx.de>
2020-02-12 10:09:39 -05:00
FanDjango cb042e749d
homing_heaters: Turn off heaters during homing/probing (#2486)
Signed-off-by: Mike Stiemke <fandjango@gmx.de>
2020-02-12 10:08:30 -05:00
David Smith 596f5e3e3a
stepper_enable: Add SET_STEPPER_ENABLE gcode command (#2463)
Signed-off-by: David Smith <davidosmith@gmail.com>
2020-02-10 22:34:11 -05:00
Kevin O'Connor 7d76067ff9 tmc: Fix typo preventing stealthchop threshold from being set
Fix typo introduced in commit 67b28522.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-09 15:38:47 -05:00
David Smith b6779cc019
delayed_gcode: Fix definition reference for UPDATE_DELAYED_GCODE (#2465)
Signed-off-by: David Smith <davidosmith@gmail.com>
2020-02-03 15:32:44 -05:00
Kevin O'Connor 68e59528a4 endstop_phase: Query the stepper step_distance from the stepper object
Don't obtain the step_distance from the config, instead obtain
step_distance from the instantiated stepper object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-01 21:58:14 -05:00
Kevin O'Connor 67b2852249 tmc: Query the stepper step_distance from the stepper object
Don't obtain the step_distance from the config, instead obtain
step_distance from the instantiated stepper object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-01 21:58:11 -05:00
Kevin O'Connor c36fe76d69 probe: Add support for configuring lift_speed
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-31 15:47:06 -05:00
Kevin O'Connor 5ca132eafa stepcompress: Fix rounding error when interval=0
In the rare case where the step generation code finds an interval of
zero, it was possible for an integer division of a negative number to
cause an incorrect result.  Fix that by using the idiv_up() and
idiv_down() helpers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-25 14:20:44 -05:00
Kevin O'Connor ef4710c6e0 hd44780: Increase timeout to 40us
There have been several reports that increasing the delay from 37us to
40us eliminates screen corruption on some clone hd44780 displays.
Increase the timeout value so that the standard code works on these
displays.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-24 00:04:31 -05:00
Kevin O'Connor 2ea3631222 delta: Add print_radius option to customize valid XY radius
Add ability to override the default XY move checking radius.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-23 21:14:09 -05:00
Kevin O'Connor 8ed0f7c5c3 kinematics: Remove support for identifying Z steppers
The caller can now determine which steppers are connected to cartesian
Z movement via the new stepper.is_active_axis() method.  It is
therefore no longer necessary for the kinematic code to identify these
steppers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-23 20:47:01 -05:00
Kevin O'Connor d1972b1e9c itersolve: Add ability to query the active_flags state
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-23 20:47:01 -05:00
Arksine 2159f398ea heater: add support for BME280
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-13 22:29:50 -05:00
Arksine 774371d78d bme280: initial implementation of BME280 environmental sensor
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-13 22:29:50 -05:00
Arksine 97b4eff424 bed_mesh: detect incompatible mesh profiles
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 8013699c45 bed_mesh: refactor print_generated_points()
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 2a2191d201 bed_mesh: fix LOAD_PROFILE
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 13d16afa0c bed_mesh: Allow the default profile to be removed
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 2c877e1729 bed_mesh: improve interpolation checks
Move interpolation checks to _init_mesh_params() so they can be done whle the config is being parsed.  Do not allow a probe_count higher than 6 for lagrange interpolation, as this typically leads to oscillation.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine a69de2be93 bed_mesh: Move BED_MESH_MAP to Bedmesh class
Don't force probing when BED_MESH_MAP is executed,  output the existing mesh.  If the user wants to probe each time before a map they can do so with a gcode_macro.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine fe929e4696 bed_mesh: Add x,y offsets to min/max points in probe_finalize
This eliminates the need for the "mesh_params" dict to have references to the x and y offsets.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 5b20ac416c bed_mesh: refactoring
Renamed some variables in set_mesh() previous called "mesh_min" and "mesh_max" to alleviate confusion with the config options.

Renamed several attributes for clarity.  The "calibrate" attribute is now bmc, "probe_params" is now "mesh_params", "probed_z_table" is now "probed_matrix", "mesh_z_table" is now "mesh_matrix".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 74892a7702 bed_mesh: improve logging of generated points
Points are now logged after the printer is ready.  The formatting is improved, printing out the point index, and its corresponding automatic and manual points.

BED_MESH_OUTPUT now includes a PGP parameter, if PGP=1 the generated points are printed to the terminal.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 914f701256 bed_mesh: add xy offsets to generated points
Rename min_point, max_point, and bed_radius to mesh_min, mesh_max, and mesh_radius respectively.  Add "mesh_origin" option, that allows round beds to specificy the center of the mesh.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine ec58b23f3b ProbePointsHelper: Optionally add xy offsets to probe points
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Kevin O'Connor 9aab58605b tuning_tower: Support tuning of traditional g-code commands
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-07 19:21:54 -05:00
Kevin O'Connor 005cfea5c3 gcode: Fix detection of some "extended" g-code commands
Fix typo that resulted in _get_extended_params() being called for all
commands.  Allow "extended" g-code commands to contain numbers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-07 19:17:20 -05:00
Kevin O'Connor ac863a95b6 rotary_delta: Initial support for rotary delta kinematics
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-06 11:52:42 -05:00
Kevin O'Connor a56484c98b delta_calibrate: Add support for manually entering a nozzle Z height
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-06 11:49:41 -05:00
Kevin O'Connor 2b6cf5b007 homing: Don't assume homing occurs with a constant step rate
Some kinematics do not result in a constant step rate during homing
operations.  Calculate the endstop checking rate using the total
distance traveled on the axis divided by the axis step distance.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-06 11:49:41 -05:00
Kevin O'Connor e43ad4c953 itersolve: Export itersolve_calc_position_from_coord()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-06 11:49:41 -05:00
Kevin O'Connor 97d976fc53 stepper: Track if using units of radians instead of millimeters
The STEPPER_BUZZ command needs to know if the axis is using radians
instead of millimeters so that it can move a more appropriate
distance.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-06 11:49:41 -05:00
Kevin O'Connor bcf10aa990 delta: Simplify DeltaCalibration state tracking
Limit the use of coordinate descent "params".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-06 11:41:09 -05:00
Kevin O'Connor 27e6b533bc delta: Move low-level delta calibration to delta.py
Move the linear delta specific calibration code from
delta_calibrate.py to delta.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-06 11:41:09 -05:00
Kevin O'Connor fdfa26edd6 delta_calibrate: Move stable position conversion to its own class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-06 11:41:09 -05:00
Simo Apell 90bc1679a2 extruder_stepper: Initial support for synchronized extruder steppers
Signed-off-by: Simo Apell <simo.apell@live.fi>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-06 11:03:05 -05:00
Kevin O'Connor e576571340 fan: Do not flush look-ahead queue on fan speed change
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-03 18:13:57 -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 4b6a65c1e0 heater: Do not flush look-ahead queue on a heater temperature update
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>
2020-01-03 18:13:57 -05:00
Kevin O'Connor dabffcc22c kin_extruder: Convert pressure advance to use "weighted average"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-20 12:21:58 -05:00
Kevin O'Connor 54149e38f9 trapq: Limit the duration of "null" sentinal moves on the trapq
If a null move is added as the first move on the trapezoid motion
queue then it could have a very large move->move_t value.  This could
cause numerical stability issues with some advanced kinematic
formulas.  Place a limit on the move_t value to avoid this.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-20 12:13:19 -05:00
Daniel Kucera efc3335911 gcode_arcs: use correct current position from gcode
Signed-off-by: Daniel Kucera <github@danman.eu>
2019-12-18 12:42:40 -05:00
Kevin O'Connor 0a86190bae display: Revert "display: Add ST7567 display support (#1540)"
This reverts commit 1b92af6078.

The standard "uc1701" lcd_type can now be used in place of the custom
"st7567" lcd_type.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-18 12:30:20 -05:00
Kevin O'Connor abf493496c mathutil: Disable queuelogger in background_coordinate_descent()
If the queuelogger was holding the lock when the process is forked
then any attempt to log from the background process would result in a
deadlock.  Attempt a workaround by disabling the queuelogger at the
start of the background process.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-17 09:51:45 -05:00
Kevin O'Connor d9cd524aec extruder: No need to track extrude_pos locally
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-17 02:01:54 -05:00
Kevin O'Connor 46e7027bc7 extruder: Flush step generation on ACTIVATE_EXTRUDER
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-17 01:59:06 -05:00
Kevin O'Connor f4c4de1a24 extruder: Move M104/M140 commands from gcode.py to extruder.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-16 20:16:21 -05:00
Kevin O'Connor 9654816abf heater_bed: Move M140/M190 commands from gcode.py to heater_bed.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-16 20:02:48 -05:00
Kevin O'Connor 0e2d1a190e gcode: Rename bg_temp() to wait_for_temperature()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-16 19:21:37 -05:00
Kevin O'Connor 665323eb29 heater: Use printer.command_error() instead of internal heater.error()
Use the more standard command_error to report invalid temperature
requests.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-16 19:16:58 -05:00
Kevin O'Connor 254789f4c5 neopixel: Add support for delaying updates in SET_LED command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-15 23:24:17 -05:00
Simon Kühling b1bbe97576 temperature_sensor: Add get_status() function
Provide printer.<sensor-config-name>.temperature variable to gcode macro
environment

Signed-off-by: Simon Kühling <mail@simonkuehling.de>
2019-12-13 10:45:04 -05:00
Simon Kühling 2721211456 heater: Add PrinterHeater get_status() function
Provide a list of available heater and sensor names to
gcode macro templates through the printer.heater.available_heaters
and printer.heater.available_sensors variables

Signed-off-by: Simon Kühling <mail@simonkuehling.de>
2019-12-13 10:45:04 -05:00
Kevin O'Connor 4cbbe18afd itersolve: Improve numerical stability of gen_steps_pre_active check
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-10 16:44:02 -05:00
Kevin O'Connor 04b3603a1e itersolve: Rename scan_pre/_post to gen_steps_pre/post_active
Rename the variables to make it a little more clear what they do.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-10 15:53:50 -05:00
Kevin O'Connor fcee27fc19 gcode: Remove builtin T0/T1/T2/... command support
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>
2019-12-10 14:24:32 -05:00
Kevin O'Connor c06618193d extruder: Add an ACTIVATE_EXTRUDER command
Add support for an extended g-code command to change the currently
active extruder.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-10 14:23:13 -05:00
Kevin O'Connor ab2d302b7e gcode: Remove support for the M206 command
The M206 command isn't particularly standardized and isn't issued by
default from 3rd party software in their standard configurations.
Encourage users to use the more powerful SET_GCODE_OFFSET command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-10 14:23:10 -05:00
Kevin O'Connor 080ee0b512 kin_extruder: Apply pressure advance in kin_extruder.c
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>
2019-12-08 20:41:35 -05:00
Kevin O'Connor 730a6d868b kin_extruder: Move integration code from trapq.c to kin_extruder.c
Move the code that calculates the definitive integral to the
kin_extruder.c file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-08 18:30:42 -05:00
Kevin O'Connor 139274f0bb mathutil: Propagate errors from background_coordinate_descent()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-05 14:48:52 -05:00
Kevin O'Connor 72161d0405 tuning_tower: Fix typo causing tuning tower to break when homing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-04 20:11:54 -05:00
Petri Honkala 98d1fee8ad tmc5160: PWMCONF is write only
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
2019-12-04 09:20:39 -05:00
Petri Honkala 99a74d9f07 tmc2130: use local variable instead of global Registers in MCU_TMC_SPI
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
2019-12-03 12:06:37 -05:00
Kevin O'Connor e310e5f0e8 uc1701: Add a delay after reset toggle (for displays using ResetHelper)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-03 11:13:54 -05:00
Kevin O'Connor 988ee5754e itersolve: Fix potential backwards time in itersolve_gen_steps_range()
Make sure that a newly choosen "high" bound is always greater than the
"low" bound.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-02 23:56:42 -05:00
Kevin O'Connor a8ad1ae726 screws_tilt_adjust: Remove check for probe printer object
The probe object may not have be instantiated when the
screws_tilt_adjust object is instantiated.  Just remove the check.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-02 20:06:04 -05:00
Kevin O'Connor 8e87ab0939 gcode: Remove support for "G4 S1" style commands
The S parameter is not a standard and was not commonly used.  The P
parameter (delay specified in milliseconds) is the commonly accepted
g-code mechanism for dwelling.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-02 19:31:20 -05:00
Kevin O'Connor 2d97e0e218 uc1701: Add support for rst_pin
Add support for an optional uc1701 rst_pin.  Use the same reset pin
code handling with the SSD1306 code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-02 10:25:30 -05:00
Kevin O'Connor 2e7f38eadd hd44780: Use two separate text framebuffers
There is concern that some lcd boards that emulate the hd44780 don't
support text updates that wrap the two text framebuffers.  Update the
code to treat the two text areas as two separate framebuffers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-01 19:18:52 -05:00
Matt Baker 8d93d1a8ef uc1701: add config option for sh1106 type with up to 132 columns.
Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
2019-11-26 19:40:39 -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
Justin Schuh 93f1e6dd86 FAN: Kick start fan when the increase is more than 50% (#2085)
Large increases in fan speed can suffer from acceleration lag, so this
change kick starts the fan for a change of 50% or more in the same way
that starting the fan from 0% does.

Signed-off-by: Justin Schuh <code@justinschuh.com>
2019-11-24 18:37:30 -05:00
Kevin O'Connor 05472bb8a3 virtual_sdcard: Don't wait for M25 in an SD gcode file
If an M25 is in a gcode file that is being printed from virtual SD, it
would cause a permanent hang.  Detect that case and don't wait for
those M25 commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-24 14:30:26 -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 00fd6223ed tuning_tower: Report start of tuning test on g-code console
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-21 13:44:02 -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 5f5896ad71 extruder: Add support for instantaneous corner velocity
Add mechanism to perform look-ahead between moves with different
extrusion ratios.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-21 13:18:21 -05:00
Kevin O'Connor 6d0c55b6c1 extruder: Initial support for "smoothed pressure advance"
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>
2019-11-21 13:18:19 -05:00
Kevin O'Connor da06e185fb trapq: Add trapq_find_move() function
Add support for finding a move by time in the trapezoidal velocity
move list.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-21 13:17:45 -05:00
Kevin O'Connor a28b29993a trapq: Add code to calculate definitive integral
Support calculating the definitive integral of a cartesian axis
position over a time range of the movement queue.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-21 13:17:45 -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 56cd39f038 itersolve: Support step generation in lead up to and after stepper activity
Add support for generating steps from kinematic functions that
calculate step times based on a range of the motion queue.  It
requires scanning for step generation during the lead up to stepper
activity (when the stepper would nominally be idle).  And it requires
scanning for step generation just after a stepper has nominally become
idle.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-21 13:17:45 -05:00
Kevin O'Connor 4dbe795ac2 trapq: Implement sentinel nodes on the trapq list
Use sentinels to make list traversal code simpler.  Also add in null
moves so that there are no time gaps in the list.

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
Florian Heilmann b0a158c271 tmc2130: Do not error if run current below hold current (#2190)
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2019-11-21 11:09:39 -05:00
Kevin O'Connor d38aed0773 cartesian: Report dual_carriage_rails from get_steppers()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-15 12:32:04 -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
Petri Honkala dd529d7ad1 msgproto: unresolved symbol fixed
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
2019-11-15 11:36:54 -05:00
Kevin O'Connor 8efa5e2db4 stepper_enable: Raise an error on bad lookup_enable() call
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-14 18:05:32 -05:00
Kevin O'Connor d39142139e stepper: Remove set_commanded_position() call
Now that the only caller to set_commanded_position() is
set_position(), remove the set_commanded_position() method and pass
the set_position() call directly to the itersolve.c code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-13 19:35:26 -05:00
Kevin O'Connor 18b0749163 bltouch: No need to call get/set_commanded_position()
Now that the homing code does not call set_commanded_position(), it is
no longer necessary to save/restore the position in the bltouch code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-13 19:35:26 -05:00
Kevin O'Connor 9396431c6b stepper: Do not call itersolve_set_commanded_pos() after homing
Now that the homing code does not use get_commanded_position(), it is
no longer necessary to alter the low-level commanded position after a
homing move.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-13 19:35:26 -05:00
Kevin O'Connor fa433c7f04 homing: Use get/set_tag_position() to determine probed position
Don't rely on get_commanded_position() to determine the final probe
point.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-13 19:35:26 -05:00
Kevin O'Connor eed371e924 endstop_phase: Use set_tag_position() instead of set_commanded_position()
Use the new get/set_tag_position() calls to avoid altering the
low-level kinematic position.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-13 19:00:23 -05:00
Kevin O'Connor 224574da4a stepper: Add get/set_tag_position() and convert calc_position()
Rename calc_position() to calc_tag_position() and have it calculate
the value of the position from the last stepper set_tag_position()
call.  This enables the calc_tag_position() code to be more flexible
as it can be run with arbitrary positions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-13 19:00:17 -05:00
Kevin O'Connor e0e2f15498 fan: Move M106/M107 commands from gcode.py to fan.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-13 11:30:42 -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 e532b75e21 mcu: Minor simplification to default reset detection
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-12 22:15:04 -05:00
Kevin O'Connor 6116a5d48f stepper_enable: Remove ability to use a list of pins in enable_pin
Now that the tmc drivers perform automatic soft stepper enabling,
there is no need to be able to list multiple pins in the enable_pin
config setting.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-12 18:45:31 -05:00
Kevin O'Connor 77dff35fae tmc: Remove virtual_enable support and replace with automatic support
Automatically detect if the stepper has a dedicated enable line.  If
it does not, then automatically enable virtual enable support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-12 18:45:31 -05:00
Kevin O'Connor a4995c61c9 stepper: Remove add_to_endstop() method
Now that the PrinterStepper and MCU_stepper classes have been merged,
there is no need for the add_to_endstop() method.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-12 17:32:18 -05:00
Kevin O'Connor 78153ca4c3 stepper: Merge PrinterStepper and MCU_stepper classes
There's no need to track the two classes separately - just combine
them.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-12 17:32:18 -05:00
Kevin O'Connor 4ca190d393 stepper: Move MCU_stepper from mcu.py to stepper.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-12 17:32:18 -05:00
Kevin O'Connor 0204de46a6 stepper: Simplify PrinterRail init
Use add_extra_stepper() during class init.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-12 17:32:18 -05:00
Kevin O'Connor 0e30b862c7 stepper_enable: Move enable tracking from stepper.py to stepper_enable.py
Move the enable line tracking out of the main stepper.py code.  This
simplifies the main kinematic code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-12 17:32:18 -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 f50e054bd0 stepper_enable: Add new extras module for stepper enable line tracking
Move the M18/M84 command handling from gcode.py to new stepper_enable
module.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-10 11:55:53 -05:00
Kevin O'Connor bdc7383e51 itersolve: Improve numerical stability of itersolve_generate_steps() loop
Minor rework of the loop to reduce the chance that numerical stability
could cause an infinite loop.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-08 14:17:35 -05:00
Kevin O'Connor 0bfb655f66 query_adc: Add a new module to help query and debug analog pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 19:28:27 -05:00
Kevin O'Connor 124ba12485 buttons: Only call into main thread on an adc button change
Determine the selected button (and if it has changed) in the
background thread first.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 18:49:56 -05:00
Kevin O'Connor 196a69c613 buttons: No need to check for None on min_value/max_value
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 18:42:55 -05:00
Kevin O'Connor d40f951d6f buttons: Remove MCU_ADC_buttons debug capability
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 18:32:26 -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 ed610a6600 extruder: Consistently use "extruder" for the primary extruder
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>
2019-11-07 16:28:47 -05:00
Kevin O'Connor 32f61b01e9 trapq: Use C99 method for declaring struct members in trapq_append()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 11:32:53 -05:00
Kevin O'Connor f63f68bbbb chelper: Report an error if the C host code does not compile
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 11:32:20 -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 2981bd601b extruder: Treat extrude with Z only movement to be an "extrude only" move
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>
2019-11-07 09:45:36 -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 797dcfcb12 itersolve: Remove unused gen_steps()
Eliminate the old gen_steps() call now that all callers have been
converted to the newer trapq based generate_steps().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor bd3c8920f6 mcu: Remove set_ignore_move()
Update callers of set_ignore_move() to use the trapq system to set a
stepper to ignore moves.

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 ef53ded6bc force_move: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor e6f713f1ce manual_stepper: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 9845d0d103 extruder: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 746b928c8b winch: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 4b5cbc18a4 polar: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 351b565728 delta: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor b792e0fdd1 corexy: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 7afac2b3af cartesian: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor f3ef9c1889 itersolve: Add support for generating steps from a trapq
Support associating a stepper_kinematics with a trapq.  Support
generating steps from a time range on the given trapq.

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 c06f6943a6 list: Add additional list helper functions
Add list_is_first, list_is_last, list_last_entry, and list_prev_entry
helper functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor fdbdb3c707 trapq: Add new trapq.c file with code for trapezoidal velocity handling
Move the "struct move" code from itersolve.c to new file trapq.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 374eb98765 polar: Implement bed angle wrapping adjustments in chelper code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 92993c062b itersolve: Rename calc_position to calc_position_cb
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 9945cc0f46 itersolve: Fix possible infinite loop in itersolve_gen_steps()
If the kinematic position calculation function had an error in it (if
it produces sudden position changes) then it could lead to an infinite
loop in itersolve_gen_steps().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 15:51:51 -05:00
Kevin O'Connor 5eb5841eaf mcu: Contact and identify all the mcus prior to configuring them
Break up the connect phase into two phases - mcu_identify and connect.
The first phase will contact all the micro-controllers and obtain the
"identify" data dictionaries for them.  Once all the micro-controllers
have been contacted, then they can be configured.  This fixes an issue
with FIRMWARE_RESTART not working correctly on multi-mcu setups that
use restart_method=command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-06 10:35:24 -05:00
Kevin O'Connor 430ad0b658 virtual_sdcard: Only return from M25 after print confirmed paused
Wait in the M25 command handler until the work_handler() background
timer fully exits.  This ensures that subsequent g-code commands (such
as M27 or M24) will correctly report a paused state.

Reported by @foosel.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-31 11:36:35 -04:00
Kevin O'Connor 40e2c64c82 clocksync: Fix typo in pause() call at connect time
The initial clock measurement wasn't properly implementing a small
delay between clock queries.  Fix the pause() call so there is a small
delay between queries.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-31 11:36:35 -04:00
Kevin O'Connor 0ba5819370 tmc_uart: Don't try to configure analog pins to -1 value
Commit 6f5f2a3b incorrectly altered the analog mux pin config.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-26 11:33:30 -04:00
Kevin O'Connor 6f5f2a3bc7 tmc_uart: Make sure to set analog mux pins after a restart
Don't assume the analog mux pins are in a low state at startup.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-24 22:00:58 -04:00
Arksine dd12c981ef temperature_fan: add get_status() function
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-10-22 22:10:13 -04:00
Arksine d85b395a9c bed_mesh: fix error reporting
Fix invalid string formatting in the parse_pair() helper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-10-22 22:09:33 -04:00
Geoff Shannon 789659599c adc_temperature: add support for AD849x thermocouple amplifiers (#1994)
Signed-off-by: Geoff Shannon <geoffpshannon@gmail.com>
2019-10-10 20:11:34 -04:00
Kevin O'Connor 6d7d079bab tuning_tower: Only cancel tuning tower test if extrude at notably lower z
Some print start scripts may extrude at a position slightly higher
than the first z layer height.  Tweak the backwards z test to reduce
the chance of the tuning test ending prematurely.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-04 20:10:12 -04:00
Master92 2b553a8108 safe_z_home: Fix unintended change in default behavior
PR #1970 introduced a new parameter, controlling the default behavior of the safe_z_home-module. To avoid unexpected changes, the default of the move_to_previous is now defaulted to False.

Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
2019-10-03 18:06:08 -04:00
Jason S. McMullan 7605244fa0 safe_z_home: Fix issue where 'home_xy_position: 0,0' did not position at 0,0
If '[stepper_x]' and/or '[stepper_y]' have a 'position_min' that is
non-zero, and '[safe_z_home] home_xy_position' is '0,0'; then the 'G28'
command will _not_ move to '0,0'; but stay at 'position_min' during the
Z endstop test.

This fix corrects this issue.

Signed-off-by: Jason S. McMullan <jason.mcmullan@gmail.com>
2019-10-03 18:05:21 -04:00
Nicholas Seckar 004edb9613 fan: Add off_below option for fans (#1897)
Below off_below the fan will be turned off. When configured correctly this
can prevent stalling, which may lead to overheating and failed fans. To
simplify calibration and use of this setting, off_below is applied in the
input duty cycle domain, prior to any scaling due to e.g. max_power.

Signed-off-by: Nicholas Seckar <nseckar@gmail.com>
2019-10-03 17:59:03 -04: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
Julien Lirochon 0c247e55e6 probe: Add range to probe accuracy results (#2015)
Signed-off-by: Julien Lirochon <julien@lirochon.net>
2019-09-29 16:56:46 -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
Petri Honkala f8f0c3f142 z-tilt: Unresolved symbol fixed
Signed-off-by: Petri Honkala <cruwaller@gmail.com>
2019-09-24 12:17:03 -04:00
Piotr Usewicz a92bdf1d54 gcode_arcs: Use is operator for Null comparison (#1989)
Signed-off-by: Piotr Usewicz <piotr@layer22.com>
2019-09-23 16:49:52 -04:00
Piotr Usewicz 6b2b8f31ee gcode_arcs: Remove unused variables (#1988)
Signed-off-by: Piotr Usewicz <piotr@layer22.com>
2019-09-23 16:49:17 -04:00
achmed20 fce98c5519 gcode_arcs: use z-height defined in f2/3 code, if present
Signed-off-by: Aleksej Vasiljkovic <achmed21@gmail.com>
2019-09-18 11:57:16 -04:00
Kevin O'Connor 8c69e1bcfe gcode: Allow M105 to produce output if called from a macro
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-18 09:58:16 -04:00
Master92 3a37d4a208 safe_z_home: Hop only if necessary and add option to move xy back
Once a hop is performed, it will only be re-issued if the z-axis has been
moved in the meantime. Usually it is only moved by a z-homing so doing so
will cause safe_z_home to do the hop on the next homing action.

When z-axis is homed, x and y positions are known. When setting this
boolean option, these are set back to their last positions.

Whenever a hop is specified it is re-issued after the Z axis has been
homed. This is especially necessary when a pressure-based probe is used.
Also, the module decides if a hop is necessary, based on either a known
Z position or a flag that is set whenever the motors are disabled.

Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
2019-09-18 09:37:33 -04:00
John Jardine 020ca5ac2c samd_sercom: fix pin enumeration error when mcu is specified
Previously, when a sercom pin specified the mcu (myname:PIN), it would result in a pin enumeration error.

Signed-off-by: John Jardine <john@gprime.net>
2019-09-17 13:28:57 -04:00
Master92 fd2f17f847 controller_fan: Replace else followed by single if with elif
Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
2019-09-17 11:52:03 -04:00
Master92 4e09cacece controller_fan: Use keyword arguments to improve readability
Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
2019-09-17 11:52:03 -04:00
Master92 4fab93a8b0 controller_fan: Use snake-case for all variables and function-names
Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
2019-09-17 11:52:03 -04:00
Master92 6333dc2069 controller_fan: Use _ to declare discarded return value
Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
2019-09-17 11:52:03 -04:00
Master92 6250157397 controller_fan: Declare instance-attribute in __init__
Signed-off-by: Nils Friedchen <Nils.Friedchen@googlemail.com>
2019-09-17 11:52:03 -04:00
Kevin O'Connor 43103929e3 temperature_fan: Allow min_speed to be set to zero
Reported by @meteyou.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-14 15:35:09 -04:00
Kevin O'Connor 63311b2348 bltouch: Improve handling of low pin_move_time configuration
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-14 15:16:26 -04:00
Aleksej Vasiljkovic 7d8c70363a gcode_arcs: Add support for G2/G3 commands
R Still missing, also might be somewhat dirty since code is converted
into G1 commands.

Signed-off-by: Aleksej Vasiljkovic <achmed21@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-13 11:57:54 -04:00
Arksine 49779f13a2 filament_switch_sensor: Add a delay between dispatch of pause and execution of pause gcode
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-09-08 20:42:43 -04:00
Julien Lirochon 12feb6d7fb configfile: Fix the exception raised when an included file is missing (#1931)
Signed-off-by: Julien Lirochon <julien@lirochon.net>
2019-09-01 18:28:18 -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 296ab7d402 klippy: Warn if starting klippy with logging disabled
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-09-01 18:09:20 -04:00
Kevin O'Connor 1b454c0943 mcu: Prevent "math domain errors" in stats calculation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-30 13:57:07 -04:00
Kevin O'Connor a67451fa36 console: Update for PinResolver changes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-19 23:52:02 -04:00
Kevin O'Connor b4280fdfe0 board_pins: Improve config error checking
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-19 21:58:11 -04:00
Kevin O'Connor bfbcb90751 board_pins: Add a new "extras" module to support per-board pin aliases
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-19 12:57:59 -04:00
Kevin O'Connor 395429be14 pins: Move reserved pin handling into PinResolver class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-19 12:57:59 -04:00
Kevin O'Connor a482ddf582 tmc2209: Add support for sensorless homing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-19 12:05:09 -04:00
Kevin O'Connor 96fdb6ef36 uc1701: Add support for a reset line on SSD1306 displays
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-17 22:14:02 -04:00
Kevin O'Connor 05bb5484b4 bus: Add MCU_bus_digital_out helper class
Add a helper class for tracking gpio outputs that are synchronized to
bus updates on a particular command queue.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-17 22:14:02 -04:00
Kevin O'Connor a3980cebcc neopixel: Add support for WS2811 RGB pixel color order
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-09 20:58:49 -04:00
Florian Heilmann 3d38211b8a extra: Add Safe Z home extra
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2019-08-09 20:49:17 -04:00
Florian Heilmann f958542ebb kinematics: Add get_status() method to kinematics
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2019-08-09 20:49:17 -04:00
Kevin O'Connor 8c5fc1688a pins: Add arduino aliases for Adafruit Grand Central board
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-09 20:15:40 -04:00
Kevin O'Connor f6d1ab2ea2 neopixel: Rework timing so that it works on AVR micro-controllers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-07 15:37:05 -04:00
Kevin O'Connor 9445e1d555 dotstar: Allow any number of chips to be daisy chained
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-06 22:49:05 -04:00
Kevin O'Connor 115b888106 neopixel: Use low priority for LED updates
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-06 22:25:26 -04:00
Kevin O'Connor 4c09d8bf02 dotstar: Initial support for "dotstar" LEDs
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-06 19:44:32 -04:00
Kevin O'Connor c2a08962b7 spicmds: Rework spi config commands
Rework the spi_config commands so that bus configuration and shutdown
message configuration is done separately from the main "config_spi"
command.  This makes the spi configuration more flexible.  It's now
possible to use software spi without a CS pin.  It's now possible to
define multiple SPI messages to send on a shutdown event.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-06 18:56:53 -04:00
Kevin O'Connor c356e8362d tmc_uart: Make sure address is at least 0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-31 13:13:27 -04:00
Kevin O'Connor a730aec8bc tmc_uart: Add support for configuring the uart address on tmc2209 chips
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-31 13:02:27 -04:00
fess 79cec9ba5c menu: use MOVE=1 for offset_z menu
use SET_GCODE_OFFSET's MOVE=1 parameter in the z offset menu.
Less confusing for people who think nothing happened.

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-07-31 11:17:31 -04:00
Kevin O'Connor a878831d5e mcp4728: Update to better match printrbot revf requirements
Reported by @Grumps49.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-26 11:02:56 -04:00
Kevin O'Connor 46041f5411 neopixel: Add support for daisy-chained chips
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-23 21:59:38 -04:00
Kevin O'Connor abf3fa4b71 neopixel: Add support for setting a default color at startup
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-23 21:59:38 -04:00
Kevin O'Connor 1fcfff2ac6 tmc_uart: Remove references to the TMC2208 in the generic UART code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-21 09:39:07 -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 e3c5638147 neopixel: Warn that the neopixel isn't currently supported on AVR
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-17 16:54:47 -04:00
Kevin O'Connor d5cc2a7b7b neopixel: Improve timing of gpio bit-banging
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-17 16:36:28 -04:00
Kevin O'Connor be2d0abbab neopixel: Optimize the update loop
Optimize the transmit code so it can run on some slower ARM cpus.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-12 23:39:00 -04:00
Kevin O'Connor b7bc96c3b2 neopixel: Add initial support for "neopixel" leds
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-12 21:44:01 -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 bc78bc4864 replicape: Try to detect shift register spi on spidev2.1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-12 11:39:14 -04:00
Kevin O'Connor 28aa2f507a endstop: Rename mcu end_stop commands to endstop
Rename the commands.

The main reason for this change is to force a micro-controller code
updated (due to important bugfix in 7fefe52d).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-12 08:10:53 -04:00
Kevin O'Connor 0343d0c73a firmware_retract: Remove z_hop support
The current z_hop support did not work correctly with common slicers
that change Z height between retract and unretract, and it did not
work correctly with slicers that issue a retract at the end of a print
and then at the beginning of the next print.

The z_hop support is therefore being removed until these issues can be
fixed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 19:25:56 -04:00
Kevin O'Connor 364c22fe84 probe: Rework the PROBE_ACCURACY command parameters
Don't default to a Z location of 10, as that could cause damage if the
probe's z_offset is greater than 10.  Instead, use the "retract
distance" method that is used for normal multi-sample probing.

Update the PROBE_ACCURACY command parameter names to use the same
parameter names as the PROBE command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 15:21:09 -04:00
Kevin O'Connor c3fe3d0d2c stepcompress: Remove no longer needed stepcompress_set_homing()
Now that homing is implemented via "drip moves", it is no longer
necessary for the stepcompress code to have special homing logic.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -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 dd34768e3a homing: Remove no longer needed homing time delay code
Now that homing is implemented via "drip moves", it is no longer
necessary to round the homing speed and it is no longer necessary to
add a delay for cpu processing time.

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 84be96aeff mcu: Rework home_wait() to use a reactor completion
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor 4f6982c4d0 serialhdl: Update SendWithRetry to use reactor completions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor 233da97b19 reactor: Add support for "completions"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor e148dbe52a mcu: Use regular send_with_response() for query_endstop()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor a116fa9054 serialhdl: Use register_response() for both registering and unregistering
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor b2c778b931 mcu: Integrate query_endstop_wait() into query_endstop()
There is no need to have two separate calls to query an endstop.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Arksine d4d8bf795b filament_switch_sensor: add SET_FILAMENT_SENSOR gcode
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-07-10 09:57:46 -04:00
Arksine 856b22b387 filament_switch_sensor: postfix M400 to script
Finish Moves needs be a hard requirement for the event gcodes, as it eliminates the possiblility of an event firing while the gcode is executing.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-07-10 09:57:46 -04:00
Arksine 893c98ed1b filament_switch_sensor: remove stale _hande_ready call in the BaseSensor
The toolhead attribute is no longer required by the BaseSensor class

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2019-07-10 09:57:46 -04:00
Arksine 0f1d42466b buttons: initialize mcu buttons based on inverted state
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-07-05 20:01:07 -04:00
Arksine 314b9654c6 delayed_gcode: initial implementation
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2019-07-01 11:09:30 -04:00
Janar Sööt ec34d78d5e gcode_macro: add iterator to status wrapper
It really helps to see a snapshot of available printer variables when building menus and macros. The list of variables always depends on what printer config you have.

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-07-01 10:59:13 -04:00
Arksine 0c379d060f skew_correction: add SKEW_PROFILE gcode
Add profile managment similar to that of bed_mesh.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-06-29 10:58:46 -04:00
Arksine 026752e399 skew_correction: Add SET_SKEW gcode
This moves skew_correction configuration out of printer.cfg.   It is now dynamically set by the SET_SKEW gcode.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-06-29 10:58:46 -04:00
Kevin O'Connor 4df78cd843 tmc: Configure "intpol" field from TMCMicrostepHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-28 16:59:26 -04:00
Kevin O'Connor a2e550d1cd stepper: Add support for providing a list of pins to enable
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-28 16:59:26 -04:00
Kevin O'Connor 7702f0a027 tmc: Add support for virtual enable pins
Add support for enabling the stepper via the communication channel.
This improves support for boards with a shared enable line.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-28 16:59:26 -04:00
Kevin O'Connor 041831f93a tmc_uart: Hold a mutex during MCU_TMC_uart get/set_register()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-28 16:59:26 -04:00
Kevin O'Connor 844dca9c6e tmc2660: Hold a mutex during MCU_TMC2660_SPI get/set_register()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-28 16:59:26 -04:00
Kevin O'Connor 1f3b74d2f7 tmc2130: Hold a mutex during MCU_TMC_SPI get/set_register()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-28 16:59:26 -04:00
Arksine 35a45e2446 pause_resume: add CLEAR_PAUSE gcode
Allow the user to clear the pause state without restoring  position.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-06-28 12:44:49 -04:00
Kevin O'Connor 505e96b7ed klippy: Only set the run_result if it hasn't already been set
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-28 10:21:50 -04:00
Kevin O'Connor e5f74a64ed polar: Add initial support for multiple bed rotations
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-28 10:00:40 -04:00
Arksine b37222e3a1 skew_correction: initial implementation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-06-26 20:16:35 -04:00
Arksine 2d7f32584f gcode: Add support for stacked transforms
Add method from pull request #1243 to support stacked transforms.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-06-26 20:16:35 -04:00
Kevin O'Connor 9855354c75 tmc_uart: Use print_time=None as default (not print_time=0)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-25 18:27:59 -04:00
Kevin O'Connor 4aeb7d38a7 sx1509: Minor cleanup - don't default print_time to 0
It's not valid to use a print_time=0, and it isn't actually used in
the sx1509 code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-25 18:19:05 -04:00
Kevin O'Connor 6ec7dee07d tmc: It's not valid to schedule messages with print_time=0
A print_time of zero may translate to a negative clock on a secondary
micro-controller, which would cause an internal error.  Change the
code to pass a real print_time or None if it is not needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-25 18:19:05 -04:00
Kevin O'Connor 52b5ca182c tmc: Simplify internal DUMP_TMC interface
Only the tmc2208 driver needs special read register translation logic.
Rework the code so a default implementation is available for all the
other drivers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-25 11:40:15 -04:00
Kevin O'Connor 4fb4a13fd7 endstop_phase: Add tmc2209 and tmc5160 to list of tmc drivers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-23 11:27:18 -04:00
Stephan Oelze ec9fad758a tmc2209: Initial support for tmc2209 stepper driver
Signed-off-by: Stephan Oelze <stephan.oelze@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-23 11:26:20 -04:00
Kevin O'Connor 80194a7e18 endstop_phase: Fix endstop_phase on trinamic drivers that aren't inverted
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 22:56:16 -04:00
Kevin O'Connor 0b02d7a1f2 tmc_uart: Support print_time in set_register()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 21:47:37 -04:00
Kevin O'Connor 9feb05ce41 mcu: Support minclock in send_with_response() requests
Enhance send_with_response() so that it supports queries with a
minclock.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 21:42:20 -04:00
Kevin O'Connor e202a8802b mcu: Move SerialCommand from serialhdl.py to mcu.py
Move the serial command wrapper class from serialhdl.py to mcu.py.
This will allow that class to better support higher level
functionality.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 21:42:20 -04:00
Kevin O'Connor cc3666aa78 serialhdl: Introduce SerialReader.send_with_response()
Introduce a main send_with_response() helper function and use it
during identify and the setup of clocksync.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 21:42:20 -04:00
Kevin O'Connor d98bbc772c serialhdl: Eventually timeout connect attempt
If the serial connection has not been successful after 2.5 minutes
then report an error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 21:42:20 -04:00
Kevin O'Connor ebb375fee9 serialhdl: Use send_with_response() to query identify data
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 18:48:33 -04:00
Kevin O'Connor 461ed4cb80 serialhdl: Add a get_msgparser() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 18:14:00 -04:00
Kevin O'Connor 647f1ee2e0 serialhdl: Rename register_callback() to register_response()
Rename the method and use that name in the mcu class as well.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 18:14:00 -04:00
Alec B. Plumb daadb36cb4 gcode_button: Execute gcode when a button is pressed or released (#1745)
An extra to execute gcode when a hardware button is pressed or released. Uses the jinja2 templating system.

Inspired by pull request #545 from Miguel Moitinho miguel@moitinho.net and pull request #1098 from Paulo Drugos paulodrugos@gmail.com

Signed-off-by: Alec Plumb <alec@etherwalker.com>
2019-06-21 18:06:31 -04:00
Kevin O'Connor 83e6c01ada probe: Allow probe parameters to be specified as g-code parameters
Add PROBE_SPEED, SAMPLES, SAMPLE_RETRACT_DIST, SAMPLES_TOLERANCE,
SAMPLES_TOLERANCE_RETRIES, and SAMPLES_RESULT parameters to the PROBE
command (and to commands that indirectly invoke a probe).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 14:44:28 -04:00
Kevin O'Connor c92aca74b5 probe: Add support for samples_tolerance
Add a check on the maximum Z distance between probe samples.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 14:06: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 98915fb1d0 probe: Always return just x,y,z from _probe()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 11:04:55 -04:00
Kevin O'Connor 077c6f7e5e reactor: Fix some corner cases with self._next_timer handling
Make sure to update self._next_timer on greenlet start/stop.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-19 21:12:34 -04:00
Kevin O'Connor 0173bb3f71 tmc_uart: Move UART code from tmc2208.py to new file tmc_uart.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-18 18:06:05 -04:00
Kevin O'Connor 3f79831485 tmc2208: Make sure each analog mux config is unique
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-18 17:58:20 -04:00
Kevin O'Connor 274857357e tmc: Retry register init during connect
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-18 17:54:02 -04:00
Kevin O'Connor cfdb60ca23 tmc2660: Set SDOFF=0 before accessing DRVCTRL
Make sure to configure DRVCONF with SDOFF=0 prior to writing DRVCTRL
as that field controls access to that register.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-18 15:19:05 -04:00
Kevin O'Connor 587db5c315 tmc2660: Don't allow configuration of DEDGE
Setting DEDGE would just break the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-18 13:24:54 -04:00
fess 49c36f868b z_tilt: Support retries
Support retrying Z_TILT_ADJUST a configurable number of times
to a configurable tolerance both in the config or as parameters.

- By default keeps original behavior of no retries.
- Adds parameters RETRIES and RETRY_TOLERANCE to QUAD_GANTRY_LEVEL gcode.
- adds config options retries and retry_tolerance to uad_gantry_level]
- issues an error if we are getting worse intead of approaching tolerance
- issues an error if retries were requested but we did not reach the tolerance
in the specified number of retries

the minimum change should  be a single z step for those
probing 2 points for 2 stepper motors and 3 for 3 stepper motors.

at one point it was suggested to use the amount of z adjustment instead of the
range of the probed points as a trigger for retry. I've chosen not to do this.
using z adustment in these cases means the minimum unit of change is related to
the angle created by the probed points  and the distance to stepper motor and
can be more than a couple steps which is rather unintuitive.

for the case when someone is using more probed points than z steppers the
probed points range will have some fixed minimum value that can't be reduced
which is also unintuitive but that case should idealy be the rarer case, and
the user can learn to set a higher tolerance that matches their probing setup.

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-06-18 12:12:25 -04:00
fess bd40690bd1 quad_gantry_level: Support retries
Support retrying QUAD_GANTRY_LEVEL a configurable number of times
to a configurable tolerance both in the config or as parameters.

- By default keeps original behavior of no retries.
- Adds parameters RETRIES and RETRY_TOLERANCE to QUAD_GANTRY_LEVEL gcode.
- adds config options retries and retry_tolerance to `[quad_gantry_level]`
- issues an error if we are getting worse intead of approaching tolerance
- issues an error if retries were requested but we did not reach the tolerance
in the specified number of retries

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-06-18 12:12:25 -04:00
fess 4681775219 z_tilt: Add RetryHelper
add RetryHelper class in prep for implementing retries for both z_tilt
and quad_gantry_level

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-06-18 12:12:25 -04:00
Kevin O'Connor bdf5898891 probe: Allow retries from ProbePointsHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-18 12:12:25 -04:00
Kevin O'Connor 20d0bb8354 config: Update tmc5160 block in example-extras.cfg
List all the configurable parameters in the tmc5160 example block and
use similar wording as the other tmc drivers.

Also, don't allow DEDGE to be configured as it would just break the
current code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-18 09:41:27 -04:00
Kevin O'Connor 494a5b732d quad_gantry_level: Use new ZAdjustHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-17 11:17:47 -04:00
Kevin O'Connor 20851ab3e9 z_tilt: Separate z adjustment code to new ZAdjustHelper class
Introduce a new class to perform the low-level Z stepper adjustments.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-17 11:17:47 -04:00
Kevin O'Connor f6864da58b tmc2208: Add support for using an analog mux to access TMC uarts
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-12 22:14:41 -04:00
Kevin O'Connor 88fe2787a9 tmc2208: Separate low-level bit-banging code from MCU_TMC_uart class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-12 22:06:54 -04:00
Kevin O'Connor 47901e57c9 verify_heater: Don't raise a heater error if the heater is off
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-12 22:06:54 -04:00
Kevin O'Connor 82b58e46a7 temperature_fan: Remove executable flag from temperature_fan.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:30:48 -04:00
Kevin O'Connor b21a22d744 tmc: Move common TMC stepper driver code to new file tmc.py
Move common code from tmc2130.py to tmc.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:29:35 -04:00
Kevin O'Connor 10c0da9a6c tmc2130: Rework remaining config helpers to use mcu_tmc interface
Introduce TMCMicrostepHelper and TMCStealthchopHelper helper code that
uses the mcu_tmc interface.  Update the callers to use these new
helpers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 7f34264101 tmc2130: Move TMC virtual endstop code into a new TMCEndstopHelper class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 35edc4d63c tmc2660: Move current setting code to its own helper class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor b2729f38a6 tmc5160: Move current setting code to its own helper class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 110bbb3843 tmc2130: Move current setting code to its own helper class
Concentrate the current setting code into its own TMCCurrentHelper
class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 6abe132cf0 tmc2130: Transmit register initialization during connect callback
Perform the register initialization directly from TMCCommandHelper and
perform it during the "connect" phase.  This unifies the register
setup for the TMC2130, TMC2208, TMC2660, and TMC5160.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 6947548c17 tmc2660: Use TMCCommandHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor c76428bd01 tmc5160: Use TMCCommandHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 1bdd51d575 tmc2208: Use TMCCommandHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 395c845ca1 tmc2130: Factor out g-code command handlers to their own class
Create a TMCCommandHelper class that implements INIT_TMC,
SET_TMC_FIELD, and DUMP_TMC.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 6a7ddb6bf0 tmc2208: Move get/set_register functions to new MCU_TMC_uart class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor ab710cd4de tmc2660: Move get/set_register functions to new MCU_TMC2660_SPI class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor a122d113e8 tmc5160: Use tmc2130.MCU_TMC_SPI for low-level get/set_register access
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 3becc6cf54 tmc2130: Move low-level get/set_register functions to new MCU_TMC_SPI class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 9ce98fd769 tmc2660: Define get_register() method
Use a get_register() method instead of get_response().  This makes the
tmc2660 class more similar to other TMC drivers.  It also enables
DUMP_TMC to dump all the readable content.

Also, use the tmc2130.get_config_microsteps() helper.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 2b0251ee99 tmc5160: Rename registers to Registers and fields to Fields
Minor change to the code so that it is more similar to the other tmc
drivers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 5de9f74525 test: Add test cases for tmc drivers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-10 14:18:58 -04:00
Kevin O'Connor 97840f9851 serialhdl: Use reactor mutex in send_with_response()
Reduce the delay in send_with_response() by introducing a reactor
mutex to wake the main thread when the response is obtained.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-09 19:12:24 -04:00
Kevin O'Connor 30d2ae8f9f gcode: Eliminate the process_batch() method
Allow the callers of process_batch() to directly inspect the gcode
mutex.  Those callers can then directly invoke run_script().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-09 18:44:44 -04:00
Kevin O'Connor 962f7b98bd gcode: Convert input handling to use a reactor mutex
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-09 18:44:44 -04:00
Kevin O'Connor afc10400e3 reactor: Be explicit on which handlers are timer_handler vs file_handler
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-09 18:44:44 -04:00
Kevin O'Connor 0546c18d27 reactor: Add support for mutexes
Add a mutex object that implements simple queing mutual exclusion for
greenlets.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-09 12:55:56 -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 d7754a8f93 homing_override: Pass params to template evaluation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-09 11:14:31 -04:00
Kevin O'Connor 8b00580884 gcode_macro: Parse variable_X parameters using ast.literal_eval()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-07 19:33:31 -04:00
Kevin O'Connor 01f3b50e73 idle_timeout: Fix typo causing get_status() to fail
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-07 12:30:42 -04:00
Kevin O'Connor f1c6d04376 filament_switch_sensor: Use template evaluation on gcode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-07 11:38:43 -04:00
Kevin O'Connor d0be48da74 filament_runout_sensor: Auto load pause_resume module if pause_on_runout enabled
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-07 11:38:43 -04:00
Kevin O'Connor 3f4190c792 idle_timeout: Use template evaluation on gcode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-07 11:38:43 -04:00
Kevin O'Connor e60ee861f8 extruder: Use template evaluation on gcode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-07 11:38:43 -04:00
Kevin O'Connor 27ca159285 gcode_macro: Add a default parameter to load_template
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-07 10:51:57 -04:00
Kevin O'Connor cacb6f4378 klippy: Provide global access to a printer.command_error exception class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:22:14 -04:00
Kevin O'Connor 49a3083d6a manual_probe: Add extra checks to catch manual probe not finishing correctly
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor 40f73dd7f4 probe: Check for toolhead movement during activate/deactivate_gcode scripts
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor df80d96ae6 manual_probe: No need to re-raise an EndstopError
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor b8c7eb40c5 bed_screws: No need to re-raise an EndstopError
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor 1fd490ddf9 probe: No need to re-raise an EndstopError
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor 67964e71f1 homing: Catch the more generic CommandError during homing
Allow the low-level homing code to raise either a gcode.error or an
EndstopError during a fault.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor e9935e1a41 gcode: No need to re-raise an EndstopError
Now that EndstopError and gcode.error use the same underlying
Exception object, it is no longer necessary to translate an error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor 945a84c0ea gcode: Use the same underlying error object for homing and gcode errors
Introduce a homing.CommandError and use that as the basis for both
gcode and EndstopError exceptions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor 15011012e5 probe: Simplify ProbePointsHelper start and end tracking
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor bbc8637ed6 probe: Be sure to call gcode.reset_last_position() after any manual move
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor 74cc005ff3 probe: Unify mean and median code between run_probe() and PROBE_ACCURACY
Factor out _calc_mean() and _calc_median() functions and call from
both run_probe() and cmd_PROBE_ACCURACY().

This also fixes a subtle error in the run_probe() median function - on
some kinematics the x and y position can change on a z move so the x
and y should be taken from the z probe values actually used.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Kevin O'Connor 2b8dca5dbf probe: Move multi-sampling capability from ProbePointsHelper to Probe
This changes the config file so that the configuration of
multi-samples is now done in the [probe] (and [bltouch]) section
instead of the various delta, bed_mesh, z_tilt, etc. config sections.

With this change, PROBE and PROBE_CALIBRATE commands now also utilize
multi-sampling.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-06 10:08:58 -04:00
Len Trigg 5989f7a8a6 firmware_retraction: Implementation of tuneable G10/G11 firmware retraction (#1617)
This supports getting and setting of retraction parameters without
having to restart klippy.

Signed-off-by: Len Trigg <lenbok@gmail.com>
2019-06-06 09:10:09 -04:00
Kevin O'Connor d065787afc gcode_macro: Add support "x in printer" to templates
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 12:41:28 -04:00
Kevin O'Connor 1c09a0935f idle_timeout: Add a get_status() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 12:35:50 -04:00
Kevin O'Connor 0bb714edd7 menu: Remove customized get_status overrides
Now that the extruder, display, heater_fan, output_pin, and servo
classes have get_status() methods, it is no longer necessary to
override them in the menu code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 11:55:40 -04:00
Janar Sööt df765b33dc display: add get_status method
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 11:51:46 -04:00
Janar Sööt 9155886c21 extruder: add get_status method
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-06-04 11:44:57 -04:00
Janar Sööt 94f5fb3553 servo: add get_status method
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-06-04 11:44:50 -04:00
Janar Sööt efecc96427 output_pin: add get_status method
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-06-04 11:44:35 -04:00
Janar Sööt e519ab2031 heater_fan: add get_status method
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-06-04 11:43:34 -04:00
Kevin O'Connor a68f577adf gcode_macro: Add support for SET_GCODE_VARIABLE command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 09:50:30 -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 4ccc218b06 gcode: Add action_x() callables to get_status()
Add action_respond_info(), action_respond_error(), and
action_emergency_stop() callables to the get_status() return
dictionary.  This allows gcode macros to directly invoke these
actions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 09:50:30 -04:00
Kevin O'Connor ac8f6dfe20 gcode_macro: Rename "status" helper to "printer"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 09:50:30 -04:00
Arksine a238ec6f98 idle_timeout: Add SET_IDLE_TIMEOUT gcode
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-06-04 09:46:26 -04:00
Kevin O'Connor fe1c57b098 bed_screws: Be sure to call gcode.reset_last_position() after any manual move
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-03 13:43:49 -04:00
Arksine 05a04d5d3d pause_resume: Use Octoprint's "paused" and "resumed" action commands.
These action commands prevent Octoprint from sending extra gcodes that can interfere with Klipper's pause/resume control.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-06-02 19:19:32 -04:00
Arksine ca8233e6d5 pause_resume: use new save/restore gcodes to handle state
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-06-02 19:19:32 -04:00
Kevin O'Connor 89650a1e60 adc_temperature: Minor comment update
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-02 17:12:55 -04:00
Artem Belevich 72100bc1f2 tmc2130: Check field name validity. (#1697)
This avoids crashing Klipper if user entered invalid field name.

Signed-off-by: Artem Belevich <artemb@gmail.com>
2019-06-02 11:41:15 -04:00
Kevin O'Connor f96239019a mcu: Support a start value for soft pwm pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-02 10:59:33 -04:00
Kevin O'Connor 3e1c42da80 thermistor: Add support for printers with an "inline_resistor"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-02 10:59:23 -04:00
Kevin O'Connor 02eeb72713 manual_probe: Verify no XY moves since start of manual probe
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-31 10:24:52 -04:00
Kevin O'Connor c54b8da530 gcode: Add support for SAVE_GCODE_STATE and RESTORE_GCODE_STATE commands
Add commands to save and restore the current g-code state.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-31 10:23:56 -04:00
Kevin O'Connor 6903ab87ca tmc2130: Add support for two's complement signed fields to FieldHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-29 09:33:51 -04:00
Kevin O'Connor 2cff3291c0 gcode: Rename absolutecoord/extrude to absolute_coord/_extrude
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-26 21:00:15 -04:00
Kevin O'Connor 862b97ce8f gcode: Fix SET_GCODE_OFFSET MOVE_SPEED parameter
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-26 20:04:50 -04:00
Kevin O'Connor 423bbada84 gcode: Minor code change to M206 to make the math similar to SET_GCODE_OFFSET
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-26 12:37:14 -04:00
Kevin O'Connor d6b69938ab gcode: Don't apply the SET_GCODE_OFFSET to the next g-code command
The SET_GCODE_OFFSET command could cause unwanted behavior when an
offset is applied to the following g-code command.  (In particular,
when the following command is an extrude only move - as in
issue #1289.)

Don't apply the offset immediately.  Instead, add support for a MOVE=1
parameter which will schedule a move to apply the given offset.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-26 11:19:15 -04:00
Kevin O'Connor 7702cc2972 bltouch: Update command timing
Prior to the BLTouch v3, the recommended command times were 700us
(pin_down), 1200us (touch_mode), 1500us (pin_up), 1800us (self_test),
and 2200us (reset).  However, the recommended Marlin timing (via servo
"angles") was 647.111, 1162.667, 1472, 1781.333, and 2193.778us.

As of the BLTouch v3, the recommended times are now 650, 1165, 1475,
1780, and 2190us.  The v3 continues to recommended Marlin timings of
647.111, 1162.667, 1472, 1781.333, and 2193.778us.

Update Klipper to use the new BL-Touch v3 recommended timing.  The new
timings are required for the BL-Touch v3 and they are closer to what
the Marlin firmware has historically used.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-26 11:09:32 -04:00
Kevin O'Connor 8532e2123e gpiocmds: Specify soft pwm duration in clock ticks
Improve the precision of soft pwm pulses by allowing the host to
directly specify the clock duration of the pulse.  This improvement in
precision may be noticeable when controller servos (and bltouch).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-26 11:09:32 -04:00
Kevin O'Connor 8cd8cb492e buttons: Minor code movement
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-26 00:18:48 -04:00
Kevin O'Connor 772ad53e20 manual_probe: Make sure the nozzle has moved during a manual probe
Make sure the TESTZ procedure is followed prior to accepting a manual
probe.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-24 22:54:35 -04:00
Kevin O'Connor 7792b0f2bb gcode: Store internal speed in mm/s
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-24 19:37:08 -04:00
Kevin O'Connor b8a4cf7701 gcode: Add '_' prefix to internal methods
Mark methods internal to gcode.py with an underscore so that it is
easier to see which functions are purely helper functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-24 18:45:18 -04:00
Kevin O'Connor 6268c702e5 spi_temperature: MAX6675 and MAX31855 should use spi mode 0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-22 11:40:53 -04:00
fess 260e4f54cf quad_gantry_level: Require exactly 4 probe points
quad_gantry_level requires exactly 4 probe points assert as much at
config time.

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-05-21 14:17:09 -04:00
fess 7d2e3de977 z_tilt: minimum points 2
"The z_tilt_adjust was coded to require 3 points because the original
intent was for railcore-xl and voron.  Since then, a number of users
have started using z_tilt_adjust for prusa i3 style printers with dual z
steppers.  That's fine, but we just haven't gotten around to removing
the superfluous check in the code." -- Kevin O'Connor

remove that check.

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-05-21 14:17:09 -04:00
fess 9887e72570 probe: ProbePointsHelper adjustable minimum points
Factor out minimum required points check for ProbePointsHelper
in prep for setting different values for quad_gantry_level
and z_tilt_adjust

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-05-21 14:17:09 -04:00
Kevin O'Connor 84bae6ff41 mcu: Fix reserve pin check
Fix typo causing conflict with mcu name and constant name.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-21 09:40:13 -04:00
LyleCheatham 1235972b77 util: Ignore errors in clear_hupcl (allows OSX to run)
Signed-off-by: Lyle Cheatham <hello@lylecheatham.com>
2019-05-20 16:49:42 -04:00
Stephan de7ead1783 tmc5160: Add support for TMC5160 steppers (#1637)
Signed-off-by: Stephan Oelze <stephan.oelze@gmail.com>
2019-05-20 16:29:37 -04:00
alfsoft 777013da4f menu: Changed Menu item "Feed Filament" name (#1609)
"Feed Filament" menu item value was off-screen that made this item useless. So I changed its name to just "Feed". Users shall easily guess that this item is for filament feeding because this item is located in "Filament" menu.

Signed-off-by: Alexander Fadeev <alfsoft@gmail.com>
2019-05-09 14:41:37 -04:00
fess 0a9e3b744c quad_gantry_level: Limit maximum adjustment
safety feature that prevents quad_gantry_level from trying to do a
correction that might break things - if your probe fires early for
whatever reason and tries to do an 8mm correction in one corner instead
we abort if a correction is over a configurable limit by default 4mm

configurable via `max_adjust` parameter in the config

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-05-01 14:35:24 -04:00
fess af78d854ac quad_gantry_level: More compact info messages
In particular trying to keep the output from a single quad_gantry_level
so that it fits in the octoprint terminal window without the need to
scroll

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-05-01 14:34:10 -04:00
Martin Nowroth 60bc93f36b temperature_fan: Add gcode command for temperature_fan.py (#1520)
Adding gcode command for setting the target temperature of temperature_fan.
Example gcode: SET_TEMPERATURE_FAN_TARGET temperature_fan=chamber target=35.0

Signed-off-by: Martin Nowroth <madnoth@gmail.com>
2019-04-15 21:13:29 -04:00
Len Trigg 1102c6c232 tsl1401cl_filament_width_sensor: Fix incorrect math in filament width sensor. (#1541)
The parameter to the M221 command should be the ratio of the nominal to
measured filament area, rather than the ratio of the diameters. Since we
are taking the ratio, most of the area calculation cancels out.

Fixes #1535.

Signed-off-by: Len Trigg <lenbok@gmail.com>
2019-04-15 21:11:26 -04:00
Dmitry 1b92af6078 display: Add ST7567 display support (#1540)
Signed-off-by: Dmitry Budaev <condemil@gmail.com>
2019-04-15 21:07:29 -04:00
Trevor Jones 9cb21de68e virtual_sdcard: consistent sorting (#1387)
Signed-off-by: Trevor Jones <trevorjones141@gmail.com>
2019-04-14 11:34:22 -04:00
Daniel 7373e92092 serialhdl: Enforce exclusive access on POSIX, this is default behavior on windows. (#1216)
Signed-off-by: Daniel Joyce <daniel.a.joyce@gmail.com>
2019-04-14 11:27:43 -04:00
Janar Sööt 0a392b6543 menu: initial support for analog buttons (#977)
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-04-14 11:18:52 -04:00
Kevin O'Connor d7e1061c63 bus: Don't reserve any pins if BUS_PINS_x is not defined
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-07 20:43:23 -04:00
Janne Grunau 478a916f51 replicape: add support for Linux hardware PWM (#1443)
The servo pins (P9_14/P9_16) are muxed to the SOCs hardware PWM unit
driven by a 13MHz GP timer. They have to be driven by the linux host
mcu. This commits adds hardware PWM support using the linux sysfs
user space interface.

The servo pins can be specified as "replicape:servo0" and
"replicape:servo1". Removes the "servo0_enable", "servo1_enable"
configuration parameters.
Fixes #1105.

Signed-off-by: Janne Grunau <janne-3d@jannau.net>
2019-04-06 13:51:51 -04:00
Kevin O'Connor 516fbf4f32 klippy: Report the underlying error on an internal error during connect
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:38:46 -04:00
Kevin O'Connor 79ecee0996 homing_override: Use gcode_macro style templates on gcode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:35:23 -04:00
Kevin O'Connor 7d246e2624 probe: Use gcode_macro style templates on activate/deactivate_gcode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:35:23 -04:00
Kevin O'Connor 486c07c190 gcode_macro: Evaluate macros using Jinja2 template engine
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:35:23 -04:00