From 1f4dde1a60b9bfc18a5b6c557f89d0b4b07fe149 Mon Sep 17 00:00:00 2001 From: Ben Price Date: Thu, 18 Apr 2024 15:16:12 +0100 Subject: [PATCH 1/7] Adding Cartographer config --- .../hardware/probes/cartographer_virtual.cfg | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 config/hardware/probes/cartographer_virtual.cfg diff --git a/config/hardware/probes/cartographer_virtual.cfg b/config/hardware/probes/cartographer_virtual.cfg new file mode 100644 index 000000000..b55b0248e --- /dev/null +++ b/config/hardware/probes/cartographer_virtual.cfg @@ -0,0 +1,78 @@ +# This probe type is for a Cartographer probe used directly as a virtual Z endstop +# rather than with an existing physical endstop. To use this configuration, +# you will need to manually add the Cartographer Klipper plugin! + +## Then, you should just add the following two lines to your overrides and everything should work! +#[cartographer] +# Path to the serial port for the Cartographer device. Typically has the form +# /dev/serial/by-id/usb-cartographer_cartographer_... +# +# If you are using the CAN Bus version, replace serial: with canbus_uuid: and add the UUID. +# Example: canbus_uuid: 1283as878a9sd +# + +[cartographer] +# Path to the serial port for the Cartographer device. Typically has the form +# /dev/serial/by-id/usb-cartographer_cartographer_... +# +# If you are using the CAN Bus version, replace serial: with canbus_uuid: and add the UUID. +# Example: canbus_uuid: 1283as878a9sd +# +speed: 40. +# Z probing dive speed. +lift_speed: 5. +# Z probing lift speed. +backlash_comp: 0.5 +# Backlash compensation distance for removing Z backlash before measuring +# the sensor response. +x_offset: 0. +# X offset of cartographer from the nozzle. +y_offset: 21.1 +# Y offset of cartographer from the nozzle. +trigger_distance: 2. +# cartographer trigger distance for homing. +trigger_dive_threshold: 1.5 +# Threshold for range vs dive mode probing. Beyond `trigger_distance + +# trigger_dive_threshold` a dive will be used. +trigger_hysteresis: 0.006 +# Hysteresis on trigger threshold for untriggering, as a percentage of the +# trigger threshold. +cal_nozzle_z: 0.1 +# Expected nozzle offset after completing manual Z offset calibration. +cal_floor: 0.1 +# Minimum z bound on sensor response measurement. +cal_ceil:5. +# Maximum z bound on sensor response measurement. +cal_speed: 1.0 +# Speed while measuring response curve. +cal_move_speed: 10. +# Speed while moving to position for response curve measurement. +default_model_name: default +# Name of default cartographer model to load. +mesh_main_direction: x +# Primary travel direction during mesh measurement. +#mesh_overscan: -1 +# Distance to use for direction changes at mesh line ends. Omit this setting +# and a default will be calculated from line spacing and available travel. +mesh_cluster_size: 1 +# Radius of mesh grid point clusters. +mesh_runs: 2 +# Number of passes to make during mesh scan. + +[safe_z_home] +home_xy_position: 150,150 +# Example home_xy_position: 175,175 - This would be for a 350 * 350mm bed. +z_hop: 10 + +[gcode_macro _USER_VARIABLES] +# We can declare an "inductive_virtual" probe type as it's pretty close to the Cartographer way of working and should just work! +variable_probe_type_enabled: "inductive_virtual" +gcode: + +# Cartographer probe definition also include the probe management macro directly from here +[include ../../../macros/base/probing/generic_probe.cfg] + +# Z Stepper overrides for Cartographer +[stepper_z] +endstop_pin: probe:z_virtual_endstop # use cartographer as virtual endstop +homing_retract_dist: 0 # cartographer needs this to be set to 0 From 2b29e732917bc18d2c80b43a109321dcc31acf9f Mon Sep 17 00:00:00 2001 From: Ben Price Date: Thu, 18 Apr 2024 15:17:36 +0100 Subject: [PATCH 2/7] Adding Cartographer option to default printer.cfg --- user_templates/printer.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index 9db3d1afe..860381848 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -106,6 +106,9 @@ ## Beacon probe also used as virtual Z endstop. Do not forget to install the plugin and add the [beacon] section to make it work! # [include config/hardware/probes/beacon_virtual.cfg] + +## Cartographer probe also used as virtual Z endstop. Do not forget to install the plugin and add the [cartographer] section to make it work! +# [include config/hardware/probes/cartographer_virtual.cfg] # ---------------------------------------------------------------------------------------- From cbe183d4d3fdf7a15f1e4bad29233b500ce64366 Mon Sep 17 00:00:00 2001 From: Ben Price Date: Thu, 18 Apr 2024 15:58:47 +0100 Subject: [PATCH 3/7] Adding Cartographer repo updates to Moonraker --- moonraker/cartographer_probe.conf | 13 +++++++++++++ user_templates/moonraker.conf | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 moonraker/cartographer_probe.conf diff --git a/moonraker/cartographer_probe.conf b/moonraker/cartographer_probe.conf new file mode 100644 index 000000000..1f44f67ad --- /dev/null +++ b/moonraker/cartographer_probe.conf @@ -0,0 +1,13 @@ +# Cartographer code +[update_manager cartographer] +type: git_repo +path: ~/cartographer-klipper +channel: dev +origin: https://github.com/Cartographer3D/cartographer-klipper.git +env: ~/klippy-env/bin/python +requirements: requirements.txt +install_script: install.sh +is_system_service: False +managed_services: klipper +info_tags: + desc=Cartographer Probe diff --git a/user_templates/moonraker.conf b/user_templates/moonraker.conf index bd96e978c..16315e4ec 100644 --- a/user_templates/moonraker.conf +++ b/user_templates/moonraker.conf @@ -46,6 +46,9 @@ # [include moonraker/tmc_autotune.conf] # ----------------------------------------------------------------- +##### Cartographer plugin update management ---------------------- +# [include moonraker/cartographer_probe.conf] +# ----------------------------------------------------------------- ##### Add your custom moonraker config customizations and overrides below this line... # ------------------------------------------------------------------------------------ From 70c97f747dd65521d2c3952df6052a2a957423af Mon Sep 17 00:00:00 2001 From: Ben Price Date: Thu, 18 Apr 2024 16:02:02 +0100 Subject: [PATCH 4/7] refining the config details --- .../hardware/probes/cartographer_virtual.cfg | 35 ++++++++++--------- user_templates/printer.cfg | 3 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/config/hardware/probes/cartographer_virtual.cfg b/config/hardware/probes/cartographer_virtual.cfg index b55b0248e..c4c468122 100644 --- a/config/hardware/probes/cartographer_virtual.cfg +++ b/config/hardware/probes/cartographer_virtual.cfg @@ -18,45 +18,46 @@ # If you are using the CAN Bus version, replace serial: with canbus_uuid: and add the UUID. # Example: canbus_uuid: 1283as878a9sd # -speed: 40. +# These settings are based on a Voron 2.4r2 300mm with the Cartographer CNC mount. Edit in overrides.cfg as appropriate for your configuration +#speed: 40. # Z probing dive speed. -lift_speed: 5. +#lift_speed: 5. # Z probing lift speed. -backlash_comp: 0.5 +#backlash_comp: 0.5 # Backlash compensation distance for removing Z backlash before measuring # the sensor response. -x_offset: 0. +#x_offset: 0. # X offset of cartographer from the nozzle. -y_offset: 21.1 +#y_offset: 21.1 # Y offset of cartographer from the nozzle. -trigger_distance: 2. +#trigger_distance: 2. # cartographer trigger distance for homing. -trigger_dive_threshold: 1.5 +#trigger_dive_threshold: 1.5 # Threshold for range vs dive mode probing. Beyond `trigger_distance + # trigger_dive_threshold` a dive will be used. -trigger_hysteresis: 0.006 +#trigger_hysteresis: 0.006 # Hysteresis on trigger threshold for untriggering, as a percentage of the # trigger threshold. -cal_nozzle_z: 0.1 +#cal_nozzle_z: 0.1 # Expected nozzle offset after completing manual Z offset calibration. -cal_floor: 0.1 +#cal_floor: 0.1 # Minimum z bound on sensor response measurement. -cal_ceil:5. +#cal_ceil:5. # Maximum z bound on sensor response measurement. -cal_speed: 1.0 +#cal_speed: 1.0 # Speed while measuring response curve. -cal_move_speed: 10. +#cal_move_speed: 10. # Speed while moving to position for response curve measurement. -default_model_name: default +#default_model_name: default # Name of default cartographer model to load. -mesh_main_direction: x +#mesh_main_direction: x # Primary travel direction during mesh measurement. #mesh_overscan: -1 # Distance to use for direction changes at mesh line ends. Omit this setting # and a default will be calculated from line spacing and available travel. -mesh_cluster_size: 1 +#mesh_cluster_size: 1 # Radius of mesh grid point clusters. -mesh_runs: 2 +#mesh_runs: 2 # Number of passes to make during mesh scan. [safe_z_home] diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index 860381848..6285ae030 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -107,7 +107,8 @@ ## Beacon probe also used as virtual Z endstop. Do not forget to install the plugin and add the [beacon] section to make it work! # [include config/hardware/probes/beacon_virtual.cfg] -## Cartographer probe also used as virtual Z endstop. Do not forget to install the plugin and add the [cartographer] section to make it work! +## Cartographer probe also used as virtual Z endstop. Do not forget to install the plugin and add the [cartographer] section to overrides.cfg make it work! +## See the below file for available options # [include config/hardware/probes/cartographer_virtual.cfg] # ---------------------------------------------------------------------------------------- From 9a2cc7b56c5fdebab0651a0b8846abf2f96ae870 Mon Sep 17 00:00:00 2001 From: Ben Price Date: Thu, 18 Apr 2024 16:29:12 +0100 Subject: [PATCH 5/7] Re-enabled defaults --- .../hardware/probes/cartographer_virtual.cfg | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/config/hardware/probes/cartographer_virtual.cfg b/config/hardware/probes/cartographer_virtual.cfg index c4c468122..4ec728626 100644 --- a/config/hardware/probes/cartographer_virtual.cfg +++ b/config/hardware/probes/cartographer_virtual.cfg @@ -18,46 +18,46 @@ # If you are using the CAN Bus version, replace serial: with canbus_uuid: and add the UUID. # Example: canbus_uuid: 1283as878a9sd # -# These settings are based on a Voron 2.4r2 300mm with the Cartographer CNC mount. Edit in overrides.cfg as appropriate for your configuration -#speed: 40. +# These settings are the defaults from Cartographer, edit as needed in your overrides.cfg +speed: 40. # Z probing dive speed. -#lift_speed: 5. +lift_speed: 5. # Z probing lift speed. -#backlash_comp: 0.5 +backlash_comp: 0.5 # Backlash compensation distance for removing Z backlash before measuring # the sensor response. -#x_offset: 0. +x_offset: 0. # X offset of cartographer from the nozzle. -#y_offset: 21.1 +y_offset: 21.1 # Y offset of cartographer from the nozzle. -#trigger_distance: 2. +trigger_distance: 2. # cartographer trigger distance for homing. -#trigger_dive_threshold: 1.5 +trigger_dive_threshold: 1.5 # Threshold for range vs dive mode probing. Beyond `trigger_distance + # trigger_dive_threshold` a dive will be used. -#trigger_hysteresis: 0.006 +trigger_hysteresis: 0.006 # Hysteresis on trigger threshold for untriggering, as a percentage of the # trigger threshold. -#cal_nozzle_z: 0.1 +cal_nozzle_z: 0.1 # Expected nozzle offset after completing manual Z offset calibration. -#cal_floor: 0.1 +cal_floor: 0.1 # Minimum z bound on sensor response measurement. -#cal_ceil:5. +cal_ceil:5. # Maximum z bound on sensor response measurement. -#cal_speed: 1.0 +cal_speed: 1.0 # Speed while measuring response curve. -#cal_move_speed: 10. +cal_move_speed: 10. # Speed while moving to position for response curve measurement. -#default_model_name: default +default_model_name: default # Name of default cartographer model to load. -#mesh_main_direction: x +mesh_main_direction: x # Primary travel direction during mesh measurement. #mesh_overscan: -1 # Distance to use for direction changes at mesh line ends. Omit this setting # and a default will be calculated from line spacing and available travel. -#mesh_cluster_size: 1 +mesh_cluster_size: 1 # Radius of mesh grid point clusters. -#mesh_runs: 2 +mesh_runs: 2 # Number of passes to make during mesh scan. [safe_z_home] From b4c9dfa6129dc9d00c53a2dc6fb77d099c61db48 Mon Sep 17 00:00:00 2001 From: Ben Price Date: Thu, 18 Apr 2024 16:43:37 +0100 Subject: [PATCH 6/7] Config for the onboard lis2dw accelerometer --- .../hardware/accelerometers/cartographer_lis2dw.cfg | 13 +++++++++++++ user_templates/printer.cfg | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 config/hardware/accelerometers/cartographer_lis2dw.cfg diff --git a/config/hardware/accelerometers/cartographer_lis2dw.cfg b/config/hardware/accelerometers/cartographer_lis2dw.cfg new file mode 100644 index 000000000..80cf3d920 --- /dev/null +++ b/config/hardware/accelerometers/cartographer_lis2dw.cfg @@ -0,0 +1,13 @@ +[lis2dw] +cs_pin: cartographer:PA3 +spi_bus: spi1 + +[resonance_tester] +accel_chip: lis2dw +probe_points: + 125, 125, 20 + +# Include the IS calibration macros to unlock them when +# an accelerometer is installed on the machine +[include ../../../macros/helpers/resonance_override.cfg] +[include ../../../scripts/K-ShakeTune/K-SnT_*.cfg] diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index 6285ae030..d8c882eb7 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -206,6 +206,8 @@ # [include config/hardware/accelerometers/lis2dw_usb_rp2040_spi1.cfg] # For BTT S2DW V1.0, ... # [include config/hardware/accelerometers/beacon_accelerometer.cfg] # For Beacon Rev H make sure Beacon. Do not forget to include the beacon_virtual_probe in the PROBE section! + +# [include config/hardware/accelerometers/cartographer_accelerometer.cfg] # For Cartographer lis2dw. # ---------------------------------------------------------------------------------------- From 1560e2176264d3be59a73adf66efd0fa6e7e786d Mon Sep 17 00:00:00 2001 From: Ben Price Date: Thu, 18 Apr 2024 18:46:06 +0100 Subject: [PATCH 7/7] Adding PROBE_CALIBRATE macro as requested --- config/hardware/probes/cartographer_virtual.cfg | 4 ++++ macros/base/probing/cartographer.cfg | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 macros/base/probing/cartographer.cfg diff --git a/config/hardware/probes/cartographer_virtual.cfg b/config/hardware/probes/cartographer_virtual.cfg index 4ec728626..c7d87ae6e 100644 --- a/config/hardware/probes/cartographer_virtual.cfg +++ b/config/hardware/probes/cartographer_virtual.cfg @@ -73,7 +73,11 @@ gcode: # Cartographer probe definition also include the probe management macro directly from here [include ../../../macros/base/probing/generic_probe.cfg] +# PROBE_CALIBRATE macro as per the cartographer docs +[include ../../../macros/base/probing/cartographer.cfg] + # Z Stepper overrides for Cartographer [stepper_z] endstop_pin: probe:z_virtual_endstop # use cartographer as virtual endstop homing_retract_dist: 0 # cartographer needs this to be set to 0 + diff --git a/macros/base/probing/cartographer.cfg b/macros/base/probing/cartographer.cfg new file mode 100644 index 000000000..fb4c6ebc0 --- /dev/null +++ b/macros/base/probing/cartographer.cfg @@ -0,0 +1,3 @@ +[gcode_macro PROBE_CALIBRATE] +gcode: +    CARTOGRAPHER_CALIBRATE