Commit Graph

2290 Commits

Author SHA1 Message Date
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
henrikssn 430578957f
stm32: Add support for STM32F072 (used in the TurboCAN board) (#4412)
* Add menuconfig option for stm32f072
* Add support for internal temp of stm32f072
* Share the temperature calculation logic between stm32f0x2 MCUs

Signed-off-by: Erik Henriksson <erikhenrikssn@gmail.com>
2021-06-27 20:35:34 -04:00
Kevin O'Connor 7fd7853785 duplicate_pin_override: Debugging tool to permit multiple use pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-27 18:50:51 -04:00
Tircown 4d559633e3
kinematics: Add dual_carriage to hybrid-corexyz (#4296)
- Add dual_carriage abilities for hybrid-corexy and hybrid-corexz
- Introduce the module idex_mode
- Fix add_stepper to the correct rail in hybrid-corexy

Signed-off-by: Fabrice GALLET <tircown@gmail.com>
2021-06-27 18:37:05 -04:00
Kevin O'Connor 6c8d1ddaec bltouch: Ensure the z_offset is not negative
It would not make sense to have a negative z_offset.  Reported by
@Yoyolick.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-22 15:30:25 -04:00
Matthew Lloyd c2907c998c
screws_tilt_adjust: Add DIRECTION parameter to SCREWS_TILT_CALCULATE (#4357)
Signed-off-by: Matthew Lloyd <github@matthewlloyd.net>
2021-06-22 15:18:05 -04:00
Kamil Trzcinski f1091a484b virtual_sdcard: add `file_path` and `file_size` to `status`
This provides a comprehensive information if currently
we have a file loaded.

Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
2021-06-22 15:15:03 -04:00
Eric Callahan 7ced62ab9c dotstar: report color data via get_status()
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-06-18 10:53:12 -04:00
Arksine 65afad9428 neopixel: report color data via get_status() method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-06-18 10:53:12 -04:00
Kamil Trzciński 46f51b2bb0
print_stats: add `cancelled` when `CANCEL_PRINT` used (#4366)
Before this change, a `CANCEL_PRINT` set a `print_stats` to `paused`
that would later be workaround-ed with `fluidd`/`mainsail` to re-define
`CANCEL_PRINT`.

This sets a proper canceled state, but additionally closes a file
from a `virtual_sdcard` context for `canceled`/`error`, as this is no longer
resumable from this point.

Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
2021-06-14 15:09:55 -04:00
Kamil Trzcinski d2c2aaf55d extruder: expose `can_extrude` flag based on temperature
Sometimes an automated filament load is implemented,
but extruder might not always extrude filament.

This adds a flag to check if this operation is possible.

Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
2021-06-14 12:56:50 -04:00
Kevin O'Connor 0bc0767997 stepper: Restore mcu_position on set_stepper_kinematics() and set_step_dist()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-11 23:13:05 -04:00
Kevin O'Connor 1506043477 stepcompress: Add missing functions to stepcompress.h
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-11 23:12:16 -04:00
Kevin O'Connor acdad76408 klippy: Add a newline between initial error message and hint text
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-10 21:30:09 -04:00
Kevin O'Connor bc29ee1c6d homing: Check for failures during multi-endstop homing
If any endstop reports a failure, then stop homing on all endstops.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor 983951443c mcu: Enable trdispatch infrastructure during homing
Separate out trsync handling from endstop handling in mcu.py code.
Enable the low-level trdispatch C code.

This is in preparation for multi-mcu homing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor e1f7748e1a trdispatch: Support fast responses to trsync_state messages
Add C code that can process trsync_state messages and dispatch
responses with low-latency.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor b6d8cf27d2 serialqueue: Add serialqueue_send_one() helper function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor c53e8c7d4a serialqueue: Add "fast reader" support
Add ability to run C code directly from the low-level socket reading
thread.  This enables host based low-latency handlers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor 620f77ddb7 msgblock: Add clock estimation helper functions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor f938caa0d2 msgblock: Add msgblock_decode()
Add function that can parse a simple VLQ encoded message to an array
of integers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor 1865080a07 msgblock: Move message manipulation code from serialqueue.c to new msgblock.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor 2559a2dd5a pollreactor: Move C pollreactor code from serialqueue.c to its own file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor 05c2d51a12 trsync: Introduce new "trigger synchronization" support
Separate out the stepper stopping code from endstop.c into its own
trsync.c code file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor f3bd4e6acf probe: Call add_stepper() earlier in boot process
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:35 -04:00
Kevin O'Connor ecbfa76242 mcu: Raise config_error (not protocol error) on pin enumeration errors
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:26 -04:00
Kevin O'Connor 31fcd491fd serialhdl: Support prepending a warn_prefix to error and log messages
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-09 18:58:26 -04:00
Eric Callahan 3fcce4bb4b bed_mesh: implement BED_MESH_OFFSET
The BED_MESH_OFFSET gcode can be used to apply X and/or Y offsets the the mesh lookup.  This allows printers with independent extruders to correct the Z adjustment when changing a tool.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-06-08 00:02:35 -04:00
Eric Callahan 4dfe01a2cd bed_mesh: move the "fade offset" out of the ZMesh
This is a temporary offset applied to the mesh used to fade toward a "target".  For clarity, apply the fade offset when the final z calculation is made.

SIgned-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-06-08 00:02:35 -04:00
Kevin O'Connor be4fb7f128 endstop_phase: Unify phase conversion code
Introduce a new PhaseCalc class and use that for both homing and
ENDSTOP_PHASE_CALIBRATE.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-06 20:41:27 -04:00
Dmitry Butyugin 4596a244e3
resonance_tester: Set max_accel ignoring the limit from the config (#4174)
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-06-06 13:04:53 -04:00
Kevin O'Connor 93b9a85d19 endstop_phase: Add support for reporting phase information via get_status()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-06-03 22:27:30 -04:00
Michael Rose 27f8cf025e
z_tilt: expose an 'applied' status to allow macros to skip QGL/Z_TILT_ADJUST (#4313)
This is useful for macros that'd like to skip QGL if already leveled,
e.g.:

```
    {% if not printer.quad_gantry_level.applied %}
        QUAD_GANTRY_LEVEL
    {% endif %}
```

Signed-off-by: Michael Rose <elementation@gmail.com>
2021-06-02 11:11:19 -04:00
Paul McGowan c148f17ea3
neopixel: add sync parameter to prevent waking toolhead (#4339)
neopixel: add sync param to prevent waking toolhead

dotstar: refactor to match neopixel methods and add sync parameter

Signed-off-by: Paul McGowan <mental405@gmail.com>
2021-06-02 10:51:45 -04:00
Stefan Dej b5e4f3d204
gcode: Update gcode descriptions (#4335)
Add help description to HELP
Add help description to RESPOND
Add help description to MEASURE_AXES_NOISE, TEST_RESONANCES and SHAPER_CALIBRATE
Add help description to PAUSE, RESUME, CLEAR_PAUSE and CANCEL_PRINT
Add help description to GET_POSITION
Add help description to SET_RETRACTION and GET_RETRACTION

Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-06-02 10:45:27 -04:00
Kevin O'Connor c0d860487a stepper: Remove set_tag_position() code
Have callers store the stepper positions in a dict.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-29 21:54:34 -04:00
Kevin O'Connor 77bc5e4388 stepper: Improve get_past_commanded_position()
Pass a print_time instead of a clock to get_past_commanded_position().
Fix calculation on steppers that home and use an inverted direction
pin.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-29 21:29:00 -04:00
Alex Zellner 341fc64a67
gcode_macro: add description property (#4317)
Signed-off-by: Alex Zellner <alexander.zellner@googlemail.com>
2021-05-26 14:21:21 -04:00
Florian Heilmann ba3bbca861
gcode_macro: Disallow whitespace in macro name (#4312)
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2021-05-26 13:03:10 -04:00
Florian Heilmann cf61ca301b safe_z_home: Simplify logic and fix edge case
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2021-05-26 12:57:31 -04:00
Jason S. McMullan 913649de2e loop_sdcard: Add loopable SD card file sections
To support continuous belt printing, add nestable repeat
loop support via an `[sdcard_loop]` module.

Supported G-Code:
  - SDCARD_LOOP_BEGIN COUNT=n  ; Loop for N times, or infinitely if N is 0
  - SDCARD_LOOP_END            ; End of loop
  - SDCARD_LOOP_DESIST         ; Complete all loops without iterating

Marlin M808 compatibility example in `config/sample-macros.cfg`:
  - M808 Ln        ; Loop for N times, or infinitely if N is 0
  - M808           ; End of loop
  - M808 K         ; Complete all loops without iterating

Added unit tests in test/klippy/sdcard_loop.test

See https://reprap.org/wiki/G-code#M808:_Set_or_Goto_Repeat_Marker

Signed-off-by: Jason S. McMullan <jason.mcmullan@gmail.com>
2021-05-26 11:57:57 -04:00
Alex Zellner 60352f4b67
filament_motion_sensor: add get_status (#4281)
Signed-off-by: Alex Zellner <alexander.zellner@googlemail.com>
2021-05-11 13:17:22 -04:00
Arksine dc71b64c0a virtual_sdcard: fix check for case sensitive files
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-05-11 13:15:56 -04:00
Dany Yanev b333547f1f
menu: Fixed typo when reading `print_stats.state` (#4261)
Fixed typo when reading `print_stats.state` causing some of the menus to now show up.

Signed-off-by: Dany Yanev <yanev89@gmail.com>
2021-05-06 11:54:27 -04:00
Tircown f2c74ec023
kinematics: Add hybrid-corexy and hybrid-corexz (#4229)
Signed-off-by: Fabrice GALLET <tircown@gmail.com>
2021-05-03 14:31:23 -04:00
Kevin O'Connor 89082b494f klippy: Report known software versions on a protocol error during connection
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-05-02 17:51:15 -04:00
Kevin O'Connor edea52863a endstop: Report trigger time in endstop_query response
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:40:37 -04:00
Kevin O'Connor 470b1e2e46 adxl345: Use "clock" suffix instead of "time" in commands
The debugging code knows how to handle fields that end in "clock".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:40:37 -04:00
Kevin O'Connor b611e72a19 pulse_counter: Use "clock" suffix instead of "time" in commands
The debugging code knows how to handle fields that end in "clock".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:40:37 -04:00
Kevin O'Connor 8f76e53c0e stepper: Remove min_stop_interval from mcu code
Now that the host never uses a min_stop_interval, remove it from the
mcu code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:26:19 -04:00
Kevin O'Connor b1ea4f3bef toolhead: Do not limit SET_VELOCITY_LIMIT to values specified in config
Allow a larger velocity, accel, and square_corner_velocity than what
is specified in the config file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:26:19 -04:00
Kevin O'Connor 5a5ecd88e2 stepper: Do not set min_stop_interval in micro-controller
The min_stop_interval safety check is fragile and leads to a notable
amount of complexity.  Avoid these issues by not programming this
safety check.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-30 11:09:08 -04:00
Kevin O'Connor 0a4a64058d probe: Use original XY position on multiple probe samples
On some kinematics it's possible for the XY position to change
slightly during a probing move.  Return back to the original XY
position on a probe lift so each probe attempt starts at the same
nominal position.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-28 21:40:49 -04:00
Kevin O'Connor 0990a3da6f gcode: Generate M115 output even if command not sent from gcode pseudo-terminal
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-28 21:40:03 -04:00
Kevin O'Connor 25389027de Revert "endstop_phase: wip"
This reverts commit f2e4653ca4.

Revert incomplete testing code that was accidentally committed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-28 20:42:33 -04:00
Kevin O'Connor f2e4653ca4 endstop_phase: wip 2021-04-28 20:32:14 -04:00
Dmitry Butyugin 3b33d6652f resonance_tester: Refactored the testing code
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-04-28 12:36:23 -04:00
Johannes Stuettgen ed6ab6b9cc screws_tilt_adjust: Add MAX_DEVIATION parameter for bed level invariant.
This is useful when a saved bed mesh is used to ensure that the bed level
has not drifted too far from where it was when the mesh was created.

Signed-off-by: Johannes Stuettgen <johannes.stuettgen@gmail.com>
2021-04-28 11:53:18 -04:00
nlef 2d2db0f839
probe: Add deactivate_on_each_sample: param for Probe (#4161)
Signed-off-by: Nick Lefskiy <n.lefskiy@yandex.ru>
2021-04-24 13:39:58 -04:00
Dmitry Butyugin 200b62bcb4 adxl345: Verify the register writes, added debug adxl345 commands
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2021-04-24 13:15:17 -04:00
Kevin O'Connor ca1d431653 stepper: Register a config default for calculated homing_positive_dir
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-16 11:42:39 -04:00
Clifford Roche 3a023d0ff4
palette2: Fix get_status (#4171)
Signed-off-by: Clifford Roche <clifford.roche@gmail.com>
2021-04-15 13:53:06 -04:00
Clifford Roche e7b0e7b43b
palette2: Add ping variation + ping status reports (#4114)
Signed-off-by: Clifford Roche <clifford.roche@gmail.com>
2021-04-14 11:37:24 -04:00
Kevin O'Connor dce9971aa9 stepcompress: Improve numerical stability of step+dir+step filter
Apply the step+dir+step filter even if, for some reason, a negative
time is found.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-11 12:19:57 -04:00
Arksine 60372fd0cf bed_mesh: introduce "faulty_regions" option
Users may define "faulty regions", locations within the mesh where a probed value is unreliable. When bed mesh generates points it will substitute points in faulty regions with up to 4 points nearest to the region. After calibration is complete the Z values at these points will be averaged and assigned to the original value inside the faulty region.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-04-10 11:16:07 -04:00
Arksine 5f5dfbaa7f bed_mesh: Allow user to clear the relative_reference_index via gcode
If a negative number is specified for the RELATIVE_REFERENCE_INDEX parameter clear the internal relative_reference_index.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-04-10 11:16:07 -04:00