Commit Graph

2355 Commits

Author SHA1 Message Date
Kevin O'Connor d23c1b06c6 gcode: Fix Python3 syntax error
Fix error introduced in d6c3aaad.  Also, go back to only accepting
ascii characters on input.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-31 14:15:32 -04:00
Kevin O'Connor ccee189f99 palette2: Use regular str() types for input on Python2
Avoid using unicode() types on Python2 as it can lead to subtle
errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-31 13:52:31 -04:00
Kevin O'Connor 1dee974aea serialhdl: Use regular str() type for stats on Python2
Avoid using unicode() types on Python2 as it can lead to subtle
errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-31 13:52:31 -04:00
Kevin O'Connor fc5353364a util: Use regular str() type in get_git_version() on Python2
Avoid using unicode() types on Python2 as it can lead to subtle
errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-31 13:52:31 -04:00
Kevin O'Connor 7a6fd1a1aa console: Use regular str() types for commands on Python2
Avoid using unicode() types on Python2 as it can lead to subtle
errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-31 13:52:31 -04:00
Kevin O'Connor d6c3aaad8a gcode: Use regular str() types for g-code commands on Python2
Avoid using unicode() types on Python2 as it can lead to subtle
errors.

Also, accept utf8 on gcode input (instead of just ascii).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-31 13:51:52 -04:00
Eric Callahan d90c3bc57a idle_timeout: exit the timer if the printer is shutdown
This resolves an issue where the timer can get stuck
in an attempt to transition from Ready to Idle if
the printer is shutdown.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-29 18:39:47 -04:00
Kevin O'Connor cf4bfb1119 tmc: Rename handle_stepper_enable() method to _handle_stepper_enable()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-29 11:56:44 -04:00
Kevin O'Connor 14bdc8e569 stepper: Remove unused _dist_to_time() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-29 11:41:59 -04:00
Kevin O'Connor 86fee2d517 tmc: Track requested hold_current so SET_TMC_CURRENT doesn't reduce it
The code automatically reduces the hold_current so that it is no
greater than the run_current.  However, this could lead to confusing
behavior if one reduced and then increased the run_current via
SET_TMC_CURRENT commands.  To avoid that, this change adds support for
tracking the requested hold_current - thus changes to run_current
don't subtly alter the hold_current.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-27 12:13:38 -04:00
Kevin O'Connor 573fceefeb input_shaper: Fix python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-26 20:01:33 -04:00
Kevin O'Connor b62171f350 input_shaper: Restore shaper_type config option
The shaper_type config option got removed in commit d5a7a7f0 - restore
that option.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-26 18:06:11 -04:00
Dmitry Butyugin 54e21a7c26 input_shaper: Factored out AxisInputShaper class
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-10-26 16:14:50 -04:00
Dmitry Butyugin d5a7a7f00f input_shaper: Define input shapers in a single place in Python code
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-10-26 16:14:50 -04:00
Eric Callahan ec2116b4f7 temperature_sensor: round reported temps to 2 decimal places
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-15 18:01:19 -04:00
Eric Callahan cd58a945e2 temperature_host: round reported temps to 2 decimal places
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-15 18:01:19 -04:00
Eric Callahan bf598d0922 lm75: round reported temps to 2 decimal places
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-15 18:01:19 -04:00
Eric Callahan 916ef4483a htu21d: round reported temps to 2 decimal places
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-15 18:01:19 -04:00
Eric Callahan e65b2593c6 heaters: round reported temps to 2 decimal places
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-15 18:01:19 -04:00
Eric Callahan 1153803360 ds18b20: round reported temps to 2 decimal places
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-15 18:01:19 -04:00
Eric Callahan c499451ab8 bme280: round reported temps to 2 decimal places
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-15 18:01:19 -04:00
Dmitry Butyugin 91466ebd43 adxl345: Renamed decode_samples and fixed/added checks on empty data
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-10-13 11:56:52 -04:00
Philipp Temminghoff 64e4649877
tmc: add current values to get_status() (#4696)
Signed-off-by: Philipp Temminghoff <philipptemminghoff@gmail.com>
2021-10-11 12:03:08 -04:00
Kevin O'Connor afd1058af6 delta: Don't limit XY+Z moves to max_z_velocity
Scale the max_z_velocity limit by the amount of movement in the Z.
This should improve bed_mesh and vase mode prints on delta printers.

Reported by @hywelmartin and @dalegaard.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-11 11:53:00 -04:00
Rufo Sanchez b336a21fe7 button: Support half-stepping encoders
Adds support for half-stepping encoders (encoders that only emit two
steps per detent, instead of four). Incorporates the feedback from
@susisstrolch's PR: https://github.com/KevinOConnor/klipper/pull/4202
, which was itself built upon a previous PR from @nickbrennan01:
https://github.com/KevinOConnor/klipper/pull/730

Uses the table from the Rotary Arduino library linked in buttons.py:
6b784cca67/Rotary.cpp (L21-L40)

Signed-off-by: Rufo Sanchez <rufo@rufosanchez.com>
2021-10-11 11:29:53 -04:00
Kevin O'Connor c56c34fa1c configfile: Use Python2's ConfigParser when running on Python2
The backport of Python3's configparser causes issues when there is
unicode characters in the config file.  To avoid introducing new
errors, go back to using the Python2 version of ConfigParser when
running on Python2.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-09 19:37:48 -04:00
Kevin O'Connor 21d5a34d22 console: Fix Python2 compatibility
Make sure to import util prior to reactor.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-08 13:00:11 -04:00
Kevin O'Connor 5251bf23f1 configfile: Workaround for non-ascii comments on Python2
Explicitly specify the comment_prefixes as regular Python2 strings -
otherwise the configparser wont ignore non-ascii characters in
comments.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-08 00:23:31 -04:00
Kevin O'Connor 64cb8d9820 ds18b20: Improve Python3 compatibility
Reported by @matthewlloyd.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-07 14:47:49 -04:00
Dmitry Butyugin 2822680eb4 adxl345: Expanded invalid adxl345 id message
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-10-06 21:17:56 -04:00
Dmitry Butyugin bd5dc03317 adxl345: Renamed debug commands to fix their parsing by Klipper
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-10-06 21:16:31 -04:00
Kevin O'Connor c7b65f50e3 configfile: Ignore trailing comments starting with a semicolon
Newer versions of configparser no longer default to ignoring trailing
comments that start with a semicolon.  Add that setting explicitly to
avoid breaking existing config files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-06 14:07:32 -04:00
Kevin O'Connor cc63fd51b2 scripts: Use backport of a recent Python3 configparser on Python2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-04 15:10:46 -04:00
Kevin O'Connor 41d42a07bf klippy: Add a build import test tool
Add a test case to verify that every optional module successfully
loads on both Python2 and Python3.  This is intended to catch syntax
and module imports that are not compatible between Python versions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-04 14:36:08 -04:00
Kevin O'Connor f1747b5118 klippy: Add Python2 module wrappers and use Python3 module naming
Add wrappers for some common Python modules so that the code can run
on both Python2 and Python3.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-04 14:36:08 -04:00
Kevin O'Connor b8c91914b7 webhooks: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-04 14:36:08 -04:00
Kevin O'Connor adeb869f56 gcode: Convert to Python3 string encoding
The error checking is not complete in this change - the code should
handle the case where an input string is not valid utf8.

The code will continue to run on Python2 after this change, however
the execution time on Python2 is measurably slower after making this
change.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 21:00:03 -04:00
Kevin O'Connor 8714282570 console: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:22:13 -04:00
Kevin O'Connor b3a39bebd4 virtual_sdcard: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:22:13 -04:00
Kevin O'Connor 0da3d84a87 configfile: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:22:13 -04:00
Kevin O'Connor b859c11378 util: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:22:13 -04:00
Kevin O'Connor 2978771ce5 mcu: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:22:13 -04:00
Kevin O'Connor fa25986adc reactor: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:18:58 -04:00
Kevin O'Connor 0fc52f9496 serialhdl: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:12:42 -04:00
Kevin O'Connor de38ef4290 kinematics: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:12:30 -04:00
Kevin O'Connor 68b939c756 display: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:12:21 -04:00
Kevin O'Connor bcbdc983a8 screws_tilt_adjust: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-30 13:14:20 -04:00
Kevin O'Connor 01ab8267a6 hybrid_corexy: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-30 13:10:45 -04:00
Kevin O'Connor af86c5f306 fan: Improve python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-30 13:10:45 -04:00
Kevin O'Connor 164060ccfe stepper: Make sure to report an error if endstop_pin is not defined
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-29 20:10:57 -04:00
Kevin O'Connor 1eecd412ef motion_report: Fix typo causing error reports to not propagate
The APIDumpHelper._start() method should propagate errors to its
caller.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-26 12:21:36 -04:00
Kevin O'Connor 46167cae67 configfile: Add support for reporting deprecated options
Add a new printer.configfile.warnings with a list of config features
that are deprecated.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-16 13:44:54 -04:00
Kevin O'Connor c89db2480d configfile: Setup get_status() results after check_unused_options()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-16 13:44:54 -04:00
Kevin O'Connor c84956befe heaters: Change default smooth_time from 2 seconds to 1 second
A larger smooth_time results in a slower reaction time for the PID.
This increased delay can cause temperature oscillations with high
power heaters.  Many boards produce good results without any
smoothing.  So, it seems a smooth_time of 1 second is a better
default.

Reported by @ReXT3D.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-03 18:11:05 -04:00
github@matthewlloyd.net 830c80a88a tuning_tower: Add STEP_DELTA and STEP_HEIGHT parameters as alternate tuning tower syntax
Signed-off-by: Matthew Lloyd <github@matthewlloyd.net>
2021-09-02 12:05:31 -04:00
github@matthewlloyd.net 286cc1becc tuning_tower: Add SKIP parameter
Signed-off-by: Matthew Lloyd <github@matthewlloyd.net>
2021-09-02 12:05:31 -04:00
Kevin O'Connor d7b04aa18f delta: Make the 'arm_length' description more clear in save_state()
Reported by @conlank.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-02 11:46:33 -04:00
Stefan Dej 3a497d04ac
toolhead: change SET_VELOCITY_LIMIT respond (fixed) (#4620)
Returns only the current values if no new ones have been passed.

Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-08-31 13:37:48 -04:00
Lasse Dalegaard caec91b149 stepper: detect duplicate endstops
When adding steppers to a `PrinterRail`, detect duplicated `endstop_pin`
settings and add them to the already-registered endstop.

Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
2021-08-31 13:23:04 -04:00
Kevin O'Connor dcf8cb82a3 tmc: Fix typo in get_status()
Fix missing variable assignement introduced in commit 5fd1c985.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 14:17:42 -04:00
Kevin O'Connor 0b4fbc78a8 adxl345: Allow multiple simultaneous clients
It is now possible to have multiple tools gathering adxl345 data at
the same time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:26:39 -04:00
Kevin O'Connor 404b64fd62 adxl345: Change default chip name from "default" to "adxl345"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:26:36 -04:00
Kevin O'Connor 22167f9510 adxl345: Compress each sample from 6 bytes to 5 bytes
Transmit data from mcu to host using 5 bytes per sample and up to 10
samples per message block.  This improves bandwidth efficiency.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:25:50 -04:00
Kevin O'Connor e34137582d adxl345: Implement timing via new adxl345_status messages
Query the adxl345 message counter every 100ms so that accurate timing
can be obtained during measurements.  This allows the adxl345 data to
be exported with timestamps while captures are running.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:25:50 -04:00
Kevin O'Connor dd95f80d9d adxl345: Support querying accelerometer data from webhooks interface
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:25:50 -04:00
Kevin O'Connor d87f7a77c3 adxl345: Add new start_internal_client() function and use in callers
Introduce a new start_internal_client() function and change all client
code to use that instead of manually calling start_measurements() and
finish_measurements().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:25:50 -04:00
Kevin O'Connor 8cfaed441d adxl345: Always initialize device on start_measurements() call
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:25:50 -04:00
Kevin O'Connor e03e0e9dac adxl345: Move g-code commands to new helper class
Separate out the G-Code command handlers to a new ADXLCommandHelper()
class.  This helps separate the sensing code from the user interface
code.

Deprecate the RATE parameter of the ACCELEROMETER_MEASURE command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:25:45 -04:00
Kevin O'Connor 6999ff6256 motion_report: Add helper tool for internal subscribers of data
Add support for internal clients to "subscribe" to data like external
clients.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:12:11 -04:00
Kevin O'Connor 5fd1c9853d tmc: Add support for a get_status() method
Export mcu_phase_offset and drv_status information.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-30 12:00:46 -04:00
Kevin O'Connor 950477849d mcu: Support multi-mcu homing
Support endstops and probes attached to a different micro-controller
than their associated steppers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-28 16:08:57 -04:00
Kevin O'Connor 2e131497ca homing: Fix error in retract move causing "must home axis" errors
It's possible for the original homing move of an axis to alter the
position of other axes.  Make sure those other axes are not requested
to move on a subsequent second home retract move, as that could cause
an error if those other axes have not been homed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-28 15:45:11 -04:00
Kevin O'Connor 8d4d16d51a manual_stepper: Add missing calc_position() wrapper call
Commit 3814a132 added code to homing.py to call calc_position() - add
that function to manual_stepper.py .

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-26 12:23:12 -04:00
Kevin O'Connor 84ac5b0146 configfile: Support config.getchoice() with integer keys
If the choice mapping uses integer keys then lookup the config option
using self.getint().  This simplifies the callers and improves the
encoding of the printer.configfile.settings export.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-25 10:36:45 -04:00
Kevin O'Connor 75183bfb86 Revert "toolhead: change SET_VELOCITY_LIMIT respond behavior"
This reverts commit 9f75e348b0.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-24 12:34:00 -04:00
stefand 9f75e348b0 toolhead: change SET_VELOCITY_LIMIT respond behavior
Returns only the current values if no new ones have been passed.

Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-08-24 10:49:31 -04:00
Kevin O'Connor 2fdd8a420d motion_report: Add support for dumping steps/trapq via API server
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-22 11:10:19 -04:00
Kevin O'Connor cf2e941aec webhooks: Add register_mux_endpoint() helper function
Add ability to register an endpoint that invokes a handler based on a
parameter in the request.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-22 11:10:19 -04:00
Kevin O'Connor 809f1ccea6 stepper: Add mcu_to_commanded_position() method
Convert stepper.get_past_commanded_position() to the more general
stepper.mcu_to_commanded_position().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-22 11:10:19 -04:00
Kevin O'Connor f2d10b5729 tmc: Use config.getint() when reading microstep setting
Don't use config.getchoice() as that results in a string reported by
printer.configfile.settings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-22 10:50:18 -04:00
Kevin O'Connor e5d5c25154 bed_mesh: Use config lists
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor fe1b2f5124 tmc_uart: Use config.getlist() for select_pins config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 31564f3b43 static_digital_output: Use config.getlist() for pins config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 92e1821423 multi_pin: Use config.getlist() for pins config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor e784c19a96 duplicate_pin_override: Use config.getlist() for pins config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 8f7eedd95e board_pins: Use config list helpers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 8a59de9431 z_tilt: Use config.getlists() for z_positions config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor d0e4b03739 safe_z_home: Use config.getfloatlist() for home_xy_position config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor d82dc1e844 resonance_tester: Use config.getlists() for probe_points config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 2461b30a6a quad_gantry_level: Use config.getlists() for gantry_corners config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 8a556f2581 homing_heaters: Use config.getlist() for heaters and steppers config options
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 65fb494e77 heater_fan: Use config.getlist() for heater config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 8f85786b3f gcode_button: Use config.getfloatlist() for analog_range config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 7f82dcb442 endstop_phase: Use config.getintlist() for trigger_phase config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 58dedb6b16 menu_keys: Use config.getfloatlist() for analog_range_ config options
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor ab023bb61d delta_calibrate: Use config.getfloatlist() for parsing "stable positions"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor 99b0cacf3b controller_fan: Use config.getlist() for heater and stepper config parameters
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:11 -04:00
Kevin O'Connor d3484efe73 probe: Use config.getlists() for points config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:10 -04:00
Kevin O'Connor 673ecec6a2 screws_tilt_adjust: Use config.getfloatlist() for coordinates config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:10 -04:00
Kevin O'Connor a546415884 bed_screws: Use config.getfloatlist() for coordinates config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:10 -04:00
Kevin O'Connor 3ef6e2ba56 adxl345: Use config.getlist() for axes_map config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:10 -04:00
Kevin O'Connor 67d99fe8a8 stepper: Use config.getlists() for gear_ratio config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:10 -04:00
Kevin O'Connor f9ca5b9098 configfile: Add helpers for parsing list of parameters from the config
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-21 18:08:10 -04:00
Eric Callahan c64ea474d7 webhooks: log client requests on shutdown
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-08-21 15:00:29 -04:00
Kevin O'Connor 65ed55a43b endstop_phase: Calculate phase based on trigger position
Update the endstop_phase code to use the phase of the stepper motor at
the endstop trigger time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-17 22:35:59 -04:00
Kevin O'Connor 3814a13251 homing: Calculate homing position based on trigger time
Calculate the "homing position" using the endstop trigger time instead
of the position of the steppers.

This is in preparation for multi-mcu homing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-17 22:35:59 -04:00
Kevin O'Connor 1dc2ab048f mcu: Return time of trigger from home_wait()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-17 22:01:23 -04:00
dawidmpunkt b4ee93043a
htu21d: Update htu21d.py (#4520)
Line 202: should be self.humidity instead of self.temp

Signed-off-by: Dawid Murawski <dawid.m@gmx.net>
2021-08-17 15:52:47 -04:00
Randell Hodges f313a2294a
bed_mesh: Added PROFILE name option (#4522)
Added optional PROFILE parameter to allow bed_mesh_calibrate to
save the mesh directly into the provided profile name instead of
default. If omitted, it will be stored in default.

Signed-off-by: Randell L Hodges <rhodges@taxfodder.com>
2021-08-17 15:30:14 -04:00
Pascal Pieper 73a7840697 output_pin: fix time difference calculation
Signed-off-by: Pascal Pieper <accounts@pascalpieper.de>
2021-08-17 14:45:53 -04:00
chrenderle afd80c1de9
bed_screws: Finish bed_screws_adjust after n consecutive accepts (#4521)
Changed the bed_screws_adjust command so that it finishes after 4
consecutive accepts. Before if you had 4 screws and adjusted the
first one you had to accept 7 times to finish the bed_screws_adjust.

Signed-off-by: Christian Enderle <mail@chrenderle.de>
2021-08-17 13:56:43 -04:00
Kevin O'Connor 1aa4becc60 bed_mesh: Fix off-by-one error in faulty region error report
Reported by @craiglink.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-17 12:05:59 -04:00
Kevin O'Connor e3cf8fc819 motion_report: Fix typo causing incomplete queries
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-17 00:10:44 -04:00
Kevin O'Connor cf3c7cd99a avr: Rename the analog-only PE0/PE1 pins on atmega168/328 to PE2/PE3
The atmega328pb has officially named these pins as PE2 and PE3, so use
that naming scheme instead of the previous Klipper invented names.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-14 22:00:17 -04:00
Kevin O'Connor f759df3cd7 endstop_phase: Convert to using tmc mcu_phase_offset
Now that the TMC drivers track the phase offset, use that to implement
endstop phase.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-08 22:28:10 -04:00
Kevin O'Connor 06b8169f56 tmc: Track offset between tmc driver and mcu position
Track the offset between driver phase and mcu position.  This offset
should be constant as long as neither the driver nor the mcu is reset.
If the offset ever changes, log a warning.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-08 22:28:10 -04:00
Kevin O'Connor c2bfeb60aa tmc: Move stepper phase reading code to TMCCommandHelper class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-06 13:12:49 -04:00
Kevin O'Connor 24586f0c31 stepper: Query the stepper mcu position during startup
Try to keep the host mcu_position synchronized with the
micro-controller by querying during startup and after every homing
event.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-06 13:12:49 -04:00
Kevin O'Connor 33dcb38297 tmc: Consistently use lower case for all TMC field names
The Trinamic specs aren't consistent with upper vs lower case, which
can be confusing.  Improve clarity by using lower case names
consistently in the code.  Register names will continue to use all
upper case naming in the code.

Update the SET_TMC_FIELD command to automatically convert field names
to lower case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-06 13:12:49 -04:00
Kevin O'Connor a52a627893 tmc2208: Send pdn_disable UART setup as first command to chip during init
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-06 13:12:49 -04:00
Kevin O'Connor fa7a91a38b homing: Improve error messages on a printer shutdown during homing
If a shutdown occurs during homing, make sure any follow up errors are
clear that the cause of the error is the shutdown.  This suppresses
the confusing "Unable to obtain 'trsync_state' response" messages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-06 13:05:09 -04:00
Kevin O'Connor afada5e79e trapq: Prune interrupted moves from history on trapq_set_position()
It is possible for a homing move to not fully complete.  Fixup the
trapq history to make processing of the history easier for callers.
Similarly, do not add artificial "null" moves to the trapq history.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-06 12:22:07 -04:00
Kevin O'Connor b17ec3d2e9 stepcompress: Pass clock to stepcompress_set_last_position()
Using sc->last_step_clock for the last position marker does not work
properly, because the stepper.py code calls stepcompress_reset() prior
to calling stepcompress_set_last_position().  Fix by passing an
explicit clock to stepcompress_set_last_position().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-06 11:19:36 -04:00
shiftingtech 36e3969219
probe: bugfix to z_offset_apply_probe (#4553)
Command was accessing the wrong variable for the existing z offset,
leading to bad behavior.

Signed-off-by: Ben Eastep <shifting@shifting.ca>
2021-08-02 16:08:19 -04:00
Tircown a143921534
idex_modes: Fix get_status (#4550)
Fix get_status to be called without eventtime parameter.

Signed-off-by: Fabrice GALLET <tircown@gmail.com>
2021-08-01 15:10:45 -04:00
Kevin O'Connor 69d9497df3 webhooks: Remove spaces from json messages sent on api server
Reduce the bandwidth slightly by removing unnecessary spaces in
messages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:54:21 -04:00
Kevin O'Connor 60aa05829f motion_report: Add get_status() method with current requested toolhead position
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:53:32 -04:00
Kevin O'Connor 38766c367f motion_report: Add new extras module for low-level motion diagnostics
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kevin O'Connor f0dbeb0493 stepper: Simplify helper module registration of stepper motors
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kevin O'Connor c632b377ca mcu: Support returning the mcu reported shutdown time
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kevin O'Connor cbd5680ae0 extruder: Add get_trapq() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kevin O'Connor 7013a7b15f stepcompress: Support extracting stepcompress history
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kevin O'Connor fbfa31a3c3 stepcompress: Rename 'struct history_move' to 'struct history_steps'
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kevin O'Connor 07f0ecb4d0 trapq: Store toolhead.set_position() updates in trapq history
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kevin O'Connor 45c232b2c7 trapq: Keep history of recent trapq moves
Store trapq moves in a separate "history" list after each move is
nominally expired.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kevin O'Connor e2f483aea3 trapq: Rename trapq_free_moves() to trapq_finalize_moves()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kevin O'Connor d1b41ea4a1 force_move: Note force_enable() and restore_enable() are internal functions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-29 16:35:30 -04:00
Kamil Trzcinski 7e88f9220c menu: fix crash when opening SDCard menu while printing
This fixes the bug introduced by f1091a484b.
The problem is that condition was returning string which
could not be converted to boolean. We solve that by showing
`Start Printing` when `is_active`.

```
ERROR:root:Unhandled exception during run
Traceback (most recent call last):
   ...
   File "/opt/klipper/klippy/extras/display/menu.py", line 117, in eval_enable
     return bool(ast.literal_eval(self._enable_tpl.render(context)))
   File "/usr/lib/python2.7/ast.py", line 49, in literal_eval
     node_or_string = parse(node_or_string, mode='eval')
   File "/usr/lib/python2.7/ast.py", line 37, in parse
     return compile(source, filename, mode, PyCF_ONLY_AST)
   File "<unknown>", line 1
     /opt/octoprint/uploads/wait_print.gcode
```

Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
2021-07-26 22:34:43 -04:00
shiftingtech f949bc882d
probe: add ability to save babystepping (#4404)
Created two new extended gcodes: Z_OFFSET_APPLY_ENDSTOP, and Z_OFFSET_APPLY_PROBE.
These use the z gcode offset to revise the probe offset, or z endstop position
allowing users to make a frequently used babystepping value permanent without
manual config editing.

Signed-off-by: Ben Eastep <shifting@shifting.ca>
2021-07-25 20:20:15 -04:00
Kevin O'Connor 0075b29081 tmc_uart: Increase default UART rate to 40000 on 32bit MCUs
A higher UART baud rate will allow for faster transfers and may result
in more stable operation in general.  Increase the baud to 40000 on
32bit MCUs and leave the baud at 9000 baud for 8bit AVR MCUs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-23 13:37:20 -04:00
Kevin O'Connor b4fec8502c tmc2209: Set SENDDELAY=2 to avoid uart rx/tx errors
It looks like the tmc2209 chips have increased uart errors with the
default SENDDELAY of zero.  Increasing the SENDDELAY to two seems to
work around this issue.

Reported by @ReXT3D.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-23 13:37:20 -04:00
Justin Schuh bb801905be spi_flash: Make SD updates more tolerant of flaky boards
Validation passes if either of the following succeeds (in order):
1. Active firmware's raw dictionary changed after update
2. Checksum of firmware.cur matches expected

Additionally, deletes firmware.bin if found after update succeeds.

Signed-off-by: Justin Schuh <code@justinschuh.com>
2021-07-20 18:05:05 -04:00
Kevin O'Connor 103dcf27ff controller_fan: Minor updates
Document change in behavior of the controller_fan module.

Lookup heater objects in connect() event handler.

Return list of stepper names from stepper_enable.get_steppers().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-20 10:34:14 -04:00
Sophie Hirn de57ce3a99
controller_fan: Add "stepper" config option (#4447)
Allows contoller_fan sections to monitor only certain steppers instead of
all of them, similar to how heaters are currently handled.

Signed-off-by: Sophie Hirn <sophie.hirn@wyvernscale.com>
2021-07-20 10:19:59 -04:00
Kevin O'Connor f24210054a mcu: Set reqclock on trsync_start commands
Set the reqclock on trsync commands to ensure those commands do not
cause 32-bit timer rollover errors.  Otherwise, it may result in
"Timer too close" errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-09 14:34:38 -04:00
Dmitry Butyugin 1128e9179b resonance_tester: Arbitrary AXIS in TEST_RESONANCES command
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-07-08 11:00:23 -04:00
Kevin O'Connor 59fe878241 rp2040: Add initial adc support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 10:11:02 -04:00
Kevin O'Connor d1bdde56cc samd_sercom: Specify the sercom explicitly in a config option
Do not infer the sercom from the config section name, as that
prevents one from using SPI buses on multiple samd mcus.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-04 09:48:45 -04:00
Kevin O'Connor df43c9e9bf stepper_enable: Move pin handling out of EnableTracking class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-03 23:58:40 -04:00
Kevin O'Connor 57bd1c6b9f stepper: Minor indentation changes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-07-03 23:58:40 -04:00