Commit Graph

2177 Commits

Author SHA1 Message Date
Pascal Pieper 99fe290753 mcu: Support reserving move queue slots
Signed-off-by: Pascal Pieper <accounts@pascalpieper.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Kevin O'Connor 086f0fafde gpiocmds: Send soft pwm cycle_time separately from schedule_soft_pwm_out
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-04 16:10:13 -05:00
Kevin O'Connor 14952ccef5 docs: Add links to default display.cfg and menu.cfg in Config_Reference.md
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-03 18:11:29 -05:00
Kevin O'Connor 23f547169c rpi_temperature: Don't read min_temp/max_temp directly from config
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-03 12:37:56 -05:00
Al b911db4c0d
rpi_temperature: New module to monitor RPi temperature (#3587)
Module to monitor RPi cpu temperature

Signed-off-by: Al Crate <aleph@al3ph.org>
2020-12-03 12:35:37 -05:00
Kevin O'Connor d7053f6e71 save_variables: Support saving variables to a disk file
Signed-off-by: Dushyant Ahuja dusht.ahuja@gmail.com
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-03 12:19:47 -05:00
Janar Sööt 91de1560a7
menu: modifications (#3262)
- remove lot of helper methods
- differentiate class instantiate from config or directly
- don't use 'enable' template rendering when static value is used.
- new element 'disabled'
- other internal adjustments

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2020-12-03 10:46:55 -05:00
Kevin O'Connor 1f4c52e7db serialhdl: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 12:40:13 -05:00
Kevin O'Connor a4f7ad9ffc heater_fan: Fix typo causing excessive cpu usage
Commit error introduced in a7e90504 and f261a468.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 12:31:22 -05:00
Kevin O'Connor f261a4688b controller_fan: Improve timing of fan commands
Don't use the reactor eventtime to schedule micro-controller commands
as that time may have low accuracy.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 11:51:29 -05:00
Kevin O'Connor a7e9050439 heater_fan: Improve timing of fan commands
Don't use the reactor eventtime to schedule micro-controller commands
as that time may have low accuracy.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 11:51:24 -05:00
Kevin O'Connor f90fbb56d2 input_shaper: Simplify input shaper type reporting
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 11:36:37 -05:00
Kevin O'Connor 6ead8dd9d9 lm75: Start temperature measurements from "klippy:connect" callback
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 11:36:37 -05:00
Kevin O'Connor 52c6ba3bb5 htu21d: Start temperature measurements from "klippy:connect" callback
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 11:36:37 -05:00
Kevin O'Connor 69f06054e1 bme280: Start temperature measurements from "klippy:connect" callback
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 11:36:37 -05:00
Kevin O'Connor f3fd814ce0 neopixel: Don't wait for responses when in debug mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 11:36:37 -05:00
Kevin O'Connor 1af28d8a79 webhooks: Improve python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-12-01 11:07:36 -05:00
Stefan Dej 7266473fec
controller_fan: add get_status (#3566)
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2020-11-23 11:55:14 -05:00
Kevin O'Connor 665ec5e987 spi_temperature: Fix incorrect max31856 spi initialization
Writes to the max31856 chip use "burst mode", so only one address
during the initialization sequence can be sent.  This fixes erroneous
"Cold Junction Fault" errors.

Reported by @NBouquain.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-23 09:58:42 -05:00
Martin Hierholzer fcb78e50e5
hd44780: allow to configure line length (#3543)
This allows to use 16x4 displays rather than only 20x4.

Signed-off-by: Martin Hierholzer <hier@beta-centauri.de>
2020-11-20 14:49:38 -05:00
Kevin O'Connor bdd938b578 board_pins: Use an explicit parameter to specify mcu name(s)
Add an 'mcu' option to the board_pins config and use that to specify
the name of the mcu to apply the aliases to.  Support applying the
aliases to multiple mcus.

Add support for any number of options starting with an "aliases_"
prefix.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-20 12:00:36 -05:00
Kevin O'Connor 15b5dbaf8f docs: Move config reference information to new Config_Reference.md
Move all the config reference information from files in the config/
directory to a new Config_Reference.md document.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-18 20:10:21 -05:00
Arksine 5970227cbd print_stats: exclude time prior to first extrusion from "print_duration"
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-13 20:48:15 -05:00
Kevin O'Connor 90d755dc0a output_pin: Don't flush lookahead queue on a SET_PIN command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-13 18:29:41 -05:00
Kevin O'Connor 9e1697786d neopixel: Apply LED updates at time of transmission
Queue updates so that delays between updates are properly applied.
This fixes macros that would blink LEDs by pausing between update
commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-05 12:57:14 -05:00
Kevin O'Connor 123908ac7a neopixel: Fix neopixel_result message so that it contains an oid
In order for commit 82156170 to work properly, the neopixel_result
message must contain the oid.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-05 11:40:34 -05:00
Kevin O'Connor 821561708d neopixel: Fix failure with multiple simultaneous neopixel updates
Make sure to set the oid parameter of mcu.lookup_query_command() so
responses are routed correctly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-04 18:47:36 -05:00
Arksine 8a5e7d8d28 gcode_macro: implement "action_call_remote_method" context action
Users may use this action to call methods registered by a webhooks client from a command template.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-04 18:32:30 -05:00
Arksine 108b66efe9 webhooks: Add "register_remote_method" endpoint
This allows clients to register methods that can be called from Klipper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-04 18:32:30 -05:00
Kevin O'Connor ccc8fe2fc5 itersolve: Convert iterative solver to use "secant method"
The previous code calculates each step time via an "exponential
search" followed by a "false position with Illinois algorithm" search.
Replace with a "secant method" with "bounds check" search.  This
simplifies the code, improves the performance, and does a better job
of finding steps near a direction change.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-02 12:07:23 -05:00
Kevin O'Connor e0842e0e03 heaters: Add sensors to printer.heaters.available_sensors even if no gcode_id
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-11-01 20:09:16 -05:00
Kevin O'Connor aaf3dc6ac3 serialqueue: Fix registration of serial fd in debug mode
When in debug output mode, make sure to register the fd correctly.
Otherwise, the poll() call will use the 0 fd which could cause random
results.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-30 14:02:12 -04:00
Kevin O'Connor 19b2363c93 klippy: Remove import of unused threading module
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-30 13:02:44 -04:00
Kevin O'Connor 79877acb14 mcu: Add support for setting reqclock in CommandQueryWrapper.send()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 12:00:28 -04:00
Kevin O'Connor 5f96f8a29b dotstar: Don't flush the lookahead queue on a SET_LED command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 12:00:28 -04:00
Kevin O'Connor 6133737215 neopixel: Don't flush the lookahead queue on a SET_LED command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 12:00:28 -04:00
Kevin O'Connor 7263077db5 neopixel: Add support for RGBW LEDs
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 12:00:25 -04:00
Kevin O'Connor 2bb30265b5 neopixel: Increase the maximum LED chain length
Rework neopixel updates to use an mcu buffer so that more than 18 LEDs
can be in a chain.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-29 11:59:15 -04:00
Kevin O'Connor 56004c0228 mcu: Don't default serial config option to /dev/ttyS0
If the mcu config section is omitted, it leads to confusing error
messages.  Don't default the serial config option to /dev/ttyS0 to
improve the error reporting.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-28 15:35:08 -04:00
Kevin O'Connor c2c79ff98d bltouch: Fix bug causing incorrect position when "stow_on_each_sample=False"
It is only valid to call raise_probe() when the toolhead is not
moving.  Make sure to call sync_print_time() from multi_probe_end() to
ensure that.  This fixes a bug that could cause the Z axis steppers to
lose their position when "stow_on_each_sample=False".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-24 00:22:58 -04:00
Kevin O'Connor 1b6b7fc58c kin_extruder: Fix numerical stability when using pressure advance
Avoid using the absolute E position when calculating pressure advance
as that position can grow arbitrarily large, which can result in
"numerical stability" problems.  That instability could eventually
lead to internal errors during step compression.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-23 22:59:20 -04:00
Kevin O'Connor f8cb1e30eb heaters: Don't raise an error if PID Ki is set to zero
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-17 20:48:25 -04:00
Dmitry Butyugin f8c4f90c04
resonance_tester: Resonance testing and input shaper auto-calibration (#3381)
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2020-10-14 20:08:10 -04:00
Dmitry Butyugin fac4e53e86 toolhead: Fixed reporting of the kinematic limits
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2020-10-14 12:42:15 -04:00
Kevin O'Connor 27249dc709 mcu: Increase the time to reset a pwm pin during startup
Some RPi0 users were reporting "timer too close" errors due to pwm pin
resets - increase the time the host has to complete the startup to
avoid this.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-11 11:14:32 -04:00
Kevin O'Connor d317793171 bltouch: Add an extra 200ms delay to the initialization process
On a reset, the mcu.py code may have sent an initialization message to
the bltouch, which needs time to complete.  Add additional time during
the bltouch setup to avoid a race with these two times.  This avoids
some "timer too close" errors that users of fast host machines were
reporting.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-11 11:14:32 -04:00
Kevin O'Connor 930317fa2a thermistor: Add support for the board thermistor on the Einsy Rambo
Add in support for the "TDK NTCG104LH104JT1" thermistor.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-10-08 15:25:09 -04:00
jhpadjustable 48b30e0f5a
display_status: fix M117 checksum trimming (#3377)
The M117 command parser discards the last character of the message
whenever the M117 command does not begin the line and there is no *xx
checksum, e.g.
  N0 M117 Look at me
causes the banner area of the printer screen to display "Look at m".
This patch only trims the checksum when one is found to trim.

Signed-Off-By: Jonathan Pickard <jhp@adjustablelabs.info>
2020-09-28 10:11:05 -04:00
Eric Callahan a8e3afd64a
configfile: report "save_config_pending" via get_status() (#3372)
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-09-28 00:05:55 -04:00
Kevin O'Connor 4d0d219716 mcu: Fix set_pwm() for hard pwm
Must use self._pwm_max to calculate range for hard pwm updates.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-27 18:09:53 -04:00
Kevin O'Connor 55e20f2c19 mcu: Add support for changing cycle_time in set_pwm()
Signed-off-by: Guy Shapira <gayuha@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-26 20:55:56 -04:00
Guy Shapira 27cefb2b38 gpiocmds: Add soft-pwm frequency modulation support
Signed-off-by: Guy Shapira <gayuha@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-26 20:51:38 -04:00
Kevin O'Connor 04f9f1b44e chelper: Add missing serialqueue_set_receive_window() def to serialqueue.h
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-26 20:15:33 -04:00
Kevin O'Connor 04b822c3aa chelper: Use standard C type definition for pyhelper_logging_callback
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-26 20:15:21 -04:00
Kevin O'Connor 73b78af6b2 chelper: Rework check for building C code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-26 20:15:10 -04:00
Kevin O'Connor ad0b76bd4b delta_calibrate: Don't error on an invalid kinematic guess
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-17 22:41:13 -04:00
Kevin O'Connor 6bba285f8e gcode: Don't log debugging output for unknown commands if command is blank
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-17 21:46:00 -04:00
Kevin O'Connor 4c14063404 heaters: Disable unused pwm output debugging info
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-17 02:06:20 -04:00
Kevin O'Connor 1af4a4ae9f reactor: Record time of recent gc collection sweeps
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-17 02:06:20 -04:00
Kevin O'Connor cd23c95760 display: Remove circular references from intermediate context object
Explicilty clear the local context object so that it does not require
a gc sweep to free it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-16 23:53:45 -04:00
Kevin O'Connor cb0a8f2ed9 reactor: Add support for explicit Python garbage collection
Add support for performing Python gc work only from the main reactor
thread and only when it appears the main thread is idle.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-16 23:53:45 -04:00
Kevin O'Connor 73cd8c241c klippy: Call gc.collect() on a "restart" request
Explicitly run the python garbage collector on a restart.  This cleans
up memory from the previous session.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-16 23:53:45 -04:00
Kevin O'Connor 7d83aed410 reactor: Terminate any greenlets on finalize() call
Make sure to terminate any greenlets that are in a pause() state.
This is necessary to ensure the reactor can be deallocated.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-16 23:53:45 -04:00
Kevin O'Connor 760a0f8df5 reactor: Add explicit finalize() method to clean up reactor state
The existence of a __del__() method prevents deallocation on python2
if there are circular references.  Replace the __del__() method with a
new finalize() call and arrange for it to be called when the main
reactor is released.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-16 23:53:45 -04:00
Kevin O'Connor a3fa11ffd4 serialhdl: Setup for serialqueue_free to be automatically called
Use ffi_main.gc() to automatically free the C serialqueue object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-16 23:53:45 -04:00
Kevin O'Connor 3dc0522870 serialhdl: Don't define a __del__() method
The existence of a __del__() method prevents deallocation on python2
if there are circular references.  Just remove the method as
disconnect() should already be called directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-16 23:53:45 -04:00
Kevin O'Connor 9814daa999 mcu: Setup for steppersync_free to be automatically called
Use ffi_main.gc() to automatically free the C steppersync object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-16 23:53:45 -04:00
Kevin O'Connor 2447025fa6 mcu: Don't define a __del__() method
The existence of a __del__() method prevents deallocation on python2
if there are circular references.  Just remove the method as
disconnect() should already be called directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-16 23:53:45 -04:00
Arksine 7ba1a2a749 bed_mesh: add mesh parameters to BED_MESH_CALIBRATE
This allows the generated points to be modified prior to probing the bed.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-09-15 20:36:55 -04:00
Arksine 9e68105b74 probe: add update_probe_points() method to helper
This allows the consumers of the ProbePoints helper to be reconfigured at runtime.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-09-15 20:36:55 -04:00
Arksine 6e77fd27cd bed_mesh: move algorithm verification to its own method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-09-15 20:36:55 -04:00
Arksine 98931789d8 bed_mesh: move mesh area configuration to _init_mesh_config
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-09-15 20:36:55 -04:00
Kevin O'Connor a92d995727 chelper: Set compiler flags to never use "x387" floating point math
The default on X86 32bit machines is to use 80bit floating point math
(as found in the ancient "387 coprocessor").  This can cause numerical
stability problems.  Set the compiler flags to make sure the newer SSE
math is always used on X86.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-15 17:12:53 -04:00
Paul McGowan 5a2f406fd1
probe: add get_status wrapper to probe for last_query from query_probe command (#3296)
Add get_status wrapper with last_query status for macros  It is sometimes useful to determine the state of the probe from a macro. If the probe is connected to an endstop pin, the results can be obtained via QUERY_ENDSTOPS but if a physical endstop is in use in addition to the probe the probe state cannot be obtained. This change allows one to use QUERY_PROBE  and then access the printer.probe.last_query object to obtain the state.

Signed-off-by: Paul McGowan <mental405@gmail.com>
2020-09-09 23:10:35 -04:00
rjpatawaran c7ea4b89c9
uc1701: Add x_offset (Used to add horizontal offset on SSD1306/SH1106 displays) (#3284)
Signed-off-by: RJ Patawaran <rjpatawaran@me.com>
2020-09-09 23:07:40 -04:00
Kevin O'Connor 1f5848fc1a adc_scaled: Add support for Duet2 Maestro "vref monitoring"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-09 22:20:54 -04:00
Kevin O'Connor fc85675145 gcode_button: Add support for analog buttons
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-09 14:21:30 -04:00
Kevin O'Connor 13ee6032ae mcu: Use schedule_pwm_out instead of set_pwm_out on a restart
Some mcu implementations don't like it when the pwm pin is configured
twice, so use the normal schedule_pwm_out implementation to update on
a restart.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-09 13:16:02 -04:00
Kevin O'Connor c285f8b6cf klippy: Improve handling of reactor.run() exceptions
Try to invoke a shutdown on an unhandled exception from reactor.run().
If that fails, try to do a clean exit.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-06 12:45:27 -04:00
Kevin O'Connor 3405095f0a adxl345: Add support for adxl345 accelerometer
Add support for taking measurements from an adxl345 accelerometer via
SPI interface.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-05 09:11:04 -04:00
Kevin O'Connor 2b2b610cff uc1701: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-04 22:29:55 -04:00
Kevin O'Connor d69a496b83 hd44780: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-04 22:14:06 -04:00
Kevin O'Connor 166ce06aea buttons: Improve python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-04 19:33:04 -04:00
Kevin O'Connor 5cce7f4d55 pid_calibrate: Update for improved python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-04 19:30:18 -04:00
Kevin O'Connor 3bcb6970f5 probe: Make sure z is homed before probing
Warn if the Z axis is not homed before attempting to probe.  This
improves the error message.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-04 15:47:52 -04:00
Kevin O'Connor 08adecd226 homing: Prefer printer.command_error() instead of homing.CommandError()
Update callers to use the printer.command_error reference instead of
directly using homing.CommandError() when raising or catching errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-04 12:10:36 -04:00
Kevin O'Connor f6dd97b784 homing: Remove EndstopError
There's no reason to distinguish between an EndstopError and a
CommandError, so just use CommandError.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-04 11:41:57 -04:00
Kevin O'Connor 1f3a160f47 toolhead: Add a move.move_error() helper
Move the EndstopMoveError() code from homing.py to a new method in the
toolhead Move class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-03 16:22:54 -04:00
Kevin O'Connor d0ed6e5705 input_shaper: Fix typo in SET_INPUT_SHAPER report of shaper_type_y
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-03 14:19:55 -04:00
Kevin O'Connor 6c872c71a7 quad_gantry_level: Add additional comments on how leveling works
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-03 12:09:02 -04:00
Kevin O'Connor c69527e2b0 spi_temperature: Simplify and comment MAX31865 temperature calculations
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-02 10:04:35 -04:00
Adrian Keet 37d7742468
spi_temperature: fix MAX31865 temperature conversion (#3274)
Signed-off-by: Adrian Keet <arkeet@gmail.com>
2020-09-02 09:32:30 -04:00
Kevin O'Connor a7defdcad0 kin_shaper: Fix check for optimized X or Y only calculations
The optimized version is only available if it's the only axis used.
This fixes input_shaper on corexz.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-30 12:32:11 -04:00
Kevin O'Connor 08ddf25cf3 kin_shaper: Add an init_shaper() helper function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-30 12:32:11 -04:00
Kevin O'Connor d28e148ddc kin_shaper: Group shaper setup code together
No code changes - just code movement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-30 12:32:11 -04:00
Kevin O'Connor 0e21188cb2 kin_shaper: Allocate space for maximum number of shaper pulses in advance
Combine the shaper pulses and count of those pulses into a `struct
shaper_pulses`.  Allocate space for the maximum number of pulses in
`struct input_shaper`.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-30 11:30:39 -04:00
Kevin O'Connor b6a25393d3 webhooks: Add client_info parameter to "info" webhook
Allow clients to send their version info to klipper and arrange for
that info to be logged.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-26 10:12:58 -04:00
Janar Sööt 97da129793 menu: only render visible list items
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2020-08-26 10:08:12 -04:00
Janar Sööt 9459549db3 menu: fixing input gcode run issue on edit start
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2020-08-26 10:07:03 -04:00
Kevin O'Connor ff6e879349 display: Allow redrawing the screen up to 10 times per second
Increase the maximum redraw rate from 4 times per second to 10 times
per second.  Some users have reported slower rendering times as a
result of 8fa1c977.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-24 19:02:30 -04:00
Kevin O'Connor 6763210558 gcode: Fix out-of-order cmd_M112 reference
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-23 13:18:30 -04:00
Kevin O'Connor 37bbf161f8 adc_temperature: Minor simplification of default sensor registration
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-23 09:02:18 -04:00
Kevin O'Connor 4a6360f2af adc_temperature: Calculate "PT100 INA826" values from formula
Calculate the "PT100 INA826" values instead of using a voltage table.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-22 17:21:17 -04:00
Kevin O'Connor d3e41b55b7 adc_temperature: Calculate PT1000 temperature/resistance pairs from formula
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-22 17:16:45 -04:00
Kevin O'Connor 1286d3006c gcode_move: Move GCodeMove class from gcode.py to new extras module
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor 4c5e93d51d gcode: Split G0/G1 command handling to new gcode_move class
Split up the main GCodeParser class into GCodeDispatch and GCodeMove
classes.  The GCodeMove class is now available using the "gcode_move"
printer object name.  This split simplifies the gcode.py code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor cd7c1b8e68 toolhead: Move G4 and M400 commands from gcode.py to toolhead.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor 80a6f59c8f gcode: Convert get_status() last_xpos to use a namedtuple
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor 2d5f9b6cda gcode: Remove unneeded base_xpos variables from get_status()
Convert the only user of base_zpos to use gcode_position.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor c0daf43d2f gcode: Convert get_status() homing_xpos to use a namedtuple
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor 39261d884d gcode: Remove unused move_xpos get_status() variables
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor 9103aaf6d5 toolhead: Remove unused get_stats() data
The "status" and "printing_time" are now available in the
"idle_timeout" module, so no need to report them from toolhead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor b2c78d71b0 gcode: Remove "action_" commands from get_status() calls
Rename printer.gcode.action_emergency_stop() to
action_emergency_stop(), printer.gcode.action_respond_info() to
action_respond_info(), and printer.gcode.action_respond_error() to
action_raise_error() in command templates.

This simplifies the get_status() interface, as returning callable
functions from that interface was confusing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor 2caaaea9a4 toolhead: Add a manual_move() helper function
Add a helper function for submitting relative movements.  This
function will also automatically ensure gcode.reset_last_position() is
called.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor b9ac6d6306 skew_correction: Make sure to call reset_last_position() on a skew update
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor 4115a77342 gcode: Automatically call reset_last_position() on a toolhead set_position()
Generate a "toolhead:set_position" event on a call to
toolhead.set_position() and use that event to automatically call
gcode.reset_last_position().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Janar Sööt 560d48dbc9 menu: reduce timeout timer period to 1s
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2020-08-20 09:10:23 -04:00
Kevin O'Connor 8fa1c97767 display: Support requesting a screen redraw on a menu key press
Add a request_redraw() method and call it when a key menu event
occurs.  Limit these proactive screen redraws to no more than 4 per
second.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 09:04:56 -04:00
alocin73 1bdf705524
hall_filament_width_sensor: Fix Flow update before next pending_position #3184 (#3198)
After reading the first item of self.filament_array, filament_width is updated back to self.nominal_filament_dia or self.diameter instead of retaining the value until next pending_position.

Updated Filament Menu Template.

Signed-off-by: Nicola Falciani <nicola.fal@gmail.com>
2020-08-19 18:58:49 -04:00
Janar Sööt bc904dd431 menu: remove surplus self.running=False
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2020-08-18 21:39:15 -04:00
Janar Sööt ccfcc3789b menu: optimize container populate
- don't populate all items at once
- populate items when container is pushed to stack
- precreate List back item, don't create it during populate.
- don't update items during populate

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2020-08-18 21:39:15 -04:00
Kevin O'Connor 9d9e5c7edc klippy: Report "shutdown" category from get_state_message()
Reported by @Arksine.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 14:10:54 -04:00
Kevin O'Connor fa83b1319c webhooks: Improve type checking of api requests
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:49:45 -04:00
Kevin O'Connor 7ec2ec30e3 webhooks: Convert to a json-rpc inspired message format
Convert to a new json message format.  Requests look like:

{"id":14, "method": "info", "params": {}}

and responses look like:

{"id": 14, "result": {}}

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:23:16 -04:00
Kevin O'Connor 2b0b30ccd5 webhooks: Remove call_remote_method()
Clients will now only receive messages that they've subscribed to.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:23:16 -04:00
Kevin O'Connor 1ae671f61f webhooks: Add klippy state to webhooks get_status() method
Clients can now subscribe to the webhooks get_status() info to
determine if the printer state changes.  It is no longer needed to
send a message to all clients on a shutdown transition.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:23:16 -04:00
Kevin O'Connor b0e3effb53 webhooks: Rework get_status() subscriptions
Implement a new subscription system for get_status() updates.
Subscriptions are per-client.  After an initial update, only changes
will be transmitted.  Responses are only transmitted to the client
that issued the subscription.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:23:05 -04:00
Kevin O'Connor 16a53e6918 webhooks: Require a subscription to receive gcode output
Add a new "gcode/subscribe_output" webhook endpoint to subscribe to
gcode output.  Only client connections that subscribe to the gcode
output will receive that output.

This also moves all the gcode webhooks from gcode.py to webhooks.py
and arranges for gcode.py to be initialized prior to webhooks.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:20:26 -04:00
Kevin O'Connor 568393c941 webhooks: Remove "method" parameter from webhook requests
Don't require or use the "method" parameter of requests.  This
simplifies the interface.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:20:25 -04:00
Kevin O'Connor 7289af6560 webhooks: Create StatusHandler class in add_early_printer_objects()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:20:25 -04:00
Kevin O'Connor b74a5c5217 webhooks: Remove register_static_path()
Use the "info" webhook to pass critical process information back to
the caller.  The remaining users of register_static_path() can get the
required information via get_status() calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:20:25 -04:00
Kevin O'Connor 0aad2437c5 webhooks: Specify server_address on klippy command-line
Don't default to "/tmp/klippy_uds" for the webhooks unix domain socket
filename.  Instead, require the filename to be specified on the
command-line (via a new "-a" parameter).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:20:25 -04:00
Kevin O'Connor 118ef908a5 display: Remove reference to printer.gcode.busy from display.cfg
The "busy" variable was removed and using it isn't necessary.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-15 17:20:24 -04:00
Janar Sööt b490848bc9
menu: fix for overwriting existing menu item (#3189)
In case of an overwriting existing menu item,
the new item was added additionally to the end of the items list.

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2020-08-14 13:42:33 -04:00
Janar Sööt 7a615b4f69 hall_filament_width_sensor: fix error
Fix no attribute error in in get_status

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2020-08-13 16:49:51 -04:00
Arksine e4f3f60ea6 virtual_sdcard: register sd static path
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-11 10:47:04 -04:00
Arksine 0c7faa978c webhooks: register gcode output handler and additional static paths
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-11 10:47:04 -04:00
Arksine bf221d5e26 webhooks: Implement a send buffer for socket writes
This prevents ClientConnection.send() from blocking, removing the possibility that callers become reentrant.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-11 10:47:04 -04:00
Arksine 4dcf494b97 webhooks: Implement unix domain socket server
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-11 10:47:04 -04:00
Bryan Boettcher 04bd48ca9d
adc_temperature: add support for AD597 (#3164)
The AD597 thermocouple amplifier is used in the Raise3D N2+ (and
possibly others).

Signed-off-by: Bryan Boettcher <bryan.boettcher@gmail.com>
2020-08-09 21:06:43 -04:00
Janar Sööt d991b4c83b
menu: Replace menu with new Jinja2 template system (#2344)
menu.cfg:
- jinja2 template scripting
- new Setup menu
- new Calibration menu
menu:
- redesigned menu code
- jinja2 support
- option to reverse menu up and down directions
- functionality set to support menu injection from other modules
- a new way of defining menu hierarchy
- other adjustments

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2020-08-09 09:29:55 -04:00
Trevor Jones efebbb9a2f
tmc5160: diag0 support (#3159)
Allow for diag0 only hardware to use sensorless homing.

Signed-off-by:  Trevor Jones <trevorjones141@gmail.com>
2020-08-09 08:17:51 -04:00
Kevin O'Connor ea5e76746a itersolve: Use stricter completion check in itersolve_find_step()
Use a more strict check for determining if the iterative solver has
correctly found a step - the guess must be within 1 picometer of the
target or correct to within 1 nanosecond.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-08 11:59:19 -04:00
Kevin O'Connor 513582afc4 itersolve: Enhance "false position" method with "illinois algorithm"
This prevents some cases where the iterative solver fails to converge
in a reasonable time, causing "no next step" errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-08 10:58:20 -04:00
Kevin O'Connor e5a3fd7cee gcode: Fix error causing _dump_debug() to fail
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-08 10:02:38 -04:00
Toby Harper f851cfae46
gcode_arcs: increment absolute e coord for each arc segment (#3162)
Arc travel was working but extrusion in absolute mode seemed not to be happening at all. This was because the E coord being sent with each G1 segment of the arc was not incrementing, effectively the same value was being sent over and over so the total extrusion for the whole arc was the amount for just one segment which is an extremely tiny amount.

My change increments e_base by e_per_move for each subsequent coord when in absolute extrude mode which results in the correct absolute E value being sent for each segment.

Signed-off-by: Toby Harper <toby@fuith.org>
2020-08-07 12:15:03 -04:00
bondus c9e7119a93
fan_generic: Add support for named fans and gcode to control them (#3054)
Signed-off-by: Pontus Borg <liquidpontus@yahoo.se>
2020-08-07 11:39:44 -04:00
Arksine 3eefc037c5 polar: fix limit_z default value
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-06 14:31:42 -04:00
Arksine 27ef58642e webhooks: Implement StatusHandler class
This class provides endpoints that allow connected hosts to fetch the state of printer objects and subscribe to state "pushed" over the connection.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-06 14:30:48 -04:00
Arksine cde7e75139 webhooks: Add call_remote_method helper function
This may be used to execute formatted RPC calls.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-06 14:30:13 -04:00
Kevin O'Connor 447374f73e gcode: Separate IO handling to its own class
Move the pseudo-tty IO handling from the main gcode class to a new
gcode_io class.  This simplifies the main gcode class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-06 14:21:08 -04:00
Kevin O'Connor 795bd03b33 webhooks: Directly invoke printer.invoke_shutdown()
No need to indirectly shutdown via the gcode class - just call
printer.invoke_shutdown() directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-06 14:21:08 -04:00
Kevin O'Connor 4346d37c06 webhooks: Introduce add_early_printer_objects()
Create the initial gcode class via new module level
add_early_printer_objects() function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-06 14:21:08 -04:00
Kevin O'Connor 8c8b9b1812 gcode: Introduce add_early_printer_objects()
Create the initial gcode class via new module level
add_early_printer_objects() function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-06 14:21:08 -04:00
Kevin O'Connor 0d930bf871 gcode: Pass the pseudo-tty fd via the start_args system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-06 14:21:08 -04:00
Kevin O'Connor b66dd1a60f gcode: Allow handlers to be registered for all gcode output
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-06 14:21:08 -04:00
Kevin O'Connor 8ed1696624 gcode: Only write to the gcode pseudo-tty if it appears to be active
If there isn't a reader of the output pipe it can lead to the
generation of a large number of errors.  Only attempt to write if it
appears the pipe is active.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-06 14:21:08 -04:00
Arksine b9f48e634e print_stats: Add virtual_sdcard state tracking
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Arksine 6b1ad715aa print_stats: stat tracking for virtual sdcard prints in progress
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Arksine 463194b1a3 virtual_sdcard: update get_status method
Do not reset progress to zero while paused.  Report 'is_active' and 'file_position'.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Arksine 963d7c247b virtual_sdcard: add SDCARD_PRINT_FILE gcode
SDCARD_PRINT_FILE allows Klipper to load and start the print for any
gcode file within the virtual_sdcard path, including subdirectories.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Arksine af39a209f3 virtual_sdcard: add SDCARD_RESET_FILE gcode
This allows the user to close a currently loaded file and reset the virtual_sdcard's state.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Florian Heilmann 10987003b0
safe_z_home: Make sure X and Y are homed before homing Z (#3153)
In it's current behavior, safe_z_home will attempt to home Z if it thinks the toolhead is above the z endstop even if the motors have since been disabled and the toolhead was moved to another position

Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2020-08-05 11:52:23 -04:00
Arksine 3143e31aca temperature_sensor: report min/max measured temp via get_status
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-01 15:56:51 -04:00
Arksine d37374974d filament_switch_sensor: report "enabled" state via get_status
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-01 15:56:51 -04:00
Arksine c22d5b2444 toolhead: report velocity and accel via get_status
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-08-01 15:56:51 -04:00
Kevin O'Connor 1f7c3fc8ec gcode: Report the final print_time in debuginput mode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-30 12:53:59 -04:00
Voron 9213646c63
corexz: Add CoreXZ kinematics (#3129)
Add a CoreXZ kinematics

Signed-off-by: Maks Zolin <mzolin@vorondesign.com>
2020-07-30 12:42:23 -04:00
Arksine 4795c0896d bed_mesh: Move profile management to its own class
This streamlines the BedMeshCalibrate class, making it only resposible for configuring and executing the calibration procedure.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-07-25 12:05:29 -04:00
Arksine dbec03abd9 bed_mesh: track the probed_matrix and mesh_params exclusively in the ZMesh class
Rather than have multiple classes keep a reference to these items, keep them in the z_mesh.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-07-25 12:05:29 -04:00
Arksine 41eedda5d6 bed_mesh: differentiate between "mesh_config" and "mesh_params"
This fixes an issue where a new profile is not properly saved after a restart.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-07-25 12:05:29 -04:00
Arksine 7c8b60b40e bed_mesh: round x and y positions received via the finalize callback
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>

Update bed_mesh.py
2020-07-25 12:05:29 -04:00
Arksine 6458def588 bed_mesh: add get_status() method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-07-25 12:05:29 -04:00
Kevin O'Connor db05938a5f servo: Set initial value via mcu_servo.setup_start_value()
Using the setup_start_value() method avoids the PWM output line
transitioning to an intermediate state prior to setting the initial
value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-25 11:39:39 -04:00
Kevin O'Connor 428a8d4881 servo: Remove servo ENABLE parameter
Allow one to disable servos via `SET_SERVO WIDTH=0` instead of using
an explicit ENABLE parameter.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-25 11:39:39 -04:00
Kevin O'Connor 122fd88c6a mcu: Reset pwm and digital output pins to start values on a host restart
This makes sure output pins are reset to their defaults when the host
is restarted and the micro-controller is not.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-25 11:36:44 -04:00
Kevin O'Connor d204cc1fb7 mcu: Add support for commands to send only on a host restart
Add a new "on_restart" parameter to mcu.add_config_cmd() and only send
those commands on a host restart that does not involve a
micro-controller restart.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-25 11:36:44 -04:00
combolek 3835654116
lm75: Added support for LM75/LM75A I2C connected temperature sensors (#3101)
Signed-off-by: Boleslaw Ciesielski <combolek@users.noreply.github.com>
2020-07-19 20:18:54 -04:00
Iakabos b0901daa85
display: Add configuration options for OLED displays (#3084)
Add user-configurable contrast, vcomh (affects "smearing"), and invert options for SSD1306/SH1106 type OLED displays.

Signed-off-by:  James Esau <james_esau@hotmail.com>
2020-07-19 20:18:08 -04:00
Kevin O'Connor 25b6bc2f73 mcu: Remove undocumented "custom" config parameter
The "custom" config parameter is not documented and has not been
recommended in years.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-19 12:07:53 -04:00
Arksine 180f44b876 webhooks: fix lambda wrapper around _process_request
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-07-13 18:39:15 -04:00
Kevin O'Connor af981432f0 thermistor: Add in definition for "SliceEngineering 450" thermistor
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-11 12:50:58 -04:00
Dmitry Butyugin 5dc0c8aac0 input_shaper: Fixed C module compilation on older gnu90 compilers
For example, Raspbian GNU/Linux 8 (jessie) uses an old GCC version 4.9.2
which uses -std=gnu90 by default.

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2020-07-07 17:50:51 -04:00
Arksine cd8f250e84 webooks: do not connect if debuginput is enabled
Changing this check from debugoutput to debuginput allows remote applications to perform tests against Klippy without an MCU connected.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-07-06 12:57:50 -04:00
Arksine bfbdc04c02 webhooks: process request handlers using a Reactor Callback
This prevents _process_data from blocking and becoming reentrant.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-07-06 12:57:50 -04:00
Kevin O'Connor 3a57608642 fan: Separate out the part cooling fan code from the generic fan code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-07-05 21:04:04 -04:00
Dmitry Butyugin 4bdc11a8b3
input_shaper: Initial support of input shaping (#3032)
Input shaping can help to reduce printer vibrations due to resonances
and eliminate or reduce ghosting in prints.

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2020-07-05 20:54:38 -04:00
Kevin O'Connor c6b652044d stepper: Make sure to reload trapq in set_stepper_kinematics()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-30 20:20:16 -04:00
Arksine 014c06f8a2 klippy: return message category in get_state_message()
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-06-24 19:07:33 -04:00
Arksine 2d2c09a0a3 webhooks: protect command processing from re-entry
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-06-24 19:07:33 -04:00
Arksine a342770ac5 pause_resume: Add CANCEL_PRINT gcode
Register API endpoints for "pause_resume/pause", "pause_resume/resume" and "pause_resume/cancel".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-06-24 19:07:33 -04:00
Arksine a31dd0ff0e query_endstops: register "query_endstops/status" endpoint
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-06-24 19:07:33 -04:00
Arksine 72962c5ca2 gcode: add webhooks support
Register "gcode/script", "gcode/help", "gcode/restart", and "gcode/firmware_restart" endpoints.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-06-24 19:07:33 -04:00
Arksine 14ac453861 klippy: Instantiate the webhooks module
Add 'cpu_info' to start_args so it may be reported via the "info" endpoint in webhooks.py.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-06-24 19:07:33 -04:00
Arksine 475f543790 webhooks: Initial implementation
The webhooks module provides a means for Klippy to register remote API endpoints.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-06-24 19:07:33 -04:00
Denis Ignatenko b3298d8992
hall_filament_width_sensor: Added width logging (#2981)
Signed-off-by: Denis Ignatenko deniss979@gmail.com
2020-06-16 13:36:49 -04:00
Arksine 4c571ea9ac bme280: fix reported measured time
This allows the bme280 to correctly work with the temperature_fan module.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-06-16 09:53:10 -04:00
Kevin O'Connor 65ae08ef21 menu_keys: Add a register_button() helper method
Use a helper method to register each button handler.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:23:34 -04:00
Kevin O'Connor 8d9566b945 menu_keys: Reschedule long-click timer on each click
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:23:34 -04:00
Kevin O'Connor 7d8ade74e8 menu_keys: Move button handling from menu.py to new file menu_keys.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:23:34 -04:00
Kevin O'Connor a1fc1ac214 configfile: Use "import ConfigParser as configparser"
This minor change makes it easier to port the code to Python3.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor 40da3f406a queuelogger: Use "import Queue as queue" for improved Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor 4905667ee2 reactor: Use "import Queue as queue" for improved Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor 0e9aa76066 uc1701: Update bus import to "from .. import bus"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor f931da1b87 extras: Use "from . import module" for relative imports
Use alternate import syntax to improve Python3 compatibility.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor 6edc2946db sx1509: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor 4b231470ed delta_calibrate: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor 8c96e9dd11 bed_mesh: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor 0ccf3018d5 msgproto: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor 8d8c239e47 util: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor f5cdfad333 mcu: Avoid using "async" for variables as it conflicts with Python3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor c4de0bba50 pid_calibrate: Avoid internal error on a shutdown
If a shutdown occurs during a PID_CALIBRATE command (eg, due to a
heater problem) then exit cleanly instead of throwing an internal
error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-14 11:34:04 -04:00
Kevin O'Connor 519c3ad5ee uc1701: Optimize swizzle_bits() code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-12 09:37:37 -04:00
Kevin O'Connor 9465618adb display: Rework write_graphics() to take one character cell at a time
Change write_graphics() from taking one pixel row of n characters to
taking all the rows and columns for one character cell.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-11 00:18:23 -04:00
Kevin O'Connor 467e8e6f40 display: Default DISPLAY=display in SET_DISPLAY_GROUP command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-09 12:19:53 -04:00
Florian Heilmann 68fcbe2a62
display: add SET_DISPLAY_GROUP command (#2969)
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2020-06-09 12:07:25 -04:00
Florian Heilmann f28c3319ed
uc1701: Fix for glyph rendering on uc1701 display (#2966)
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2020-06-09 08:20:48 -04:00
Kevin O'Connor cf9627cc05 display: Use animated heated bed icons on default hd44780 display
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-09 08:09:59 -04:00
Kevin O'Connor 7713986ae1 display: Make hd44780 glyphs configurable
Allow the 20x4 hd44780 screen glyphs to be customizable from the
config file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-09 08:09:59 -04:00
Kevin O'Connor 1a7e4e51b3 display: Use '.' and '*' in display_glyph description
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-08 21:40:42 -04:00
Kevin O'Connor d94dd8e9fd docs: Note changes to glyph names
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-08 16:55:09 -04:00
Florian Heilmann 3dcac1308e display: Move glyph definition to printer config
This commit allows to modify the icons (or glyphs) in the displays that
support it. Existing icons can be modified and new icons can be added via
a [display_glyph] section in the config.

Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2020-06-08 16:40:45 -04:00
Kevin O'Connor 12e3b9fa7b hall_filament_width_sensor: Fix whitespace errors
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-06 14:52:56 -04:00
Kevin O'Connor 739e6e7396 extruder_stepper: Don't directly access extruder member variables
Rework extruder.get_trapq() into extruder.sync_stepper() so that
extruder_stepper.py does not need to directly access the extruder
internals.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-06 14:41:15 -04:00
theophile 518fe023b4
extruder_stepper: Support changing synced extruder on the fly (#2824)
Signed-off-by: Christopher Meredith <chmeredith@gmail.com>
2020-06-06 14:30:58 -04:00
matpab 967fe1c01c
HallFilamentWidthSensor: Use current width instead of nomal width while delay is not over (#2907)
Option for using the current diameter instead of nominal while the first measurement isn't in place

Signed-off-by: Matthias Pabel <matthias.pabel@hs-augsburg.de>
2020-06-06 14:19:00 -04:00
Kevin O'Connor 5d26c2a08e gcode_arcs: Add back in support for E moves in absolute extrude mode
This reverts commit 43fa41c1af.

The above commit disabled absolute extrude moves because it was
unclear if the code would work properly when an M221 extrude factor or
G92 offset was in use.  However, since the calculation is done
relative to the raw E position and is sent as a raw E position to
gcode.cmd_G1() these modes should not matter.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-04 15:25:17 -04:00
Kevin O'Connor 2a66286d1c display: Do not show time remaining in default 16x4 display
The time remaining estimation is wildy inaccurate.  Only show the time
elapsed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-04 15:02:18 -04:00
Kevin O'Connor 9850dc75f4 toolhead: Handle flush_step_generation() call after dwell()
If self.kin_flush_delay changes after a G4 dwell command (or other
non-kinematic time update) then it could lead to "internal step
compression" errors.  Make sure to handle this case in
flush_step_generation().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-01 15:29:20 -04:00
Kevin O'Connor 1ab41cf41d gcode: Make it clear that gcode.get_status() can be called without eventtime
Make it clear that gcode.get_status() to be called without an
eventtime by defaulting eventtime=None.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-26 14:59:15 -04:00
Kevin O'Connor ceaf818a11 tuning_tower: Minor optimization
Store a reference to the gcode class in self.code.  Obtain the
z_offset once and use for both the oldval and newval calculation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-26 14:56:52 -04:00
Kevin O'Connor 04532448bc tuning_tower: Remove max(0, z) check
Commit 9530373c introduced a minimum value of zero for the g-code z
position.  Unfortunately, that would likely cause the tuning tower to
not emit a command at the start of a test because the initial dummy z
position is set to a negative value.  The minimum bound should not be
needed so remove it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-26 14:46:15 -04:00
Kevin O'Connor 686d557863 tmc5160: Change the default for the pwm_freq field to zero
The tmc5160 spec shows a default of zero, so use that same default for
Klipper.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-24 23:58:48 -04:00
Adrian Keet b267178370 controller_fan: Add fan_speed parameter.
This gives it parity with heater_fan.  Also change the default speed from
max_power to 1.0, since it is already scaled by max_power in set_speed.

Signed-off-by: Adrian Keet <arkeet@gmail.com>
2020-05-24 11:46:46 -04:00
Rubens Panfili 9530373ccb
tuning_tower: compensate z-offset (#2881)
Signed-off-by: Rubens Panfili <rubens.panfili@gmail.com>
2020-05-24 11:33:09 -04:00
Kevin O'Connor 492cd3d99f configfile: Fix check for unused config sections and options
Commit c3899cef inadvertently broke the error check for unused config
options.  Add a new note_valid parameter to the config access wrappers
and use that in get_status() to fix the check.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-21 17:50:51 -04:00
Denis Ignatenko 9270cabb74
hall_filament_width_sensor: fix overflow issue on 12 bit adc (#2902)
Signed-off-by: Denis Ignatenko <deniss979@gmail.com>
2020-05-21 13:59:09 -04:00
Denis Ignatenko 1d2746f167
hall_filament_width_sensor: Increasing measure stability (#2836)
Signed-off-by: Denis Ignatenko <deniss979@gmail.com>
2020-05-18 17:14:24 -04:00
fess c9daefd97f z_tilt: retries, fix extra retry bug.
round to only 6 decimal places of precision.  prevents doing extra retry
from small variations due to floating point math.

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2020-05-18 14:55:25 -04:00
fess 7b0e6725ca z_tilt: retries fixup err message
print retries status before erroring on increase

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2020-05-18 14:55:25 -04:00
Kevin O'Connor 20a27c697f bltouch: Add "probe in touch mode" option
Signed-off-by: Mike Stiemke <fandjango@gmx.de>
2020-05-11 12:46:25 -04:00
Kevin O'Connor 703490da1c bltouch: Simplify handling of command timing
Always disable the PWM after each command sent.  Automatically trim
the command duration so the PWM disable doesn't increase the total
pulse time (when the duration is 200ms or greater).

Track the ideal command end time separately from the pwm transmit time
and only delay toolhead moves to this ideal time.

Update verify_state() to automatically schedule the check using the
time of the last sent command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-11 12:46:25 -04:00
Nathan Plamondon c402b275c3
bed_mesh: Fix typo (#2849)
Signed-off-by: Nate Plamondon <nplamondon@gmail.com>
2020-05-11 12:30:57 -04:00
Kevin O'Connor 787ed452c2 klippy: Rename try_load_module() to load_object()
Rename try_load_module() so that it uses consistent naming for
"printer objects".  Change the function to raise an error by default
if the specified module does not exist.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-08 11:05:14 -04:00
Kevin O'Connor 8472c57b59 klippy: Minor code movement
Move set_rollover_info() - no code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-08 11:05:14 -04:00
Kevin O'Connor 2d4b520260 gcode: Move "ok" tracking to GCodeCommand class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor bf4bd5cfc1 gcode: Remove parsing helpers from main gcode class
Remove the parsing helpers from the main gcode class now that all
callers have been converted to use the parsing helpers in the
GCodeCommand class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor a68bb935df menu: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 1fd76b7393 manual_stepper: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 821df4e994 dotstar: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor a7ca0e1670 delayed_gcode: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor e9e0c374d6 temperature_fan: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor a11535fc86 servo: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 53093a7a15 output_pin: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 3c4091548e tmc5160: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor d759cc60d3 tmc2130: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 3e64093b81 tmc2660: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 8b8f591a05 tmc: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 0fd12609a6 neopixel: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 310d583413 gcode_button: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 1e992f9d16 filament_switch_sensor: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 02ee379f82 pause_resume: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 3e6f2206b3 hall_filament_width_sensor: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor e5c512c8d5 bed_tilt: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor f2688dbb33 bed_screws: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 0197fec202 delta_calibrate: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor b24465976e heater_bed: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 95919d1256 screws_tilt_adjust: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 203568b909 bltouch: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 4fd5090253 tuning_tower: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor 7232014657 query_endstops: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:12 -04:00
Kevin O'Connor d04476c82e fan: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 33c6667881 stepper_enable: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor a79096efdf pid_calibrate: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 12b20c6e77 safe_z_home: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 947569d347 endstop_phase: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 153c1cbe60 homing_override: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 1f64ca4fd9 query_adc: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor a13e681b2e gcode_macro: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor fb16e8810b idle_timeout: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 1d2bb5a412 tsl1401cl_filament_width_sensor: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 19abe2b974 force_move: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 57ca91a875 quad_gantry_level: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor d4adeda76b manual_probe: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor dce46ea053 z_tilt: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor ff6c11e827 probe: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 1746148a45 firmware_retraction: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 5fe5e21508 heaters: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor c186766708 configfile: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 9b6010dc7b extruder: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 6869611147 cartesian: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor ec0e3e710c toolhead: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor b0d9a82718 virtual_sdcard: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 48ebb6959d skew_correction: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 433c8c937a respond: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 5a0b9d1ce8 display_status: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 98c9a991a3 bed_mesh: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor c0796bc42d gcode_arcs: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor c79f135cd5 gcode: Use new GCodeCommand wrappers in command handlers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor ddb8311890 gcode: Create new wrapper class for gcode command parameters
Instead of passing a dictionary to the command handlers, create a
wrapper class and pass that class to the command handlers.  This can
simplify the command handler code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 9a92b346fd itersolve: Use more explicit list traversal in itersolve_generate_steps()
Avoid using doubles as flags when generating steps during "lead up to
stepper activity".  Instead, explicitly track how many inactive move
entries are skipped and only generate steps for those entries.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-04 14:00:53 -04:00
Kevin O'Connor 7843c23b8c itersolve: Fix numeric stability of flush range times
Don't assume the times passed to itersolve_gen_steps_range() are
contained within the move.  It's possible the checks in
itersolve_generate_steps() may round to different values when
converting the times to a relative move time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-04 10:24:46 -04:00
Lucio Tarantino dac42efbd9
htu21d: Support for HTI21D family sensor on I2C bus (#2803)
Signed-off-by: Lucio Tarantino <lucio.tarantino@gmail.com>
2020-05-03 18:47:24 -04:00
Janne Grunau 0aa78ec76e
linux: Adapt servo0 channels for beagleboard kernel 4.14.108-ti (#2746)
The beagleboard TI kernel 4.14 and 4.19 contain a commit which change
the device names ("pwm: Create device class for pwm channels") from
pwmN to pwm-${chip}:N. This commit was never merged into the upstream
kernel.

Decrease the number of pwm channels to a more reasonable 16. Increase
the number of pwm chips to 8 since the replicape servo pwm outputs are
on pwmchip4.

Update replicape code to detect appropriate channel.

Signed-off-by: Janne Grunau <janne-gh@jannau.net>
2020-05-03 11:24:42 -04:00
Kevin O'Connor f4429a54a9 clocksync: Don't filter any of the initial syncronization clock messages
Add a 50ms delay from the initial clock measurement to the first
get_clock query.  Disable the prediction_variance filter on each
get_clock query so that none of those measurements are ignored.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-02 11:08:02 -04:00
Kevin O'Connor 3aacc4d6a2 gcode: Only call position_with_transform() when printer is ready
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-02 07:35:23 -04:00
Kevin O'Connor ced389f4f6 pid_calibrate: Fix module import
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-25 14:49:50 -04:00
Kevin O'Connor 17123889f6 heaters: Make heater.py an "extras" module
The heater logic is an independent module that does not need to be
treated as part of the "core" klipper code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-25 14:26:45 -04:00
Kevin O'Connor d858498a53 heater: Move M105 command handling from gcode.py to heater.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-25 14:26:28 -04:00
Kevin O'Connor 44f868a802 klippy: Add an is_shutdown() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-25 12:41:44 -04:00
Kevin O'Connor 86a99cf38e gcode_button: Simplify script execution
It's no longer necessary to queue gcode scripts - gcode.run_script()
now does that automatically.

Also, make release_gcode config optional.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-25 12:11:49 -04:00
Kevin O'Connor c590bf7643 probe: Rename probe_prepare/finalize to probe_prepare/finish
The probe_finalize() name is used for callbacks in both the
PrinterProbe and ProbePointsHelper classes.  Rename the PrinterProbe
callback to avoid confusion.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-25 12:01:52 -04:00
Kevin O'Connor 64031ab3d7 gcode: Rename respond() to respond_raw()
Rename the method to make it more clear that it is a low-level call
that should be rarely used.

Also, change gcode_button.py, hall_filament_width_sensor.py, and
tsl1401cl_filament_width_sensor.py to use respond_info() instead of
respond_raw().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-24 15:54:18 -04:00
Kevin O'Connor 61524542d2 gcode: Don't export respond_error()
Don't export the respond_error() method as callers should raise a
gcode.error() instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-24 14:59:25 -04:00
Kevin O'Connor 568a0da50e virtual_sdcard: No need to call gcode.respond_error() on disk error
Report low-level disk errors via the log and use the normal sdcard
mechanism to report end of sdcard print to gcode users.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-24 14:54:13 -04:00
Kevin O'Connor ed3e6b42c7 gcode: Raise a gcode.error() from G20 command
It's important to raise an error (instead of calling respond_error() )
so that a G20 will stop a virtual_sdcard print.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-24 14:53:41 -04:00
Kevin O'Connor 9730be8e17 respond: Simplify M118 handling
No need to check for '#original' in params - it's always there.
Properly handle a lower case m118 command.  Don't register a help text
for the legacy M118 g-code command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-24 10:11:37 -04:00
Kevin O'Connor 3990d997de z_tilt: Raise a gcode.error() instead of directly calling respond_error()
Raising an error (instead of reporting an error) is important as only
a raised error will stop a print from virtual_sdcard.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-24 10:10:33 -04:00
Kevin O'Connor 43fa41c1af gcode_arcs: Disable E moves in absolute extrude mode
Commit 402110f6 didn't actually fix absolute extrude mode.  For now,
report an error if an extrude move is requested in absolute extrude
mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-23 10:05:05 -04:00
Kevin O'Connor fc627ec470 gcode_arcs: Minor cleanup of planArc()
Fix linear_travel optimization.  Use "2*pi" instead of "radians(360)".
Always emit at least one segment and always end at the final target
coordinates.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-22 17:58:10 -04:00
Kevin O'Connor 402110f655 gcode_arcs: Fix Z moves and E moves
Fix Z moves so that the movement is spaced out among the arc movements.

Fix extrude moves when in absolute extrude mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-22 16:30:02 -04:00
Kevin O'Connor ff28f33967 gcode_arcs: Simplify parameter parsing
Use the normal gcode.get_float() mechanism for extracting parameters
from the g-code command.

Don't register descriptions for the G2/G3 commands as the convention
is to only use descriptions for "extended g-code commands".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-22 16:19:15 -04:00
Kevin O'Connor 120331f49a safe_z_home: Simplify check for axes to home
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-22 11:55:25 -04:00
Kevin O'Connor 9e8c4770ed rotary_delta: The get_status() method should take eventtime parameter
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-20 22:36:00 -04:00
Kevin O'Connor 06846313fd homing: Avoid divide by zero error on PROBE at minimum Z position
Reported by @proto3.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-19 12:46:50 -04:00
Kevin O'Connor 0ae20421d1 neopixel: Allow host software to configure neopixel timing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-15 13:29:43 -04:00
Piotr Usewicz 939b575b01
bed_mesh: Fix typo (#2692)
Signed-off-by: Piotr Usewicz <piotr@layer22.com>
2020-04-14 22:09:28 -04:00
Kevin O'Connor a028aeaf78 Revert "bltouch: No need to pause the toolhead for PWM off commands"
This reverts commit 5c8d15bbee.

The lower_probe() code was already manually optimizing the timing of
the pwm disable, and that conflicted with the optimization in commit
5c8d15bb.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-04 18:51:53 -04:00
Grigori Goronzy 0a20430e07 serial: Add Fysetc Cheetah board specific reset sequence
Fysetc Cheetah v1.2 boards require a special sequence to reset reliably.
This sequence works for me in all cases. Simpler sequences without
double reset did not work correctly. This is likely because of a weird
stateful circuitry for toggling the bootloader state.

Cheetah boards use RTS to configure bootloader triggering. By default,
pySerial sets RTS on connect, which unfortunately configures the board
to start the bootloader on reset.

Add a toggle for the RTS state to allow users to workaround. The RTS state
is set before the serial connection is opened, so there are no glitches.

Addresses #2026.

Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
2020-04-02 13:56:50 -04:00
Kevin O'Connor 5c8d15bbee bltouch: No need to pause the toolhead for PWM off commands
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 9f2a025762 bltouch: Don't assume reset will do a pin_up in test_sensor()
Some clones don't raise the pin on a reset and the ANTClabs BL-Touch
sometimes doesn't raise the pin either.

Rework the (infrequently called) sensor test code to always issue a
pin_up command before the touch command.  Also, perform a reset and
retry if the sensor test fails.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 2b916e79c7 bltouch: Call sync_print_time() on multi_probe_end()
Be sure to fully raise the probe prior to starting any future toolhead
movements in the multi_probe_end() case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-02 08:25:22 -04:00
Kevin O'Connor 5e207d2baa bltouch: Apply reset command for a full second on a raise_probe() failure
If an error is found during the pin_up_not_triggered check, then apply
the reset command for a full second (instead of just 100ms).  This
gives the bltouch more time to check its internal state.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-02 08:25:22 -04:00
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