Commit Graph

2252 Commits

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