From 57ab6ed20a6b47619c4d37e5bf94ce67320ee964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Wed, 14 Jun 2023 23:37:16 +0200 Subject: [PATCH] simplified ADXL system and fixed a typo in Mellow Fly-SB2209 template --- .../hardware/accelerometers/adxl345_ebb.cfg | 18 ------------- ...l345_sht.cfg => adxl345_hardware_spi1.cfg} | 11 +++++++- ...l345_skr.cfg => adxl345_hardware_ssp1.cfg} | 10 +++++-- .../hardware/accelerometers/adxl345_rpi.cfg | 8 ++++-- .../accelerometers/adxl345_sb2040.cfg | 18 ------------- .../accelerometers/adxl345_software_spi.cfg | 26 +++++++++++++++++++ .../hardware/accelerometers/adxl345_usb.cfg | 11 +++++--- .../toolhead/BTT_EBB36-42_v1.0.cfg | 6 +++++ .../toolhead/BTT_EBB36-42_v1.1.cfg | 6 +++++ .../toolhead/BTT_EBB36-42_v1.2.cfg | 6 +++++ .../mcu_defaults/toolhead/BTT_SB2209_v1.0.cfg | 8 +++++- .../mcu_defaults/toolhead/BTT_SB2240_v1.0.cfg | 6 +++++ .../toolhead/Mellow_SB2040_v1.cfg | 6 +++++ .../toolhead/Mellow_SHT36-42_v1.x.cfg | 3 +++ .../toolhead/Mellow_SHT36_v2.x.cfg | 3 +++ user_templates/printer.cfg | 11 ++++---- 16 files changed, 106 insertions(+), 51 deletions(-) delete mode 100644 config/hardware/accelerometers/adxl345_ebb.cfg rename config/hardware/accelerometers/{adxl345_sht.cfg => adxl345_hardware_spi1.cfg} (55%) rename config/hardware/accelerometers/{adxl345_skr.cfg => adxl345_hardware_ssp1.cfg} (70%) delete mode 100644 config/hardware/accelerometers/adxl345_sb2040.cfg create mode 100644 config/hardware/accelerometers/adxl345_software_spi.cfg diff --git a/config/hardware/accelerometers/adxl345_ebb.cfg b/config/hardware/accelerometers/adxl345_ebb.cfg deleted file mode 100644 index 8491be932..000000000 --- a/config/hardware/accelerometers/adxl345_ebb.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[adxl345] -cs_pin: toolhead:ADXL_CS -spi_software_sclk_pin: toolhead:ADXL_SCLK -spi_software_mosi_pin: toolhead:ADXL_MOSI -spi_software_miso_pin: toolhead:ADXL_MISO -axes_map: x,y,z - -[resonance_tester] -accel_chip: adxl345 -probe_points: - -1,-1,-1 - - -# Include the IS calibration macros to unlock them when -# an accelerometer is installed on the machine -[include ../../../macros/helpers/resonance_override.cfg] -[include ../../../macros/calibration/IS_shaper_calibrate.cfg] -[include ../../../macros/calibration/IS_vibrations_measurement.cfg] diff --git a/config/hardware/accelerometers/adxl345_sht.cfg b/config/hardware/accelerometers/adxl345_hardware_spi1.cfg similarity index 55% rename from config/hardware/accelerometers/adxl345_sht.cfg rename to config/hardware/accelerometers/adxl345_hardware_spi1.cfg index 91cafb3c3..963c60107 100644 --- a/config/hardware/accelerometers/adxl345_sht.cfg +++ b/config/hardware/accelerometers/adxl345_hardware_spi1.cfg @@ -1,5 +1,14 @@ +# This ADXL file is dedicated to be used with ADXL boards +# connected over the SPI bus of the MCU boards on "spi1" + +# This include most Mellow toolhead boards such as SHT boards, ... +# But also Octopus, etc... + +# If using a toolhead board, be sure to have the pin override in your mcu.cfg (toolhead:ADXL_CS) + + [adxl345] -cs_pin: toolhead:ADXL_CS +cs_pin: ADXL_CS spi_bus: spi1 axes_map: x,y,z diff --git a/config/hardware/accelerometers/adxl345_skr.cfg b/config/hardware/accelerometers/adxl345_hardware_ssp1.cfg similarity index 70% rename from config/hardware/accelerometers/adxl345_skr.cfg rename to config/hardware/accelerometers/adxl345_hardware_ssp1.cfg index 1770407b9..9276b532f 100644 --- a/config/hardware/accelerometers/adxl345_skr.cfg +++ b/config/hardware/accelerometers/adxl345_hardware_ssp1.cfg @@ -1,7 +1,13 @@ +# This ADXL file is dedicated to be used with ADXL boards +# connected over the SPI bus of the MCU boards on "ssp1" + +# This include BTT SKRv1.4, ... + + [adxl345] -spi_bus: ssp1 cs_pin: ADXL_CS -axes_map: -z,y,x +spi_bus: ssp1 +axes_map: x,y,z [resonance_tester] accel_chip: adxl345 diff --git a/config/hardware/accelerometers/adxl345_rpi.cfg b/config/hardware/accelerometers/adxl345_rpi.cfg index 8d7b67df4..e5b26a1c9 100644 --- a/config/hardware/accelerometers/adxl345_rpi.cfg +++ b/config/hardware/accelerometers/adxl345_rpi.cfg @@ -1,4 +1,8 @@ -# This file is the recommended way to get an accelerometer connected and used in Klipper +# This ADXL file is dedicated to be used with ADXL boards +# connected over the SPI bus of the RaspberryPi +# It is the official and recommended way to get an +# accelerometer connected and used in Klipper + # Do not forget to also flash the RPi with the Klipper firmware! [include ../../mcu_definitions/rpi.cfg] @@ -6,7 +10,7 @@ [adxl345] cs_pin: rpi:None -axes_map: -z,y,x +axes_map: x,y,z [resonance_tester] accel_chip: adxl345 diff --git a/config/hardware/accelerometers/adxl345_sb2040.cfg b/config/hardware/accelerometers/adxl345_sb2040.cfg deleted file mode 100644 index 8491be932..000000000 --- a/config/hardware/accelerometers/adxl345_sb2040.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[adxl345] -cs_pin: toolhead:ADXL_CS -spi_software_sclk_pin: toolhead:ADXL_SCLK -spi_software_mosi_pin: toolhead:ADXL_MOSI -spi_software_miso_pin: toolhead:ADXL_MISO -axes_map: x,y,z - -[resonance_tester] -accel_chip: adxl345 -probe_points: - -1,-1,-1 - - -# Include the IS calibration macros to unlock them when -# an accelerometer is installed on the machine -[include ../../../macros/helpers/resonance_override.cfg] -[include ../../../macros/calibration/IS_shaper_calibrate.cfg] -[include ../../../macros/calibration/IS_vibrations_measurement.cfg] diff --git a/config/hardware/accelerometers/adxl345_software_spi.cfg b/config/hardware/accelerometers/adxl345_software_spi.cfg new file mode 100644 index 000000000..02884cfc1 --- /dev/null +++ b/config/hardware/accelerometers/adxl345_software_spi.cfg @@ -0,0 +1,26 @@ +# This ADXL file is dedicated to be used with ADXL boards +# connected over the software SPI bus of the MCU boards + +# This include most BTT toolhead boards such as EBB boards, SB2209, SB2240, +# but also some Mellow boards such as the Fly-SB2040, ... +# If using a toolhead board, be sure to have the pin override in your mcu.cfg (toolhead:ADXL_CS) + + +[adxl345] +cs_pin: ADXL_CS +spi_software_sclk_pin: ADXL_SCLK +spi_software_mosi_pin: ADXL_MOSI +spi_software_miso_pin: ADXL_MISO +axes_map: x,y,z + +[resonance_tester] +accel_chip: adxl345 +probe_points: + -1,-1,-1 + + +# Include the IS calibration macros to unlock them when +# an accelerometer is installed on the machine +[include ../../../macros/helpers/resonance_override.cfg] +[include ../../../macros/calibration/IS_shaper_calibrate.cfg] +[include ../../../macros/calibration/IS_vibrations_measurement.cfg] diff --git a/config/hardware/accelerometers/adxl345_usb.cfg b/config/hardware/accelerometers/adxl345_usb.cfg index b65915f83..f3ac0f1e7 100644 --- a/config/hardware/accelerometers/adxl345_usb.cfg +++ b/config/hardware/accelerometers/adxl345_usb.cfg @@ -1,12 +1,17 @@ -# USB support for RPi pico and KUSBA V2 -# Edit the serial line with the correct address. +# This ADXL file is dedicated to be used with ADXL boards +# connected over USB to the pi as dedicated and standalone ADXL-MCU boards + +# This include KUSBA, ... + + +# You need to override the following to be able to set the proper serial in your overrides.cfg file [mcu adxl] serial: /dev/serial/by-id/xxx [adxl345] cs_pin: adxl:gpio1 spi_bus: spi0a -axes_map: -z,y,x +axes_map: x,y,z [resonance_tester] accel_chip: adxl345 diff --git a/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.0.cfg b/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.0.cfg index 348a1dac3..a02592191 100644 --- a/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.0.cfg +++ b/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.0.cfg @@ -66,3 +66,9 @@ pin: toolhead:STATUS_NEOPIXEL [tmc2209 extruder] uart_pin: toolhead:E_TMCUART +[adxl345] +cs_pin: toolhead:ADXL_CS +spi_software_sclk_pin: toolhead:ADXL_SCLK +spi_software_mosi_pin: toolhead:ADXL_MOSI +spi_software_miso_pin: toolhead:ADXL_MISO + diff --git a/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.1.cfg b/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.1.cfg index 8338e47df..3bfe66c1c 100644 --- a/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.1.cfg +++ b/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.1.cfg @@ -66,3 +66,9 @@ pin: toolhead:STATUS_NEOPIXEL [tmc2209 extruder] uart_pin: toolhead:E_TMCUART +[adxl345] +cs_pin: toolhead:ADXL_CS +spi_software_sclk_pin: toolhead:ADXL_SCLK +spi_software_mosi_pin: toolhead:ADXL_MOSI +spi_software_miso_pin: toolhead:ADXL_MISO + diff --git a/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.2.cfg b/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.2.cfg index fb84e2ac4..bb924dde7 100644 --- a/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.2.cfg +++ b/user_templates/mcu_defaults/toolhead/BTT_EBB36-42_v1.2.cfg @@ -66,3 +66,9 @@ pin: toolhead:STATUS_NEOPIXEL [tmc2209 extruder] uart_pin: toolhead:E_TMCUART +[adxl345] +cs_pin: toolhead:ADXL_CS +spi_software_sclk_pin: toolhead:ADXL_SCLK +spi_software_mosi_pin: toolhead:ADXL_MOSI +spi_software_miso_pin: toolhead:ADXL_MISO + diff --git a/user_templates/mcu_defaults/toolhead/BTT_SB2209_v1.0.cfg b/user_templates/mcu_defaults/toolhead/BTT_SB2209_v1.0.cfg index f5b72e8d3..c344532f0 100644 --- a/user_templates/mcu_defaults/toolhead/BTT_SB2209_v1.0.cfg +++ b/user_templates/mcu_defaults/toolhead/BTT_SB2209_v1.0.cfg @@ -28,7 +28,7 @@ aliases: STATUS_NEOPIXEL=MCU_RGB , - ADXL_CS=MCU_SPI2_CS , ADXL_SCLK=MCU_SPI2_CLK , ADXL_MISO=MCU_SPI2_MISO , ADXL_MOSI=MCU_SPI2_MOSI , + ADXL_CS=MCU_SPI2_NSS , ADXL_SCLK=MCU_SPI2_CLK , ADXL_MISO=MCU_SPI2_MISO , ADXL_MOSI=MCU_SPI2_MOSI , MAX31865_NSS=MCU_SPI1_NSS , MAX31865_CLK=MCU_SPI1_CLK , MAX31865_MOSI=MCU_SPI1_MOSI , MAX31865_MISO = MCU_SPI1_MISO , @@ -67,3 +67,9 @@ pin: toolhead:STATUS_NEOPIXEL [tmc2209 extruder] uart_pin: toolhead:E_TMCUART +[adxl345] +cs_pin: toolhead:ADXL_CS +spi_software_sclk_pin: toolhead:ADXL_SCLK +spi_software_mosi_pin: toolhead:ADXL_MOSI +spi_software_miso_pin: toolhead:ADXL_MISO + diff --git a/user_templates/mcu_defaults/toolhead/BTT_SB2240_v1.0.cfg b/user_templates/mcu_defaults/toolhead/BTT_SB2240_v1.0.cfg index 867d0d561..c93aec612 100644 --- a/user_templates/mcu_defaults/toolhead/BTT_SB2240_v1.0.cfg +++ b/user_templates/mcu_defaults/toolhead/BTT_SB2240_v1.0.cfg @@ -89,3 +89,9 @@ driver_SGT: 30 driver_SEMIN: 2 driver_SEMAX: 8 +[adxl345] +cs_pin: toolhead:ADXL_CS +spi_software_sclk_pin: toolhead:ADXL_SCLK +spi_software_mosi_pin: toolhead:ADXL_MOSI +spi_software_miso_pin: toolhead:ADXL_MISO + diff --git a/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v1.cfg b/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v1.cfg index a5b92ea37..851639414 100644 --- a/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v1.cfg +++ b/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v1.cfg @@ -66,3 +66,9 @@ pin: toolhead:STATUS_NEOPIXEL [tmc2209 extruder] uart_pin: toolhead:E_TMCUART +[adxl345] +cs_pin: toolhead:ADXL_CS +spi_software_sclk_pin: toolhead:ADXL_SCLK +spi_software_mosi_pin: toolhead:ADXL_MOSI +spi_software_miso_pin: toolhead:ADXL_MISO + diff --git a/user_templates/mcu_defaults/toolhead/Mellow_SHT36-42_v1.x.cfg b/user_templates/mcu_defaults/toolhead/Mellow_SHT36-42_v1.x.cfg index 6f85acea5..8acba97dd 100644 --- a/user_templates/mcu_defaults/toolhead/Mellow_SHT36-42_v1.x.cfg +++ b/user_templates/mcu_defaults/toolhead/Mellow_SHT36-42_v1.x.cfg @@ -67,3 +67,6 @@ pin: toolhead:STATUS_NEOPIXEL [tmc2209 extruder] uart_pin: toolhead:E_TMCUART +[adxl345] +cs_pin: toolhead:ADXL_CS + diff --git a/user_templates/mcu_defaults/toolhead/Mellow_SHT36_v2.x.cfg b/user_templates/mcu_defaults/toolhead/Mellow_SHT36_v2.x.cfg index 343dc4c31..72a794bfa 100644 --- a/user_templates/mcu_defaults/toolhead/Mellow_SHT36_v2.x.cfg +++ b/user_templates/mcu_defaults/toolhead/Mellow_SHT36_v2.x.cfg @@ -66,3 +66,6 @@ pin: toolhead:STATUS_NEOPIXEL [tmc2209 extruder] uart_pin: toolhead:E_TMCUART +[adxl345] +cs_pin: toolhead:ADXL_CS + diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index f4cbcbda2..9f1634320 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -159,12 +159,11 @@ # --------------------------------------------------------------------- ACCELEROMETER ----> Select only one line ### -------------------------------------------------------------------------------------- -# [include config/hardware/accelerometers/adxl345_rpi.cfg] -# [include config/hardware/accelerometers/adxl345_ebb.cfg] -# [include config/hardware/accelerometers/adxl345_sht.cfg] -# [include config/hardware/accelerometers/adxl345_sb2040.cfg] -# [include config/hardware/accelerometers/adxl345_skr.cfg] -# [include config/hardware/accelerometers/adxl345_usb.cfg] +# [include config/hardware/accelerometers/adxl345_rpi.cfg] # For ADXL plugged directly on the Pi (official and recommended way) +# [include config/hardware/accelerometers/adxl345_software_spi.cfg] # For ADXL plugged in boards such as BTT EBB, SB2209, SB2240, or Mellow Fly-SB2040, ... +# [include config/hardware/accelerometers/adxl345_hardware_spi1.cfg] # For ADXL plugged in Mellow SHT, Octopus, ... +# [include config/hardware/accelerometers/adxl345_hardware_ssp1.cfg] # For ADXL plugged in SKRv1.4, ... +# [include config/hardware/accelerometers/adxl345_usb.cfg] # For KUBSA, ... # ----------------------------------------------------------------------------------------