Commit Graph

1350 Commits

Author SHA1 Message Date
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