diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..4d54ca315 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,40 @@ +name: Mark and Manage Stale Issues and Pull Requests + +on: + schedule: + - cron: '30 7 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v9.0.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-stale: 30 + days-before-close: 14 + stale-issue-message: > + 📌 **This issue has been marked as stale because it has not had activity in the past 30 days.** + + To keep it open, please respond to this message or add new information. Otherwise, this will be closed in 14 days. + + Thank you for your contributions! + stale-pr-message: > + 📌 **This pull request has been marked as stale because it has not had activity in the past 30 days.** + + Please update the PR or comment to keep it active. Otherwise, this will be closed in 14 days. + + We appreciate your contribution! + stale-issue-label: 'stale' + stale-pr-label: 'stale, reviewer-needed' + exempt-issue-labels: 'tracking' + exempt-pr-labels: 'tracking' + close-issue-message: 'This issue was closed due to inactivity for 14 days. Feel free to reopen it if you think it was an error or if you have new information or progress to share' + close-pr-message: 'This pull request was closed due to inactivity for 14 days. Please reopen it if you think it was an error or if you wish to continue the contribution.' + exempt-all-milestones: true + exempt-all-assignees: true + exempt-draft-prs: true diff --git a/.gitignore b/.gitignore index 1c963e1f2..344064f33 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /*.cfg /*.conf /.VERSION +/scripts/K-ShakeTune # ------------------------------------------------------------------- diff --git a/README.md b/README.md index 078af819e..7f3da803b 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,57 @@ -# Klippain - -> Klippain - The pain-free recipe for (french)bread and butter Klipper configuration! - -Klippain is a generic, modular, and highly customizable Klipper configuration for 3D printers. Designed for use on various machines such as Cartesian, CoreXY and CoreXZ, it has been reported working correctly on Voron V2.4, Voron Trident, Voron V0, Voron SwitchWire, TriZero, VZbot, Ender5, Ender3, Prusas, etc... - -![Klippain](./docs/klippain.png) - -Klippain is regularly updated with new features and merged PRs from users. You can reach me on the Voron Discord as **Frix_x#0161**. - -Fun fact: "pain" \pɛ̃\ is the French word for bread, so there's no pain in this pain—only joy! Thanks to the French channel "honhonhonbaguette-FR" on the Voron Discord for the joke and name suggestion! - - -## Features - -Klippain is designed for versatility. By selecting and enabling the desired hardware and software options, it can be used on a wide range of machines. - -Custom features available out of the box include **adaptive bed mesh**, **custom printer calibration macros**, **automated input shaper workflows**, and **vibration measurement** macros and scripts, ... Refer to the [features documentation](./docs/features.md) for a detailed list and usage instructions. - - -## Installation - -To install Klippain, first ensure you have already Klipper, Moonraker, and a WebUI installed on your printer. If not, use [KIAUH](https://github.com/th33xitus/kiauh). - -Then, run the installation script using the following command over SSH. This script will backup your old configuration, download this GitHub repository to your RaspberryPi home directory, and set up Klippain in `~/printer_data/config`. You will also be prompted to select and install MCU board_pins templates. This is recommended for faster `mcu.cfg` setup, but you can do it manually later if you prefer. - -```bash -wget -O - https://raw.githubusercontent.com/Frix-x/klippain/main/install.sh | bash -``` - -Finally, Klippain requires a few simple steps to configure and customize it for your printer: please follow the [configuration guide](./docs/configuration.md). - - > **Warning** - > - > General rule to keep the auto-update feature working: **never modify Klippain files directly**, but instead add overrides as per the documentation! To proceed, you can modify all the pre-installed templates in your config root folder (`printer.cfg`, `mcu.cfg`, `variables.cfg` and `overrides.cfg`) as they will be preserved on update. - - -## Removing Klippain - -In case Klippain doesn't suit your needs or if you installed it by mistake, you can easily remove Klippain and revert to your previous configuration by using the automated uninstall script. During the uninstallation process, the script will remove all specific Klippain files and configurations. Additionally, you will be given an option to restore your previously backed-up configuration, allowing your printer to return to its last working state (from before Klippain was installed). - -To run the uninstall script, execute the following command over SSH: - -```bash -wget -O - https://raw.githubusercontent.com/Frix-x/klippain/main/uninstall.sh | bash -``` - - > **Note** - > - > All backups are preserved during the uninstallation process. So, you can easily revert back at any time if you wish to :stuck_out_tongue_winking_eye: - - -## Support the Project - -I strive to accommodate user requests that align with this configuration's design. Feel free to open an issue or a PR for specific hardware device support or new features. - -Alternatively, consider buying me a coffee or contributing to new hardware purchases to support my work! +# Klippain + +> Klippain - The pain-free recipe for (french)bread and butter Klipper configuration! + +Klippain is a generic, modular, and highly customizable Klipper configuration for 3D printers. Designed for use on various machines such as Cartesian, CoreXY and CoreXZ, it has been reported working correctly on Voron V2.4, Voron Trident, Voron V0, Voron SwitchWire, TriZero, VZbot, Ender5, Ender3, Prusas, etc... + +![Klippain](./docs/klippain.png) + +Klippain is regularly updated with new features and merged PRs from users. You can reach me on the Voron Discord as **Frix_x#0161**. + +Fun fact: "pain" \pɛ̃\ is the French word for bread, so there's no pain in this pain—only joy! Thanks to the French channel "honhonhonbaguette-FR" on the Voron Discord for the joke and name suggestion! + + +## Features + +Klippain is designed for versatility. By selecting and enabling the desired hardware and software options, it can be used on a wide range of machines. + +Custom features available out of the box include a full featured set of standard macros, **adaptive bed mesh**, **custom printer calibrations**, **automated input shaper workflows**, and **vibration measurement** macros and scripts, ... Refer to the [features documentation](./docs/features.md) for a detailed list and usage instructions. + + +## Installation + +To install Klippain, first ensure you have already Klipper, Moonraker, and a WebUI installed on your printer. If not, you can use [KIAUH](https://github.com/th33xitus/kiauh). + +Then, run the installation script using the following command over SSH. This script will backup your old configuration, download this GitHub repository to your RaspberryPi home directory, and set up Klippain in `~/printer_data/config`. You will also be prompted to select and install MCU board_pins templates. This is recommended for faster `mcu.cfg` setup, but you can do it manually later if you prefer. + +```bash +wget -O - https://raw.githubusercontent.com/Frix-x/klippain/main/install.sh | bash +``` + +Finally, Klippain requires a few simple steps to configure and customize it for your printer: please follow the [configuration guide](./docs/configuration.md). + + > **Warning**: + > + > General rule to keep the auto-update feature working: **never modify Klippain files directly**, but instead add overrides as per [the documentation](./docs/overrides.md)! To proceed, you can modify all the pre-installed templates in your config root folder (`printer.cfg`, `mcu.cfg`, `variables.cfg` and `overrides.cfg`) as they will be preserved on update. + + +## Removing Klippain + +In case Klippain doesn't suit your needs or if you installed it by mistake, you can easily remove Klippain and revert to your previous configuration by using the automated uninstall script. During the uninstallation process, the script will remove all specific Klippain files and configurations. Additionally, you will be given an option to restore your previously backed-up configuration, allowing your printer to return to its last working state (from before Klippain was installed). + +To run the uninstall script, execute the following command over SSH: + +```bash +wget -O - https://raw.githubusercontent.com/Frix-x/klippain/main/uninstall.sh | bash +``` + + > **Note**: + > + > All backups are preserved during the uninstallation process. So, you can easily revert back at any time if you wish to :stuck_out_tongue_winking_eye: + + +## Support the Project + +I strive to accommodate user requests that align with this configuration's design. Feel free to open an issue or a PR for specific hardware device support or new features. + +Alternatively, consider buying me a coffee or contributing to new hardware purchases to support my work! diff --git a/config/hardware/accelerometers/adxl345_Fysetc_SB_Can_TH.cfg b/config/hardware/accelerometers/adxl345_Fysetc_SB_Can_TH.cfg new file mode 100644 index 000000000..9f06e9d80 --- /dev/null +++ b/config/hardware/accelerometers/adxl345_Fysetc_SB_Can_TH.cfg @@ -0,0 +1,8 @@ +[include generics/adxl345_software_spi.cfg] + +# As it's a toolhead ADXL, we add some default pins overrides from here +[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/config/hardware/accelerometers/adxl345_rpi.cfg b/config/hardware/accelerometers/adxl345_rpi.cfg index e5b26a1c9..b65ff26dc 100644 --- a/config/hardware/accelerometers/adxl345_rpi.cfg +++ b/config/hardware/accelerometers/adxl345_rpi.cfg @@ -21,5 +21,4 @@ probe_points: # 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] +[include ../../../scripts/K-ShakeTune/K-SnT_*.cfg] diff --git a/config/hardware/accelerometers/adxl345_usb.cfg b/config/hardware/accelerometers/adxl345_usb.cfg index f3ac0f1e7..0bd2edb72 100644 --- a/config/hardware/accelerometers/adxl345_usb.cfg +++ b/config/hardware/accelerometers/adxl345_usb.cfg @@ -22,5 +22,4 @@ probe_points: # 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] +[include ../../../scripts/K-ShakeTune/K-SnT_*.cfg] diff --git a/config/hardware/accelerometers/adxl345_usb_rampon.cfg b/config/hardware/accelerometers/adxl345_usb_rampon.cfg index a91c95b03..0dcb97bb5 100644 --- a/config/hardware/accelerometers/adxl345_usb_rampon.cfg +++ b/config/hardware/accelerometers/adxl345_usb_rampon.cfg @@ -21,5 +21,4 @@ probe_points: # 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] +[include ../../../scripts/K-ShakeTune/K-SnT_*.cfg] diff --git a/config/hardware/accelerometers/adxl345_usb_rp2040_spi1.cfg b/config/hardware/accelerometers/adxl345_usb_rp2040_spi1.cfg index 67c924515..f03a7e46c 100644 --- a/config/hardware/accelerometers/adxl345_usb_rp2040_spi1.cfg +++ b/config/hardware/accelerometers/adxl345_usb_rp2040_spi1.cfg @@ -25,5 +25,4 @@ probe_points: # 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] +[include ../../../scripts/K-ShakeTune/K-SnT_*.cfg] diff --git a/config/hardware/accelerometers/generics/adxl345_hardware_spi1.cfg b/config/hardware/accelerometers/generics/adxl345_hardware_spi1.cfg index f0746898e..7906be329 100644 --- a/config/hardware/accelerometers/generics/adxl345_hardware_spi1.cfg +++ b/config/hardware/accelerometers/generics/adxl345_hardware_spi1.cfg @@ -21,5 +21,4 @@ probe_points: # 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] +[include ../../../../scripts/K-ShakeTune/K-SnT_*.cfg] diff --git a/config/hardware/accelerometers/generics/adxl345_hardware_ssp1.cfg b/config/hardware/accelerometers/generics/adxl345_hardware_ssp1.cfg index 165c905b1..9089059c4 100644 --- a/config/hardware/accelerometers/generics/adxl345_hardware_ssp1.cfg +++ b/config/hardware/accelerometers/generics/adxl345_hardware_ssp1.cfg @@ -18,5 +18,4 @@ probe_points: # 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] +[include ../../../../scripts/K-ShakeTune/K-SnT_*.cfg] diff --git a/config/hardware/accelerometers/generics/adxl345_software_spi.cfg b/config/hardware/accelerometers/generics/adxl345_software_spi.cfg index 480c21349..9318acf80 100644 --- a/config/hardware/accelerometers/generics/adxl345_software_spi.cfg +++ b/config/hardware/accelerometers/generics/adxl345_software_spi.cfg @@ -22,5 +22,4 @@ probe_points: # 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] +[include ../../../../scripts/K-ShakeTune/K-SnT_*.cfg] diff --git a/config/hardware/accelerometers/lis2dw_usb_rp2040_spi1.cfg b/config/hardware/accelerometers/lis2dw_usb_rp2040_spi1.cfg new file mode 100644 index 000000000..fdba7f843 --- /dev/null +++ b/config/hardware/accelerometers/lis2dw_usb_rp2040_spi1.cfg @@ -0,0 +1,25 @@ +# This LIS2DW file is dedicated to be used with USB RP2040 boards where the LIS2DW +# is connected to SPI1 + +# This include BTT S2DW V1.0, ... + + +# You need to set the proper serial in your overrides.cfg file +[mcu lis2dw_mcu] +serial: /dev/serial/by-id/xxx + +[lis2dw] +cs_pin: lis2dw_mcu:gpio9 +spi_bus: spi1a +axes_map: x,y,z + +[resonance_tester] +accel_chip: lis2dw +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 ../../../scripts/K-ShakeTune/K-SnT_*.cfg] diff --git a/config/hardware/axis/X/TMC/TMC5160.cfg b/config/hardware/axis/X/TMC/TMC5160.cfg index 98bb51a57..248485e34 100644 --- a/config/hardware/axis/X/TMC/TMC5160.cfg +++ b/config/hardware/axis/X/TMC/TMC5160.cfg @@ -11,5 +11,5 @@ spi_software_mosi_pin: DRIVER_SPI_MOSI spi_software_miso_pin: DRIVER_SPI_MISO interpolate: True run_current: 0.8 -sense_resistor: 0.110 +sense_resistor: 0.075 stealthchop_threshold: 0 diff --git a/config/hardware/axis/Y/TMC/TMC5160.cfg b/config/hardware/axis/Y/TMC/TMC5160.cfg index 90598c190..92fe211d7 100644 --- a/config/hardware/axis/Y/TMC/TMC5160.cfg +++ b/config/hardware/axis/Y/TMC/TMC5160.cfg @@ -11,5 +11,5 @@ spi_software_mosi_pin: DRIVER_SPI_MOSI spi_software_miso_pin: DRIVER_SPI_MISO interpolate: True run_current: 0.8 -sense_resistor: 0.110 +sense_resistor: 0.075 stealthchop_threshold: 0 diff --git a/config/hardware/axis/Z/TMC/TMC5160_1-Motor.cfg b/config/hardware/axis/Z/TMC/TMC5160_1-Motor.cfg new file mode 100644 index 000000000..991470198 --- /dev/null +++ b/config/hardware/axis/Z/TMC/TMC5160_1-Motor.cfg @@ -0,0 +1,18 @@ +# Z TMC5160 definition + +# User variable only needed here as they are called recursively +[gcode_macro _USER_VARIABLES] +variable_z_driver: "tmc5160" +gcode: + + +[tmc5160 stepper_z] +cs_pin: Z_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.8 +sense_resistor: 0.075 +stealthchop_threshold: 0 \ No newline at end of file diff --git a/config/hardware/axis/Z/TMC/TMC5160_3-Motors.cfg b/config/hardware/axis/Z/TMC/TMC5160_3-Motors.cfg new file mode 100644 index 000000000..4a6b57679 --- /dev/null +++ b/config/hardware/axis/Z/TMC/TMC5160_3-Motors.cfg @@ -0,0 +1,23 @@ +[include TMC5160_1-Motor.cfg] + +[tmc5160 stepper_z1] +cs_pin: Z1_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.8 +sense_resistor: 0.075 +stealthchop_threshold: 0 + +[tmc5160 stepper_z2] +cs_pin: Z2_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.8 +sense_resistor: 0.075 +stealthchop_threshold: 0 \ No newline at end of file diff --git a/config/hardware/axis/Z/TMC/TMC5160_4-Motors.cfg b/config/hardware/axis/Z/TMC/TMC5160_4-Motors.cfg new file mode 100644 index 000000000..a47270201 --- /dev/null +++ b/config/hardware/axis/Z/TMC/TMC5160_4-Motors.cfg @@ -0,0 +1,12 @@ +[include TMC5160_3-Motors.cfg] + +[tmc5160 stepper_z3] +cs_pin: Z3_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.8 +sense_resistor: 0.075 +stealthchop_threshold: 0 \ No newline at end of file diff --git a/config/hardware/axis/Z/Trident_TR8x2_1.8deg.cfg b/config/hardware/axis/Z/Trident_TR8x2_1.8deg.cfg new file mode 100644 index 000000000..8649a265e --- /dev/null +++ b/config/hardware/axis/Z/Trident_TR8x2_1.8deg.cfg @@ -0,0 +1,18 @@ +[stepper_z] +rotation_distance: 2 +microsteps: 32 +full_steps_per_rotation: 200 + +[stepper_z1] +rotation_distance: 2 +microsteps: 32 +full_steps_per_rotation: 200 + +[stepper_z2] +rotation_distance: 2 +microsteps: 32 +full_steps_per_rotation: 200 + +# We also include the default wiring and speeds from here to avoid duplicating +[include default_wiring_3M.cfg] +[include default_speed.cfg] diff --git a/config/hardware/axis/Z/Trident_TR8x8_0.9deg.cfg b/config/hardware/axis/Z/Trident_TR8x8_0.9deg.cfg new file mode 100644 index 000000000..7ffd97f5e --- /dev/null +++ b/config/hardware/axis/Z/Trident_TR8x8_0.9deg.cfg @@ -0,0 +1,18 @@ +[stepper_z] +rotation_distance: 8 +microsteps: 32 +full_steps_per_rotation: 400 + +[stepper_z1] +rotation_distance: 8 +microsteps: 32 +full_steps_per_rotation: 400 + +[stepper_z2] +rotation_distance: 8 +microsteps: 32 +full_steps_per_rotation: 400 + +# We also include the default wiring and speeds from here to avoid duplicating +[include default_wiring_3M.cfg] +[include default_speed.cfg] diff --git a/config/hardware/displays/BTT_mini12864.cfg b/config/hardware/displays/BTT_mini12864.cfg index 659d4c068..17be931f3 100644 --- a/config/hardware/displays/BTT_mini12864.cfg +++ b/config/hardware/displays/BTT_mini12864.cfg @@ -1,12 +1,16 @@ # Neopixel leds integrated in the BTT mini12864 display [gcode_macro _USER_VARIABLES] variable_status_leds_minidisplay_enabled = True +variable_status_leds_minidisplay_knob_only = True variable_status_leds_minidisplay_led_name: "btt_mini12864" +variable_status_leds_minidisplay_idx: '1,2' + gcode: # Also include directly the leds control macros from here [include ../../../macros/hardware_functions/status_leds.cfg] - +# Include adaptations to the menus +[include ../../../config/software/display/display.cfg] [display] lcd_type: uc1701 @@ -36,10 +40,10 @@ initial_BLUE: 0.0 color_order: RGB # Set RGB values on boot up for each Neopixel. -# Index 1 = display, Index 2 and 3 = Knob +# Index 3 = display, Index 1 and 2 = Knob [delayed_gcode setdisplayneopixel] initial_duration: 1 gcode: - SET_LED LED=btt_mini12864 RED=1 GREEN=1 BLUE=1 INDEX=1 TRANSMIT=0 + SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=1 TRANSMIT=0 SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=2 TRANSMIT=0 - SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=3 + SET_LED LED=btt_mini12864 RED=1 GREEN=1 BLUE=1 INDEX=3 diff --git a/config/hardware/displays/BTT_mini12864_inversed.cfg b/config/hardware/displays/BTT_mini12864_inversed.cfg index 8db250533..e85610c48 100644 --- a/config/hardware/displays/BTT_mini12864_inversed.cfg +++ b/config/hardware/displays/BTT_mini12864_inversed.cfg @@ -1,12 +1,16 @@ # Neopixel leds integrated in the BTT mini12864 display [gcode_macro _USER_VARIABLES] variable_status_leds_minidisplay_enabled = True +variable_status_leds_minidisplay_knob_only = True variable_status_leds_minidisplay_led_name: "btt_mini12864" +variable_status_leds_minidisplay_idx: '1,2' + gcode: # Also include directly the leds control macros from here [include ../../../macros/hardware_functions/status_leds.cfg] - +# Include adaptations to the menus +[include ../../../config/software/display/display.cfg] [display] lcd_type: uc1701 @@ -36,10 +40,10 @@ initial_BLUE: 0.0 color_order: RGB # Set RGB values on boot up for each Neopixel. -# Index 1 = display, Index 2 and 3 = Knob +# Index 3 = display, Index 1 and 2 = Knob [delayed_gcode setdisplayneopixel] initial_duration: 1 gcode: - SET_LED LED=btt_mini12864 RED=1 GREEN=1 BLUE=1 INDEX=1 TRANSMIT=0 + SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=1 TRANSMIT=0 SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=2 TRANSMIT=0 - SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=3 + SET_LED LED=btt_mini12864 RED=1 GREEN=1 BLUE=1 INDEX=3 diff --git a/config/hardware/displays/Fysetc_mini12864.cfg b/config/hardware/displays/Fysetc_mini12864.cfg index 6cd925c83..fa295ecef 100644 --- a/config/hardware/displays/Fysetc_mini12864.cfg +++ b/config/hardware/displays/Fysetc_mini12864.cfg @@ -1,12 +1,16 @@ # Neopixel leds integrated in the Fysetc mini12864 display [gcode_macro _USER_VARIABLES] variable_status_leds_minidisplay_enabled = True +variable_status_leds_minidisplay_knob_only = True variable_status_leds_minidisplay_led_name: "fysetc_mini12864" +variable_status_leds_minidisplay_idx: '2,3' + gcode: # Also include directly the leds control macros from here [include ../../../macros/hardware_functions/status_leds.cfg] - +# Include adaptations to the menus +[include ../../../config/software/display/display.cfg] [display] lcd_type: uc1701 diff --git a/config/hardware/displays/Fysetc_mini12864_inversed.cfg b/config/hardware/displays/Fysetc_mini12864_inversed.cfg index c8a576c2c..9aaafe815 100644 --- a/config/hardware/displays/Fysetc_mini12864_inversed.cfg +++ b/config/hardware/displays/Fysetc_mini12864_inversed.cfg @@ -1,12 +1,16 @@ # Neopixel leds integrated in the Fysetc mini12864 display [gcode_macro _USER_VARIABLES] variable_status_leds_minidisplay_enabled = True +variable_status_leds_minidisplay_knob_only = True variable_status_leds_minidisplay_led_name: "fysetc_mini12864" +variable_status_leds_minidisplay_idx: '2,3' + gcode: # Also include directly the leds control macros from here [include ../../../macros/hardware_functions/status_leds.cfg] - +# Include adaptations to the menus +[include ../../../config/software/display/display.cfg] [display] lcd_type: uc1701 diff --git a/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0.cfg b/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0.cfg new file mode 100644 index 000000000..98e25169f --- /dev/null +++ b/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0.cfg @@ -0,0 +1,36 @@ +# Neopixel leds integrated in the Fysetc mini12864 display +[gcode_macro _USER_VARIABLES] +variable_status_leds_minidisplay_enabled = True +variable_status_leds_minidisplay_knob_only = False +variable_status_leds_minidisplay_led_name: "fysetc_mini12864" +gcode: + +# Also include directly the leds control macros from here +[include ../../../macros/hardware_functions/status_leds.cfg] + + +[display] +lcd_type: uc1701 +cs_pin: EXP1_8 +a0_pin: EXP1_7 +rst_pin: EXP1_6 +encoder_pins: ^EXP2_8, ^EXP2_6 +click_pin: ^!EXP1_9 +## Some micro-controller boards may require an spi bus to be specified: +#spi_bus: spi +## Alternatively, some micro-controller boards may work with software spi: +contrast: 63 +spi_software_miso_pin: EXP2_10 +spi_software_mosi_pin: EXP2_5 +spi_software_sclk_pin: EXP2_9 + +[output_pin beeper] +pin: EXP1_10 + +[led fysetc_mini12864] +red_pin: EXP1_5 +green_pin: EXP1_4 +blue_pin: EXP1_3 +initial_RED: 0.1 +initial_GREEN: 0.5 +initial_BLUE: 0.0 \ No newline at end of file diff --git a/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0_inversed.cfg b/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0_inversed.cfg new file mode 100644 index 000000000..bc2fe543d --- /dev/null +++ b/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0_inversed.cfg @@ -0,0 +1,36 @@ +# Neopixel leds integrated in the Fysetc mini12864 display +[gcode_macro _USER_VARIABLES] +variable_status_leds_minidisplay_enabled = True +variable_status_leds_minidisplay_knob_only = False +variable_status_leds_minidisplay_led_name: "fysetc_mini12864" +gcode: + +# Also include directly the leds control macros from here +[include ../../../macros/hardware_functions/status_leds.cfg] + + +[display] +lcd_type: uc1701 +cs_pin: EXP1_3 +a0_pin: EXP1_4 +rst_pin: EXP1_5 +encoder_pins: ^EXP2_3, ^EXP2_5 +click_pin: ^!EXP1_2 +## Some micro-controller boards may require an spi bus to be specified: +#spi_bus: spi +## Alternatively, some micro-controller boards may work with software spi: +contrast: 63 +spi_software_miso_pin: EXP2_1 +spi_software_mosi_pin: EXP2_6 +spi_software_sclk_pin: EXP2_2 + +[output_pin beeper] +pin: EXP1_1 + +[led fysetc_mini12864] +red_pin: EXP1_6 +green_pin: EXP1_7 +blue_pin: EXP1_8 +initial_RED: 0.1 +initial_GREEN: 0.5 +initial_BLUE: 0.0 \ No newline at end of file diff --git a/config/hardware/displays/V0_display.cfg b/config/hardware/displays/V0_display.cfg new file mode 100644 index 000000000..5b0984321 --- /dev/null +++ b/config/hardware/displays/V0_display.cfg @@ -0,0 +1,52 @@ +# Neopixel leds integrated in the V0 Display +[gcode_macro _USER_VARIABLES] +variable_status_leds_minidisplay_enabled = True +variable_status_leds_minidisplay_knob_only = False +variable_status_leds_minidisplay_led_name: "v0_displaystatus" + +gcode: + +# Also include directly the leds control macros from here +[include ../../../macros/hardware_functions/status_leds.cfg] +# Include adaptations to the menus +[include ../../../config/software/display/display.cfg] + +# You need to set the proper serial in your overrides.cfg file +[mcu v0_display] +#serial: my-v0-display-serial +restart_method: command + +[display] +lcd_type: sh1106 +i2c_mcu: v0_display +i2c_bus: i2c1a +# Set the direction of the encoder wheel +# Standard: Right (clockwise) scrolls down or increases values. Left (counter-clockwise scrolls up or decreases values. +encoder_pins: ^v0_display:PA3, ^v0_display:PA4 +# Reversed: Right (clockwise) scrolls up or decreases values. Left (counter-clockwise scrolls down or increases values. +#encoder_pins: ^v0_display:PA4, ^v0_display:PA3 +click_pin: ^!v0_display:PA1 +kill_pin: ^!v0_display:PA5 +#x_offset: 2 +# Use X offset to shift the display towards the right. Value can be 0 to 3 +#vcomh: 0 +# Set the Vcomh value on SSD1306/SH1106 displays. This value is +# associated with a "smearing" effect on some OLED displays. The +# value may range from 0 to 63. Default is 0. +# Adjust this value if you get some vertical stripes on your display. (31 seems to be a good value) + +[neopixel v0_displaystatus] +pin: v0_display:PA0 +chain_count: 1 +# Can be GRBW depending on the manufacturer of the display +color_order: GRB +initial_RED: 0.1 +initial_GREEN: 0.5 +initial_BLUE: 0.0 + +# Set RGB values on boot up for each Neopixel. +# Index 1 = display, Index 2 and 3 = Knob +[delayed_gcode setdisplayneopixel] +initial_duration: 1 +gcode: + SET_LED LED=v0_displaystatus RED=1 GREEN=0 BLUE=0 INDEX=1 TRANSMIT=0 diff --git a/config/hardware/ercf.cfg b/config/hardware/ercf.cfg index 7cf97e801..3a478857a 100644 --- a/config/hardware/ercf.cfg +++ b/config/hardware/ercf.cfg @@ -1,26 +1,10 @@ +## DEPRECATED! +## Please use the mmu.cfg file instead + + ## Enraged Rabbit Carrot Feeder config file ## Designed to be used with Ercf Software V3 "Happy Hare" (HH) by moggieuk: https://github.com/moggieuk/ERCF-Software-V3 [gcode_macro _USER_VARIABLES] variable_klippain_ercf_enabled: True gcode: - -[extruder] -max_extrude_only_distance: 200 -max_extrude_cross_section: 50.0 - -# Custom macro to raise an error during the START_PRINT and stop it in case of an ERCF error -[gcode_macro _ERCF_ERROR_CHECK] -gcode: - {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} - {% set INITIAL_TOOL = printer["gcode_macro START_PRINT"].initial_tool %} - - {% if printer.ercf.enabled %} - {% if printer.ercf.tool|int != INITIAL_TOOL or printer.ercf.filament != "Loaded" %} - {action_raise_error("ERCF error while loading filament! Please check and restart the print")} - {% else %} - {% if verbose %} - RESPOND MSG="T{INITIAL_TOOL} ready" - {% endif %} - {% endif %} - {% endif %} diff --git a/config/hardware/extruder/orbiter2.0.cfg b/config/hardware/extruder/orbiter2.0.cfg index 98ab31ff1..78841f875 100644 --- a/config/hardware/extruder/orbiter2.0.cfg +++ b/config/hardware/extruder/orbiter2.0.cfg @@ -22,6 +22,9 @@ min_extrude_temp: 172 pressure_advance: 0.0475 pressure_advance_smooth_time: 0.040 +# Orbiter 2 motor will not be happy with 0.45 for run current. Recommended value in overrides.cfg is 0.85 depending on driver. +# https://www.orbiterprojects.com/orbiter-v2-0/ for more details + # We also include the default wiring and low thermal hotend patch [include default_wiring.cfg] [include ../../../macros/helpers/hotend_heater_ctrl.cfg] diff --git a/config/hardware/extruder/sherpa_mini.cfg b/config/hardware/extruder/sherpa_mini.cfg new file mode 100644 index 000000000..853b1f4da --- /dev/null +++ b/config/hardware/extruder/sherpa_mini.cfg @@ -0,0 +1,28 @@ +[gcode_macro _USER_VARIABLES] +variable_extruder_enabled: True +gcode: + + +[extruder] +# Sherpa mini Gear Ratio +# new_rd = previous_rd * mesured_distance / requested_distance +rotation_distance: 22.67895 +gear_ratio: 50:8 +microsteps: 32 +full_steps_per_rotation: 200 + +nozzle_diameter: 0.400 +filament_diameter: 1.75 +max_extrude_only_distance: 110 +max_extrude_cross_section: 5 +sensor_type: ATC Semitec 104NT-4-R025H42G +min_temp: 10 +max_temp: 290 +max_power: 1.0 +min_extrude_temp: 172 +pressure_advance: 0.0475 +pressure_advance_smooth_time: 0.040 + +# We also include the default wiring and low thermal hotend patch +[include default_wiring.cfg] +[include ../../../macros/helpers/hotend_heater_ctrl.cfg] diff --git a/config/hardware/fans/hotend_fan_tachometer.cfg b/config/hardware/fans/hotend_fan_tachometer.cfg new file mode 100644 index 000000000..dbf370a8c --- /dev/null +++ b/config/hardware/fans/hotend_fan_tachometer.cfg @@ -0,0 +1,14 @@ +[gcode_macro _USER_VARIABLES] +variable_hotend_fan_tach_enabled: True +gcode: + +[heater_fan hotend_fan] +pin: E_FAN +max_power: 1.0 +kick_start_time: 0.100 +heater: extruder +heater_temp: 50.0 +tachometer_pin: E_FAN_TACHO + +# And we also include the tachometer check macros from here +[include ../../../macros/helpers/tachometer_check.cfg] diff --git a/config/hardware/fans/part_fan_tachometer.cfg b/config/hardware/fans/part_fan_tachometer.cfg new file mode 100644 index 000000000..675ec97bd --- /dev/null +++ b/config/hardware/fans/part_fan_tachometer.cfg @@ -0,0 +1,12 @@ +[gcode_macro _USER_VARIABLES] +variable_part_fan_tach_enabled: True +gcode: + +[fan] +pin: PART_FAN +kick_start_time: 0.100 +cycle_time: 0.010 +tachometer_pin: PART_FAN_TACHO + +# And we also include the tachometer check macros from here +[include ../../../macros/helpers/tachometer_check.cfg] diff --git a/config/hardware/lights/config_colors.cfg b/config/hardware/lights/config_colors.cfg new file mode 100644 index 000000000..14a646bc7 --- /dev/null +++ b/config/hardware/lights/config_colors.cfg @@ -0,0 +1,57 @@ +## This file contain the color definitions used for the different LED states +# You can override it if needed to define your own colors. These defaults +# should be a good starting point + +[gcode_macro _LEDS_COLORS_DEFINITION] +variable_colors: { + 'logo': { + 'busy': {'r': 0.4, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + 'cleaning': {'r': 0.0, 'g': 0.02, 'b': 0.5, 'w': 0.0}, + 'calibrating_z': {'r': 0.8, 'g': 0., 'b': 0.35, 'w': 0.0}, + 'heating': {'r': 0.3, 'g': 0.18, 'b': 0.0, 'w': 0.0}, + 'homing': {'r': 0.0, 'g': 0.6, 'b': 0.2, 'w': 0.0}, + 'leveling': {'r': 0.5, 'g': 0.1, 'b': 0.4, 'w': 0.0}, + 'meshing': {'r': 0.2, 'g': 1.0, 'b': 0.0, 'w': 0.0}, + 'on': {'r': 0.8, 'g': 0.8, 'b': 0.8, 'w':1.0}, + 'off': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + 'printing': {'r': 1.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + 'done_printing': {'r': 0.0, 'g': 1.0, 'b': 0.0, 'w': 0.0}, + 'standby': {'r': 0.01, 'g': 0.01, 'b': 0.01, 'w': 0.1}, + 'error': {'r': 0.6, 'g': 0.0, 'b': 0.0, 'w':0.0}, + }, + 'nozzle': { + 'heating': {'r': 0.8, 'g': 0.35, 'b': 0.0, 'w':0.0}, + 'off': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + 'on': {'r': 0.8, 'g': 0.8, 'b': 0.8, 'w':1.0}, + 'standby': {'r': 0.6, 'g': 0.0, 'b': 0.0, 'w':0.0}, + 'done_printing': {'r': 1.0, 'g': 1.0, 'b': 0.0, 'w': 1.0}, + 'error': {'r': 0.6, 'g': 0.0, 'b': 0.0, 'w':0.0}, + }, + 'caselight': { + 'busy': {'r': 0.4, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + 'cleaning': {'r': 0.0, 'g': 0.02, 'b': 0.5, 'w': 0.0}, + 'calibrating_z': {'r': 0.8, 'g': 0., 'b': 0.35, 'w': 0.0}, + 'heating': {'r': 0.3, 'g': 0.18, 'b': 0.0, 'w': 0.0}, + 'homing': {'r': 0.0, 'g': 0.6, 'b': 0.2, 'w': 0.0}, + 'leveling': {'r': 0.5, 'g': 0.1, 'b': 0.4, 'w': 0.0}, + 'meshing': {'r': 0.2, 'g': 1.0, 'b': 0.0, 'w': 0.0}, + 'on': {'r': 0.8, 'g': 0.8, 'b': 0.8, 'w':1.0}, + 'off': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + 'printing': {'r': 1.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + 'done_printing': {'r': 0.0, 'g': 1.0, 'b': 0.0, 'w': 0.0}, + 'standby': {'r': 0.01, 'g': 0.01, 'b': 0.01, 'w': 0.1}, + 'error': {'r': 0.6, 'g': 0.0, 'b': 0.0, 'w':0.0}, + }, + 'minidisplay': { + 'on': {'r': 0.0, 'g': 0.2, 'b': 0.4, 'w':1.0}, + 'off': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + 'error': {'r': 0.4, 'g': 0.0, 'b': 0.0, 'w':0.0}, + 'shutdown': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + }, + 'thermal': { + 'hot': {'r': 1.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, + 'cold': {'r': 0.3, 'g': 0.0, 'b': 0.3, 'w': 0.0} + } + } + +gcode: diff --git a/config/hardware/lights/fcob_white.cfg b/config/hardware/lights/fcob_white.cfg index 4ff581fc1..8c18f06dc 100644 --- a/config/hardware/lights/fcob_white.cfg +++ b/config/hardware/lights/fcob_white.cfg @@ -1,4 +1,5 @@ # White lights using 24V (example: white fcob) + [gcode_macro _USER_VARIABLES] variable_light_enabled: True variable_light_pin_name: "caselight" diff --git a/config/hardware/lights/neopixel_caselight.cfg b/config/hardware/lights/neopixel_caselight.cfg index 1f9884e5b..331ef9c89 100644 --- a/config/hardware/lights/neopixel_caselight.cfg +++ b/config/hardware/lights/neopixel_caselight.cfg @@ -1,11 +1,14 @@ # Neopixel leds used as general printer lights + [gcode_macro _USER_VARIABLES] variable_status_leds_caselight_enabled = True +variable_status_leds_effects_enabled = False variable_status_leds_caselight_led_name: "caselight" gcode: # Also include directly the leds control macros from here [include ../../../macros/hardware_functions/status_leds.cfg] +[include config_colors.cfg] [neopixel caselight] diff --git a/config/hardware/lights/neopixel_caselight_effects.cfg b/config/hardware/lights/neopixel_caselight_effects.cfg new file mode 100644 index 000000000..21c6bc8f9 --- /dev/null +++ b/config/hardware/lights/neopixel_caselight_effects.cfg @@ -0,0 +1,186 @@ +# Neopixel leds used as general printer lights +# using LED_effects + +[gcode_macro _USER_VARIABLES] +variable_status_leds_caselight_enabled = True +variable_status_leds_effects_enabled = True +variable_status_leds_caselight_led_name: "caselight" +gcode: + +# Also include directly the leds control macros from here +[include ../../../macros/hardware_functions/status_leds.cfg] +[include config_colors.cfg] + + +[neopixel caselight] +pin: LIGHT_NEOPIXEL +# The pin connected to the neopixel. This parameter must be +# provided. +chain_count: 31 +# The number of Neopixel chips that are "daisy chained" to the +# provided pin. The default is 1 (which indicates only a single +# Neopixel is connected to the pin). +color_order: GRB +# Set the pixel order required by the LED hardware (using a string +# containing the letters R, G, B, W with W optional). The default is +# GRB. +initial_RED: 0.0 +initial_GREEN: 0.0 +initial_BLUE: 0.0 +#initial_WHITE: 0.0 +# Sets the initial LED color of the Neopixel. Each value should be +# between 0.0 and 1.0. The WHITE option is only available on RGBW +# LEDs. The default for each color is 0.# + + +######################################################### +# Define led effects for the different printer states +######################################################### +## Ready State +[led_effect cl_standby] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + breathing 20.00 1 add (1.00,1.00,1.00) + static 0 0 top (0.07,0.37,0.57) + +## Busy State +[led_effect cl_busy] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + breathing 10 1 add (1.00,1.00,1.00) + static 0 0 top (1.00,0,0) + +## Heating State +[led_effect cl_heating] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + breathing 10 1 top (1.00,0.00,0.00) + +## Leveling State +[led_effect cl_leveling] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + breathing 10 1 add (1.00,1.00,1.00) + static 0 0 top (0.5,0.1,0.4) + +## Homing State +[led_effect cl_homing] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + breathing 10 1 add (1.00,1.00,1.00) + static 0 0 top (0.0, 0.6, 0.2) + +## Cleaning State +[led_effect cl_cleaning] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + breathing 10 1 add (1.00,1.00,1.00) + static 0 0 top (0.0, 0.02, 0.5) + +## Meshing State +[led_effect cl_meshing] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + breathing 10 1 add (1.00,1.00,1.00) + static 0 0 top (0.2, 1.0, 0.0) + +## Calibrating Z State +[led_effect cl_calibrating_z] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + breathing 10 1 add (1.00,1.00,1.00) + static 0 0 top (0.0, 0.0, 0.35) + +## Printing State +[led_effect cl_printing] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + breathing 120 1 add (1.00,1.00,1.00) + static 0 0 top (0.0, 0.0, 0.3), (0.0, 0.3, 0.0), (0.3, 0.0, 0.0) + +## Printing Done State +[led_effect cl_done_printing] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + strobe 0.20 0.60 subtract (1.00,0.00,1.00) + static 1.00 1.00 top (1.00,1.00,1.00) + +## Error State +[led_effect cl_error] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + strobe 1 1.5 add (1.0, 1.0, 1.0) + breathing 2 0 difference (0.95, 0.0, 0.0) + static 1 0 top (1.0, 0.0, 0.0) + +## On State +[led_effect cl_on] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + static 0 0 top (1.0, 1.0, 1.0) + +## Off State +[led_effect cl_off] +leds: + neopixel:caselight (1) +autostart: false +frame_rate: 24 +layers: + static 0 0 top (0.0, 0.0, 0.0) + +## Printer startup effect +[led_effect cl_startup] +leds: + neopixel:caselight +autostart: false +frame_rate: 24 +layers: + gradient 0.3 1 add (1.0, 0.0, 0.0),(0.0, 1.0, 0.0),(0.0, 0.0, 1.0) + +## Critical error effect +[led_effect critical_error] +leds: + neopixel:caselight +layers: + strobe 1 1.5 add (1.0, 1.0, 1.0) + breathing 2 0 difference (0.95, 0.0, 0.0) + static 1 0 top (1.0, 0.0, 0.0) +autostart: false +frame_rate: 24 +run_on_error: true diff --git a/config/hardware/lights/status_leds.cfg b/config/hardware/lights/status_leds.cfg index 09cf248f1..683e371b7 100644 --- a/config/hardware/lights/status_leds.cfg +++ b/config/hardware/lights/status_leds.cfg @@ -1,6 +1,8 @@ # Neopixel leds used on the toolhead (stealthburner style) + [gcode_macro _USER_VARIABLES] variable_status_leds_enabled: True +variable_status_leds_effects_enabled: False variable_status_leds_logo_led_name: "status_leds" variable_status_leds_logo_idx: '1' variable_status_leds_nozzle_led_name: "status_leds" @@ -9,6 +11,7 @@ gcode: # Also include directly the leds control macros from here [include ../../../macros/hardware_functions/status_leds.cfg] +[include config_colors.cfg] [neopixel status_leds] diff --git a/config/hardware/lights/status_leds_effects.cfg b/config/hardware/lights/status_leds_effects.cfg new file mode 100644 index 000000000..dfa7db8df --- /dev/null +++ b/config/hardware/lights/status_leds_effects.cfg @@ -0,0 +1,231 @@ +# Neopixel leds used on the toolhead (stealthburner style) +# using LED_effects + +[gcode_macro _USER_VARIABLES] +variable_status_leds_enabled: True +variable_status_leds_effects_enabled: True +variable_status_leds_logo_led_name: "status_leds" +variable_status_leds_logo_idx: '1' +variable_status_leds_nozzle_led_name: "status_leds" +variable_status_leds_nozzle_idx: '2,3' +gcode: + +# Also include directly the leds control macros from here +[include ../../../macros/hardware_functions/status_leds.cfg] +[include config_colors.cfg] + + +[neopixel status_leds] +pin: STATUS_NEOPIXEL +# The pin connected to the neopixel. This parameter must be provided. +chain_count: 3 +# The number of Neopixel chips that are "daisy chained" to the +# provided pin. The default is 1 (which indicates only a single +# Neopixel is connected to the pin). +color_order: GRBW +# Set the pixel order required by the LED hardware. Options are GRB, +# RGB, GRBW, or RGBW. The default is GRB. +initial_RED: 0.0 +initial_GREEN: 0.0 +initial_BLUE: 0.0 +initial_WHITE: 0.0 +# Sets the initial LED color of the Neopixel. Each value should be +# between 0.0 and 1.0. The WHITE option is only available on RGBW +# LEDs. The default for each color is 0.# + +######################################################### +# Define led effects for the different printer states +######################################################### +## Ready State +[led_effect sb_logo_standby] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + breathing 20 1 top (0.0, 0.0, 1.0) + +[led_effect sb_nozzle_standby] +leds: + neopixel:status_leds (2,3) +autostart: false +frame_rate: 24 +layers: + breathing 20 1 top (0.0, 0.0, 1.0) + +## Busy State +[led_effect sb_logo_busy] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (1,0,0) + +## Heating State +[led_effect sb_logo_heating] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (1,0,0) + +[led_effect sb_nozzle_heating] +leds: + neopixel:status_leds (2,3) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (1.0, 0.18, 0.0, 0.0) + +## Leveling State +[led_effect sb_logo_leveling] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.5, 0.1, 0.4) + +## Homing State +[led_effect sb_logo_homing] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.0, 0.6, 0.2) + +## Cleaning State +[led_effect sb_logo_cleaning] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.0, 0.02, 0.5) + +## Meshing State +[led_effect sb_logo_meshing] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.2, 1.0, 0.0) + +## Calibrating Z State +[led_effect sb_logo_calibrating_z] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.0, 0.0, 0.35) + +## Printing State +[led_effect sb_logo_printing] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + gradient 0.3 1 add (0.3, 0.0, 0.0),(0.3, 0.3, 0.0),(0.3, 0.1, 0.0) + +## Printing Done State +[led_effect sb_logo_done_printing] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + strobe 0.2 0.6 add (1.00,1.00,1.00) + breathing 10.00 0.00 subtract (0.0,0.40,0.0) + static 0.00 1.00 top (0.0,1.0,0.0) + +[led_effect sb_nozzle_done_printing] +leds: + neopixel:status_leds (2,3) +autostart: false +frame_rate: 24 +layers: + strobe 0.2 0.6 add (1.00,1.00,1.00) + breathing 10.00 0.00 subtract (0.0,0.40,0.0) + static 0.00 1.00 top (0.0,1.0,0.0) + +## Error State +[led_effect sb_logo_error] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + strobe 1 1.5 add (1.0, 1.0, 1.0) + breathing 2 0 difference (0.95, 0.0, 0.0) + static 1 0 top (1.0, 0.0, 0.0) + +[led_effect sb_nozzle_error] +leds: + neopixel:status_leds (2,3) +autostart: false +frame_rate: 24 +layers: + strobe 1 1.5 add (1.0, 1.0, 1.0) + breathing 2 0 difference (0.95, 0.0, 0.0) + static 1 0 top (1.0, 0.0, 0.0) + +## On State +[led_effect sb_logo_on] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + static 0 0 top (1.0, 1.0, 1.0) + +[led_effect sb_nozzle_on] +leds: + neopixel:status_leds (2,3) +autostart: false +frame_rate: 24 +layers: + static 0 0 top (1.0, 1.0, 1.0) + +## Off State +[led_effect sb_logo_off] +leds: + neopixel:status_leds (1) +autostart: false +frame_rate: 24 +layers: + static 0 0 top (0.0, 0.0, 0.0) + +[led_effect sb_nozzle_off] +leds: + neopixel:status_leds (2,3) +autostart: false +frame_rate: 24 +layers: + static 0 0 top (0.0, 0.0, 0.0) + +## Printer startup effect +[led_effect startup] +leds: + neopixel:status_leds +autostart: false +frame_rate: 24 +layers: + gradient 0.3 1 add (1.0, 0.0, 0.0),(0.0, 1.0, 0.0),(0.0, 0.0, 1.0) + + ## Critical error effect +[led_effect critical_error] +leds: + neopixel:status_leds +layers: + strobe 1 1.5 add (1.0, 1.0, 1.0) + breathing 2 0 difference (0.95, 0.0, 0.0) + static 1 0 top (1.0, 0.0, 0.0) +autostart: false +frame_rate: 24 +run_on_error: true diff --git a/config/hardware/lights/status_leds_rainbow_barf.cfg b/config/hardware/lights/status_leds_rainbow_barf.cfg new file mode 100644 index 000000000..828037ee6 --- /dev/null +++ b/config/hardware/lights/status_leds_rainbow_barf.cfg @@ -0,0 +1,34 @@ +# Neopixel leds used on the toolhead (stealthburner style) +# in a rainbow barf pattern PCB + +[gcode_macro _USER_VARIABLES] +variable_status_leds_enabled: True +variable_status_leds_effects_enabled: False +variable_status_leds_logo_led_name: "status_leds" +variable_status_leds_logo_idx: '1,2,3,4,5,6,7,8' +variable_status_leds_nozzle_led_name: "status_leds" +variable_status_leds_nozzle_idx: '9,10' +gcode: + +# Also include directly the leds control macros from here +[include ../../../macros/hardware_functions/status_leds.cfg] +[include config_colors.cfg] + + +[neopixel status_leds] +pin: STATUS_NEOPIXEL +# The pin connected to the neopixel. This parameter must be provided. +chain_count: 10 +# The number of Neopixel chips that are "daisy chained" to the +# provided pin. The default is 1 (which indicates only a single +# Neopixel is connected to the pin). +color_order: GRB, GRB, GRB, GRB, GRB, GRB, GRB, GRB, GRBW, GRBW +# Set the pixel order required by the LED hardware. Options are GRB, +# RGB, GRBW, or RGBW. The default is GRB. +initial_RED: 0.0 +initial_GREEN: 0.0 +initial_BLUE: 0.0 +initial_WHITE: 0.0 +# Sets the initial LED color of the Neopixel. Each value should be +# between 0.0 and 1.0. The WHITE option is only available on RGBW +# LEDs. The default for each color is 0.# diff --git a/config/hardware/lights/status_leds_rainbow_barf_effects.cfg b/config/hardware/lights/status_leds_rainbow_barf_effects.cfg new file mode 100644 index 000000000..f8bbe2662 --- /dev/null +++ b/config/hardware/lights/status_leds_rainbow_barf_effects.cfg @@ -0,0 +1,231 @@ +# Neopixel leds used on the toolhead (stealthburner style) +# in a rainbow barf pattern PCB using LED_effects + +[gcode_macro _USER_VARIABLES] +variable_status_leds_enabled: True +variable_status_leds_effects_enabled: True +variable_status_leds_logo_led_name: "status_leds" +variable_status_leds_logo_idx: '1,2,3,4,5,6,7,8' +variable_status_leds_nozzle_led_name: "status_leds" +variable_status_leds_nozzle_idx: '9,10' +gcode: + +# Also include directly the leds control macros from here +[include ../../../macros/hardware_functions/status_leds.cfg] +[include config_colors.cfg] + + +[neopixel status_leds] +pin: STATUS_NEOPIXEL +# The pin connected to the neopixel. This parameter must be provided. +chain_count: 10 +# The number of Neopixel chips that are "daisy chained" to the +# provided pin. The default is 1 (which indicates only a single +# Neopixel is connected to the pin). +color_order: GRB, GRB, GRB, GRB, GRB, GRB, GRB, GRB, GRBW, GRBW +# Set the pixel order required by the LED hardware. Options are GRB, +# RGB, GRBW, or RGBW. The default is GRB. +initial_RED: 0.0 +initial_GREEN: 0.0 +initial_BLUE: 0.0 +initial_WHITE: 0.0 +# Sets the initial LED color of the Neopixel. Each value should be +# between 0.0 and 1.0. The WHITE option is only available on RGBW +# LEDs. The default for each color is 0.# + +######################################################### +# Define led effects for the different printer states +######################################################### +## Ready State +[led_effect sb_logo_standby] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + breathing 20 1 top (0.0, 0.0, 1.0) + +[led_effect sb_nozzle_standby] +leds: + neopixel:status_leds (9-10) +autostart: false +frame_rate: 24 +layers: + breathing 20 1 top (0.0, 0.0, 1.0) + +## Busy State +[led_effect sb_logo_busy] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (1,0,0) + +## Heating State +[led_effect sb_logo_heating] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (1,0,0) + +[led_effect sb_nozzle_heating] +leds: + neopixel:status_leds (9-10) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (1.0, 0.18, 0.0, 0.0) + +## Leveling State +[led_effect sb_logo_leveling] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.5, 0.1, 0.4) + +## Homing State +[led_effect sb_logo_homing] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.0, 0.6, 0.2) + +## Cleaning State +[led_effect sb_logo_cleaning] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.0, 0.02, 0.5) + +## Meshing State +[led_effect sb_logo_meshing] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.2, 1.0, 0.0) + +## Calibrating Z State +[led_effect sb_logo_calibrating_z] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + breathing 3 1 top (0.0, 0.0, 0.35) + +## Printing State +[led_effect sb_logo_printing] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + gradient 0.3 1 add (0.3, 0.0, 0.0),(0.3, 0.3, 0.0),(0.3, 0.1, 0.0) + +## Printing Done State +[led_effect sb_logo_done_printing] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + strobe 0.2 0.6 add (1.00,1.00,1.00) + breathing 10.00 0.00 subtract (0.0,0.40,0.0) + static 0.00 1.00 top (0.0,1.0,0.0) + +[led_effect sb_nozzle_done_printing] +leds: + neopixel:status_leds (9-10) +autostart: false +frame_rate: 24 +layers: + strobe 0.2 0.6 add (1.00,1.00,1.00) + breathing 10.00 0.00 subtract (0.0,0.40,0.0) + static 0.00 1.00 top (0.0,1.0,0.0) + +## Error State +[led_effect sb_logo_error] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + strobe 1 1.5 add (1.0, 1.0, 1.0) + breathing 2 0 difference (0.95, 0.0, 0.0) + static 1 0 top (1.0, 0.0, 0.0) + +[led_effect sb_nozzle_error] +leds: + neopixel:status_leds (9-10) +autostart: false +frame_rate: 24 +layers: + strobe 1 1.5 add (1.0, 1.0, 1.0) + breathing 2 0 difference (0.95, 0.0, 0.0) + static 1 0 top (1.0, 0.0, 0.0) + +## On State +[led_effect sb_logo_on] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + static 0 0 top (1.0, 1.0, 1.0) + +[led_effect sb_nozzle_on] +leds: + neopixel:status_leds (9-10) +autostart: false +frame_rate: 24 +layers: + static 0 0 top (1.0, 1.0, 1.0) + +## Off State +[led_effect sb_logo_off] +leds: + neopixel:status_leds (1-8) +autostart: false +frame_rate: 24 +layers: + static 0 0 top (0.0, 0.0, 0.0) + +[led_effect sb_nozzle_off] +leds: + neopixel:status_leds (9-10) +autostart: false +frame_rate: 24 +layers: + static 0 0 top (0.0, 0.0, 0.0) + +## Printer startup effect +[led_effect startup] +leds: + neopixel:status_leds +autostart: false +frame_rate: 24 +layers: + gradient 0.3 1 add (1.0, 0.0, 0.0),(0.0, 1.0, 0.0),(0.0, 0.0, 1.0) + +## Critical error effect +[led_effect critical_error] +leds: + neopixel:status_leds +layers: + strobe 1 1.5 add (1.0, 1.0, 1.0) + breathing 2 0 difference (0.95, 0.0, 0.0) + static 1 0 top (1.0, 0.0, 0.0) +autostart: false +frame_rate: 24 +run_on_error: true diff --git a/config/hardware/mmu.cfg b/config/hardware/mmu.cfg new file mode 100644 index 000000000..ab9ca8228 --- /dev/null +++ b/config/hardware/mmu.cfg @@ -0,0 +1,14 @@ +## MMU config file +## Designed to be used with the "HappyHare" (HH) software backend by moggieuk: https://github.com/moggieuk/Happy-Hare + +[gcode_macro _USER_VARIABLES] +variable_klippain_mmu_enabled: True +gcode: + +[extruder] +max_extrude_only_distance: 200 +max_extrude_cross_section: 50.0 + + +# Also include directly the MMU macros and config from here +[include ../../macros/hardware_functions/mmu.cfg] diff --git a/config/hardware/probes/bltouch_virtual.cfg b/config/hardware/probes/bltouch_virtual.cfg new file mode 100644 index 000000000..c3110d89f --- /dev/null +++ b/config/hardware/probes/bltouch_virtual.cfg @@ -0,0 +1,28 @@ +# This probe type is for an BLTouch probe used directly as a virtual Z endstop rather than +# with an existing physical endstop. This configuration is common if you are running a +# Voron Switchwire or other "bed slinger" that does not have a fixed Z endstop at bed +# height. + +[gcode_macro _USER_VARIABLES] +variable_probe_type_enabled: "bltouch" +variable_startprint_actions: "bed_soak", "extruder_preheating", "chamber_soak", "tilt_calib", "extruder_heating", "purge", "clean", "z_offset", "bedmesh", "primeline" +gcode: + +# The BLTouch probe definition also includes the probe management and +# overides directly from here +[include ../../../macros/base/probing/generic_probe.cfg] + +[bltouch] +sensor_pin: ^PROBE_INPUT +control_pin: SERVO_PIN +x_offset: 0.0 +y_offset: 0.0 +z_offset: 0 +samples: 1 +sample_retract_dist: 3.0 +samples_result: median +samples_tolerance: 0.004 +samples_tolerance_retries: 1 + +[stepper_z] +endstop_pin: probe:z_virtual_endstop diff --git a/config/hardware/probes/dockable.cfg b/config/hardware/probes/dockable.cfg index 4bd8e7361..aff5bf45e 100644 --- a/config/hardware/probes/dockable.cfg +++ b/config/hardware/probes/dockable.cfg @@ -3,10 +3,10 @@ variable_probe_type_enabled: "dockable" variable_startprint_actions: "bed_soak", "extruder_preheating", "chamber_soak", "tilt_calib", "extruder_heating", "purge", "clean", "z_offset", "bedmesh", "primeline" gcode: -# Dockable probe definition also include the probe management and overides directly from here +# Dockable probe definition also include the probe management and overrides directly from here [include ../../../macros/base/probing/generic_probe.cfg] [include ../../../macros/base/probing/dockable_probe.cfg] -[include ../../../macros/base/probing/overides/dockable_probe_overides.cfg] +[include ../../../macros/base/probing/overrides/dockable_probe_overrides.cfg] [probe] pin: ^PROBE_INPUT diff --git a/config/hardware/probes/dockable_virtual.cfg b/config/hardware/probes/dockable_virtual.cfg index 9ac19f628..3e3835429 100644 --- a/config/hardware/probes/dockable_virtual.cfg +++ b/config/hardware/probes/dockable_virtual.cfg @@ -8,10 +8,10 @@ variable_probe_type_enabled: "dockable_virtual" variable_startprint_actions: "bed_soak", "extruder_preheating", "chamber_soak", "tilt_calib", "extruder_heating", "purge", "clean", "z_offset", "bedmesh", "primeline" gcode: -# Dockable probe definition also include the probe management and overides directly from here +# Dockable probe definition also include the probe management and overrides directly from here [include ../../../macros/base/probing/generic_probe.cfg] [include ../../../macros/base/probing/dockable_probe.cfg] -[include ../../../macros/base/probing/overides/dockable_probe_overides.cfg] +[include ../../../macros/base/probing/overrides/dockable_probe_overrides.cfg] [probe] pin: ^PROBE_INPUT diff --git a/config/hardware/temperature_sensors/cabinet_temp.cfg b/config/hardware/temperature_sensors/cabinet_temp.cfg index 6237ad4b7..9addc0606 100644 --- a/config/hardware/temperature_sensors/cabinet_temp.cfg +++ b/config/hardware/temperature_sensors/cabinet_temp.cfg @@ -1,3 +1,3 @@ -[temperature_sensor ElectricalCabinet] +[temperature_sensor Electrical_Cabinet] sensor_type: ATC Semitec 104GT-2 sensor_pin: ELECTRICAL_CABINET_TEMPERATURE diff --git a/config/hardware/temperature_sensors/custom_thermistors.cfg b/config/hardware/temperature_sensors/custom_thermistors.cfg new file mode 100644 index 000000000..7706b954b --- /dev/null +++ b/config/hardware/temperature_sensors/custom_thermistors.cfg @@ -0,0 +1,9 @@ +# This is a custom thermistor definition that is +# commonly found in some MCU boards like the Picobilical +[thermistor CMFB103F3950FANT] +temperature1: 0.0 +resistance1: 32116.0 +temperature2: 40.0 +resistance2: 5309.0 +temperature3: 80.0 +resistance3: 1228.0 diff --git a/config/hardware/temperature_sensors/rpi_temp.cfg b/config/hardware/temperature_sensors/rpi_temp.cfg index 68bfcb90e..f2f44f476 100644 --- a/config/hardware/temperature_sensors/rpi_temp.cfg +++ b/config/hardware/temperature_sensors/rpi_temp.cfg @@ -1,2 +1,2 @@ -[temperature_sensor RaspberryPi] +[temperature_sensor Raspberry_Pi] sensor_type: temperature_host diff --git a/config/kinematics/cartesian.cfg b/config/kinematics/cartesian.cfg index 7a676034a..344afcb08 100644 --- a/config/kinematics/cartesian.cfg +++ b/config/kinematics/cartesian.cfg @@ -4,4 +4,9 @@ max_velocity: 200 max_accel: 3000 max_z_velocity: 30 max_z_accel: 500 +# minimum_cruise_ratio: 0.5 # This left commented to not break older Klipper versions square_corner_velocity: 5.0 + +# And add directly all the machines standard includes here +# to put them above the rest from printer.cfg +[include ../machine.cfg] diff --git a/config/kinematics/corexy.cfg b/config/kinematics/corexy.cfg index 1a5fb2863..b7573a2f1 100644 --- a/config/kinematics/corexy.cfg +++ b/config/kinematics/corexy.cfg @@ -4,4 +4,9 @@ max_velocity: 400 max_accel: 8000 max_z_velocity: 30 max_z_accel: 500 +# minimum_cruise_ratio: 0.5 # This left commented to not break older Klipper versions square_corner_velocity: 5.0 + +# And add directly all the machines standard includes here +# to put them above the rest from printer.cfg +[include ../machine.cfg] diff --git a/config/kinematics/corexz.cfg b/config/kinematics/corexz.cfg index 8d95ff504..a11c6bfdf 100644 --- a/config/kinematics/corexz.cfg +++ b/config/kinematics/corexz.cfg @@ -4,4 +4,9 @@ max_velocity: 400 max_accel: 1000 max_z_velocity: 200 max_z_accel: 1000 +# minimum_cruise_ratio: 0.5 # This left commented to not break older Klipper versions square_corner_velocity: 5.0 + +# And add directly all the machines standard includes here +# to put them above the rest from printer.cfg +[include ../machine.cfg] diff --git a/config/machine.cfg b/config/machine.cfg index 87d0de761..734cb60f5 100644 --- a/config/machine.cfg +++ b/config/machine.cfg @@ -1,25 +1,35 @@ [virtual_sdcard] path: ~/printer_data/gcodes on_error_gcode: - {% set probe_type_enabled = printer["gcode_macro _USER_VARIABLES"].probe_type_enabled %} + {% if printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} + STATUS_LEDS COLOR="ERROR" + {% endif %} + {% if printer["gcode_macro _USER_VARIABLES"].probe_type_enabled == "dockable" or printer["gcode_macro _USER_VARIABLES"].probe_type_enabled == "dockable_virtual" %} + _PROBE_ON_ERROR_ACTION + {% endif %} - {% if printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} - STATUS_LEDS COLOR="ERROR" - {% endif %} - - {% if probe_type_enabled == "dockable" %} - _PROBE_ON_ERROR_ACTION - {% endif %} - -[exclude_object] + # Park only if printer is homed + {% if "xyz" in printer.toolhead.homed_axes %} + PARK + {% endif %} + [idle_timeout] timeout: 1800 +gcode: + RESPOND MSG="Idle timeout reached" + TURN_OFF_HEATERS + M84 + {% if printer["gcode_macro _USER_VARIABLES"].light_enabled %} + LIGHT_OFF + {% endif %} + {% if printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} + STATUS_LEDS COLOR="OFF" + {% endif %} [pause_resume] - [display_status] - +[exclude_object] [respond] [force_move] @@ -29,8 +39,17 @@ enable_force_move: True resolution: 0.1 -# include all the remaining macros (not already included in config files) and scripts +# ----------------------------------------------------------------------------------- +# Include all the remaining files (not already included in config files) and scripts # from here to avoid to include them in the main printer.cfg and avoid user confusion +# ----------------------------------------------------------------------------------- + +[include hardware/temperature_sensors/custom_thermistors.cfg] + +[include software/shaketune.cfg] + +[include ../scripts/*.cfg] + [include ../macros/base/*.cfg] [include ../macros/base/homing/homing_*.cfg] @@ -45,5 +64,3 @@ resolution: 0.1 [include ../macros/miscs/compatibility.cfg] [include ../macros/miscs/debugging.cfg] [include ../macros/miscs/startup.cfg] - -[include ../scripts/*.cfg] diff --git a/config/mcu_definitions/ercf/BTT_MMB_CAN_v1.0.cfg b/config/mcu_definitions/ercf/BTT_MMB_CAN_v1.0.cfg deleted file mode 100644 index 0051ce533..000000000 --- a/config/mcu_definitions/ercf/BTT_MMB_CAN_v1.0.cfg +++ /dev/null @@ -1,29 +0,0 @@ -[board_pins ercf_manufacturer] -mcu: ercf -aliases: - MCU_MOTOR1_STEP=PB15 , MCU_MOTOR1_DIR=PB14 , MCU_MOTOR1_EN=PA8 , MCU_GEAR_MOTOR1_CS=PA10 , - MCU_MOTOR2_STEP=PD2 , MCU_MOTOR2_DIR=PB13 , MCU_MOTOR2_EN=PD1 , MCU_GEAR_MOTOR2_CS=PC7 , - MCU_MOTOR3_STEP=PD0 , MCU_MOTOR3_DIR=PD3 , MCU_MOTOR3_EN=PA15 , MCU_GEAR_MOTOR3_CS=PC6 , - MCU_MOTOR4_STEP=PB6 , MCU_MOTOR4_DIR=PB7 , MCU_MOTOR4_EN=PB5 , MCU_GEAR_MOTOR4_CS=PA9 , - MCU_SCK=PA5 , MCU_MISO=PA6 , MCU_SPI0_MOSI=PA7 , - MCU_MOTOR3_DIAG=PB9 - - # MMB STP definition - MCU_STP1=PA3 , # a.u.a. MOTOR1_DIAG - MCU_STP2=PA4 , # a.u.a. MOTOR2_DIAG - MCU_STP3=PB8 , # a.u.a. MOTOR4_DIAG - MCU_STP4=PB7 , - MCU_STP5=PC15 , - MCU_STP6=PC13 , - MCU_STP7=PC14 , - MCU_STP8=PB12 , - MCU_STP9=PB11 , - MCU_STP10=PB10 , - MCU_STP11=PB2 , - - MCU_MOT=PA0 , - MCU_SENSOR=PA1 , - MCU_RGB=PA2 , - - MCU_I2C_SDA=PB4 , - MCU_I2C_SCL=PB3 , diff --git a/config/mcu_definitions/ercf/Tircown_ERCF_easy_brd.cfg b/config/mcu_definitions/ercf/Tircown_ERCF_easy_brd.cfg deleted file mode 100644 index 0b7d46229..000000000 --- a/config/mcu_definitions/ercf/Tircown_ERCF_easy_brd.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[board_pins ercf_manufacturer] -mcu: ercf -aliases: - MCU_GEAR_STEP=PA4 , MCU_GEAR_DIR=PA10 , MCU_GEAR_ENABLE=PA2 , - MCU_SELECTOR_STEP=PA9 , MCU_SELECTOR_DIR=PB8 , MCU_SELECTOR_ENABLE=PA11 , MCU_SELECTOR_DIAG=PA7, - MCU_TMCUART=PA8 , - - MCU_GEAR_STOP=PB9 , MCU_SELECTOR_STOP=PB9 , - - MCU_SERVO=PA5, - - MCU_ENCODER=PA6, diff --git a/config/mcu_definitions/main/BTT_Kraken_v1.0.cfg b/config/mcu_definitions/main/BTT_Kraken_v1.0.cfg new file mode 100644 index 000000000..3feba64d0 --- /dev/null +++ b/config/mcu_definitions/main/BTT_Kraken_v1.0.cfg @@ -0,0 +1,54 @@ +[board_pins mcu_manufacturer] +aliases: + MCU_S1_STEP=PC14 , MCU_S1_DIR=PC13 , MCU_S1_ENABLE=PE6 , MCU_S1_UART=PD6 , + MCU_S2_STEP=PE5 , MCU_S2_DIR=PE4 , MCU_S2_ENABLE=PE3 , MCU_S2_UART=PD5 , + MCU_S3_STEP=PE2 , MCU_S3_DIR=PE1 , MCU_S3_ENABLE=PE0 , MCU_S3_UART=PD4 , + MCU_S4_STEP=PB9 , MCU_S4_DIR=PB8 , MCU_S4_ENABLE=PB7 , MCU_S4_UART=PD3 , + MCU_S5_STEP=PG9 , MCU_S5_DIR=PG10 , MCU_S5_ENABLE=PG13 , MCU_S5_UART=PD2 , + MCU_S6_STEP=PG11 , MCU_S6_DIR=PD7 , MCU_S6_ENABLE=PG12 , MCU_S6_UART=PA15 , + MCU_S7_STEP=PB4 , MCU_S7_DIR=PB3 , MCU_S7_ENABLE=PB5 , MCU_S7_UART=PA9 , + MCU_S8_STEP=PG15 , MCU_S8_DIR=PB6 , MCU_S8_ENABLE=PG14 , MCU_S8_UART=PA10 , + MCU_MOSI=PC8 , MCU_MISO=PC7 , MCU_SCK=PC6 , + + MCU_MOTOR_SERVO=PE7 , + MCU_RGB1=PF12 , MCU_RGB2=PF11 , + MCU_MIN1=PC15 , MCU_MIN2=PF0 , MCU_MIN3=PF1 , MCU_MIN4=PF2 , + MCU_MIN5=PF3 , MCU_MIN6=PF4 , MCU_MIN7=PF10 , MCU_MIN8=PC0 , + + MCU_HE0=PF6 , MCU_HE1=PF7 , MCU_HE2=PF9 , MCU_HE3=PF8 , + + MCU_BED_OUT=PF5 , + + MCU_TB=PB0 , + MCU_T0=PB1 , MCU_T1=PC5 , MCU_T2=PC4 , MCU_T3=PA7 , + + MCU_FAN0=PA0 , MCU_FAN1=PA1 , MCU_FAN2=PA2 , MCU_FAN3=PA3 , MCU_FAN4=PA4 , MCU_FAN5=PA5 , + MCU_FAN6=PA6 , MCU_FAN7=PE8 , + MCU_FAN6_TACH=PC1 , MCU_FAN7_TACH=PG0 , + + MCU_PS_ON=PD10 , + MCU_FWS1=PC2 , MCU_FWS2=PC3 , + + MCU_IND_DET=PD11 , + # PROBE header + MCU_PROBE=PC1 , MCU_PROBE_SERVO=PE9 , + + # SPI header + MCU_SPI_1=<5V> , MCU_SPI_2= , + MCU_SPI_3=PE10 , MCU_SPI_4=PE12 , + MCU_SPI_5=PE14 , MCU_SPI_6=PE13 , + MCU_SPI_7=<3.3V> , MCU_SPI_8= , + + # EXP1 header + EXP1_1=PG5 , EXP1_2=PG4 , + EXP1_3=PG3 , EXP1_4=PG2 , + EXP1_5=PD15 , EXP1_6=PD14 , # Slot in the socket on this side + EXP1_7=PD13 , EXP1_8=PD12 , + EXP1_9= , EXP1_10=<5V> , + + # EXP2 header + EXP2_1=PE13 , EXP2_2=PE12 , + EXP2_3=PG8 , EXP2_4=PE11 , + EXP2_5=PG7 , EXP2_6=PE14 , # Slot in the socket on this side + EXP2_7=PG6 , EXP2_8= , + EXP2_9= , EXP2_10=<5V> , diff --git a/config/mcu_definitions/main/BTT_Manta_M5P_v1.0.cfg b/config/mcu_definitions/main/BTT_Manta_M5P_v1.0.cfg new file mode 100644 index 000000000..8e4139197 --- /dev/null +++ b/config/mcu_definitions/main/BTT_Manta_M5P_v1.0.cfg @@ -0,0 +1,39 @@ +[board_pins mcu_manufacturer] +aliases: + MCU_M1_STEP=PC8 , MCU_M1_DIR=PC9 , MCU_M1_EN=PA15 , MCU_M1_CS=PD9 , + MCU_M2_STEP=PA10 , MCU_M2_DIR=PA14 , MCU_M2_EN=PA13 , MCU_M2_CS=PD8 , + MCU_M3_STEP=PC6 , MCU_M3_DIR=PC7 , MCU_M3_EN=PA9 , MCU_M3_CS=PB10 , + MCU_M4_STEP=PB12 , MCU_M4_DIR=PB11 , MCU_M4_EN=PA8 , MCU_M4_CS=PB2 , + MCU_M5_STEP=PB0 , MCU_M5_DIR=PB1 , MCU_M5_EN=PC4 , MCU_M5_CS=PA6 , + + MCU_M1_STOP=PD3 , MCU_M2_STOP=PD2 , MCU_M3_STOP=PC3 , MCU_M4_STOP=PC2 , + + MCU_HE0=PC5 , MCU_HE1=PA7 , + + MCU_BED_OUT=PA5 , + + MCU_THB=PA0 , MCU_TH0=PA1 , MCU_TH1=PA2 , + + MCU_FAN0=PA4 , MCU_FAN1=PA3 , + + MCU_RGB1=PC11 , MCU_RGB2=PC14 , + + MCU_PROBE1=PC15 , MCU_PROBE2=PC13 , + MCU_IND_PROBE=PC15 , + + MCU_SPI2_MOSI=PB15 , MCU_SPI2_MISO=PB14 , MCU_SPI2_SCK=PB13 , MCU_SPI2_CS=PC0 , + + + # EXP1 header + EXP1_1=PD5 , EXP1_2=PD4 , + EXP1_3=PB3 , EXP1_4=PD6 , + EXP1_5=PB5 , EXP1_6=PB4 , # Slot in the socket on this side + EXP1_7=PB7 , EXP1_8=PB6 , + EXP1_9= , EXP1_10=<5V> , + + # EXP2 header + EXP2_1=PB14 , EXP2_2=PB13 , + EXP2_3=PB8 , EXP2_4=PB9 , + EXP2_5=PC10 , EXP2_6=PB15 , # Slot in the socket on this side + EXP2_7=PC12 , EXP2_8=PF2 , + EXP2_9= , EXP2_10= , diff --git a/config/mcu_definitions/main/BTT_Manta_M8P_v2.0.cfg b/config/mcu_definitions/main/BTT_Manta_M8P_v2.0.cfg index 63b0df370..eb15b6d25 100644 --- a/config/mcu_definitions/main/BTT_Manta_M8P_v2.0.cfg +++ b/config/mcu_definitions/main/BTT_Manta_M8P_v2.0.cfg @@ -18,9 +18,9 @@ aliases: MCU_THB=PB1 , MCU_TH0=PB0 , MCU_TH1=PC5 , MCU_TH2=PC4 , MCU_TH3=PA7 , - MCU_FAN0=PF7 , MCU_FAN1=PF9 , MCU_FAN2=PF6 , MCU_FAN3=PF8 , MCU_FAN4=PA4 , - MCU_FAN5=PC2 , MCU_FAN5_TACH=PA6 , - MCU_FAN6=PC1 , MCU_FAN6_TACH=PA2 , + MCU_FAN0=PF7 , MCU_FAN1=PF9 , MCU_FAN2=PF6 , MCU_FAN3=PA8 , MCU_FAN4=PA4 , + MCU_FAN5=PA6 , MCU_FAN5_TACH=PC2 , + MCU_FAN6=PA2 , MCU_FAN6_TACH=PC1 , MCU_RGB1=PD15 , MCU_PS_ON=PD14 , @@ -29,10 +29,11 @@ aliases: MCU_PROBE1=PD13 , MCU_PROBE2=PD12 , MCU_IND_PROBE=PD8 , - MCU_SPI2_MOSI=PC12 , MCU_SPI2_MISO=PC11 , MCU_SPI2_SCK=PC10 , MCU_SPI2_CS=PA15 , + MCU_SPI_MOSI=PC12 , MCU_SPI_MISO=PC11 , MCU_SPI_SCK=PC10 , MCU_SPI_CS=PA15 , + MCU_M_SPI_MOSI=PG6, MCU_M_SPI_MISO=PG7, MCU_M_SPI_SCK=PG8, # TX RX - MCU_CAN_TRANSMIT=PD1 , MCU_CAN_RECIEVE=PD0 , + MCU_CAN_LOW=PD1 , MCU_CAN_HIGH=PD0 , MCU_FWS1=PC0 , MCU_FWS=PF10 , diff --git a/config/mcu_definitions/main/BTT_Octopus_Pro_v1.1.cfg b/config/mcu_definitions/main/BTT_Octopus_Pro_v1.1.cfg new file mode 100644 index 000000000..45b078573 --- /dev/null +++ b/config/mcu_definitions/main/BTT_Octopus_Pro_v1.1.cfg @@ -0,0 +1,42 @@ +[board_pins mcu_manufacturer] +aliases: + MCU_MOTOR0_STEP=PF13 , MCU_MOTOR0_DIR=PF12 , MCU_MOTOR0_ENABLE=PF14 , MCU_MOTOR0_UART=PC4 , + MCU_MOTOR1_STEP=PG0 , MCU_MOTOR1_DIR=PG1 , MCU_MOTOR1_ENABLE=PF15 , MCU_MOTOR1_UART=PD11 , + MCU_MOTOR2_1_STEP=PF11 , MCU_MOTOR2_1_DIR=PG3 , MCU_MOTOR2_1_ENABLE=PG5 , MCU_MOTOR2_1_UART=PC6 , + MCU_MOTOR3_STEP=PG4 , MCU_MOTOR3_DIR=PC1 , MCU_MOTOR3_ENABLE=PA2 , MCU_MOTOR3_UART=PC7 , + MCU_MOTOR4_STEP=PF9 , MCU_MOTOR4_DIR=PF10 , MCU_MOTOR4_ENABLE=PG2 , MCU_MOTOR4_UART=PF2 , + MCU_MOTOR5_STEP=PC13 , MCU_MOTOR5_DIR=PF0 , MCU_MOTOR5_ENABLE=PF1 , MCU_MOTOR5_UART=PE4 , + MCU_MOTOR6_STEP=PE2 , MCU_MOTOR6_DIR=PE3 , MCU_MOTOR6_ENABLE=PD4 , MCU_MOTOR6_UART=PE1 , + MCU_MOTOR7_STEP=PE6 , MCU_MOTOR7_DIR=PA14 , MCU_MOTOR7_ENABLE=PE0 , MCU_MOTOR7_UART=PD3 , + + MCU_STOP0=PG6 , MCU_STOP1=PG9 , MCU_STOP2=PG10 , MCU_STOP3=PG11 , + MCU_STOP4=PG12 , MCU_STOP5=PG13 , MCU_STOP6=PG14 , MCU_STOP7=PG15 , + MCU_PROBE=PB7 , + MCU_SERVOS=PB6 , + + MCU_HE0=PA0 , MCU_HE1=PA3 , MCU_HE2=PB0 , MCU_HE3=PB11 , + + MCU_BED0=PA1 , + + MCU_TB=PF3 , + MCU_T0=PF4 , MCU_T1=PF5 , MCU_T2=PF6 , MCU_T3=PF7 , + + MCU_FAN0=PA8 , MCU_FAN1=PE5 , MCU_FAN2=PD12 , MCU_FAN3=PD13 , MCU_FAN4=PD14 , MCU_FAN5=PD15 , + + MCU_NEOPIXEL=PB10 , + MCU_PS_ON=PE11 , + MCU_POWER_DET=PC0 , + + # EXP1 header + EXP1_1=PE8 , EXP1_2=PE7 , + EXP1_3=PE9 , EXP1_4=PE10 , + EXP1_5=PE12 , EXP1_6=PE13 , # Slot in the socket on this side + EXP1_7=PE14 , EXP1_8=PE15 , + EXP1_9= , EXP1_10=<5V> , + + # EXP2 header + EXP2_1=PA6 , EXP2_2=PA5 , + EXP2_3=PB1 , EXP2_4=PA4 , + EXP2_5=PB2 , EXP2_6=PA7 , # Slot in the socket on this side + EXP2_7=PC15 , EXP2_8= , + EXP2_9= , EXP2_10=<5V> , diff --git a/config/mcu_definitions/main/BTT_SKR_2.cfg b/config/mcu_definitions/main/BTT_SKR_2.cfg new file mode 100644 index 000000000..838159102 --- /dev/null +++ b/config/mcu_definitions/main/BTT_SKR_2.cfg @@ -0,0 +1,75 @@ +#-----------------------------------------# +#### BTT SKR2 MCU Board Pin definition #### +#-----------------------------------------# + +# This file contains pin mappings for the BTT SKR2 board. To +# use this config, during "make menuconfig" select the STM32F407 or STM32F429 processor with +# a "32KiB bootloader" offset, 8Mhz Clock reference, and USB PA11 PA12 communication. + +# To flash this firmware: copy "out/klipper.bin" to an SD card, rename it to "firmware.bin", and +# turn on the printer with the card inserted. Upon successful upload, the firmware will be +# renamed to firmware.cur. + +# https://github.com/bigtreetech/SKR-2/blob/master/Hardware/BIGTREETECH%20SKR%202-Pin.pdf +# https://github.com/bigtreetech/SKR-2/blob/master/Hardware/BIGTREETECH%20SKR%202-SCH.pdf + +[board_pins mcu_manufacturer] +aliases: + MCU_XM_STEP=PE2 , MCU_XM_DIR=PE1 , MCU_XM_ENABLE=PE3 , MCU_XM_UART=PE0 , + MCU_YM_STEP=PD5 , MCU_YM_DIR=PD4 , MCU_YM_ENABLE=PD6 , MCU_YM_UART=PD3 , + MCU_ZM_STEP=PA15 , MCU_ZM_DIR=PA8 , MCU_ZM_ENABLE=PD1 , MCU_ZM_UART=PD0 , + MCU_E0M_STEP=PD15 , MCU_E0M_DIR=PD14 , MCU_E0M_ENABLE=PC7 , MCU_E0M_UART=PC6 , + MCU_E1M_STEP=PD11 , MCU_E1M_DIR=PD10 , MCU_E1M_ENABLE=PD13 , MCU_E1M_UART=PD12 , + + MCU_MOTSPI_MISO=PA14 , MCU_MOTSPI_MOSI=PE14 , MCU_MOTSPI_SCK=PE15 , + + MCU_XSTOP=PC1 , MCU_YSTOP=PC3 , MCU_ZSTOP=PC0 , + MCU_E0DET=PC2 , MCU_E1DET=PA0 , MCU_PWRDET=PC15 , + + MCU_HE0=PB3 , MCU_HE1=PB4 , + MCU_BED=PD7 , + + MCU_PSON=PE8 , MCU_MPWR=PC13 , + + MCU_TB=PA1 , MCU_TH0=PA2 , MCU_TH1=PA3 , + + MCU_FAN0=PB7 , MCU_FAN1=PB6 , MCU_FAN2=PB5 , + + MCU_RGB=PE6 , + + MCU_SERVOS=PE5 , MCU_PROBE=PE4 , + + # EXP1 header + EXP1_1=PC5 , EXP1_2=PB0 , + EXP1_3=PB1 , EXP1_4=PB9 , + EXP1_5=PE10 , EXP1_6=PE11 , # Key in the socket on this side + EXP1_7=PE12 , EXP1_8=PE13 , + EXP1_9= , EXP1_10=<5V> , + + # EXP2 header + EXP2_1=PA6 , EXP2_2=PA5 , + EXP2_3=PE7 , EXP2_4=PA4 , + EXP2_5=PB2 , EXP2_6=PA7 , # Key in the socket on this side + EXP2_7=PC4 , EXP2_8= , + EXP2_9= , EXP2_10= , + + # TFT header + MCU_TFT_1=<5V> , + MCU_TFT_2= , + MCU_TFT_3=PA9 , + MCU_TFT_4=PA10 , + MCU_TFT_5= , + + # Mini-SD + MCU_MINISD_DATA1=PC9 , MCU_MINISD_DATA0=PC8 , MCU_MINISD_CLK=PC12 , MCU_MINISD_CMD=PD2 , MCU_MINISD_DATA3=PC11 , MCU_MINISD_DATA2=PC10 , + + # WIFI + MCU_WIFI_GND= , MCU_WIFI_VCC=<3.3V> , + MCU_WIFI_IO15=PB12 , MCU_WIFI_IO13=PB15 , + MCU_WIFI_IO2= , MCU_WIFI_IO12=PB14 , + MCU_WIFI_IO0=PB10 , MCU_WIFI_IO14=PB13 , + MCU_WIFI_IO4=PB11 , MCU_WIFI_IO16= , + MCU_WIFI_IO5= , MCU_WIFI_EN= , + MCU_WIFI_RXD=PD8 , MCU_WIFI_ADC= , + MCU_WIFI_TXD=PD9 , MCU_WIFI_RST=PC14 , + diff --git a/config/mcu_definitions/main/BTT_SKR_Pro_V1.2.cfg b/config/mcu_definitions/main/BTT_SKR_Pro_V1.2.cfg new file mode 100644 index 000000000..b1576cec2 --- /dev/null +++ b/config/mcu_definitions/main/BTT_SKR_Pro_V1.2.cfg @@ -0,0 +1,52 @@ +[board_pins mcu_manufacturer] +aliases: + MCU_XM_STEP=PE9 , MCU_XM_DIR=PF1 , MCU_XM_ENABLE=PF2 , MCU_XM_TMCUART=PC13 , MCU_XM_TMCTX=PE4 , + MCU_YM_STEP=PE11 , MCU_YM_DIR=PE8 , MCU_YM_ENABLE=PD7 , MCU_YM_TMCUART=PE3 , MCU_YM_TMCTX=PE2 , + MCU_ZM_STEP=PE13 , MCU_ZM_DIR=PC2 , MCU_ZM_ENABLE=PC0 , MCU_ZM_TMCUART=PE1 , MCU_ZM_TMCTX=PE0 , + MCU_E0M_STEP=PE14 , MCU_E0M_DIR=PA0 , MCU_E0M_ENABLE=PC3 , MCU_E0M_TMCUART=PD4 , MCU_E0M_TMCTX=PD2 , + MCU_EM1_STEP=PD15 , MCU_EM1_DIR=PE7, MCU_EM1_ENABLE=PA3 , MCU_EM1_TMCUART=PD1 , MCU_EM1_TMCTX=PD0 , + MCU_EM2_STEP=PD13 , MCU_EM2_DIR=PG9, MCU_EM2_ENABLE=PF0 , MCU_EM2_TMCUART=PD6 , MCU_EM2_TMCTX=PD5 , + + + MCU_XSTOP=PB10 , MCU_YSTOP=PE12 , MCU_ZSTOP=PG8 , + MCU_E0STOP=PE15 , MCU_E1STOP=PE10 , MCU_E2STOP=PG5 , + + MCU_HEAT0=PB1 , MCU_HEAT1=PD14 , MCU_HEAT2=PB0 , + MCU_BED=PD12 , + + MCU_T0=PF3 , MCU_T1=PF4 , MCU_T2=PF5 , MCU_T3=PF6 , + + MCU_FAN0=PC8 , MCU_FAN1=PE5 , MCU_FAN2=PE6 , + + # Z-Probe Header + MCU_SERVOS=PA1 , MCU_PROBE=PA2 , + + # EXP1 header + EXP1_1=PG4 , EXP1_2=PA8 , + EXP1_3=PD11 , EXP1_4=PD10 , + EXP1_5=PG2 , EXP1_6=PG3 , # Key in the socket on other side + EXP1_7=PG6 , EXP1_8=PG7 , + EXP1_9= , EXP1_10=<5V> , + + # EXP2 header + EXP2_1=PB14 , EXP2_2=PB13 , + EXP2_3=PG10 , EXP2_4=PB12 , + EXP2_5=PF11 , EXP2_6=PB15 , # Key in the socket on other side + EXP2_7=PF12 , EXP2_8= , + EXP2_9= , EXP2_10=PF13 , + + # SPI header + MCU_SPI_MOSI=PC12 , MCU_SPI_MISO=PC11 , MCU_SPI_SCK=PC10 , MCU_SPI_CS=PA15 , + + # UART header + MCU_UART_RX3=PD9 , MCU_UART_TX3=PD8 , + + # I2C header + MCU_I2C_SDA=PB7 , MCU_I2C_SCL=PB6 , + + # I/O header + MCU_IO0=PD0 , MCU_IO1=PD2 , MCU_IO2=PD3 , MCU_IO3=PD4 , MCU_IO4=PD5 , + + # WIFI header (#_# = ROW_COL) + MCU_WIFI_1_2=PG0 , MCU_WIFI_1_3=PG1 , MCU_WIFI_1_4=PC7, + MCU_WIFI_2_1=PC6 , MCU_WIFI_2_2=PF14 , MCU_WIFI_2_3=PF15 \ No newline at end of file diff --git a/config/mcu_definitions/main/Fysetc_Catalyst_v1.x.cfg b/config/mcu_definitions/main/Fysetc_Catalyst_v1.x.cfg new file mode 100644 index 000000000..8b5dc9b64 --- /dev/null +++ b/config/mcu_definitions/main/Fysetc_Catalyst_v1.x.cfg @@ -0,0 +1,20 @@ +[board_pins mcu_manufacturer] +aliases: + MCU_A_MOT_STEP=PC15 , MCU_A_MOT_DIR=PC13 , MCU_A_MOT_ENABLE=PA10 , MCU_A_MOT_CS_PDN=PC14 , MCU_A_MOD_DIAG=PA9 , + MCU_B_MOT_STEP=PC12 , MCU_B_MOT_DIR=PC10 , MCU_B_MOT_ENABLE=PD2 , MCU_B_MOT_CS_PDN=PC11 , MCU_B_MOD_DIAG=PB3 , + MCU_Z_MOT_STEP=PB2 , MCU_Z_MOT_DIR=PC5 , MCU_Z_MOT_ENABLE=PB10 , MCU_Z_MOT_CS_PDN=PC4 , + MCU_E_MOT_STEP=PB6 , MCU_E_MOT_DIR=PB4 , MCU_E_MOT_ENABLE=PB7 , MCU_E_MOT_CS_PDN=PB5 , + MCU_SPI_MOSI=PA7 , MCU_SPI_MISO=PA6 , MCU_SPI_SCK=PA5 , + + MCU_FAN0=PA13 , MCU_FAN1=PA14 , MCU_FAN2=PA8 , + MCU_NEOPIXEL=PC9 , + + MCU_PROBE=PC3 , # aka MCU_IO3 + + MCU_IO0=PA0 , MCU_IO1=PA1 , MCU_IO2=PA2 , MCU_IO3=PC3 , + + MCU_HEAT=PC7 , + + MCU_BED=PC8 , + + MCU_T0=PC0 , MCU_T1=PB0 , MCU_T2=PB1 , diff --git a/config/mcu_definitions/main/Fysetc_S6_v2.x.cfg b/config/mcu_definitions/main/Fysetc_S6_v2.x.cfg new file mode 100644 index 000000000..aaf671020 --- /dev/null +++ b/config/mcu_definitions/main/Fysetc_S6_v2.x.cfg @@ -0,0 +1,47 @@ +[board_pins mcu_manufacturer] +aliases: + MCU_X_MOT_STEP=PE11 , MCU_X_MOT_DIR=PE10 , MCU_X_MOT_ENABLE=PE9 , MCU_X_MOT_CS_PDN=PE7 , MCU_X_MOT_UART=PE8 , + MCU_Y_MOT_STEP=PD8 , MCU_Y_MOT_DIR=PB12 , MCU_Y_MOT_ENABLE=PD9 , MCU_Y_MOT_CS_PDN=PE15 , MCU_Y_MOT_UART=PC4 , + MCU_Z_MOT_STEP=PD14 , MCU_Z_MOT_DIR=PD13 , MCU_Z_MOT_ENABLE=PD15 , MCU_Z_MOT_CS_PDN=PD10 , MCU_Z_MOT_UART=PD12 , + MCU_E0_MOT_STEP=PD5 , MCU_E0_MOT_DIR=PD6 , MCU_E0_MOT_ENABLE=PD4 , MCU_E0_MOT_CS_PDN=PD7 , MCU_E0_MOT_UART=PA15 , + MCU_E1_MOT_STEP=PE6 , MCU_E1_MOT_DIR=PC13 , MCU_E1_MOT_ENABLE=PE5 , MCU_E1_MOT_CS_PDN=PC14 , MCU_E1_MOT_UART=PC5 , + MCU_E2_MOT_STEP=PE2 , MCU_E2_MOT_DIR=PE4 , MCU_E2_MOT_ENABLE=PE3 , MCU_E2_MOT_CS_PDN=PC15 , MCU_E2_MOT_UART=PE0 , + MCU_TMC_MOSI=PE14 , MCU_TMC_MISO=PE13 , MCU_TMC_SCK=PE12 , + + MCU_X_MIN=PB14 , MCU_Y_MIN=PB13 , MCU_Z_MIN=PA0 , + MCU_X_MAX=PA1 , MCU_Y_MAX=PA2 , MCU_Z_MAX=PA3 , + + MCU_FAN0=PB0 , MCU_FAN1=PB1 , MCU_FAN2=PB2 , + + MCU_RGB_R=PB6 , MCU_RGB_G=PB5 , MCU_RGB_B=PB7 , MCU_LED_DEBUG=PD3 , + + MCU_E0_OUT=PB3 , MCU_E1_OUT=PB4 , MCU_E2_OUT=PB15 , + + MCU_BED_OUT=PC8 , + + MCU_TE0=PC0 , MCU_TE1=PC1 , MCU_TE2=PC2 , MCU_TB=PC3 , + + MCU_I2C_SLC=PB8 , MCU_I2C_SDA=PB9 , + MCU_SWD_DIO=PA13 , MCU_SWD_CLK=PA14 , + MCU_Pi_PWR_UART_TX1=PA9 , MCU_Pi_PWR_UART_RX1=PA10 , + MCU_P2_DP=PA12 , MCU_P2_DM=PA11 , + + # AUX3 header + MCU_AUX3_5V=<5V> , MCU_AUX3_CD=PB10 , + MCU_AUX3_MISO=PA6 , MCU_AUX3_MOSI=PA7 , + MCU_AUX3_SCK=PA5 , MCU_AUX3_CS=PA4 , + MCU_AUX3_GND= , MCU_AUX3_RST= , + + # EXP1 header + EXP1_1=PC9 , EXP1_2=PA8 , + EXP1_3=PC11 , EXP1_4=PD2 , + EXP1_5=PC10 , EXP1_6=PC12 , # Slot in the socket on this side + EXP1_7=PD0 , EXP1_8=PD1 , + EXP1_9= , EXP1_10=<5V> , + + # EXP2 header + EXP2_1=PA6 , EXP2_2=PA5 , + EXP2_3=PC6 , EXP2_4=PA4 , + EXP2_5=PC7 , EXP2_6=PA7 , # Slot in the socket on this side + EXP2_7=PB10 , EXP2_8= , + EXP2_9= , EXP2_10=<5V> , \ No newline at end of file diff --git a/config/mcu_definitions/main/LDO_Leviathan_v1.2.cfg b/config/mcu_definitions/main/LDO_Leviathan_v1.2.cfg new file mode 100644 index 000000000..6ff8422ff --- /dev/null +++ b/config/mcu_definitions/main/LDO_Leviathan_v1.2.cfg @@ -0,0 +1,60 @@ +[board_pins mcu_manufacturer] +aliases: + MCU_HV-STEPPER0_STEP=PB10, MCU_HV-STEPPER0_DIR=PB11, MCU_HV-STEPPER0_EN=PG0, MCU_HV-STEPPER0_CS=PE15, + MCU_HV-STEPPER1_STEP=PF15, MCU_HV-STEPPER1_DIR=PF14, MCU_HV-STEPPER1_EN=PE9, MCU_HV-STEPPER1_CS=PE11, + + MCU_SPI2_MOSI=PE14, MCU_SPI2_MISO=PE13, MCU_SPI2_SCK=PE12, + + MCU_STEPPER0_STEP=PD4, MCU_STEPPER0_DIR=PD3, MCU_STEPPER0_EN=PD7, MCU_STEPPER0_UART=PD5, + MCU_STEPPER1_STEP=PC12, MCU_STEPPER1_DIR=PC11, MCU_STEPPER1_EN=PD2, MCU_STEPPER1_UART=PD0, + MCU_STEPPER2_STEP=PC9, MCU_STEPPER2_DIR=PC8, MCU_STEPPER2_EN=PC10, MCU_STEPPER2_UART=PA8, + MCU_STEPPER3_STEP=PG7, MCU_STEPPER3_DIR=PG6, MCU_STEPPER3_EN=PC7, MCU_STEPPER3_UART=PG8, + MCU_STEPPER4_STEP=PD10, MCU_STEPPER4_DIR=PD9, MCU_STEPPER4_EN=PD13, MCU_STEPPER4_UART=PD11, + + MCU_STOP_X=PC1, MCU_STOP_Y=PC2, MCU_STOP_Z=PC3, MCU_STOP_E0=PC0, + MCU_Z_PROBE=PF1, + + MCU_HE0=PG10, + MCU_BED0=PG11, + + MCU_T0=PA1, MCU_T1=PA2, MCU_T2=PA0, MCU_T3=PA3, + + MCU_FAN0=PB7, MCU_FAN1=PB3, MCU_FAN2=PF7, MCU_FAN3=PF9, + MCU_FAN0_TACHO=PB0, MCU_FAN1_TACHO=PB4, MCU_FAN2_TACHO=PF6, MCU_FAN3_TACHO=PF8, + + MCU_NEOPIXEL=PF10, + MCU_LED=PE6, + + # TX RX + MCU_CAN_TRANSMIT=PB6, MCU_CAN_RECIEVE=PB5, + + # EXP1 header + EXP1_1=PG9 , EXP1_2=PG12 , + EXP1_3=PG13 , EXP1_4=PG14 , + EXP1_5=PC13 , EXP1_6=PC14 , # Slot in the socket on this side + EXP1_7=PC15 , EXP1_8=PF0 , + EXP1_9= , EXP1_10=<5V> , + + # EXP2 header + EXP2_1=PA6 , EXP2_2=PA5 , + EXP2_3=PE2 , EXP2_4=PE4 , + EXP2_5=PE3 , EXP2_6=PA7 , # Slot in the socket on this side + EXP2_7=PE5 , EXP2_8= , + EXP2_9= , EXP2_10=PE4 , + + # Extension Port + EXT_1=<5V> , EXT_2=<5V> , + EXT_3= , EXT_4= , + EXT_5=<3.3V> , EXT_6=<3.3V> , + EXT_7=PF5 , EXT_8=PF4 , + EXT_9=PF3 , EXT_10=PF2 , + EXT_11=PC4 , EXT_12=PC5 , + EXT_13=PB0 , EXT_14=PB1 , + EXT_15=PE8 , EXT_16=PE7 , + EXT_17=PG5 , EXT_18=PG4 , + EXT_19=PG3 , EXT_20=PG2 , + EXT_21=PD15 , EXT_22=PD14 , + EXT_23=PB15 , EXT_24=PB14 , + EXT_25=PB13 , EXT_26=PB12 , + EXT_27= , EXT_28= , + EXT_29=<24V> , EXT_30=<24V> , diff --git a/config/mcu_definitions/main/Mellow_Fly_Gemini_v3.cfg b/config/mcu_definitions/main/Mellow_Fly_Gemini_v3.cfg new file mode 100644 index 000000000..270715478 --- /dev/null +++ b/config/mcu_definitions/main/Mellow_Fly_Gemini_v3.cfg @@ -0,0 +1,42 @@ +[board_pins mcu_manufacturer] +aliases: + # Stepper drivers + MCU_DRIVE0_EN=PA3, MCU_DRIVE0_STEP=PC13, MCU_DRIVE0_DIR=PC1, MCU_DRIVE0_UART=PB11, # X + MCU_DRIVE1_EN=PD2, MCU_DRIVE1_STEP=PC14, MCU_DRIVE1_DIR=PC4, MCU_DRIVE1_UART=PC10, # Y + MCU_DRIVE2_EN=PC12, MCU_DRIVE2_STEP=PC15, MCU_DRIVE2_DIR=PC5, MCU_DRIVE2_UART=PB7, # Z + MCU_DRIVE3_EN=PC11, MCU_DRIVE3_STEP=PC3, MCU_DRIVE3_DIR=PC8, MCU_DRIVE3_UART=PB6, # E + + # Heaters + MCU_BED=PA2, + MCU_HEAT0=PA0, + + # Thermisors + MCU_THB=PC2, + MCU_TH0=PC0, + + # Fans + MCU_FAN0=PC6, MCU_FAN1=PC7, + + # End stops + MCU_DRIVE0_STOP=PA4, MCU_DRIVE1_STOP=PA5, MCU_DRIVE2_STOP=PA6, MCU_DRIVE3_STOP=PB1, + + # TMC SPI + MCU_TMC_MOSI=PB5, MCU_TMC_MISO=PB4, MCU_TMC_SCK=PB3, + + # CAN TX RX + MCU_CAN_LOW=PB8 , MCU_CAN_HIGH=PB9 , + + # ST-LINK + MCU_STLINK_1= , MCU_STLINK_2=PA14 , MCU_STLINK_3=PA13 , MCU_STLINK_4= , MCU_STLINK_5=<3.3V> , MCU_STLINK_6=<5V> , + + # EXP1 header + EXP1_1=PC9, EXP1_3=PA13, EXP1_5=PA9, EXP1_7=, EXP1_9=, + EXP1_2=PB10, EXP1_4=PA10, EXP1_6=PA8, EXP1_8=, EXP1_10=<5V>, + # EXP2 header + EXP2_1=PB14, EXP2_3=PA15, EXP2_5=PA14, EXP2_7=PA7, EXP2_9=, + EXP2_2=PB13, EXP2_4=PB12, EXP2_6=PB15, EXP2_8=, EXP2_10=, + + + # BL Touch + MCU_SERVO=PB0, # BL Touch servo pin + MCU_PROBE=PA1 # BL Touch end stop pin \ No newline at end of file diff --git a/config/mcu_definitions/main/Mellow_Fly_Super8_v1.x.cfg b/config/mcu_definitions/main/Mellow_Fly_Super8_v1.x.cfg new file mode 100644 index 000000000..b2f03a7de --- /dev/null +++ b/config/mcu_definitions/main/Mellow_Fly_Super8_v1.x.cfg @@ -0,0 +1,50 @@ +[board_pins mcu_manufacturer] +aliases: + MCU_DRIVE0_STEP=PE2 , MCU_DRIVE0_DIR=PC5 , MCU_DRIVE0_EN=PF11 , MCU_DRIVE0_UART=PC4 , + MCU_DRIVE1_STEP=PE3 , MCU_DRIVE1_DIR=PF13 , MCU_DRIVE1_EN=PF14 , MCU_DRIVE1_UART=PF12 , + MCU_DRIVE2_STEP=PE4 , MCU_DRIVE2_DIR=PG0 , MCU_DRIVE2_EN=PG1 , MCU_DRIVE2_UART=PF15 , + MCU_DRIVE3_STEP=PE14 , MCU_DRIVE3_DIR=PE8 , MCU_DRIVE3_EN=PE9 , MCU_DRIVE3_UART=PE7 , + MCU_DRIVE4_STEP=PE15 , MCU_DRIVE4_DIR=PE11 , MCU_DRIVE4_EN=PF2 , MCU_DRIVE4_UART=PE10 , + MCU_DRIVE5_STEP=PE1 , MCU_DRIVE5_DIR=PF0 , MCU_DRIVE5_EN=PC15 , MCU_DRIVE5_UART=PF1 , + MCU_DRIVE6_STEP=PE0 , MCU_DRIVE6_DIR=PG3 , MCU_DRIVE6_EN=PG4 , MCU_DRIVE6_UART=PG2 , + MCU_DRIVE7_STEP=PE6 , MCU_DRIVE7_DIR=PG6 , MCU_DRIVE7_EN=PG7 , MCU_DRIVE7_UART=PG5 , + MCU_TMC_MOSI=PB5 , MCU_TMC_MISO=PB4 , MCU_TMC_SCK=PB3 , + + MCU_IO0=PG12 , MCU_IO1=PG11 , MCU_IO2=PG10 , MCU_IO3=PG9 , MCU_IO4=PD7 , MCU_IO5=PD6 , MCU_IO6=PA8 , + MCU_IN7=PF8 , + MCU_HV_IN=PF3 , + MCU_ADC_0=PF4 , MCU_ADC_1=PF5 , MCU_ADC_2=PF9 , MCU_ADC_3=PF10 , MCU_ADC_4=PC0 , MCU_ADC_5=PC1 , + + MCU_HEAT0=PB0 , MCU_HEAT1=PB1 , MCU_HEAT2=PC7 , MCU_HEAT3=PF7 , MCU_HEAT4=PF6 , + + MCU_BED=PE5 , + + # BLTOUCH + MCU_SERVO=PC6 , # Pin 3 + MCU_PROBE=PC3 , # Pin 5 + + # ACCELEROMETER + MCU_ACCELEROMETER_1=<5V> , MCU_ACCELEROMETER_2= , MCU_ACCELEROMETER_3=PD0 , MCU_ACCELEROMETER_4=PD1 , MCU_ACCELEROMETER_5=PD3 , MCU_ACCELEROMETER_6=PD4 , MCU_ACCELEROMETER_7=PD5 , + + # ST-LINK + MCU_STLINK_1= , MCU_STLINK_2=PA14 , MCU_STLINK_3=PA13 , MCU_STLINK_4= , MCU_STLINK_5=<3.3V> , MCU_STLINK_6=<5V> , + + # SCREEN + MCU_SCREEN_1=PA10 , MCU_SCREEN_2=PA9 , MCU_SCREEN_3= , MCU_SCREEN_4=<5V> , + + MCU_FAN0=PA0 , MCU_FAN1=PA1 , MCU_FAN2=PA2 , MCU_FAN3=PA3 , MCU_FAN4=PA15 , + MCU_FAN5=PB11 , MCU_FAN6=PB10 , MCU_FAN7=PD12 , MCU_FAN8=PD14 , MCU_FAN9=PD15 , + + # EXP1 header + EXP1_1=PE12 , EXP1_2=PE13 , + EXP1_3=PB2 , EXP1_4=PG8 , + EXP1_5=PC14 , EXP1_6=PC13 , # Slot in the socket on this side + EXP1_7=PG14 , EXP1_8=PG13 , + EXP1_9= , EXP1_10=<5V> , + + # EXP2 header + EXP2_1=PA6 , EXP2_2=PA5 , + EXP2_3=PB7 , EXP2_4=PA4 , + EXP2_5=PB6 , EXP2_6=PA7 , # Slot in the socket on this side + EXP2_7=PG15 , EXP2_8= , + EXP2_9= , EXP2_10=<5V> , diff --git a/config/mcu_definitions/mmu/BTT_MMB_CAN_v1.0.cfg b/config/mcu_definitions/mmu/BTT_MMB_CAN_v1.0.cfg new file mode 100644 index 000000000..559e548a2 --- /dev/null +++ b/config/mcu_definitions/mmu/BTT_MMB_CAN_v1.0.cfg @@ -0,0 +1,23 @@ +[board_pins mmu_manufacturer] +mcu: mmu +aliases: + MCU_M1_STEP=PB15 , MCU_M1_DIR=PB14 , MCU_M1_EN=PA8 , MCU_M1_UART=PA10 , # MCU_M1_DIAG=PA3 , + MCU_M2_STEP=PD2 , MCU_M2_DIR=PB13 , MCU_M2_EN=PD1 , MCU_M2_UART=PC7 , # MCU_M2_DIAG=PA4 , + MCU_M3_STEP=PD0 , MCU_M3_DIR=PD3 , MCU_M3_EN=PA15 , MCU_M3_UART=PC6 , MCU_M3_DIAG=PB9 , + MCU_M4_STEP=PB6 , MCU_M4_DIR=PB7 , MCU_M4_EN=PB5 , MCU_M4_UART=PA9 , # MCU_M4_DIAG=PB8 , + + MCU_MISO=PA6 , MCU_SCK=PA5 , MCU_MOSI=PA7 , + + MCU_STP1=PA3 , MCU_STP2=PA4 , MCU_STP3=PB9 , # Shared with Steppers Diag pins 1-2-4 so it's better to use STP 4-11 for others servos/sensors + MCU_STP4=PB8 , MCU_STP5=PC15 , MCU_STP6=PC13 , MCU_STP7=PC14 , MCU_STP8=PB12 , MCU_STP9=PB11 , MCU_STP10=PB10 , MCU_STP11=PB2 , + + + MCU_MOT=PA0 , + MCU_SENSOR=PA1 , + MCU_RGB=PA2 , + + ## I2C header + MCU_I2C_SDA=PB4 , MCU_I2C_SCL=PB3 , + + ## SWD header + MCU_SWD_PA14=PA14 , MCU_SWD_PA13=PA13 , diff --git a/config/mcu_definitions/mmu/BTT_SKR_Pico_v1.0.cfg b/config/mcu_definitions/mmu/BTT_SKR_Pico_v1.0.cfg new file mode 100644 index 000000000..113022ac9 --- /dev/null +++ b/config/mcu_definitions/mmu/BTT_SKR_Pico_v1.0.cfg @@ -0,0 +1,25 @@ +[board_pins mmu_manufacturer] +mcu: mmu +aliases: + MCU_X_STEP=gpio11 , MCU_X_DIR=gpio10 , MCU_X_EN=gpio12 , + MCU_Y_STEP=gpio6 , MCU_Y_DIR=gpio5 , MCU_Y_EN=gpio7 , + MCU_Z_STEP=gpio19 , MCU_Z_DIR=gpio28 , MCU_Z_EN=gpio2 , + MCU_E0_STEP=gpio14 , MCU_E0_DIR=gpio13 , MCU_E0_EN=gpio15 , + MCU_TMCUART=gpio9 , MCU_TMCTX=gpio8 , + + MCU_X-STOP=gpio4 , MCU_Y-STOP=gpio3 , MCU_Z-STOP=gpio25 , + MCU_E0-STOP=gpio16 , + + MCU_HE=gpio23 , + MCU_HB=gpio21 , + + MCU_TH0=gpio27 , + MCU_THB=gpio26 , + + MCU_FAN1=gpio17 , MCU_FAN2=gpio18 , MCU_FAN3=gpio20 , + + MCU_SERVOS=gpio29 , + + MCU_PROBE=gpio22 , + + MCU_RGB=gpio24 , diff --git a/config/mcu_definitions/ercf/Fysetc_ERCF_ERB.cfg b/config/mcu_definitions/mmu/Fysetc_ERCF_ERB.cfg similarity index 57% rename from config/mcu_definitions/ercf/Fysetc_ERCF_ERB.cfg rename to config/mcu_definitions/mmu/Fysetc_ERCF_ERB.cfg index 410032d1d..e7f01e7d4 100644 --- a/config/mcu_definitions/ercf/Fysetc_ERCF_ERB.cfg +++ b/config/mcu_definitions/mmu/Fysetc_ERCF_ERB.cfg @@ -1,10 +1,9 @@ -[board_pins ercf_manufacturer] -mcu: ercf +[board_pins mmu_manufacturer] +mcu: mmu aliases: MCU_GEAR_MOTOR_STEP=gpio10 , MCU_GEAR_MOTOR_DIR=gpio9 , MCU_GEAR_MOTOR_EN=gpio8 , MCU_GEAR_MOTOR_UART=gpio20 , - MCU_SELECTOR_MOTOR_STEP=gpio16 , MCU_SELECTOR_MOTOR_DIR=gpio15 , MCU_SELECTOR_MOTOR_EN=gpio14 , MCU_SELECTOR_MOTOR_UART=gpio17 , - MCU_GEAR_MOTOR_DIAG=gpio13 , + MCU_SELECTOR_MOTOR_STEP=gpio16 , MCU_SELECTOR_MOTOR_DIR=gpio15 , MCU_SELECTOR_MOTOR_EN=gpio14 , MCU_SELECTOR_MOTOR_UART=gpio17 , MCU_SELECTOR_MOTOR_DIAG=gpio19 , MCU_HALL_SENSOR=gpio25 , @@ -13,10 +12,11 @@ aliases: MCU_ENCODER=gpio22 , MCU_RGB=gpio21 , - MCU_UART0_TX=gpio0 , MCU_UART0_RX=gpio1 , - MCU_SPI0_SCK=gpio2 , MCU_SPI0_MISO=gpio3 , - MCU_SPI0_MOSI=gpio4 , MCU_SPI0_CS=gpio5 , - MCU_I2C1_SDA=gpio6 , MCU_I2C1_SCL=gpio7 , - MCU_ADC0=gpio26 , MCU_ADC1=gpio27 , - MCU_ADC2=gpio28 , MCU_ADC3=gpio29 , - GND= , 5V=<5V> , + # EXTRA PINS header + MCU_0=gpio0 , MCU_1=gpio1 , + MCU_2=gpio2 , MCU_3=gpio3 , + MCU_4=gpio4 , MCU_5=gpio5 , + MCU_6=gpio6 , MCU_7=gpio7 , + MCU_26=gpio26 , MCU_27=gpio27 , + MCU_28=gpio28 , MCU_29=gpio29 , + GND= , 5V=<5V> , diff --git a/config/mcu_definitions/ercf/Mellow_fly_ERCF.cfg b/config/mcu_definitions/mmu/Mellow_fly_ERCF.cfg similarity index 58% rename from config/mcu_definitions/ercf/Mellow_fly_ERCF.cfg rename to config/mcu_definitions/mmu/Mellow_fly_ERCF.cfg index d5494105d..858160cb0 100644 --- a/config/mcu_definitions/ercf/Mellow_fly_ERCF.cfg +++ b/config/mcu_definitions/mmu/Mellow_fly_ERCF.cfg @@ -1,5 +1,5 @@ -[board_pins ercf_manufacturer] -mcu: ercf +[board_pins mmu_manufacturer] +mcu: mmu aliases: MCU_GEAR_STEP=gpio7 , MCU_GEAR_DIR=gpio8 , MCU_GEAR_EN=gpio6 , MCU_GEAR_UART=gpio9 , MCU_GEAR_DIAG=gpio23 , @@ -13,10 +13,10 @@ aliases: MCU_MISO=gpio16 , MCU_MOSI=gpio18 , MCU_SCK=gpio19 , - GND= , GND= , - 3.3V=<3.3V> , 3.3V=<3.3V> , - MCU_P26=gpio26 , MCU_P10=gpio10 , - MCU_P27=gpio27 , MCU_P11=gpio11 , - MCU_P28=gpio28 , MCU_P12=gpio12 , - MCU_P29=gpio29 , MCU_P24=gpio24 , - MCU_P25=gpio25 , MCU_P13=gpio13 , + GND= , GND= , + 3.3V=<3.3V> , 3.3V=<3.3V> , + MCU_IO26=gpio26 , MCU_IO10=gpio10 , + MCU_IO27=gpio27 , MCU_IO11=gpio11 , + MCU_IO28=gpio28 , MCU_IO12=gpio12 , + MCU_IO29=gpio29 , MCU_IO24=gpio24 , + MCU_IO25=gpio25 , MCU_IO13=gpio13 , diff --git a/config/mcu_definitions/mmu/Tircown_ERCF_easy_brd.cfg b/config/mcu_definitions/mmu/Tircown_ERCF_easy_brd.cfg new file mode 100644 index 000000000..08cbb16cd --- /dev/null +++ b/config/mcu_definitions/mmu/Tircown_ERCF_easy_brd.cfg @@ -0,0 +1,12 @@ +[board_pins mmu_manufacturer] +mcu: mmu +aliases: + MCU_GEAR_STEP=PA4 , MCU_GEAR_DIR=PA10 , MCU_GEAR_ENABLE=PA2 , + MCU_SELECTOR_STEP=PA9 , MCU_SELECTOR_DIR=PB8 , MCU_SELECTOR_ENABLE=PA11 , MCU_SELECTOR_DIAG=PA7, + MCU_TMCUART=PA8 , + + MCU_SELECTOR_STOP=PB9 , + + MCU_SERVO=PA5, + + MCU_ENCODER=PA6, diff --git a/config/mcu_definitions/toolhead/Fysetc_SB_Can_TH_v1.x.cfg b/config/mcu_definitions/toolhead/Fysetc_SB_Can_TH_v1.x.cfg new file mode 100644 index 000000000..63b87b10d --- /dev/null +++ b/config/mcu_definitions/toolhead/Fysetc_SB_Can_TH_v1.x.cfg @@ -0,0 +1,16 @@ +[board_pins toolhead_manufacturer] +mcu: toolhead +aliases: + MCU_TMCDRIVER_STEP=PA7 , MCU_TMCDRIVER_DIR=PA5 , MCU_TMCDRIVER_ENABLE=PB4 , MCU_TMCDRIVER_UART=PA10 , + MCU_EXT_DIAG=PB5 , MCU_TMCDRIVER_TX=PA9 , + + MCU_PROBE=PB6 , MCU_IO1=PB11 , MCU_IO2=PB7 , + + MCU_HE0=PA8 , + MCU_TE0=PA0 , + + MCU_FAN0_PWM=PA2 , MCU_FAN1_PWM=PA3 , + + MCU_RGB=PB1 , MCU_STATUS=PA1 , + + MCU_ADXL345_CSPIN=PB12 , MCU_ADXL345_CLK=PB13 , MCU_ADXL345_MISO=PB14 , MCU_ADXL345_MOSI=PB15 , diff --git a/config/mcu_definitions/toolhead/LDO_Nitehawk-SB_v1.0.cfg b/config/mcu_definitions/toolhead/LDO_Nitehawk-SB_v1.0.cfg new file mode 100644 index 000000000..c98d9d27b --- /dev/null +++ b/config/mcu_definitions/toolhead/LDO_Nitehawk-SB_v1.0.cfg @@ -0,0 +1,20 @@ +[board_pins toolhead_manufacturer] +mcu: toolhead +aliases: + MCU_EMOT_EN=gpio25 , MCU_EMOT_STEP=gpio23 , MCU_EMOT_DIR=gpio24 , MCU_EMOT_UART=gpio0 , MCU_EMOT_TX=gpio1 , + + MCU_ENDSTOP_X=gpio13 , MCU_ENDSTOP_Y=gpio12 , + MCU_HV_ENDSTOP=gpio10 , + + MCU_FAN0=gpio5 , MCU_FAN1=gpio6 , + MCU_PWM0=gpio16 , MCU_PWM1=gpio17 , + + MCU_TEMP=gpio29 , + + MCU_HEAT=gpio9 , MCU_HEAT_CHAMBER=gpio28 , MCU_NH_TEMP=gpio26 , + + MCU_RGB=gpio7 , MCU_ACTIVITY_LED=gpio8 , + + MCU_ADXL_CS=gpio21 , MCU_ADXL_SCK=gpio18 , MCU_ADXL_MOSI=gpio20 , MCU_ADXL_MISO=gpio19 , + + MCU_FS=gpio3 , MCU_SU=gpio2 , MCU_ST_UART_TX=gpio1 , MCU_ST_UART_RX=gpio0 , diff --git a/config/mcu_definitions/toolhead/Mellow_SB2040_Pro.cfg b/config/mcu_definitions/toolhead/Mellow_SB2040_Pro.cfg new file mode 100644 index 000000000..4b27bf71d --- /dev/null +++ b/config/mcu_definitions/toolhead/Mellow_SB2040_Pro.cfg @@ -0,0 +1,20 @@ +[board_pins toolhead_manufacturer] +mcu: toolhead +aliases: + MCU_EMOT_EN=gpio7 , MCU_EMOT_STEP=gpio9 , MCU_EMOT_DIR=gpio10 , MCU_EMOT_CS=gpio8 , + + MCU_5V_ENDSTOP=gpio28 , + MCU_ENDSTOP=gpio29 , + MCU_HV_ENDSTOP=gpio25 , + + MCU_FAN0=gpio13 , MCU_FAN1=gpio14 , MCU_FAN2=gpio15 , + + MCU_TEMP=gpio27 , MCU_ONBOARD_NTCK100K=gpio26 , + + MCU_HEAT=gpio6 , + + MCU_RGB=gpio12 , + MCU_PWM0=gpio16 , MCU_PWM1=gpio17 , + + MCU_ADXL_CS=gpio1 , MCU_ADXL_SCK=gpio0 , MCU_ADXL_MOSI=gpio3 , MCU_ADXL_MISO=gpio2 , # gpio0-2-3 share with EMOT SPI!!! + MCU_MAX31865_CS=gpio22 , MCU_MAX31865_SCK=gpio18 , MCU_MAX31865_MOSI=gpio19 , MCU_MAX31865_MISO=gpio23 , diff --git a/config/mcu_definitions/toolhead/Mellow_SB2040_v2.cfg b/config/mcu_definitions/toolhead/Mellow_SB2040_v2.cfg new file mode 100644 index 000000000..8d1999a42 --- /dev/null +++ b/config/mcu_definitions/toolhead/Mellow_SB2040_v2.cfg @@ -0,0 +1,20 @@ +[board_pins toolhead_manufacturer] +mcu: toolhead +aliases: + MCU_EMOT_EN=gpio7 , MCU_EMOT_STEP=gpio9 , MCU_EMOT_DIR=gpio10 , MCU_EMOT_UART=gpio8 , + + MCU_5V_ENDSTOP=gpio28 , + MCU_ENDSTOP=gpio29 , + MCU_HV_ENDSTOP=gpio25 , + + MCU_FAN0=gpio13 , MCU_FAN1=gpio14 , MCU_FAN2=gpio15 , + + MCU_TEMP=gpio27 , MCU_ONBOARD_NTCK100K=gpio26 , + + MCU_HEAT=gpio6 , + + MCU_RGB=gpio12 , + MCU_PWM0=gpio16 , MCU_PWM1=gpio17 , + + MCU_ADXL_CS=gpio1 , MCU_ADXL_SCK=gpio0 , MCU_ADXL_MOSI=gpio3 , MCU_ADXL_MISO=gpio2 , + MCU_MAX31865_CS=gpio22 , MCU_MAX31865_SCK=gpio18 , MCU_MAX31865_MOSI=gpio19 , MCU_MAX31865_MISO=gpio23 , diff --git a/config/software/bed_mesh/bed_mesh_120mm.cfg b/config/software/bed_mesh/bed_mesh_120mm.cfg index a49908760..0e0372d31 100644 --- a/config/software/bed_mesh/bed_mesh_120mm.cfg +++ b/config/software/bed_mesh/bed_mesh_120mm.cfg @@ -5,7 +5,7 @@ variable_bed_mesh_enabled: True gcode: # Also include directly the dockable probe overide of BED_MESH_CALIBRATE from here -[include ../../../macros/base/probing/overides/bed_mesh_calibrate.cfg] +[include ../../../macros/base/probing/overrides/bed_mesh_calibrate.cfg] # And also include the adaptive mesh macro at the same time [include ../../../macros/calibration/adaptive_bed_mesh.cfg] diff --git a/config/software/bed_mesh/bed_mesh_180mm.cfg b/config/software/bed_mesh/bed_mesh_180mm.cfg index fae7f41c2..ade7bd60f 100644 --- a/config/software/bed_mesh/bed_mesh_180mm.cfg +++ b/config/software/bed_mesh/bed_mesh_180mm.cfg @@ -5,7 +5,7 @@ variable_bed_mesh_enabled: True gcode: # Also include directly the dockable probe overide of BED_MESH_CALIBRATE from here -[include ../../../macros/base/probing/overides/bed_mesh_calibrate.cfg] +[include ../../../macros/base/probing/overrides/bed_mesh_calibrate.cfg] # And also include the adaptive mesh macro at the same time [include ../../../macros/calibration/adaptive_bed_mesh.cfg] diff --git a/config/software/bed_mesh/bed_mesh_250mm.cfg b/config/software/bed_mesh/bed_mesh_250mm.cfg index 15a68ad24..c7ba5b1f5 100644 --- a/config/software/bed_mesh/bed_mesh_250mm.cfg +++ b/config/software/bed_mesh/bed_mesh_250mm.cfg @@ -5,7 +5,7 @@ variable_bed_mesh_enabled: True gcode: # Also include directly the dockable probe overide of BED_MESH_CALIBRATE from here -[include ../../../macros/base/probing/overides/bed_mesh_calibrate.cfg] +[include ../../../macros/base/probing/overrides/bed_mesh_calibrate.cfg] # And also include the adaptive mesh macro at the same time [include ../../../macros/calibration/adaptive_bed_mesh.cfg] diff --git a/config/software/bed_mesh/bed_mesh_300mm.cfg b/config/software/bed_mesh/bed_mesh_300mm.cfg index d2b8e062e..edfaad310 100644 --- a/config/software/bed_mesh/bed_mesh_300mm.cfg +++ b/config/software/bed_mesh/bed_mesh_300mm.cfg @@ -5,7 +5,7 @@ variable_bed_mesh_enabled: True gcode: # Also include directly the dockable probe overide of BED_MESH_CALIBRATE from here -[include ../../../macros/base/probing/overides/bed_mesh_calibrate.cfg] +[include ../../../macros/base/probing/overrides/bed_mesh_calibrate.cfg] # And also include the adaptive mesh macro at the same time [include ../../../macros/calibration/adaptive_bed_mesh.cfg] diff --git a/config/software/bed_mesh/bed_mesh_350mm.cfg b/config/software/bed_mesh/bed_mesh_350mm.cfg index ae6728ec6..63c23527e 100644 --- a/config/software/bed_mesh/bed_mesh_350mm.cfg +++ b/config/software/bed_mesh/bed_mesh_350mm.cfg @@ -5,7 +5,7 @@ variable_bed_mesh_enabled: True gcode: # Also include directly the dockable probe overide of BED_MESH_CALIBRATE from here -[include ../../../macros/base/probing/overides/bed_mesh_calibrate.cfg] +[include ../../../macros/base/probing/overrides/bed_mesh_calibrate.cfg] # And also include the adaptive mesh macro at the same time [include ../../../macros/calibration/adaptive_bed_mesh.cfg] diff --git a/config/software/bed_mesh/bed_mesh_mk52.cfg b/config/software/bed_mesh/bed_mesh_mk52.cfg index 3c7d4ce2f..91deb0556 100644 --- a/config/software/bed_mesh/bed_mesh_mk52.cfg +++ b/config/software/bed_mesh/bed_mesh_mk52.cfg @@ -5,7 +5,7 @@ variable_bed_mesh_enabled: True gcode: # Also include directly the dockable probe overide of BED_MESH_CALIBRATE from here -[include ../../../macros/base/probing/overides/bed_mesh_calibrate.cfg] +[include ../../../macros/base/probing/overrides/bed_mesh_calibrate.cfg] # And also include the adaptive mesh macro at the same time [include ../../../macros/calibration/adaptive_bed_mesh.cfg] diff --git a/config/software/display/display.cfg b/config/software/display/display.cfg new file mode 100644 index 000000000..83e2eb75c --- /dev/null +++ b/config/software/display/display.cfg @@ -0,0 +1,145 @@ +### Klippain display management ### + +[gcode_macro _USER_VARIABLES] +variable_minidisplay_bootlogo_enabled = True +variable_minidisplay_bootinfo_enabled = True +gcode: + +[include klippain_splash.cfg] + + +#### START SPLASH SCREEN +[gcode_macro _INIT_BOOT_LOGO] +gcode: + {% if printer["gcode_macro _USER_VARIABLES"].minidisplay_bootlogo_enabled %} + SET_DISPLAY_GROUP GROUP=_my_intro + UPDATE_DELAYED_GCODE ID=_INIT_BOOT_INFO DURATION=4 + UPDATE_DELAYED_GCODE ID=clear_display DURATION=4.1 + {% endif %} + +#### START SPLASH SCREEN +[delayed_gcode _INIT_BOOT_INFO] +initial_duration: 4 +gcode: + {% if printer["gcode_macro _USER_VARIABLES"].minidisplay_bootinfo_enabled %} + SET_DISPLAY_GROUP GROUP=_my_info + UPDATE_DELAYED_GCODE ID=clear_display DURATION=4 + {% endif %} + +[delayed_gcode clear_display] +gcode: + M117 + SET_DISPLAY_GROUP GROUP={printer.configfile.settings.display.display_group} + + + +### Menu changes to personalize it with Klippain macros +# default implementation: https://github.com/Klipper3d/klipper/blob/master/klippy/extras/display/menu.cfg + +# Shutdown and reboot +[menu __main __setup __restart] +type: list +enable: {not printer.idle_timeout.state == "Printing"} +name: Host control + +# Add a park menu item. +[menu __main __control __park] +type: command +name: Park toolhead +enable: {printer.idle_timeout.state != "Printing" or + printer.pause_resume.is_paused} +index: 0 +gcode: + PARK + +[menu __main __setup __restart __shutdown] +type: command +enable: {not printer.idle_timeout.state == "Printing"} +name: Shutdown host +gcode: SHUTDOWN + +### menu octoprint ### +[menu __main __octoprint] +type: disabled + +[menu __main __control __caselightonoff] +type: input +enable: {'output_pin caselight' in printer} +name: Lights: {'ON ' if menu.input else 'OFF'} +input: {printer['output_pin caselight'].value} +input_min: 0 +input_max: 1 +input_step: 1 +gcode: + SET_PIN PIN=caselight VALUE={printer["gcode_macro _USER_VARIABLES"].light_intensity_start_print if menu.input else 0} + +[menu __main __control __caselightpwm] +type: input +enable: {'output_pin caselight' in printer} +name: Lights: {'%3d' % (menu.input*100)}% +input: {printer['output_pin caselight'].value} +input_min: 0.0 +input_max: 1.0 +input_step: 0.01 +realtime: True +gcode: + SET_PIN PIN=caselight VALUE={menu.input*100} + +################################################################################ +# Replace filament loading with our own macros +################################################################################ +[menu __main __filament] +type: list +name: Filament +enable: {printer.idle_timeout.state != "Printing" or + printer.pause_resume.is_paused} + +# Hide the old load/unload commands. +[menu __main __filament __loadf] +type: command +name: Load Fil. fast +enable: False + +[menu __main __filament __loads] +type: command +name: Load Fil. slow +enable: False + +[menu __main __filament __unloadf] +type: command +name: Unload Fil.fast +enable: False + +[menu __main __filament __unloads] +type: command +name: Unload Fil.slow +enable: False + +# Add new load/unload using our macros. +[menu __main __filament __load] +type: command +index: 1 +name: Load Filament +gcode: + LOAD_FILAMENT + +[menu __main __filament __unload] +type: command +index: 2 +name: Unload Filament +gcode: + UNLOAD_FILAMENT + +[menu __main __filament __purge] +type: command +index: 3 +name: Purge Filament +gcode: + PURGE + +[menu __main __filament __clean] +type: command +index: 3 +name: Clean Nozzle +gcode: + CLEAN_NOZZLE diff --git a/config/software/display/klippain_splash.cfg b/config/software/display/klippain_splash.cfg new file mode 100644 index 000000000..bd41077e0 --- /dev/null +++ b/config/software/display/klippain_splash.cfg @@ -0,0 +1,603 @@ +[display_data _my_intro intro1] +position: 0, 0 +text: + ~kp00~~kp01~~kp02~~kp03~~kp04~~kp05~~kp06~~kp07~ + +[display_data _my_intro intro2] +position: 1, 0 +text: + ~kp10~~kp11~~kp12~~kp13~~kp14~~kp15~~kp16~~kp17~ + +[display_data _my_intro intro3] +position: 2, 0 +text: + ~kp20~~kp21~~kp22~~kp23~~kp24~~kp25~~kp26~~kp26~ + +[display_data _my_intro intro4] +position: 3, 0 +text: + ~kp30~~kp31~~kp32~~kp33~~kp34~~kp35~~kp36~~kp26~ + +[display_data _my_info info1] +position: 1, 0 +text: + Klipper: + +[display_data _my_info info2] +position: 2, 0 +text: + {printer.mcu.mcu_version} + + +[display_glyph kp00] +data: + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + .............*** + .......********* + ....************ + .*************** + + +[display_glyph kp01] +data: + ................ + ................ + ................ + ................ + ................ + ...............* + ...............* + ...............* + ..............** + ..............** + ..........*...** + .....******...** + ***********...** + ***********..*** + ***********..*** + ***********..*** + +[display_glyph kp02] +data: + ..************** + .*************** + .*************** + **************** + **************** + **************** + **************** + **************** + **************** + **************** + **************** + **************** + **************** + **************** + **************** + **************** + +[display_glyph kp03] +data: + ********......** + ********........ + ********..**.... + ********..****.. + *********..****. + **********.***** + **********..**** + **********...*** + **********.....* + **********...... + ***********..... + ***********..*.* + ********.....*.* + ******.......*.* + *****........*.* + ****....***..*.* + +[display_glyph kp04] +data: + .........******* + ........******** + ........******** + ........*******. + .......******... + ......*****..... + ......*........* + ..............** + .............*** + .......***..**** + .....****..***** + ***..***.*.***** + ***..**.*..***** + ***..*.**.****** + ***..*.**.****** + ***..*.*..****** + +[display_glyph kp05] +data: + **************** + *****.....****** + *............*** + ...............* + ...***...**..... + *****...*****... + ****..*.******.. + ****.*.********. + ***.**.********* + **.**..********* + **.**.********** + **.**.********** + **.*..********** + **...*********** + **...*********** + **..************ + +[display_glyph kp06] +data: + *...************ + *...************ + **...*********.. + **.............. + **...........*** + .**......******* + ..*......******* + .......********* + ........******** + ........******** + ........******** + ........******** + *.......******** + *............... + ..............** + ........******** + +[display_glyph kp07] +data: + ****...********* + **...*********** + ...************* + .*************** + ***************. + **************.* + ************..** + ***********..*** + **********..***. + ********..****.. + ******...***.... + ****...****..... + **...*****...... + ..******.......* + ******........*. + ***..........*.. + +[display_glyph kp10] +data: + **************** + **************** + **************** + **************** + **************** + **************** + **************** + **************** + ************.... + **********...*** + ********...***** + ******...******* + *****..********* + ****..********** + ***..*********** + **.************* + +[display_glyph kp11] +data: + **********...*** + **********...*** + **********...*** + **********...*** + **********...*** + ********.....*** + ****.........*** + .............*** + ..*******.....*. + ***********..... + ***********..... + ***********....* + **********....** + *********....*** + *********...**** + *********...**** + +[display_glyph kp12] +data: + ***************. + ************.... + **********...... + *********......* + *******.....**** + ******.....****. + *****....******. + *.......******.* + ........*****.** + ....*..******.** + .***...******.** + ***...*******.*. + **.*..*******.*. + **.*.********.*. + *.**.********..* + *.**.********..* + +[display_glyph kp13] +data: + ......***....*.* + .....***.......* + ....****.*.*.... + **..***.*..**... + ...***.**.****.. + ...***.**.****** + *.****.*..****** + ..****.*.******* + .****.**.******* + .****....******* + .*****..******** + .*****.********* + ******.********* + **************** + **************** + **************** + +[display_glyph kp14] +data: + ***..*.*..****** + **...*.*.******* + ....**...******* + ....**..******** + ..****..******** + ******.********* + **************** + **************** + **************** + **************** + ***************. + ************.... + **********...... + ********........ + *****........... + ***............. + +[display_glyph kp15] +data: + **.************* + ***************. + **************.. + *************... + ************.... + **********...... + ********........ + *****........... + ***............* + *..............* + ..............** + ..............** + .............*** + .............*.. + ............*... + ................ + +[display_glyph kp16] +data: + ........*******. + ...*............ + ...*............ + ...*............ + ..**............ + ..**........**** + .**.....*****... + ***............. + **.............. + *............... + *............... + ................ + ................ + ................ + ................ + ................ + +[display_glyph kp17] +data: + ...........**... + ..........*..... + ........**...... + ......**........ + ...***.......... + ***............. + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + + + +[display_glyph kp20] +data: + *..************* + ..************** + .*************** + ***************. + *************... + ************...* + ***********..*** + **********.****. + *********.***... + ********.***.... + *******.***..... + ******.***...... + ******.***...... + *****.***....... + ****..**........ + ****.***........ + +[display_glyph kp21] +data: + ********...***** + *****......***** + **.........***** + ...****....***** + .****......***** + ***........***** + ...........***** + ...........***** + ............**** + .............*** + ..............** + ................ + ................ + ...........*.*.. + ..........*..... + .......**....... + +[display_glyph kp22] +data: + *.*..********.** + *.*.************ + *...************ + *..************* + *..************* + *.************** + **************** + **************** + ***************. + ************.... + **********...... + *******......... + ................ + ................ + ................ + ................ + +[display_glyph kp23] +data: + **************** + ***************. + ************.... + **********...... + ********........ + *****........... + ***............. + *............... + ................ + ................ + ***............. + ...***.......... + ......*****..... + ............**** + ................ + ................ + +[display_glyph kp24] +data: + *............... + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ..............** + ............**.. + ........****.... + *******......... + ................ + ................ + +[display_glyph kp25] +data: + ...........*.... + ..........*..... + .........*...... + ........*....... + .......*........ + ......*......... + .....*.......... + ....*........... + ..**............ + **.............. + ................ + ................ + ................ + ................ + ................ + ................ + +[display_glyph kp26] +data: + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + ................ + +[display_glyph kp30] +data: + ***..**......... + ***.***......... + ***.**.......... + **.***.......... + **.***.......... + *..**........... + *.***........... + *.***..........* + ..**..........*. + .***............ + .***.........*.. + .**.........*... + ***.........*... + ***........*.... + ***........*.... + **........*..... + +[display_glyph kp31] +data: + ......*......... + .....*.......... + ....*.......***. + ..*.........***. + .*..........***. + .*..........**** + *...........**** + ............**** + ............**** + ............***. + ............***. + ............***. + ............***. + ............***. + ................ + ................ + +[display_glyph kp32] +data: + ................ + ................ + ...***..***..... + .*****..***..... + *****...***..... + ****....***..... + ***.....***..... + **......***..... + ***.....***..... + ****....***..... + .****...***..... + ..****..******** + ...***..******** + ....**..******** + ................ + ................ + +[display_glyph kp33] +data: + ................ + ................ + ..***..*****.... + ..***.*******..* + ..***.********.* + ..***.***...**.* + ..***.***...**.* + ..***.********.* + ..***.*******..* + ..***.*****....* + ..***.***......* + ..***.***......* + ..***.***......* + ..***.***......* + ................ + ................ + +[display_glyph kp34] +data: + ................ + ................ + ******.......*** + *******.....**** + ********....**** + **...***...***** + **...***...**..* + *******...***..* + *******...****** + *****....******* + **.......******* + **......****.... + **......***..... + **......**...... + ................ + ................ + +[display_glyph kp35] +data: + ................ + ................ + ......***..***.. + ......***..****. + *.....***..***** + *.....***..***** + **....***..***** + **....***..***** + ***...***..***.* + ***...***..***.. + ****..***..***.. + .***..***..***.. + .****.***..***.. + ..***.***..***.. + ................ + ................ + +[display_glyph kp36] +data: + ................ + ................ + ...***.......... + ...***.......... + ...***.......... + *..***.......... + **.***.......... + ******.......... + ******.......... + ******.......... + .*****.......... + ..****.......... + ...***.......... + ...***.......... + ................ + ................ diff --git a/config/software/shaketune.cfg b/config/software/shaketune.cfg new file mode 100644 index 000000000..c422e16ec --- /dev/null +++ b/config/software/shaketune.cfg @@ -0,0 +1,7 @@ +# This is an automatic override for the Shake&Tune entrypoint. This will allow it +# to work correctly in the full Klippain environement (within the scripts folder). + +[gcode_shell_command shaketune] +command: ~/printer_data/config/scripts/K-ShakeTune/scripts/shaketune.sh +timeout: 600.0 +verbose: True diff --git a/config/software/spoolman.cfg b/config/software/spoolman.cfg new file mode 100644 index 000000000..387550718 --- /dev/null +++ b/config/software/spoolman.cfg @@ -0,0 +1,6 @@ +[gcode_macro _USER_VARIABLES] +variable_spoolman_enabled: True +gcode: + +# Automatically include the spoolman macros +[include ../../macros/helpers/spoolman.cfg] diff --git a/config/software/tilting/qgl_180mm.cfg b/config/software/tilting/qgl_180mm.cfg index 1ed235190..314a25f01 100644 --- a/config/software/tilting/qgl_180mm.cfg +++ b/config/software/tilting/qgl_180mm.cfg @@ -6,7 +6,7 @@ variable_qgl_enabled: True gcode: # Also include directly the dockable probe overide of qgl from here -[include ../../../macros/base/probing/overides/qgl.cfg] +[include ../../../macros/base/probing/overrides/qgl.cfg] [include ../../../macros/base/homing/tilting.cfg] diff --git a/config/software/tilting/qgl_250mm.cfg b/config/software/tilting/qgl_250mm.cfg index 6b59e611a..0be712261 100644 --- a/config/software/tilting/qgl_250mm.cfg +++ b/config/software/tilting/qgl_250mm.cfg @@ -6,7 +6,7 @@ variable_qgl_enabled: True gcode: # Also include directly the dockable probe overide of qgl from here -[include ../../../macros/base/probing/overides/qgl.cfg] +[include ../../../macros/base/probing/overrides/qgl.cfg] [include ../../../macros/base/homing/tilting.cfg] diff --git a/config/software/tilting/qgl_300mm.cfg b/config/software/tilting/qgl_300mm.cfg index 8fedbfe1b..8b6403a77 100644 --- a/config/software/tilting/qgl_300mm.cfg +++ b/config/software/tilting/qgl_300mm.cfg @@ -6,7 +6,7 @@ variable_qgl_enabled: True gcode: # Also include directly the dockable probe overide of qgl from here -[include ../../../macros/base/probing/overides/qgl.cfg] +[include ../../../macros/base/probing/overrides/qgl.cfg] [include ../../../macros/base/homing/tilting.cfg] diff --git a/config/software/tilting/qgl_350mm.cfg b/config/software/tilting/qgl_350mm.cfg index 5461ae6f4..6b1f03c64 100644 --- a/config/software/tilting/qgl_350mm.cfg +++ b/config/software/tilting/qgl_350mm.cfg @@ -6,7 +6,7 @@ variable_qgl_enabled: True gcode: # Also include directly the dockable probe overide of qgl from here -[include ../../../macros/base/probing/overides/qgl.cfg] +[include ../../../macros/base/probing/overrides/qgl.cfg] [include ../../../macros/base/homing/tilting.cfg] diff --git a/config/software/tilting/z_tilt_120mm.cfg b/config/software/tilting/z_tilt_120mm.cfg index 9db6069d5..76fbafcb6 100644 --- a/config/software/tilting/z_tilt_120mm.cfg +++ b/config/software/tilting/z_tilt_120mm.cfg @@ -6,7 +6,7 @@ variable_ztilt_enabled: True gcode: # Also include directly the dockable probe overide of qgl from here -[include ../../../macros/base/probing/overides/z_tilt.cfg] +[include ../../../macros/base/probing/overrides/z_tilt.cfg] [include ../../../macros/base/homing/tilting.cfg] diff --git a/config/software/tilting/z_tilt_250mm.cfg b/config/software/tilting/z_tilt_250mm.cfg index 2082bce69..77f84bc26 100644 --- a/config/software/tilting/z_tilt_250mm.cfg +++ b/config/software/tilting/z_tilt_250mm.cfg @@ -6,7 +6,7 @@ variable_ztilt_enabled: True gcode: # Also include directly the dockable probe overide of qgl from here -[include ../../../macros/base/probing/overides/z_tilt.cfg] +[include ../../../macros/base/probing/overrides/z_tilt.cfg] [include ../../../macros/base/homing/tilting.cfg] diff --git a/config/software/tilting/z_tilt_300mm.cfg b/config/software/tilting/z_tilt_300mm.cfg index f800ec2c6..d510a5db3 100644 --- a/config/software/tilting/z_tilt_300mm.cfg +++ b/config/software/tilting/z_tilt_300mm.cfg @@ -6,7 +6,7 @@ variable_ztilt_enabled: True gcode: # Also include directly the dockable probe overide of qgl from here -[include ../../../macros/base/probing/overides/z_tilt.cfg] +[include ../../../macros/base/probing/overrides/z_tilt.cfg] [include ../../../macros/base/homing/tilting.cfg] diff --git a/config/software/tilting/z_tilt_350mm.cfg b/config/software/tilting/z_tilt_350mm.cfg index dfd5aa5c3..586f00fad 100644 --- a/config/software/tilting/z_tilt_350mm.cfg +++ b/config/software/tilting/z_tilt_350mm.cfg @@ -6,7 +6,7 @@ variable_ztilt_enabled: True gcode: # Also include directly the dockable probe overide of qgl from here -[include ../../../macros/base/probing/overides/z_tilt.cfg] +[include ../../../macros/base/probing/overrides/z_tilt.cfg] [include ../../../macros/base/homing/tilting.cfg] diff --git a/docs/configuration.md b/docs/configuration.md index 9b2e03867..82886ba82 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -2,10 +2,9 @@ Klippain requires a few simple steps to configure and customize it for your printer: please follow the following documentation step by step in order to get your printer running. - > **Warning** + > **Warning**: > - > General rule to keep the auto-update feature working: **never modify Klippain files directly**, but instead add overrides as per the following documentation. To proceed, you can modify all the pre-installed templates in your config root folder (`printer.cfg`, `mcu.cfg`, `variables.cfg` and `overrides.cfg`) as they will be preserved on update. - + > General rule to keep the auto-update feature working: **never modify Klippain files directly**, but instead add overrides as per the following documentation. To proceed, you can modify all the pre-installed templates in your config root folder (`printer.cfg`, `mcu.cfg`, `variables.cfg` and `overrides.cfg` and, if applicable, the MMU configs files in the `mmu` directory created when you install Happy-Hare) as they will be preserved on update. ## 1. MCU Settings @@ -13,38 +12,51 @@ Before configuring Klippain, you will need to configure your MCUs and wiring. If Don't forget to fill in the serial_port or can_uuid of your MCUs. Refer to the [official Klipper documentation](https://www.klipper3d.org/FAQ.html#wheres-my-serial-port) for help. - ## 2. Printer Settings, Overrides, and Variables Don't overlook, this section is the most important. Now that your MCU is configured, you will need to follow some additionnal steps to configure Klippain: + 1. In `printer.cfg`, uncomment lines corresponding to your printer hardware or software components to enable them (e.g., extruder type, XY motors, Z motors, QGL vs Z_TILT, etc.). 1. Then, edit `overrides.cfg` according to the [overrides documentation and examples](./overrides.md). Use overrides to tweak machine dimensions, invert motor directions, change axis limits, currents, sensors type, or anything you feel the need to change. 1. Once Klipper boots successfully, adjust the `variables.cfg` file to match your machine's configuration. This file provides additional customization for macro behavior (coordinates, enabling/disabling software features, etc.). > **Note**: > - > If you plan to use an ERCF, Klippain is only compatible with the [Happy Hare](https://github.com/moggieuk/ERCF-Software-V3) software backend. - > Enable the ERCF lines in Klippain's `printer.cfg` and then install Happy Hare directly by following its official documention. **When the Happy Hare installer ask if you want to include all the ERCF files into your printer.cfg: answer no** as everything is already included in Klippain! - + > If you want to use an MMU/ERCF with Klippain, you need to install the [HappyHare](https://github.com/moggieuk/Happy-Hare) backend. Also, have a look at the Klippain [MMU documentation](./docs/mmu.md) for more specific details about its configuration. ## 3. Initial startup of the machine Before your first print, **carefully check all features to prevent issues on your machine!** Begin with the [config checks section from the official Klipper documentation](https://www.klipper3d.org/Config_checks.html). -Next, ensure the mechanical probe (if used) can be attached/detached, verify that QGL/Z_TILT works, and confirm correct coordinates for all components (purge bucket, physical Z endstop, etc.). Check your first layer calibration (and the `switch_offset` parameter of the automatic Z calibration plugin, if used), etc. +Next, ensure the mechanical probe (if used) can be attached/detached, verify that QGL/Z_TILT works, and confirm correct coordinates for all components (purge bucket, physical Z endstop, etc.). Check your first layer calibration (and the `switch_offset` parameter of the automatic Z calibration plugin, if used), etc... -Finally, add custom print start G-code to your slicer. Here's an example for SuperSlicer: -``` -START_PRINT EXTRUDER_TEMP={first_layer_temperature[initial_extruder] + extruder_temperature_offset[initial_extruder]} BED_TEMP=[first_layer_bed_temperature] MATERIAL=[filament_type] CHAMBER=[chamber_temperature] SIZE={first_layer_print_min[0]}_{first_layer_print_min[1]}_{first_layer_print_max[0]}_{first_layer_print_max[1]} INITIAL_TOOL={initial_extruder} -``` +## 4. Slicer configuration + +Klippain will work out of the box with most slicers on the market and your profiles should be almost ready to go. You will just need to set some custom start print and end print gcodes to give Klippain the correct info. -Also, add custom print end G-code to your slicer: +### Custom print start Gcode + +| Slicer | Custom start print gcode | +|:-------|:-------------------------| +|[SuperSlicer](https://github.com/supermerill/SuperSlicer)|`START_PRINT EXTRUDER_TEMP={first_layer_temperature[initial_extruder] + extruder_temperature_offset[initial_extruder]} BED_TEMP=[first_layer_bed_temperature] MATERIAL=[filament_type] SIZE={first_layer_print_min[0]}_{first_layer_print_min[1]}_{first_layer_print_max[0]}_{first_layer_print_max[1]} INITIAL_TOOL={initial_extruder}`| +|[OrcaSlicer](https://github.com/SoftFever/OrcaSlicer)|`START_PRINT EXTRUDER_TEMP=[nozzle_temperature_initial_layer] BED_TEMP=[bed_temperature_initial_layer_single] MATERIAL=[filament_type] SIZE={first_layer_print_min[0]}_{first_layer_print_min[1]}_{first_layer_print_max[0]}_{first_layer_print_max[1]} INITIAL_TOOL=[initial_tool]`| +|[PrusaSlicer](https://github.com/prusa3d/PrusaSlicer)|`START_PRINT EXTRUDER_TEMP={first_layer_temperature[initial_extruder]} BED_TEMP=[first_layer_bed_temperature] MATERIAL=[filament_type] SIZE={first_layer_print_min[0]}_{first_layer_print_min[1]}_{first_layer_print_max[0]}_{first_layer_print_max[1]} INITIAL_TOOL={initial_extruder}`| + +In addition, there are a few other optional parameters that are supported in Klippain (they must be added on the same line after the first parameters): + - `CHAMBER=[chamber_temperature]` *(for SuperSlicer and OrcaSlicer)* or `CHAMBER=[idle_temperature]` *(for PrusaSlicer)* to set a target heatsoak temperature during the START_PRINT sequence. + - `TOTAL_LAYER=[total_layer_count]` to be able to set the PRINT_STATS_INFOS in Klipper. If you use this, you will also need to add the corresponding `SET_PRINT_STATS_INFO CURRENT_LAYER={layer_num}` to your slicer custom layer change gcode. + - `TOOLS_USED=!referenced_tools!` *(only for MMU users)* is highly recommended to check only the used tools with the HappyHare [Moonraker gcode preprocessor](https://github.com/moggieuk/Happy-Hare/blob/main/doc/gcode_preprocessing.md). + - `CHECK_GATES=0` or `1` *(only for MMU users)* that will override the corresponding variable defined in Klippain `variables.cfg` for this specific print. + - `SYNC_MMU_EXTRUDER=1` *(only for MMU users)* if you want to stay with the default `sync_to_extruder: 0` value of HappyHare (defined in `mmu/mmu_parameters.cfg`), but still want to use the sync for a specific print. + + +### Custom print start Gcode + +All slicers will be happy with a simple: ``` END_PRINT ``` - > **Note** for ERCF users: - > - > By default, Klippain unloads the filament at the end of the print, but you can change the default behavior by modifying the variable `variable_ercf_unload_on_end_print` in your `variables.cfg` file. - > You can also specify the wanted behavior directly in your slicer end print custom gcode by using `END_PRINT ERCF_UNLOAD_AT_END=0`. - +In addition, there are a few other optional parameters that are supported in Klippain (they must be added on the same line after the first parameters): + - `FILTER_TIME=600` that will override the corresponding variable defined in Klippain `variables.cfg` for this specific print. Time is expressed in seconds. + - `MMU_UNLOAD_AT_END=0` or `1` *(only for MMU users)* that will override the corresponding variable defined in Klippain `variables.cfg`. diff --git a/docs/features.md b/docs/features.md index 442749bc0..cef910a15 100644 --- a/docs/features.md +++ b/docs/features.md @@ -22,4 +22,6 @@ Here you can find a list of all the custom features availables in the macros or ## Hardware This config support out of the box a lot of different machine hardware configurations. -More info will be added in this section later... + +Please see [How to write an override](./overrides.md#how-to-write-an-override) in docs/overrides.md for more information on customizing your configuration. + diff --git a/docs/features/adaptive_bed_mesh.md b/docs/features/adaptive_bed_mesh.md index 699defa7e..5ceae934c 100644 --- a/docs/features/adaptive_bed_mesh.md +++ b/docs/features/adaptive_bed_mesh.md @@ -50,7 +50,7 @@ If you want to install it to your own custom config, here is the way to go: PRINT_START [all your own things...] SIZE=%MINX%_%MINY%_%MAXX%_%MAXY% ``` -> Please note that using the `[exclude_object]` tags (method 1) is a little bit less precise than using the original "SIZE" parameter (method 2) as the `[exclude_object]` tags are using the full parts sizes (not only the first layer). So if you do a part with large overhangs, it will do a large mesh using the tags but will only mesh the base of the part with the SIZE parameter. Also, if you add a skirt around the parts or use a purge tower (like ERCF users), there is no tags associated to this and the mesh can be a little bit smaller and lead to bad adhesion of these objects. So my advice is: use the [exclude_object] tags method for a new installation as it's much more easier to install. But if you are updating from an older version of the macro or use an ERCF, use the SIZE parameter! +> Please note that using the `[exclude_object]` tags (method 1) is a little bit less precise than using the original "SIZE" parameter (method 2) as the `[exclude_object]` tags are using the full parts sizes (not only the first layer). So if you do a part with large overhangs, it will do a large mesh using the tags but will only mesh the base of the part with the SIZE parameter. Also, if you add a skirt around the parts or use a purge tower (like MMU/ERCF users), there is no tags associated to this and the mesh can be a little bit smaller and lead to bad adhesion of these objects. So my advice is: use the [exclude_object] tags method for a new installation as it's much more easier to install. But if you are updating from an older version of the macro or use an MMU, use the SIZE parameter! 3. In klipper, if it's not already the case, add and configure a `[bed_mesh]` for your machine. This will be the base on which my macro compute the new adaptive bed mesh. Keep in mind that you can (and should) push the precision a little bit further: do not hesistate to go with a mesh of 9x9 (or even more) as with my adaptive bed mesh, not all the points will be probed for smaller parts. diff --git a/docs/images/mmu/HHv2_error_tmc.png b/docs/images/mmu/HHv2_error_tmc.png new file mode 100644 index 000000000..d0ec224cf Binary files /dev/null and b/docs/images/mmu/HHv2_error_tmc.png differ diff --git a/docs/images/mmu/HHv2_mcu_tmc.png b/docs/images/mmu/HHv2_mcu_tmc.png new file mode 100644 index 000000000..d28611758 Binary files /dev/null and b/docs/images/mmu/HHv2_mcu_tmc.png differ diff --git a/docs/images/mmu/HHv2emptygate.png b/docs/images/mmu/HHv2emptygate.png new file mode 100644 index 000000000..67f1374a1 Binary files /dev/null and b/docs/images/mmu/HHv2emptygate.png differ diff --git a/docs/mmu.md b/docs/mmu.md new file mode 100644 index 000000000..53f57c112 --- /dev/null +++ b/docs/mmu.md @@ -0,0 +1,104 @@ +# MMU Configuration in Klippain + +Klippain is fully compatible with Multi-Material Units (MMU) and leverages the [HappyHare](https://github.com/moggieuk/Happy-Hare) software backend for an easy and effective use of them. + +This documentation outlines the procedures for setting up and operate an MMU within Klippain. It includes instructions on proper usage and troubleshooting common issues. + + +## Installing HappyHare + + > **Note**: + > + > If you were using the previous ERCF-Software-V3, move your old `ercf_***.cfg` files in a safe place for future reference and then uninstall it completely by running `~/ERCF-Software-V3/install.sh -u && rm -rf ~/ERCF-Software-V3`. + +Follow these steps to install the latest HappyHare: + +```bash +cd ~ +git clone https://github.com/moggieuk/Happy-Hare.git +cd Happy-Hare +./install.sh -i +``` + +Klippain requires a few simple steps to configure and customize it for your printer, if you haven't already followed the [configuration guide](./configuration.md), please do so first. + +Finally, enable Klippain's MMU feature by uncommenting the corresponding line in your `printer.cfg`. Don't forget to have a look at the HappyHare config files in the `mmu` folder at the root of your config. + + +## Configuration Tips + +HappyHare is a software with a lot of features and you should first have a look at how it works and its concepts [here](https://github.com/moggieuk/Happy-Hare?tab=readme-ov-file#---readme-table-of-contents) and its documentation section [here](https://github.com/moggieuk/Happy-Hare/tree/main/doc). On top of this, Klippain define a couple of things a bit differently to allow more flexibility and a better integration with it. + +### Check gates on START_PRINT + +If you want to check the gates at the start of a print to avoid an error when using a gate that was previously marked as empty, it is recommended to set `variable_mmu_check_gates_on_start_print: True` in your Klippain `variables.cfg`. + + > **Note**: + > + > Be sure to also include `TOOLS_USED=!referenced_tools!` in your slicer custom start print gcode in order to allow the [HappyHare Moonraker gcode preprocessor](https://github.com/moggieuk/Happy-Hare/blob/main/doc/gcode_preprocessing.md) to work correctly and and to ensure that all tools are checked. + +### Early check errors during START_PRINT + +In Klippain, you have two options to control how and when MMU errors are detected during the start of a print: + + 1. **Managed by Klippain**: This allows the system to check for errors during the sequence and, if errors are detected, to stop the sequence immediately so that you can troubleshoot the MMU. However, you'll need to restart the print after the MMU problems are fixed. + To enable this mode, set `variable_mmu_check_gates_on_start_print: True` in your Klippain `variables.cfg`. Note that when this is set, the original `print_start_detection` parameter of HH will have no effect, as Klippain will take over the management of MMU state changes. + + 1. **Managed by HappyHare**: This allows HappyHare to automatically detect the start and end of a print. However, if an MMU error occurs, the system will only pause at the very end of the START_PRINT sequence, meaning you'll have to wait until then to fix any MMU problems. However, once the problem is resolved, you can resume printing, provided you have been able to manually purge, clean, and prepare the nozzle for printing. + To enable this mode, set `variable_mmu_check_gates_on_start_print: False` in your Klippain `variables.cfg` to allow HappyHare to take care of this and set its `print_start_detection` parameter to your liking. + +Using these parameters, you can choose to detect errors early and stop printing immediately for faster troubleshooting, or you can stick with the default mode, which stops printing at the end of the START_PRINT sequence for error handling. The choice depends entirely on your preferences and how you want to handle MMU errors during printing. + +### Difference between GATE and TOOL + + - **GATE** refers to the physical MMU slot + - **TOOL** refers to the virtual tool (or filament) used in software. The one you can call using the `Tx` command. + +By default, as you can see with the `MMU_REMAP_TTG` command in HappyHare, GATE and TOOL are mapped equivalently one by one. But you can use the same command to change this mapping like this: `MMU_REMAP_TTG TOOL=x GATE=y`. + +This feature is particularly useful if you have already sliced a project with certain tools defined in the slicer and want to reprint it after moving the filament spools to different gates, or with different filament colors without having to reorganize the spool positions or reslice your project. For more information, please look at the official HappyHare [Tool-to-Gate (TTG) mapping documentation](https://github.com/moggieuk/Happy-Hare?tab=readme-ov-file#3-tool-to-gate-ttg-mapping). + +### Using Bypass + +If you want to print without using the MMU features, you can use the MMU bypass mode. Here is how to use it: + 1. Home the MMU by running `MMU_HOME FORCE_UNLOAD=1`. + 1. Select the bypass mode with `MMU_SELECT_BYPASS`. + 1. Finally, manually insert the filament into the bowden tube up to the extruder gears and load the filament with the `MMU_LOAD` command or start the print (the `START_PRINT` sequence will automatically try to load the filament into the toolhead). + +At the end of the print, you can use the `MMU_EJECT` command (if `variable_mmu_unload_on_end_print` is set to False in Klippain `variables.cfg`, otherwise it is ejected automatically) to unload the filament from the extruder and then manually pull it out of the bowden tube. + +### Spoolman support with MMU + +HappyHare can natively handle spool changes in Spoolman. This requires some configuration in the `mmu/mmu_parameters.cfg` file: + 1. Set `enable_spoolman:1` to enable spoolman support in HH. + 1. Then configure the spool IDs using the `gate_spool_id:` variable. + +You can also use the `MMU_GATE_MAP GATE=n SPOOLID=id` macro at runtime to change the spool ID associated with a gate. + + > **Note**: + > + > If you set the `INITIAL_TOOL` parameter in your slicer custom start gcode, Klippain will use it to select and activate the correct spool from Spoolman for the print. + + +## MMU error messages in Klippain + +### Variable check error + +``` +MMU support is enabled in Klippain, but some variables are missing from your variables.cfg. Please update your template or refer to the corresponding documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md +``` + +If you have the previous message in the console when Klippain is starting, you will want to update your Klippain `variables.cfg` template file or check that the MMU variables are set correctly in it: + - `variable_mmu_force_homing_in_start_print`: True or False + - `variable_mmu_unload_on_cancel_print`: True or False + - `variable_mmu_unload_on_end_print`: True or False + - `variable_mmu_check_gates_on_start_print`: True or False + - `variable_mmu_check_errors_on_start_print`: True or False + +### Empty gate error + +![](./images/mmu/HHv2emptygate.png) + +If you encounter an error despite the gate being loaded correctly, it's often because the gate was previously marked as empty and hasn't had its status updated. To resolve this during a print, for instance, you can use the command `MMU_GATE_MAP GATE=n AVAILABLE=1`. + +It's a best practice to verify the state of each gate after changing filaments. Use the `MMU_GATE_MAP` command to ensure your setup is accurate. Additionally, the `MMU_CHECK_GATE` command allows you to update the status for all MMU gates. If you need to update specific gates or tools, you can use commands like `MMU_CHECK_GATE TOOLS=0,2,5` to check and update tools 0, 2, and 5, or `MMU_CHECK_GATE GATES=0,2,5` for gates 0, 2, and 5, respectively. diff --git a/docs/overrides.md b/docs/overrides.md index e8273c4a7..99dcf29ba 100644 --- a/docs/overrides.md +++ b/docs/overrides.md @@ -24,7 +24,18 @@ Additionally, if you want to add a new macro to Klippain or even replace an exis The following examples should help you add all the overrides you need to customize Klippain and make it work correctly with your printer! -Let's say you want to change the motor current for the X-axis. You'll need to override the `[tmc2209 stepper_x]` section because that's where the current is defined. To do this, simply add the following to your `overrides.cfg` file: +If something in your hardware isn't working as expected, first inspect the relevant default configuration file for your hardware. For example if your v0 display encoder is rotating in the opposite direction: +`cd ~/printer_data/config` then `less config/hardware/displays/V0_display.cfg`, copy the relevant portion then edit to suit in your `overrides.cfg`: +``` +[display] +# Set the direction of the encoder wheel +# Standard: Right (clockwise) scrolls down or increases values. Left (counter-clockwise scrolls up or decreases values. +#encoder_pins: ^v0_display:PA3, ^v0_display:PA4 +# Reversed: Right (clockwise) scrolls up or decreases values. Left (counter-clockwise scrolls down or increases values. +encoder_pins: ^v0_display:PA4, ^v0_display:PA3 +``` + +Or let's say you want to change the motor current for the X-axis. You'll need to override the `[tmc2209 stepper_x]` section because that's where the current is defined. To do this, simply add the following to your `overrides.cfg` file: ``` [tmc2209 stepper_x] run_current: ... diff --git a/docs/pinout.md b/docs/pinout.md index 8e0101db8..ea752c01e 100644 --- a/docs/pinout.md +++ b/docs/pinout.md @@ -2,24 +2,25 @@ In Klipper, once a `[board_pins]` is defined, the aliases are used in all sections to make them more readable ([official board_pins Klipper documentation](https://www.klipper3d.org/Config_Reference.html#board_pins)). I use this mechanism extensively on a two-level model to add genericity and simplify the MCU configuration for everyone. - ## Configuring your mcu.cfg file Klippain is designed using a two-level [board_pins] model: + 1. First level: Some rules and pin naming conventions (let's call them "Frix-x names") were defined and used in all config files. Then a set of [user board_pins templates](./../user_templates/mcu_defaults/) were created for the most common MCUs of the market. This is basically what you need to put in your `mcu.cfg` file. 2. Second level: Since it's always a pain to retrieve the pin names from the boards manufacturer's documentation like `PA12` or `gpio23` (let's call them "controller names"), I added a second layer of [board_pins] to link some "easy to retrieve names" (ie. what's printed on the MCU boards around the ports and easy to read with "MCU_" as a prefix) to these "controller names". This second layer of board_pins is located [in this folder](./../config/mcu_definitions/) and is not intended to be modified. To summarize, we have two board_pins used for each MCU. One user board_pins and one manufacturer board_pins. They link the following: + ``` Frix-x names -> Manufacturer (PCB print) names > controller names ``` So in order to populate your own `mcu.cfg` file, just copy one of the [user template](./../user_templates/mcu_defaults/) into it. Then feel free to change the wiring to your liking. For example, if you have wired your part fan to port `FAN3` instead of `FAN0`, just change the definition to `PART_FAN=MCU_FAN3` and that's it! - > **Info** + > **Info**: + > > Klipper does not allow `[board_pins]` sections to contain pin modifiers such as `!`, `^` and `~`. Moreover, when configuring multiple MCUs at the same time, all the aliases used in the hardware sections must be prefixed with the MCU name. This is a current limitation of Klipper and is why you need to use the overrides.cfg file to add them. - ## Using a new MCU If you want to use a new MCU that is not yet supported in my config, you just have to define a new [board_pins] in your `mcu.cfg` file and use the same convention. Also feel free to also add a manufacturer board_pins to my config and submit a PR: I'll be happy to merge it and extend MCU support for new boards :) @@ -27,46 +28,59 @@ If you want to use a new MCU that is not yet supported in my config, you just ha Here is a list of all the "Frix-x names" available to use in your own board_pins: #### Steppers + - `[EXYZ1-3]_STEP`: drivers step pins - `[EXYZ1-3]_DIR`: drivers dir pins - `[EXYZ1-3]_ENABLE`: drivers enable pins - `[EXYZ1-3]_TMCUART`: drivers UART pins - - Beside standard axis there is also the support for the `GEAR_...` and `SELECTOR_...` drivers used in the ERCF + - `DRIVER_SPI_MOSI`, `DRIVER_SPI_MISO`, `DRIVER_SPI_SCK`: used in case of SPI drivers + - Beside standard axis there is also the support for the `MMU_GEAR_...` and `MMU_SEL_...` drivers used in the MMU/ERCF/TRADRACK #### Endstops & Probe + - `[XYZ]_STOP`: classic axis endstops pins - - `PROBE_INPUT`: classical probe like Klicky, Omron, Pinda, TAP, etc... + - `PROBE_INPUT`: classical probe input like Klicky, Omron, Pinda, TAP, etc... + - `MMU_SEL_ENDSTOP`: for the MMU/ERCF physical selector endstop + +#### Heaters -#### Heaters - `E_HEATER`: hotend heater cartridge - `BED_HEATER`: bed heating pad (or bed SSR) #### Temperature sensors + - `E_TEMPERATURE`: hotend temperature sensor - `BED_TEMPERATURE`: bed temperature sensor - - `CHAMBER_TEMPERATURE`: chamber temperature sensor + - `CHAMBER_TEMPERATURE`: chamber temperature sensor (used to heatsoak the chamber during the START_PRINT sequence) - `ELECTRICAL_CABINET_TEMPERATURE`: electrical cabinet temperature sensor (not really used in the config, but if present, this sensor is added to the Mainsail / Fluidd web interface as an additional info) #### Fans + - `E_FAN`: hotend fan. This fan should stay at 100% whenever the hotend is hot, so a PWM capable pin is not mandatory - - `PART_FAN`: part fan used during the print. This pin should be a PWM capable pin to allow power modulation - - `EXHAUST_FAN`: for an exhaust filter (such as the Voron basic exhaust). This pin should be a PWM capable pin to allow power modulation - - `FILTER_FAN`: for a filter (such as a Nevermore filter). This pin should be a PWM capable pin to allow power modulation + - `E_FAN_TACHO`: tachometer of the hotend fan, optional and used to validate that the fan is spinning as a safety feature + - `PART_FAN`: part fan used during the print. This pin should be a PWM capable pin to allow modulation of the fan speed + - `PART_FAN_TACHO`: tachometer of the part fan, optional and used to validate that the fan is spinning as a safety feature + - `EXHAUST_FAN`: for an exhaust filter (such as the Voron basic exhaust). This pin should be a PWM capable pin to allow modulation of the fan speed + - `FILTER_FAN`: for a filter (such as a Nevermore filter). This pin should be a PWM capable pin to allow modulation of the fan speed - `CONTROLLER_FAN`: to cool down your MCUs or electronic bay - `HOST_CONTROLLER_FAN`: to cool down your Pi (or equivalent Klipper host controller) #### Lights + - `LIGHT_OUTPUT`: simple chamber lights (such as 24v leds or 24v fcob light bars) - - `LIGHT_NEOPIXEL` : neopixel chamber lights - - `STATUS_NEOPIXEL` : toolhead neopixel lights (such as the one used on the Voron StealthBurner toolhead) + - `LIGHT_NEOPIXEL` : neopixels chamber lights + - `STATUS_NEOPIXEL` : toolhead/machine status led neopixels (such as the one used on the Voron StealthBurner toolhead) + - `MMU_NEOPIXEL`: for the specific MMU/ERCF neopixel leds #### Other I/Os - - `RUNOUT_SENSOR`: filament motion sensor - - `ERCF_ENCODER`: filament motion sensor used in the ERCF carriage - - `TOOLHEAD_SENSOR`: toolhead filament sensor used for the ERCF - - `SERVO_PIN`: for a mechanical and movable probe dock or brush (such as the ones that are commonly found on the Voron V0 mods) - - `ERCF_SERVO`: for a the ERCF servo + - `RUNOUT_SENSOR`: filament runout sensor (currently only one motion or switch sensor is supported in Klippain) + - `MMU_ENCODER`: filament motion sensor used in the MMU/ERCF carriage + - `TOOLHEAD_SENSOR`: optional toolhead filament sensor used for the MMU/ERCF/TRADRACK + - `SERVO_PIN`: for a mechanical and movable probe dock or brush (such as the ones that are commonly found on the Voron V0 mods) + - `MMU_SERVO`: for the MMU servo + - `MMU_GATE_SENSOR`: for the MMU/TRADRACK gate sensor + - `MMU_PRE_GATE_[0-11]`: for the MMU/ERCT sensors ## External references @@ -77,4 +91,6 @@ For more information on the boards and pinouts, please see directly the manufact - [BTT Manta 8P](https://github.com/bigtreetech/Manta-M8P) - [Fly SHT](https://mellow.klipper.cn/#/board/fly_sht36_42/) - [BTT EBB](https://github.com/bigtreetech/EBB) - - [BTT SKR Mini E3](https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3) \ No newline at end of file + - [BTT SKR Mini E3](https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3) + - [Fysetc S6](https://github.com/FYSETC/FYSETC-S6) + - [Fly Gemini v3](https://mellow-3d.github.io/fly-gemini_v3_pins.html) \ No newline at end of file diff --git a/install.sh b/install.sh old mode 100755 new mode 100644 index 1fc234ebd..27b7d9f03 --- a/install.sh +++ b/install.sh @@ -6,6 +6,7 @@ # @version: 1.3 # CHANGELOG: +# v1.4: added Shake&Tune install call # v1.3: - added a warning on first install to be sure the user wants to install klippain and fixed a bug # where some artefacts of the old user config where still present after the install (harmless bug but not clean) # - automated the install of the Gcode shell commands plugin @@ -25,6 +26,8 @@ FRIX_CONFIG_PATH="${HOME}/klippain_config" BACKUP_PATH="${HOME}/klippain_config_backups" # Where the Klipper folder is located (ie. the internal Klipper firmware machinery) KLIPPER_PATH="${HOME}/klipper" +# Branch from Frix-x/klippain repo to use during install (default: main) +FRIX_BRANCH="main" set -eu @@ -72,11 +75,11 @@ function check_download { local frixtemppath frixreponame frixtemppath="$(dirname ${FRIX_CONFIG_PATH})" frixreponame="$(basename ${FRIX_CONFIG_PATH})" + frixbranchname="${FRIX_BRANCH}" if [ ! -d "${FRIX_CONFIG_PATH}" ]; then echo "[DOWNLOAD] Downloading Klippain repository..." - if git -C $frixtemppath clone https://github.com/klsummers92/klippain.git $frixreponame; then - chmod +x ${FRIX_CONFIG_PATH}/install.sh + if git -C $frixtemppath clone -b $frixbranchname https://github.com/Frix-x/klippain.git $frixreponame; then printf "[DOWNLOAD] Download complete!\n\n" else echo "[ERROR] Download of Klippain git repository failed!" @@ -90,6 +93,11 @@ function check_download { # Step 3: Backup the old Klipper configuration function backup_config { + if [ ! -e "${USER_CONFIG_PATH}" ]; then + printf "[BACKUP] No previous config found, skipping backup...\n\n" + return 0 + fi + mkdir -p ${BACKUP_DIR} # Copy every files from the user config ("2>/dev/null || :" allow it to fail silentely in case the config dir doesn't exist) @@ -100,7 +108,7 @@ function backup_config { # If Klippain is not already installed (we check for .VERSION in the backup to detect it), # we need to remove, wipe and clean the current user config folder... if [ ! -f "${BACKUP_DIR}/.VERSION" ]; then - rm -R ${USER_CONFIG_PATH} + rm -fR ${USER_CONFIG_PATH} fi printf "[BACKUP] Backup of current user config files done in: ${BACKUP_DIR}\n\n" @@ -129,9 +137,6 @@ function install_config { # CHMOD the scripts to be sure they are all executables (Git should keep the modes on files but it's to be sure) chmod +x ${FRIX_CONFIG_PATH}/install.sh chmod +x ${FRIX_CONFIG_PATH}/uninstall.sh - for file in is_workflow.py graph_vibrations.py graph_shaper.py graph_belts.py; do - chmod +x ${FRIX_CONFIG_PATH}/scripts/is_workflow/$file - done # Symlink the gcode_shell_command.py file in the correct Klipper folder (erased to always get the last version) ln -fsn ${FRIX_CONFIG_PATH}/scripts/gcode_shell_command.py ${KLIPPER_PATH}/klippy/extras @@ -143,7 +148,7 @@ function install_config { # Helper function to ask and install the MCU templates if needed function install_mcu_templates { - local install_template file_list main_template install_toolhead_template toolhead_template install_ercf_template + local install_template file_list main_template install_toolhead_template toolhead_template install_mmu_template read < /dev/tty -rp "[CONFIG] Would you like to select and install MCU wiring templates files? (Y/n) " install_template if [[ -z "$install_template" ]]; then @@ -206,33 +211,33 @@ function install_mcu_templates { fi fi - # Finally see if the user use an ERCF board - read < /dev/tty -rp "[CONFIG] Do you have an ERCF MCU and want to install a template? (y/N) " install_ercf_template - if [[ -z "$install_ercf_template" ]]; then - install_ercf_template="n" + # Finally see if the user use an MMU/ERCF board + read < /dev/tty -rp "[CONFIG] Do you have an MMU/ERCF MCU and want to install a template? (y/N) " install_mmu_template + if [[ -z "$install_mmu_template" ]]; then + install_mmu_template="n" fi - install_ercf_template="${install_ercf_template,,}" + install_mmu_template="${install_mmu_template,,}" - # Check if the user wants to install an ERCF MCU template - if [[ "$install_ercf_template" =~ ^(yes|y)$ ]]; then + # Check if the user wants to install an MMU/ERCF MCU template + if [[ "$install_mmu_template" =~ ^(yes|y)$ ]]; then file_list=() while IFS= read -r -d '' file; do file_list+=("$file") - done < <(find "${FRIX_CONFIG_PATH}/user_templates/mcu_defaults/ercf" -maxdepth 1 -type f -print0) - echo "[CONFIG] Please select your ERCF MCU in the following list:" + done < <(find "${FRIX_CONFIG_PATH}/user_templates/mcu_defaults/mmu" -maxdepth 1 -type f -print0) + echo "[CONFIG] Please select your MMU/ERCF MCU in the following list:" for i in "${!file_list[@]}"; do echo " $((i+1))) $(basename "${file_list[i]}")" done - read < /dev/tty -p "[CONFIG] Template to install (or 0 to skip): " ercf_template - if [[ "$ercf_template" -gt 0 ]]; then + read < /dev/tty -p "[CONFIG] Template to install (or 0 to skip): " mmu_template + if [[ "$mmu_template" -gt 0 ]]; then # If the user selected a file, copy its content into the mcu.cfg file - filename=$(basename "${file_list[$((ercf_template-1))]}") - cat "${FRIX_CONFIG_PATH}/user_templates/mcu_defaults/ercf/$filename" >> ${USER_CONFIG_PATH}/mcu.cfg + filename=$(basename "${file_list[$((mmu_template-1))]}") + cat "${FRIX_CONFIG_PATH}/user_templates/mcu_defaults/mmu/$filename" >> ${USER_CONFIG_PATH}/mcu.cfg echo "[CONFIG] Template '$filename' inserted into your mcu.cfg user file" - printf "[CONFIG] You must install ERCF Happy Hare from https://github.com/moggieuk/ERCF-Software-V3 to use ERCF with Klippain\n\n" + printf "[CONFIG] Note: keep in mind that you have to install the HappyHare backend manually to use an MMU/ERCF with Klippain. See the Klippain documentation for more information!\n\n" else - printf "[CONFIG] No ERCF template selected. Skip and continuing...\n\n" + printf "[CONFIG] No MMU/ERCF template selected. Skip and continuing...\n\n" fi fi } @@ -258,5 +263,7 @@ backup_config install_config restart_klipper +wget -O - https://raw.githubusercontent.com/Frix-x/klippain-shaketune/main/install.sh | bash + echo "[POST-INSTALL] Everything is ok, Klippain installed and up to date!" echo "[POST-INSTALL] Be sure to check the breaking changes on the release page: https://github.com/Frix-x/klippain/releases" diff --git a/macros/base/cancel_print.cfg b/macros/base/cancel_print.cfg index d61f699b5..82c3a8ade 100644 --- a/macros/base/cancel_print.cfg +++ b/macros/base/cancel_print.cfg @@ -4,23 +4,27 @@ description: Cancel the print, retract 10mm of filament and park gcode: {% set turn_off_heaters_in_end_print = printer["gcode_macro _USER_VARIABLES"].turn_off_heaters_in_end_print %} {% set safe_extruder_temp = printer["gcode_macro _USER_VARIABLES"].safe_extruder_temp|float %} - {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} - {% set ercf_unload_on_cancel_print = printer["gcode_macro _USER_VARIABLES"].ercf_unload_on_cancel_print %} + {% set light_intensity_end_print = printer["gcode_macro _USER_VARIABLES"].light_intensity_end_print %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} + {% set mmu_unload_on_cancel_print = printer["gcode_macro _USER_VARIABLES"].mmu_unload_on_cancel_print %} {% set filter_enabled = printer["gcode_macro _USER_VARIABLES"].filter_enabled %} {% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} + {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} + {% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %} + {% set hotend_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].hotend_fan_tach_enabled %} PARK - {% if klippain_ercf_enabled and ercf_unload_on_cancel_print %} - {% if printer.ercf.enabled %} - # unload filament and park into ercf - ERCF_EJECT + {% if klippain_mmu_enabled and mmu_unload_on_cancel_print %} + {% if printer.mmu.enabled and printer.mmu.tool|int != -2 %} + # Unload filament and park the MMU + MMU_EJECT {% endif %} - {% else %} - # pull back the filament a little bit - _TIP_SHAPING + {% elif printer.extruder.can_extrude %} + # Pull back the filament a little bit + G92 E0 G1 E-10 F2100 {% endif %} @@ -30,6 +34,10 @@ gcode: SET_HEATER_TEMPERATURE HEATER=extruder TARGET={safe_extruder_temp} {% endif %} + {% if hotend_fan_tach_enabled %} + UPDATE_DELAYED_GCODE ID=_BACKGROUND_HOTEND_TACHO_CHECK DURATION=0 + {% endif %} + M107 M400 @@ -41,8 +49,14 @@ gcode: SDCARD_RESET_FILE + # If a filter is connected, and used during the print, continue filtering the air + # for a couple of min before stopping everything {% if filter_enabled %} - STOP_FILTER + {% if printer['fan_generic filter'].speed > 0 %} + {% set FILTER_TIME = params.FILTER_TIME|default(filter_default_time)|int %} + START_FILTER SPEED=1 + UPDATE_DELAYED_GCODE ID=_STOP_FILTER_DELAYED DURATION={FILTER_TIME} + {% endif %} {% endif %} {% if light_enabled %} @@ -52,4 +66,15 @@ gcode: STATUS_LEDS COLOR="OFF" {% endif %} + {% if klippain_mmu_enabled %} + {% if printer.mmu.enabled and printer.mmu.print_start_detection|int == 0 %} + _MMU_PRINT_END STATE=cancelled + {% endif %} + {% endif %} + + # If a filament sensor is connected, re-enable it in case it was disabled during printing + {% if filament_sensor_enabled %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 + {% endif %} + BASE_CANCEL_PRINT diff --git a/macros/base/control.cfg b/macros/base/control.cfg new file mode 100644 index 000000000..0f857bcd3 --- /dev/null +++ b/macros/base/control.cfg @@ -0,0 +1,25 @@ +[gcode_macro _OFF] +description: Turn off the printer +gcode: + {% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %} + {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} + {% set display_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_minidisplay_enabled %} + M84 ; turn steppers off + TURN_OFF_HEATERS ; turn bed / hotend off + M107 ; turn print cooling fan off + {% if light_enabled %} + LIGHT_OFF ; turn off light + {% endif %} + {% if status_leds_enabled %} + STATUS_LEDS COLOR="SHUTDOWN" ; turn off status LEDs + {% endif %} + {% if display_leds_enabled %} + _SET_ALLLEDS_BY_NAME LEDS="minidisplay" COLOR="shutdown" ; turn off all minidisplay LEDs even in knob only mode + {% endif %} + +[gcode_macro SHUTDOWN] +description: Turn off the printer and shutdown the host +gcode: + _OFF ; Shortcut to turn everything off (see above for this macro) + {action_respond_info('action:poweroff')} ; OctoPrint compatible host shutdown + {action_call_remote_method("shutdown_machine")} ; Moonraker compatible host shutdown diff --git a/macros/base/end_print.cfg b/macros/base/end_print.cfg index 4f1a5f23f..5228ba43a 100644 --- a/macros/base/end_print.cfg +++ b/macros/base/end_print.cfg @@ -5,24 +5,25 @@ gcode: {% set turn_off_heaters_in_end_print = printer["gcode_macro _USER_VARIABLES"].turn_off_heaters_in_end_print %} {% set safe_extruder_temp = printer["gcode_macro _USER_VARIABLES"].safe_extruder_temp|float %} {% set light_intensity_end_print = printer["gcode_macro _USER_VARIABLES"].light_intensity_end_print %} - {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} - {% set ercf_unload = params.ERCF_UNLOAD_AT_END|default(printer["gcode_macro _USER_VARIABLES"].ercf_unload_on_end_print)|int %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} + {% set mmu_unload = params.MMU_UNLOAD_AT_END|default(printer["gcode_macro _USER_VARIABLES"].mmu_unload_on_end_print)|default(0)|int %} {% set filter_enabled = printer["gcode_macro _USER_VARIABLES"].filter_enabled %} {% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} {% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %} + {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} + {% set hotend_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].hotend_fan_tach_enabled %} PARK - {% if klippain_ercf_enabled and ercf_unload %} - {% if printer.ercf.enabled %} - # unload filament and park into ercf - ERCF_EJECT + {% if klippain_mmu_enabled %} + {% if printer.mmu.enabled and mmu_unload %} + # unload filament and park into MMU. Or just unload filament out of extruder if using bypass. + MMU_EJECT {% endif %} - {% else %} + {% elif printer.extruder.can_extrude %} # pull back the filament a little bit - _TIP_SHAPING G92 E0 G1 E-10 F2100 {% endif %} @@ -33,6 +34,10 @@ gcode: SET_HEATER_TEMPERATURE HEATER=extruder TARGET={safe_extruder_temp} {% endif %} + {% if hotend_fan_tach_enabled %} + UPDATE_DELAYED_GCODE ID=_BACKGROUND_HOTEND_TACHO_CHECK DURATION=0 + {% endif %} + M107 M400 @@ -45,17 +50,30 @@ gcode: {% endif %} - # If a filter is connected, filter the air at full power + # If a filter is connected, and used during the print, continue filtering the air # for a couple of min before stopping everything {% if filter_enabled %} - {% set FILTER_TIME = params.FILTER_TIME|default(filter_default_time)|int %} - START_FILTER SPEED=1 - UPDATE_DELAYED_GCODE ID=_STOP_FILTER_DELAYED DURATION={FILTER_TIME} + {% if printer['fan_generic filter'].speed > 0 %} + {% set FILTER_TIME = params.FILTER_TIME|default(filter_default_time)|int %} + START_FILTER SPEED=1 + UPDATE_DELAYED_GCODE ID=_STOP_FILTER_DELAYED DURATION={FILTER_TIME} + {% endif %} {% endif %} {% if light_enabled %} LIGHT_ON S={light_intensity_end_print} {% endif %} {% if status_leds_enabled %} - STATUS_LEDS COLOR="OFF" + STATUS_LEDS COLOR="DONE_PRINTING" {% endif %} + + {% if klippain_mmu_enabled %} + {% if printer.mmu.enabled and printer.mmu.print_start_detection|int == 0 %} + _MMU_PRINT_END + {% endif %} + {% endif %} + + # If a filament sensor is connected, re-enable it in case it was disabled during printing + {% if filament_sensor_enabled %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 + {% endif %} \ No newline at end of file diff --git a/macros/base/homing/homing_conditional.cfg b/macros/base/homing/homing_conditional.cfg index b3498a7a7..37ff1eeaa 100644 --- a/macros/base/homing/homing_conditional.cfg +++ b/macros/base/homing/homing_conditional.cfg @@ -8,9 +8,7 @@ gcode: STATUS_LEDS COLOR="HOMING" {% endif %} G28 + {% if status_leds_enabled %} + STATUS_LEDS COLOR="READY" + {% endif %} {% endif %} - - {% if status_leds_enabled %} - STATUS_LEDS COLOR="READY" - {% endif %} - \ No newline at end of file diff --git a/macros/base/homing/homing_override.cfg b/macros/base/homing/homing_override.cfg index 3171a585c..02f605d9b 100644 --- a/macros/base/homing/homing_override.cfg +++ b/macros/base/homing/homing_override.cfg @@ -73,7 +73,6 @@ gcode: # Set the homing acceleration prior to any movement {% set saved_accel = printer.toolhead.max_accel %} - {% set saved_decel = printer.toolhead.max_accel_to_decel %} M204 S{homing_travel_accel} {% if bed_mesh_enabled %} @@ -107,8 +106,8 @@ gcode: SET_KINEMATIC_POSITION X=0 Y=0 Z=0 G0 Z{homing_zhop} F{z_drop_speed} {% if sensorless_homing_enabled and kinematics == "corexz" %} - # Wait for 2s for stallguard registers to clear - G4 P2000 + # Wait for stallguard registers to clear + M400 {% endif %} {% set X, Y, Z = True, True, True %} {% endif %} @@ -147,11 +146,11 @@ gcode: G1 X{x_position_endstop + x_homing_backoff} F{homing_travel_speed} {% if sensorless_homing_enabled %} {% if kinematics == "corexy" %} - G4 P2000 + M400 SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} {% elif kinematics == "corexz" %} - G4 P2000 + M400 SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} SET_TMC_CURRENT STEPPER=stepper_z CURRENT={old_current_z} {% elif kinematics == "cartesian" %} @@ -188,7 +187,7 @@ gcode: G1 Y{y_position_endstop + y_homing_backoff} F{homing_travel_speed} {% if sensorless_homing_enabled %} {% if kinematics == "corexy" %} - G4 P2000 + M400 SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} {% elif kinematics == "corexz" %} @@ -229,7 +228,7 @@ gcode: G1 Y{y_position_endstop + y_homing_backoff} F{homing_travel_speed} {% if sensorless_homing_enabled %} {% if kinematics == "corexy" %} - G4 P2000 + M400 SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} {% elif kinematics == "corexz" %} @@ -271,11 +270,11 @@ gcode: G1 X{x_position_endstop + x_homing_backoff} F{homing_travel_speed} {% if sensorless_homing_enabled %} {% if kinematics == "corexy" %} - G4 P2000 + M400 SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} {% elif kinematics == "corexz" %} - G4 P2000 + M400 SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} SET_TMC_CURRENT STEPPER=stepper_z CURRENT={old_current_z} {% elif kinematics == "cartesian" %} @@ -340,7 +339,7 @@ gcode: {% endif %} # Reset acceleration values to what it was before - SET_VELOCITY_LIMIT ACCEL={saved_accel} ACCEL_TO_DECEL={saved_decel} + SET_VELOCITY_LIMIT ACCEL={saved_accel} {% if probe_type_enabled == "dockable" or probe_type_enabled == "dockable_virtual" %} _EXIT_POINT FUNCTION=homing_override diff --git a/macros/base/homing/tilting.cfg b/macros/base/homing/tilting.cfg index 50fe6457a..9a5e2b108 100644 --- a/macros/base/homing/tilting.cfg +++ b/macros/base/homing/tilting.cfg @@ -4,7 +4,6 @@ gcode: {% set FORCE_OPERATION = params.FORCE|default('true') %} {% set conf_QGL = printer["gcode_macro _USER_VARIABLES"].qgl_enabled %} {% set conf_ztilt = printer["gcode_macro _USER_VARIABLES"].ztilt_enabled %} - {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set probe_type_enabled = printer["gcode_macro _USER_VARIABLES"].probe_type_enabled %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} @@ -12,10 +11,6 @@ gcode: SET_GCODE_VARIABLE MACRO=_PROBE_ON_ERROR_ACTION VARIABLE=probing VALUE=True {% endif %} - {% if status_leds_enabled %} - STATUS_LEDS COLOR="LEVELING" - {% endif %} - {% if conf_QGL %} {% if printer.quad_gantry_level.applied|lower == 'false' or FORCE_OPERATION|lower == 'true' %} {% if verbose %} @@ -39,7 +34,3 @@ gcode: {% if probe_type_enabled == "dockable" %} SET_GCODE_VARIABLE MACRO=_PROBE_ON_ERROR_ACTION VARIABLE=probing VALUE=False {% endif %} - - {% if status_leds_enabled %} - STATUS_LEDS COLOR="READY" - {% endif %} diff --git a/macros/base/park.cfg b/macros/base/park.cfg index e042afd7d..504676e34 100644 --- a/macros/base/park.cfg +++ b/macros/base/park.cfg @@ -1,10 +1,15 @@ [gcode_macro PARK] description: Park the toolhead at the back and retract some filament if the nozzle is hot gcode: - {% set E = params.E|default(1.7)|float %} + {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} + {% set material = printer['gcode_macro START_PRINT'].material %} {% set Px, Py = printer["gcode_macro _USER_VARIABLES"].park_position_xy|map('float') %} + {% set Px = params.X|default(Px)|float %} + {% set Py = params.Y|default(Py)|float %} + {% set park_lift_z = printer["gcode_macro _USER_VARIABLES"].park_lift_z %} + {% set Z_HOP = params.Z_HOP|default(park_lift_z)|float %} {% set firmware_retraction_enabled = printer["gcode_macro _USER_VARIABLES"].firmware_retraction_enabled %} {% set St = printer["gcode_macro _USER_VARIABLES"].travel_speed * 60 %} @@ -13,16 +18,69 @@ gcode: {% set max_z = printer.toolhead.axis_maximum.z|float %} {% set act_z = printer.toolhead.position.z|float %} - {% set z_safe = act_z + park_lift_z %} + {% set z_safe = act_z + Z_HOP %} {% if z_safe > max_z %} {% set z_safe = max_z %} {% endif %} - # retract filament before move up toolhead - {% if printer.extruder.temperature > 185 and firmware_retraction_enabled %} - G10 + {% if printer.toolhead.homed_axes != "xyz" %} + {action_raise_error("Cannot park the toolhead because axis are not homed!")} {% endif %} + + SAVE_GCODE_STATE NAME=PARK + + {% if printer.extruder.can_extrude %} + {% if params.E is defined %} + {% set E = params.E|float|abs %} + + {% if verbose %} + RESPOND MSG="Retraction overrided with parameter, Extruder retraction = {E}" + {% endif %} + {% else %} + {% if firmware_retraction_enabled %} # use firmware_retraction parameter for retract (in case firmware retraction is selected in printer.cfg) + {% if verbose %} + RESPOND MSG="Firmware retraction enabled, Extruder retraction = {printer.firmware_retraction.retract_length}" + {% endif %} + G10 + {% else %} # otherwise: + {% if printer["gcode_macro _USER_VARIABLES"].material_parameters[material] is defined %} # use material parameter if available for retract, otherwise use default value + {% set E = printer["gcode_macro _USER_VARIABLES"].material_parameters[material].retract_length|default(1.7) %} + {% else %} + {% set E = 1.7 %} + {% endif %} + + {% if verbose %} + RESPOND MSG="Firmware retraction disabled, Extruder retraction = {E}" + {% endif %} + {% endif %} + {% endif %} + + {% if E is defined and E > 0 %} + G92 E0 + G1 E-{E} F2100 + {% endif %} + {% endif %} + G90 G1 Z{z_safe} F{Sz} - G0 X{Px} Y{Py} F{St} + + RESTORE_GCODE_STATE NAME=PARK + +[gcode_macro PARK_FRONT] +description: Park the toolhead on the front of the printer for maintenance +gcode: + {% set St = printer["gcode_macro _USER_VARIABLES"].travel_speed * 60 %} + {% set Sz = printer["gcode_macro _USER_VARIABLES"].z_drop_speed * 60 %} + + {% if printer.toolhead.homed_axes != "xyz" %} + {action_raise_error("Cannot park the toolhead in maintenance position because axis are not homed!")} + {% endif %} + + SAVE_GCODE_STATE NAME=PARK_FRONT + + G90 ; absolute positioning + G0 Z{printer.toolhead.axis_maximum.z/3*2} F{Sz} + G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+10} F{St} + + RESTORE_GCODE_STATE NAME=PARK_FRONT diff --git a/macros/base/pause_resume.cfg b/macros/base/pause_resume.cfg index 5a1eecfb3..54b2af0bf 100644 --- a/macros/base/pause_resume.cfg +++ b/macros/base/pause_resume.cfg @@ -24,11 +24,20 @@ gcode: {% set St = printer["gcode_macro _USER_VARIABLES"].travel_speed %} {% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %} {% set light_intensity_printing = printer["gcode_macro _USER_VARIABLES"].light_intensity_printing %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} {% if not printer.pause_resume.is_paused %} - RESPOND MSG="Print is not paused. Resume ignored" + RESPOND MSG="Print is not paused. Resume ignored" {% else %} - RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 MOVE_SPEED={St} + {% if klippain_mmu_enabled %} + {% if printer.mmu.enabled and printer.mmu.is_locked %} + RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=0 + {% else %} + RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 MOVE_SPEED={St} + {% endif %} + {% else %} + RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 MOVE_SPEED={St} + {% endif %} {% if light_enabled %} LIGHT_ON S={light_intensity_printing} {% endif %} diff --git a/macros/base/probing/dockable_probe.cfg b/macros/base/probing/dockable_probe.cfg index d3739b7e7..5d3b68782 100644 --- a/macros/base/probing/dockable_probe.cfg +++ b/macros/base/probing/dockable_probe.cfg @@ -138,7 +138,6 @@ gcode: # Set the dock/undock acceleration prior to any movement {% set saved_accel = printer.toolhead.max_accel %} - {% set saved_decel = printer.toolhead.max_accel_to_decel %} M204 S{probe_dock_accel} # Probe entry location @@ -161,7 +160,7 @@ gcode: {% endif %} # Reset acceleration values to what it was before - SET_VELOCITY_LIMIT ACCEL={saved_accel} ACCEL_TO_DECEL={saved_decel} + SET_VELOCITY_LIMIT ACCEL={saved_accel} _CHECK_PROBE action=attach @@ -211,6 +210,9 @@ gcode: {% set probe_servo_enabled = printer["gcode_macro _USER_VARIABLES"].probe_servo_enabled %} + # Probe stow height + {% set probe_stow_z_height = printer["gcode_macro _USER_VARIABLES"].probe_stow_z_height|default(None) %} + _ENTRY_POINT FUNCTION=DOCK_PROBE @@ -244,10 +246,9 @@ gcode: # Set the dock/undock acceleration prior to any movement {% set saved_accel = printer.toolhead.max_accel %} - {% set saved_decel = printer.toolhead.max_accel_to_decel %} M204 S{probe_dock_accel} - # Probe entry location + # Move to probe entry location _PROBE_MOVE_TO LOCATION={probe_before_dock_position} DISTANCE={probe_move_dock_length} SPEED={travel_speed} # Deploy dock using the servo (if available) @@ -255,9 +256,14 @@ gcode: _SERVO_DEPLOY ITEM="probe" {% endif %} - # Pickup from Probe location + # Move probe into dock _PROBE_MOVE_TO LOCATION='dock' SPEED={probe_dock_speed} + # Move probe to stow z height if defined + {% if probe_stow_z_height is not none %} + G0 Z{probe_stow_z_height} F{z_drop_speed} + {% endif %} + # Get detach probe _PROBE_MOVE_TO LOCATION={probe_after_dock_position} DISTANCE={probe_move_dock_length} SPEED={probe_dock_speed} @@ -267,7 +273,7 @@ gcode: {% endif %} # Reset acceleration values to what it was before - SET_VELOCITY_LIMIT ACCEL={saved_accel} ACCEL_TO_DECEL={saved_decel} + SET_VELOCITY_LIMIT ACCEL={saved_accel} G4 P500 _CHECK_PROBE action=dock diff --git a/macros/base/probing/overides/bed_mesh_calibrate.cfg b/macros/base/probing/overrides/bed_mesh_calibrate.cfg similarity index 97% rename from macros/base/probing/overides/bed_mesh_calibrate.cfg rename to macros/base/probing/overrides/bed_mesh_calibrate.cfg index 968923ec2..8a5effe79 100644 --- a/macros/base/probing/overides/bed_mesh_calibrate.cfg +++ b/macros/base/probing/overrides/bed_mesh_calibrate.cfg @@ -1,30 +1,30 @@ -############################################################################# -# Dockable probe macros highly inspired from https://github.com/jlas1/Klicky-Probe -# Reworked by Elpopo and myself to simplify it while trying to stay generic -############################################################################# - -[gcode_macro BED_MESH_CALIBRATE] -rename_existing: _BASE_BED_MESH_CALIBRATE -description: Perform Mesh Bed Leveling with klicky automount -gcode: - {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} - {% set probe_type_enabled = printer["gcode_macro _USER_VARIABLES"].probe_type_enabled %} - - {% if verbose %} - { action_respond_info("Bed Mesh Calibrate") } - {% endif %} - _CG28 - - ACTIVATE_PROBE - - {% if probe_type_enabled == "dockable" %} - SET_GCODE_VARIABLE MACRO=_PROBE_ON_ERROR_ACTION VARIABLE=probing VALUE=True - {% endif %} - - _BASE_BED_MESH_CALIBRATE {% for p in params %}{'%s=%s ' % (p, params[p])}{% endfor %} - - {% if probe_type_enabled == "dockable" %} - SET_GCODE_VARIABLE MACRO=_PROBE_ON_ERROR_ACTION VARIABLE=probing VALUE=False - {% endif %} - - DEACTIVATE_PROBE +############################################################################# +# Dockable probe macros highly inspired from https://github.com/jlas1/Klicky-Probe +# Reworked by Elpopo and myself to simplify it while trying to stay generic +############################################################################# + +[gcode_macro BED_MESH_CALIBRATE] +rename_existing: _BASE_BED_MESH_CALIBRATE +description: Perform Mesh Bed Leveling with klicky automount +gcode: + {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} + {% set probe_type_enabled = printer["gcode_macro _USER_VARIABLES"].probe_type_enabled %} + + {% if verbose %} + { action_respond_info("Bed Mesh Calibrate") } + {% endif %} + _CG28 + + ACTIVATE_PROBE + + {% if probe_type_enabled == "dockable" %} + SET_GCODE_VARIABLE MACRO=_PROBE_ON_ERROR_ACTION VARIABLE=probing VALUE=True + {% endif %} + + _BASE_BED_MESH_CALIBRATE {% for p in params %}{'%s=%s ' % (p, params[p])}{% endfor %} + + {% if probe_type_enabled == "dockable" %} + SET_GCODE_VARIABLE MACRO=_PROBE_ON_ERROR_ACTION VARIABLE=probing VALUE=False + {% endif %} + + DEACTIVATE_PROBE diff --git a/macros/base/probing/overides/dockable_probe_overides.cfg b/macros/base/probing/overrides/dockable_probe_overrides.cfg similarity index 96% rename from macros/base/probing/overides/dockable_probe_overides.cfg rename to macros/base/probing/overrides/dockable_probe_overrides.cfg index 8eb4ae744..e2f574881 100644 --- a/macros/base/probing/overides/dockable_probe_overides.cfg +++ b/macros/base/probing/overrides/dockable_probe_overrides.cfg @@ -46,6 +46,10 @@ gcode: %}{'%s=%s ' % (p, params[p])}{% endfor %} + # Save nozzle location before dock + M400 + _ENTRY_POINT FUNCTION=PROBE_CALIBRATE + DEACTIVATE_PROBE # Restore nozzle location again at the end @@ -95,6 +99,10 @@ gcode: %}{'%s=%s ' % (p, params[p])}{% endfor %} + # Save nozzle location before dock + M400 + _ENTRY_POINT FUNCTION=PROBE_CALIBRATE + DEACTIVATE_PROBE # Restore nozzle location again at the end diff --git a/macros/base/probing/overides/qgl.cfg b/macros/base/probing/overrides/qgl.cfg similarity index 77% rename from macros/base/probing/overides/qgl.cfg rename to macros/base/probing/overrides/qgl.cfg index a788d0584..872b5f332 100644 --- a/macros/base/probing/overides/qgl.cfg +++ b/macros/base/probing/overrides/qgl.cfg @@ -8,23 +8,32 @@ rename_existing: _BASE_QUAD_GANTRY_LEVEL description: Conform a moving, twistable gantry to the shape of a stationary bed with klicky automount gcode: {% set tilting_travel_accel = printer["gcode_macro _USER_VARIABLES"].tilting_travel_accel %} + {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% if verbose %} { action_respond_info("Quad gantry leveling") } {% endif %} + _CG28 + + {% if status_leds_enabled %} + STATUS_LEDS COLOR="LEVELING" + {% endif %} ACTIVATE_PROBE # Set the tilting acceleration prior to any movement {% set saved_accel = printer.toolhead.max_accel %} - {% set saved_decel = printer.toolhead.max_accel_to_decel %} M204 S{tilting_travel_accel} _BASE_QUAD_GANTRY_LEVEL {% for p in params %}{'%s=%s ' % (p, params[p])}{% endfor %} # Reset acceleration values to what it was before - SET_VELOCITY_LIMIT ACCEL={saved_accel} ACCEL_TO_DECEL={saved_decel} + SET_VELOCITY_LIMIT ACCEL={saved_accel} DEACTIVATE_PROBE + + {% if status_leds_enabled %} + STATUS_LEDS COLOR="READY" + {% endif %} diff --git a/macros/base/probing/overides/z_tilt.cfg b/macros/base/probing/overrides/z_tilt.cfg similarity index 77% rename from macros/base/probing/overides/z_tilt.cfg rename to macros/base/probing/overrides/z_tilt.cfg index 54ae64e6d..28b75b68a 100644 --- a/macros/base/probing/overides/z_tilt.cfg +++ b/macros/base/probing/overrides/z_tilt.cfg @@ -8,23 +8,33 @@ rename_existing: _BASE_Z_TILT_ADJUST description: Conform a moving bed to the shape of a stationary gantry with dockable probe automount gcode: {% set tilting_travel_accel = printer["gcode_macro _USER_VARIABLES"].tilting_travel_accel %} + {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} + {% if verbose %} { action_respond_info("Z tilt adjust") } {% endif %} + _CG28 + {% if status_leds_enabled %} + STATUS_LEDS COLOR="LEVELING" + {% endif %} + ACTIVATE_PROBE # Set the tilting acceleration prior to any movement {% set saved_accel = printer.toolhead.max_accel %} - {% set saved_decel = printer.toolhead.max_accel_to_decel %} M204 S{tilting_travel_accel} _BASE_Z_TILT_ADJUST {% for p in params %}{'%s=%s ' % (p, params[p])}{% endfor %} # Reset acceleration values to what it was before - SET_VELOCITY_LIMIT ACCEL={saved_accel} ACCEL_TO_DECEL={saved_decel} + SET_VELOCITY_LIMIT ACCEL={saved_accel} DEACTIVATE_PROBE + + {% if status_leds_enabled %} + STATUS_LEDS COLOR="READY" + {% endif %} diff --git a/macros/base/start_print.cfg b/macros/base/start_print.cfg index e49cc2cfd..b5f05a782 100644 --- a/macros/base/start_print.cfg +++ b/macros/base/start_print.cfg @@ -7,9 +7,14 @@ variable_soak: 0 variable_chamber_temp: 0 variable_chamber_maxtime: 0 variable_initial_tool: 0 +variable_check_gates: 0 +variable_tools_used: "" +variable_sync_mmu_extruder: 0 variable_material: "XXX" variable_fl_size: "0_0_0_0" variable_bed_mesh_profile: "" +variable_total_layer: 0 +variable_adaptive_primeline: 1 gcode: # Get all the parameters passed from the slicer {% set BED_TEMP = params.BED_TEMP|default(printer["gcode_macro _USER_VARIABLES"].print_default_bed_temp)|float %} # Bed temperature @@ -18,10 +23,14 @@ gcode: {% set SOAK = params.SOAK|default(printer["gcode_macro _USER_VARIABLES"].print_default_soak)|int %} # Heatsoak time of the bed in minutes {% set CHAMBER_TEMP = params.CHAMBER|default(printer["gcode_macro _USER_VARIABLES"].print_default_chamber_temp)|int %} # Chamber temperature setpoint {% set CHAMBER_MAXTIME = params.CHAMBER_MAXTIME|default(printer["gcode_macro _USER_VARIABLES"].print_default_chamber_max_heating_time)|int %} # Chamber heatsoak timeout in minutes - {% set INITIAL_TOOL = params.INITIAL_TOOL|default(0)|int %} # Initial tool (for the ERCF initialization) + {% set INITIAL_TOOL = params.INITIAL_TOOL|default(0)|int %} # Initial tool (for the MMU/ERCF initialization) {% set MATERIAL = params.MATERIAL|default(printer["gcode_macro _USER_VARIABLES"].print_default_material)|string %} # Material type set in the slicer {% set FL_SIZE = params.SIZE|default("0_0_0_0")|string %} # Get bounding box of the first layer for the adaptive bed mesh + {% set CHECK_GATES = params.CHECK_GATES|default(printer['gcode_macro _USER_VARIABLES'].mmu_check_gates_on_start_print)|default(0)|int %} # Check if MMU gates are availables + {% set TOOLS_USED = params.TOOLS_USED|default("")|string %} # Check if MMU gates (used in gcode file) are availables + {% set SYNC_MMU_EXTRUDER = params.SYNC_MMU_EXTRUDER|default(0)|int %} # set MMU gear motor and extruder synchronization during print TODO {% set BED_MESH_PROFILE = params.MESH|default("")|string %} # Bed mesh profile to load + {% set ADAPTIVE_PRIMELINE = params.ADAPTIVE_PRIMELINE|default(1)|int %} # Weither to do or not an adaptive prime line near the real print zone # Set the variables to be used in all the modules based on the slicer parameters SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=bed_temp VALUE={BED_TEMP} @@ -30,9 +39,18 @@ gcode: SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=chamber_temp VALUE={CHAMBER_TEMP} SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=chamber_maxtime VALUE={CHAMBER_MAXTIME} SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=initial_tool VALUE={INITIAL_TOOL} + SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=check_gates VALUE={CHECK_GATES} + SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=tools_used VALUE='"{TOOLS_USED}"' + SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=sync_mmu_extruder VALUE={SYNC_MMU_EXTRUDER} SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=material VALUE='"{MATERIAL}"' SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=fl_size VALUE='"{FL_SIZE}"' SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=bed_mesh_profile VALUE='"{BED_MESH_PROFILE}"' + SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=adaptive_primeline VALUE={ADAPTIVE_PRIMELINE} + + {% if params.TOTAL_LAYER %} # total layers count (if provided by the slicer) + SET_PRINT_STATS_INFO TOTAL_LAYER={params.TOTAL_LAYER|int} + SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=total_layer VALUE={params.TOTAL_LAYER|int} + {% endif %} # Get all the config options and configurations for this macro {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} @@ -41,11 +59,13 @@ gcode: {% set light_intensity_printing = printer["gcode_macro _USER_VARIABLES"].light_intensity_printing %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set force_homing_in_start_print = printer["gcode_macro _USER_VARIABLES"].force_homing_in_start_print %} - {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} - {% set ercf_reset_stats_on_start_print = printer["gcode_macro _USER_VARIABLES"].ercf_reset_stats_on_start_print %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} {% set firmware_retraction_enabled = printer["gcode_macro _USER_VARIABLES"].firmware_retraction_enabled %} {% set filter_enabled = printer["gcode_macro _USER_VARIABLES"].filter_enabled %} + {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} + {% set part_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].part_fan_tach_enabled %} + {% set hotend_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].hotend_fan_tach_enabled %} {% if MATERIAL not in printer["gcode_macro _USER_VARIABLES"].material_parameters %} RESPOND MSG="Material '{MATERIAL}' is unknown!" @@ -81,12 +101,17 @@ gcode: STOP_FILTER {% endif %} - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - {% if ercf_reset_stats_on_start_print %} - ERCF_RESET_STATS - {% endif %} - {% endif %} + # If a tachometer is enabled on one of the fans, we check them: + # - It's done only once for the part fan to be sure nothing block it before starting the print + # - And as a safety feature, we start a monitoring loop for the hotend fan (that is automatically stopped at the end of a print) + {% if part_fan_tach_enabled %} + M106 S255 + G4 P2000 + _PART_FAN_CHECK + M106 S0 + {% endif %} + {% if hotend_fan_tach_enabled %} + UPDATE_DELAYED_GCODE ID=_BACKGROUND_HOTEND_TACHO_CHECK DURATION=1 {% endif %} SET_GCODE_OFFSET Z=0 @@ -108,6 +133,11 @@ gcode: _CG28 {% endif %} + # If an MMU is enabled, initialize it for the print + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_INIT + {% endif %} + # Here is the core of the START_PRINT were we get the startprint_actions variable # to do the procedure in the correct order for the configured probe (or user custom override) {% set sp_actions = printer["gcode_macro _USER_VARIABLES"].startprint_actions %} @@ -153,6 +183,10 @@ gcode: START_FILTER SPEED={material.filter_speed / 100} {% endif %} + {% if filament_sensor_enabled and not material.filament_sensor %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 + {% endif %} + # And.... Goooo! {% if status_leds_enabled %} STATUS_LEDS COLOR="PRINTING" @@ -162,6 +196,12 @@ gcode: LIGHT_ON S={light_intensity_printing} {% endif %} + {% if klippain_mmu_enabled %} + {% if printer.mmu.enabled and printer.mmu.print_start_detection|int == 0 %} + _MMU_PRINT_START + {% endif %} + {% endif %} + {% if verbose %} RESPOND MSG="Start printing !" {% endif %} @@ -171,7 +211,15 @@ gcode: [gcode_macro _MODULE_PRIMELINE] gcode: - PRIMELINE + # ----- PRIME LINE ------------------------------------------- + {% set FL_SIZE = printer["gcode_macro START_PRINT"].fl_size %} + {% set ADAPTIVE_PRIMELINE = printer["gcode_macro START_PRINT"].adaptive_primeline %} + {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} + + {% if verbose %} + RESPOND MSG="Executing a primeline..." + {% endif %} + PRIMELINE SIZE={FL_SIZE} ADAPTIVE_MODE={ADAPTIVE_PRIMELINE} [gcode_macro _MODULE_HEATSOAK_BED] @@ -276,7 +324,7 @@ gcode: {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} - {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} {% set purge_and_brush_enabled = printer["gcode_macro _USER_VARIABLES"].purge_and_brush_enabled %} {% set purgeclean_servo_enabled = printer["gcode_macro _USER_VARIABLES"].purgeclean_servo_enabled %} @@ -301,12 +349,9 @@ gcode: M109 S{EXTRUDER_TEMP} - # Load intial tool in the ERCF if needed - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - ERCF_CHANGE_TOOL STANDALONE=1 TOOL={INITIAL_TOOL} - _ERCF_ERROR_CHECK - {% endif %} + # Load intial tool into MMU (if needed) + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_LOAD_INITIAL_TOOL {% endif %} {% if purgeclean_servo_enabled %} @@ -376,13 +421,9 @@ gcode: {% if bed_mesh_enabled %} {% if BED_MESH_PROFILE == "" %} - {% if status_leds_enabled %} - STATUS_LEDS COLOR="MESHING" - {% endif %} {% if verbose %} RESPOND MSG="Bed mesh measurement..." {% endif %} - ADAPTIVE_BED_MESH SIZE={FL_SIZE} {% else %} {% if verbose %} @@ -398,6 +439,7 @@ gcode: # Preheat the nozzle to safe probing temperature. {% set safe_extruder_temp = printer["gcode_macro _USER_VARIABLES"].safe_extruder_temp|float %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} + {% set probe_type_enabled = printer["gcode_macro _USER_VARIABLES"].probe_type_enabled %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% if status_leds_enabled %} @@ -407,10 +449,22 @@ gcode: RESPOND MSG="Pre-heating the nozzle to a safe temperature..." {% endif %} - M109 S{safe_extruder_temp} - - {% if verbose %} - RESPOND MSG="Extruder at safe temperature of {safe_extruder_temp} degrees" + {% if probe_type_enabled == "vorontap" %} + M109 S{safe_extruder_temp} + {% if verbose %} + RESPOND MSG="Extruder at safe temperature of {safe_extruder_temp} degrees" + {% endif %} + {% else %} + {% if printer.extruder.target < safe_extruder_temp %} + M104 S{safe_extruder_temp} + {% if verbose %} + RESPOND MSG="Extruder is heating at temperature of {safe_extruder_temp} degrees" + {% endif %} + {% else %} + {% if verbose %} + RESPOND MSG="Extruder is already hot" + {% endif %} + {% endif %} {% endif %} @@ -442,3 +496,4 @@ gcode: # [gcode_macro _MODULE_CUSTOM3] # gcode: # ## Your custom code here + diff --git a/macros/calibration/IS_shaper_calibrate.cfg b/macros/calibration/IS_shaper_calibrate.cfg deleted file mode 100644 index 04aeaf432..000000000 --- a/macros/calibration/IS_shaper_calibrate.cfg +++ /dev/null @@ -1,97 +0,0 @@ -################################################ -###### STANDARD INPUT_SHAPER CALIBRATIONS ###### -################################################ -# Written by Frix_x#0161 # -# @version: 1.4 - -# CHANGELOG: -# v1.4: added possibility to only run one axis at a time for the axes shaper calibration -# v1.3: added possibility to override the default parameters -# v1.2: added EXCITATE_AXIS_AT_FREQ to hold a specific excitating frequency on an axis and diagnose mechanical problems -# v1.1: added M400 to validate that the files are correctly saved to disk -# v1.0: first version of the automatic input shaper workflow - - -### What is it ? ### -# This macro helps you to configure the input shaper algorithm of Klipper by running the tests sequencially and calling an automatic script -# that generate the graphs, manage the files and so on. It's basically a fully automatic input shaper calibration workflow. -# Results can be found in your config folder using FLuidd/Maisail file manager. - -# The goal is to make it easy to set, share and use it. - -# Usage: -# 1. Call the AXES_SHAPER_CALIBRATION macro, wait for it to end and compute the graphs. Then look for the results in the results folder. -# 2. Call the BELTS_SHAPER_CALIBRATION macro, wait for it to end and compute the graphs. Then look for the results in the results folder. -# 3. If you find out some strange noise, you can use the EXCITATE_AXIS_AT_FREQ macro to diagnose the origin - - -[gcode_macro AXES_SHAPER_CALIBRATION] -description: Run standard input shaper test for all axes -gcode: - {% set verbose = params.VERBOSE|default(true) %} - {% set min_freq = params.FREQ_START|default(5)|float %} - {% set max_freq = params.FREQ_END|default(133.3)|float %} - {% set hz_per_sec = params.HZ_PER_SEC|default(1)|float %} - {% set axis = params.AXIS|default("all")|string|lower %} - - {% set X, Y = False, False %} - - {% if axis == "all" %} - {% set X, Y = True, True %} - {% elif axis == "x" %} - {% set X = True %} - {% elif axis == "y" %} - {% set Y = True %} - {% else %} - { action_raise_error("AXIS selection invalid. Should be either all, x or y!") } - {% endif %} - - {% if X %} - TEST_RESONANCES AXIS=X OUTPUT=raw_data NAME=x FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec} - M400 - - {% if verbose %} - RESPOND MSG="X axis shaper graphs generation..." - {% endif %} - RUN_SHELL_COMMAND CMD=plot_graph PARAMS=SHAPER - {% endif %} - - {% if Y %} - TEST_RESONANCES AXIS=Y OUTPUT=raw_data NAME=y FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec} - M400 - - {% if verbose %} - RESPOND MSG="Y axis shaper graphs generation..." - {% endif %} - RUN_SHELL_COMMAND CMD=plot_graph PARAMS=SHAPER - {% endif %} - - -[gcode_macro BELTS_SHAPER_CALIBRATION] -description: Run custom demi-axe test to analyze belts on CoreXY printers -gcode: - {% set verbose = params.VERBOSE|default(true) %} - {% set min_freq = params.FREQ_START|default(5)|float %} - {% set max_freq = params.FREQ_END|default(133.33)|float %} - {% set hz_per_sec = params.HZ_PER_SEC|default(1)|float %} - - TEST_RESONANCES AXIS=1,1 OUTPUT=raw_data NAME=b FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec} - M400 - TEST_RESONANCES AXIS=1,-1 OUTPUT=raw_data NAME=a FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec} - M400 - - {% if verbose %} - RESPOND MSG="Belts graphs generation..." - {% endif %} - RUN_SHELL_COMMAND CMD=plot_graph PARAMS=BELTS - - -[gcode_macro EXCITATE_AXIS_AT_FREQ] -description: Maintain a specified input shaper excitating frequency for some time to diagnose vibrations -gcode: - {% set FREQUENCY = params.FREQUENCY|default(25)|int %} - {% set TIME = params.TIME|default(10)|int %} - {% set AXIS = params.AXIS|default("x")|string|lower %} - - TEST_RESONANCES OUTPUT=raw_data AXIS={AXIS} FREQ_START={FREQUENCY-1} FREQ_END={FREQUENCY+1} HZ_PER_SEC={1/(TIME/3)} - M400 diff --git a/macros/calibration/IS_vibrations_measurement.cfg b/macros/calibration/IS_vibrations_measurement.cfg deleted file mode 100644 index 40af7707d..000000000 --- a/macros/calibration/IS_vibrations_measurement.cfg +++ /dev/null @@ -1,191 +0,0 @@ -################################################ -###### VIBRATIONS AND SPEED OPTIMIZATIONS ###### -################################################ -# Written by Frix_x#0161 # -# @version: 2.1 - -# CHANGELOG: -# v2.1: allow decimal entries for speed and increment and added the E axis as an option to be neasured -# v2.0: added the possibility to measure mutliple axis -# v1.0: first speed and vibrations optimization macro - - -### What is it ? ### -# This macro helps you to identify the speed settings that exacerbate the vibrations of the machine (ie. where the frame resonate badly). -# It also helps to find the clean speed ranges where the machine is silent. -# I had some strong vibrations at very specific speeds on my machine (52mm/s for example) and I wanted to find all these problematic speeds -# to avoid them in my slicer profile and finally get the silent machine I was dreaming! - -# It works by moving the toolhead at different speed settings while recording the vibrations using the ADXL chip. Then the macro call a custom script -# to compute and find the best speed settings. The results can be found in your config folder using Fluidd/Mainsail file manager. - -# The goal is to make it easy to set, share and use it. - -# This macro is parametric and most of the values can be adjusted with their respective input parameters. -# It can be called without any parameters - in which case the default values would be used - or with any combination of parameters as desired. - -# Usage: -# 1. DO YOUR INPUT SHAPER CALIBRATION FIRST !!! This macro should not be used before as it would be useless and the results invalid. -# 2. Call the VIBRATIONS_CALIBRATION macro with the speed range you want to measure (default 20 to 200mm/s with 2mm/s increment). -# Be carefull about the Z_HEIGHT variable that default to 20mm -> if your ADXL is under the nozzle, increase it to avoid a crash of the ADXL on the bed of the machine. -# 3. Wait for it to finish all the measurement and compute the graph. Then look at it in the results folder. - - -[gcode_macro VIBRATIONS_CALIBRATION] -gcode: - # - # PARAMETERS - # - {% set size = params.SIZE|default(60)|int %} # size of the area where the movements are done - {% set direction = params.DIRECTION|default('XY') %} # can be set to either XY, AB, ABXY, A, B, X, Y, Z - {% set z_height = params.Z_HEIGHT|default(20)|int %} # z height to put the toolhead before starting the movements - {% set verbose = params.VERBOSE|default(true) %} # Wether to log the current speed in the console - - {% set min_speed = params.MIN_SPEED|default(20)|float * 60 %} # minimum feedrate for the movements - {% set max_speed = params.MAX_SPEED|default(200)|float * 60 %} # maximum feedrate for the movements - {% set speed_increment = params.SPEED_INCREMENT|default(2)|float * 60 %} # feedrate increment between each move - {% set feedrate_travel = params.TRAVEL_SPEED|default(200)|int * 60 %} # travel feedrate between moves - - {% set accel_chip = params.ACCEL_CHIP|default("adxl345") %} # ADXL chip name in the config - - # - # COMPUTED VALUES - # - {% set mid_x = printer.toolhead.axis_maximum.x|float / 2 %} - {% set mid_y = printer.toolhead.axis_maximum.y|float / 2 %} - {% set nb_samples = ((max_speed - min_speed) / speed_increment + 1) | int %} - - {% set direction_factor = { - 'XY' : { - 'start' : {'x': -0.5, 'y': -0.5 }, - 'move_factors' : { - '0' : {'x': 0.5, 'y': -0.5, 'z': 0.0 }, - '1' : {'x': 0.5, 'y': 0.5, 'z': 0.0 }, - '2' : {'x': -0.5, 'y': 0.5, 'z': 0.0 }, - '3' : {'x': -0.5, 'y': -0.5, 'z': 0.0 } - } - }, - 'AB' : { - 'start' : {'x': 0.0, 'y': 0.0 }, - 'move_factors' : { - '0' : {'x': 0.5, 'y': -0.5, 'z': 0.0 }, - '1' : {'x': -0.5, 'y': 0.5, 'z': 0.0 }, - '2' : {'x': 0.0, 'y': 0.0, 'z': 0.0 }, - '3' : {'x': 0.5, 'y': 0.5, 'z': 0.0 }, - '4' : {'x': -0.5, 'y': -0.5, 'z': 0.0 }, - '5' : {'x': 0.0, 'y': 0.0, 'z': 0.0 } - } - }, - 'ABXY' : { - 'start' : {'x': -0.5, 'y': 0.5 }, - 'move_factors' : { - '0' : {'x': -0.5, 'y': -0.5, 'z': 0.0 }, - '1' : {'x': 0.5, 'y': -0.5, 'z': 0.0 }, - '2' : {'x': -0.5, 'y': 0.5, 'z': 0.0 }, - '3' : {'x': 0.5, 'y': 0.5, 'z': 0.0 }, - '4' : {'x': -0.5, 'y': -0.5, 'z': 0.0 }, - '5' : {'x': -0.5, 'y': 0.5, 'z': 0.0 } - } - }, - 'B' : { - 'start' : {'x': 0.5, 'y': 0.5 }, - 'move_factors' : { - '0' : {'x': -0.5, 'y': -0.5, 'z': 0.0 }, - '1' : {'x': 0.5, 'y': 0.5, 'z': 0.0 } - } - }, - 'A' : { - 'start' : {'x': -0.5, 'y': 0.5 }, - 'move_factors' : { - '0' : {'x': 0.5, 'y': -0.5, 'z': 0.0 }, - '1' : {'x': -0.5, 'y': 0.5, 'z': 0.0 } - } - }, - 'X' : { - 'start' : {'x': -0.5, 'y': 0.0 }, - 'move_factors' : { - '0' : {'x': 0.5, 'y': 0.0, 'z': 0.0 }, - '1' : {'x': -0.5, 'y': 0.0, 'z': 0.0 } - } - }, - 'Y' : { - 'start' : {'x': 0.0, 'y': 0.5 }, - 'move_factors' : { - '0' : {'x': 0.0, 'y': -0.5, 'z': 0.0 }, - '1' : {'x': 0.0, 'y': 0.5, 'z': 0.0 } - } - }, - 'Z' : { - 'start' : {'x': 0.0, 'y': 0.0 }, - 'move_factors' : { - '0' : {'x': 0.0, 'y': 0.0, 'z': 1.0 }, - '1' : {'x': 0.0, 'y': 0.0, 'z': 0.0 } - } - }, - 'E' : { - 'start' : {'x': 0.0, 'y': 0.0 }, - 'move_factor' : 0.05 - } - } - %} - - # - # STARTING... - # - {% if not 'xyz' in printer.toolhead.homed_axes %} - { action_raise_error("Must Home printer first!") } - {% endif %} - - {% if params.SPEED_INCREMENT|default(2)|float * 100 != (params.SPEED_INCREMENT|default(2)|float * 100)|int %} - { action_raise_error("Only 2 decimal digits are allowed for SPEED_INCREMENT") } - {% endif %} - - {% if (size / (max_speed / 60)) < 0.25 and direction != 'E' %} - { action_raise_error("SIZE is too small for this MAX_SPEED. Increase SIZE or decrease MAX_SPEED!") } - {% endif %} - - {% if not (direction in direction_factor) %} - { action_raise_error("DIRECTION is not valid. Only XY, AB, ABXY, A, B, X, Y, Z or E is allowed!") } - {% endif %} - - {action_respond_info("")} - {action_respond_info("Starting speed and vibration calibration")} - {action_respond_info("This operation can not be interrupted by normal means. Hit the \"emergency stop\" button to stop it if needed")} - {action_respond_info("")} - - SAVE_GCODE_STATE NAME=STATE_VIBRATIONS_CALIBRATION - - M83 - G90 - - # Going to the start position - G1 Z{z_height} - G1 X{mid_x + (size * direction_factor[direction].start.x) } Y{mid_y + (size * direction_factor[direction].start.y)} F{feedrate_travel} - - # vibration pattern for each frequency - {% for curr_sample in range(0, nb_samples) %} - {% set curr_speed = min_speed + curr_sample * speed_increment %} - {% if verbose %} - RESPOND MSG="{"Current speed: %.2f mm/s" % (curr_speed / 60)|float}" - {% endif %} - - ACCELEROMETER_MEASURE CHIP={accel_chip} - {% if direction == 'E' %} - G0 E{curr_speed*direction_factor[direction].move_factor} F{curr_speed} - {% else %} - {% for key, factor in direction_factor[direction].move_factors|dictsort %} - G1 X{mid_x + (size * factor.x) } Y{mid_y + (size * factor.y)} Z{z_height + (size * factor.z)} F{curr_speed} - {% endfor %} - {% endif %} - ACCELEROMETER_MEASURE CHIP={accel_chip} NAME=sp{("%.2f" % (curr_speed / 60)|float)|replace('.','_')}n1 - - G4 P300 - M400 - {% endfor %} - - {% if verbose %} - RESPOND MSG="Graphs generation... Please wait a minute or two and look in the configured folder." - {% endif %} - RUN_SHELL_COMMAND CMD=plot_graph PARAMS="VIBRATIONS {direction}" - - RESTORE_GCODE_STATE NAME=STATE_VIBRATIONS_CALIBRATION diff --git a/macros/calibration/calibrate.cfg b/macros/calibration/calibrate.cfg index 715d33562..8efac3d8d 100644 --- a/macros/calibration/calibrate.cfg +++ b/macros/calibration/calibrate.cfg @@ -8,16 +8,24 @@ gcode: {% set BED_TEMP = params.BED_TEMP|default(printer["gcode_macro _USER_VARIABLES"].print_default_bed_temp)|float %} {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(printer["gcode_macro _USER_VARIABLES"].print_default_extruder_temp)|float %} {% set MATERIAL = params.MATERIAL|default("ABS")|string %} + {% set TOOL = params.TOOL|default(0)| int %} # optional: used only in case of an MMU {% set center_x = printer.toolhead.axis_maximum.x|float / 2 %} {% set center_y = printer.toolhead.axis_maximum.y|float / 2 %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} + {% if klippain_mmu_enabled %} + {% if printer.mmu.enabled and printer.mmu.filament == "Loaded" %} + {% set TOOL = printer.mmu.tool|int %} # use the current loaded tool + {% endif %} + {% endif %} + {% if TYPE=="flow" %} # No bed mesh needed for this one as it's a small center print so we compute the size manually (default flow size is 40mm) {% set computed_size = (center_x - 20)|string + '_' + (center_y - 20)|string + '_' + (center_x + 20)|string + '_' + (center_y + 20)|string %} # Call the standard START_PRINT with almost no soaking time and no chamber temp requirement (we want to go fast!) - START_PRINT EXTRUDER_TEMP={EXTRUDER_TEMP} BED_TEMP={BED_TEMP} MATERIAL={MATERIAL} SOAK=1 SIZE={computed_size} + START_PRINT EXTRUDER_TEMP={EXTRUDER_TEMP} BED_TEMP={BED_TEMP} MATERIAL={MATERIAL} SOAK=1 SIZE={computed_size} INITIAL_TOOL={TOOL} TOOLS_USED={TOOL} FLOW_MULTIPLIER_CALIBRATION EXTRUSION_WIDTH=0.471 END_PRINT FILTER_TIME=0 @@ -26,7 +34,7 @@ gcode: {% set computed_size = (center_x - 60)|string + '_' + (center_y - 60)|string + '_' + (center_x + 60)|string + '_' + (center_y + 60)|string %} # Call the standard START_PRINT with almost no soaking time and no chamber temp requirement (we want to go fast!) - START_PRINT EXTRUDER_TEMP={EXTRUDER_TEMP} BED_TEMP={BED_TEMP} MATERIAL={MATERIAL} SOAK=1 SIZE={computed_size} + START_PRINT EXTRUDER_TEMP={EXTRUDER_TEMP} BED_TEMP={BED_TEMP} MATERIAL={MATERIAL} SOAK=1 SIZE={computed_size} INITIAL_TOOL={TOOL} TOOLS_USED={TOOL} PRESSURE_ADVANCE_CALIBRATION END_PRINT FILTER_TIME=0 diff --git a/macros/calibration/test_speed.cfg b/macros/calibration/test_speed.cfg index 4ba6d9075..51e5f32c6 100644 --- a/macros/calibration/test_speed.cfg +++ b/macros/calibration/test_speed.cfg @@ -63,7 +63,7 @@ gcode: G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} # Set new limits - SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} {% for i in range(iterations) %} # Large pattern diagonals @@ -95,8 +95,8 @@ gcode: G0 X{x_center_max} Y{y_center_min} F{speed*60} {% endfor %} - # Restore max speed/accel/accel_to_decel to their configured values - SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel} + # Restore max speed/accel to their configured values + SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} # Re-home and get position again for comparison: M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 diff --git a/macros/hardware_functions/mmu.cfg b/macros/hardware_functions/mmu.cfg new file mode 100644 index 000000000..161db484f --- /dev/null +++ b/macros/hardware_functions/mmu.cfg @@ -0,0 +1,249 @@ +## Custom MMU Macros used in Klippain +## Automatically included when an MMU is defined in printer.cfg + +[gcode_macro _KLIPPAIN_MMU_INIT] +description: Internal macro to initialize the MMU during the START_PRINT sequence +gcode: + {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} + {% set mmu_force_homing_in_start_print = printer["gcode_macro _USER_VARIABLES"].mmu_force_homing_in_start_print %} + + {% set INITIAL_TOOL = printer["gcode_macro START_PRINT"].initial_tool %} + {% set CHECK_GATES = printer["gcode_macro START_PRINT"].check_gates %} + {% set TOOLS_USED = printer["gcode_macro START_PRINT"].tools_used %} + {% set SYNC_MMU_EXTRUDER = printer["gcode_macro START_PRINT"].sync_mmu_extruder %} + + {% if printer.mmu.enabled %} + # Manually changing the MMU state to start print (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print) + {% if printer.mmu.print_start_detection|int == 0 %} + _MMU_PRINT_START + {% endif %} + + # Park the toolhead to get on a safe place (without retracting the filament) + PARK E=0 + + # If the MMU is not in bypass mode + {% if printer.mmu.tool|int != -2 %} + # Home the MMU if necessary and pre select the initial tool + {% if mmu_force_homing_in_start_print or printer.mmu.is_homed == 0 %} + MMU_HOME TOOL={INITIAL_TOOL} FORCE_UNLOAD=1 + {% endif %} + + # If we need to check the gates (specified by the slicer or the Klippain variable) + {% if CHECK_GATES %} + {% if TOOLS_USED != "!referenced_tools!" %} + + # If we are in the case of a multi-filament print + {% if TOOLS_USED and printer.mmu.tool|string != TOOLS_USED %} + {% if verbose %} + RESPOND PREFIX='MMU info:' MSG=" You are planning a multi-filament print. The tool(s): {TOOLS_USED} will be checked to limit the risk of errors." + {% endif %} + + # First eject in case a bad tool is already loaded, then check the gates and select the initial tool + MMU_EJECT + MMU_CHECK_GATE TOOLS={TOOLS_USED} + MMU_SELECT TOOL={INITIAL_TOOL} + + # Else if the TOOL_USED parameter is not valid... We can still start the print but only check the initial tool + {% elif printer.mmu.tool|int != INITIAL_TOOL or (printer.mmu.tool|int == INITIAL_TOOL and printer.mmu.filament != "Loaded") %} + {% if verbose %} + {% if printer.mmu.tool|int != INITIAL_TOOL %} + RESPOND PREFIX='Config info:' MSG=" Only T{INITIAL_TOOL} will be checked! You should consider using TOOLS_USED=!referenced_tools! in the custom start gcode of your slicer" + {% elif printer.mmu.tool|int == INITIAL_TOOL and printer.mmu.filament != "Loaded" %} + RESPOND PREFIX='Config info:' MSG=" T{INITIAL_TOOL} is selected but the filament is not loaded. In order to avoid a possible error if the initial tool is marked as empty in HappyHare, it will be checked!" + {% endif %} + {% endif %} + + # First eject in case a bad tool is already loaded, then check the initial tool gate + MMU_EJECT + MMU_CHECK_GATE TOOLS={INITIAL_TOOL} + {% endif %} + + # Else if there was an error in the Moonraker gcode preprocessor (TOOL_USED is still equal to "!referenced_tools!") + {% else %} + {% if verbose %} + RESPOND PREFIX='MMU info:' MSG=" TOOLS_USED={TOOLS_USED} is likely not valid. Please check your slicer custom start gcode and verify that the HappyHare Moonraker gcode preprocessor is working! There will be no check on the gates and they will all be marked as available to avoid an error" + {% endif %} + + # Reset the state status (Available or Empty) for all the MMU gates to avoid an error + {% set gate_str = printer.mmu.ttg_map|join(',') %} + MMU_GATE_MAP GATES={gate_str} AVAILABLE=-1 + {% endif %} + + # Else if no check of the gates is wanted (specified by the slicer or the Klippain variable) + {% else %} + {% if verbose %} + RESPOND PREFIX='Config info:' MSG=" No gate check requested by the user. You should consider variable_mmu_check_gates_on_start_print: True in your Klippain variables.cfg or use the MMU_CHECK_GATES=1 parameter in your slicer custom start gcode" + {% endif %} + {% if printer.mmu.tool|int != INITIAL_TOOL %} + MMU_HOME FORCE_UNLOAD=1 TOOL={INITIAL_TOOL} + {% endif %} + {% endif %} + + # First instance of the MMU error check (if enabled...) to stop the START_PRINT sequence earlier + {% if printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 0 %} + _MMU_ERROR_CHECK1 + {% endif %} + + # Else if the MMU is in bypass mode, we just check for an error + {% else %} + # First instance of the MMU error check (if enabled...) while in bypass mode to stop the START_PRINT sequence earlier + {% if printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 0 %} + _MMU_ERROR_CHECK1 + {% endif %} + {% endif %} + + # Set the sync_to_extruder mode of HH if wanted by the user for the print (set from the slicer custom start gcode) + {% if printer.configfile.config.mmu.sync_to_extruder == 0 and printer.mmu.tool|int != -2 %} + {% if SYNC_MMU_EXTRUDER == 1 %} + {% if verbose %} + RESPOND MSG="MMU gear motor will be synchronized with the extruder during the print" + {% endif %} + MMU_TEST_CONFIG sync_to_extruder=1 + {% endif %} + + # Force disable the sync_to_extruder mode of HH if the MMU is set in bypass mode + {% elif (printer.configfile.config.mmu.sync_to_extruder == 1 or SYNC_MMU_EXTRUDER == 1) and printer.mmu.tool|int == -2 %} + {% if verbose %} + RESPOND MSG="MMU bypass mode is used so its gear motor cannot be synchronized with the extruder during the print" + {% endif %} + MMU_TEST_CONFIG sync_to_extruder=0 + {% endif %} + + # Preload the MMU gates if the filament is not already loaded and the MMU is set in normal mode + {% if printer.mmu.tool|int != -2 %} + {% if printer.mmu.filament != "Loaded" %} + {% if printer.mmu.tool|int != INITIAL_TOOL %} + MMU_SELECT TOOL={INITIAL_TOOL} + MMU_PRELOAD + {% endif %} + {% else %} + {% if printer.mmu.tool|int != INITIAL_TOOL %} + MMU_EJECT + MMU_SELECT TOOL={INITIAL_TOOL} + MMU_PRELOAD + {% endif %} + {% endif %} + {% endif %} + + # Manually reset the MMU state to the initial state (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print) + {% if printer.mmu.print_start_detection|int == 0 %} + _MMU_PRINT_END STATE=standby + {% endif %} + {% endif %} + + +[gcode_macro _KLIPPAIN_MMU_LOAD_INITIAL_TOOL] +description: Internal macro to load the initial filament during the START_PRINT sequence +gcode: + {% set INITIAL_TOOL = printer["gcode_macro START_PRINT"].initial_tool %} + + {% if printer.mmu.enabled %} + # Manually changing the MMU state to start print (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print) + {% if printer.mmu.print_start_detection|int == 0 %} + _MMU_PRINT_START + {% endif %} + + # If the MMU is not in bypass mode, we load the initial tool if not already loaded + {% if printer.mmu.tool|int != -2 %} + MMU_CHANGE_TOOL TOOL={INITIAL_TOOL} STANDALONE=1 + + # Else if in bypass mode, then manually load the filament (that was manually inserted) to the nozzle + {% else %} + MMU_LOAD + {% endif %} + + # Second instance of the MMU error check (if enabled...) to stop the START_PRINT sequence earlier + {% if printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 0 %} + _MMU_ERROR_CHECK2 + {% endif %} + # And manually reset the MMU state to the initial state (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print) + {% if printer.mmu.print_start_detection|int == 0 %} + _MMU_PRINT_END STATE=standby + {% endif %} + {% endif %} + + +[gcode_macro _KLIPPAIN_MMU_SET_CLOGDETECTION] +description: Internal macro to automatically disable or re-enable MMU clog detection as needed +gcode: + {% set clog_detection = params.STATE|int %} + {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} + + {% if printer.mmu.enabled %} + {% if printer.mmu.clog_detection > 0 and printer.configfile.config.mmu.sync_to_extruder == 0 %} + {% if clog_detection == 0 %} + MMU_TEST_CONFIG enable_clog_detection={clog_detection} + {% if verbose %} + RESPOND MSG="MMU clog detection automatically disabled" + {% endif %} + {% elif clog_detection > 0 %} + MMU_TEST_CONFIG enable_clog_detection={clog_detection} + {% if verbose %} + RESPOND MSG="MMU clog detection automatically re-enabled" + {% endif %} + {% endif %} + {% endif %} + {% endif %} + + +# Custom macros to check for an error on the MMU and stop the START_PRINT sequence earlier +# (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print) +[gcode_macro _MMU_ERROR_CHECK1] +description: Internal macro to check for an error on the MMU and stop the START_PRINT sequence earlier +gcode: + {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} + + {% if printer.mmu.print_state|string == "pause_locked" or printer.mmu.is_locked %} + {action_raise_error("MMU is locked! Please check your MMU and use the RESUME command to unlock it. Then restart the print")} + {% endif %} + + {% if verbose %} + {% if printer.mmu.tool|int == -1 %} + RESPOND PREFIX='MMU gate:' MSG=" no tool selected!" + {% elif printer.mmu.tool|int == -2 %} + RESPOND PREFIX='MMU gate:' MSG=" bypass mode selected" + {% elif printer.mmu.filament == "Loaded" %} + RESPOND PREFIX='MMU gate:' MSG=" T{printer.mmu.tool} already loaded" + {% else %} + RESPOND PREFIX='MMU tool:' MSG=" T{printer.mmu.tool} preloaded" + {% endif %} + {% endif %} + +[gcode_macro _MMU_ERROR_CHECK2] +description: Internal macro to check for an error on the MMU and stop the START_PRINT sequence earlier +gcode: + {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} + {% set INITIAL_TOOL = printer["gcode_macro START_PRINT"].initial_tool %} + + {% if printer.mmu.print_state|string == "pause_locked" or printer.mmu.is_locked %} + {action_raise_error("MMU is locked! Please check your MMU and use the RESUME command to unlock it. Then restart the print")} + {% elif printer.mmu.filament != "Loaded" %} + {action_raise_error("Filament is not loaded! Please check your MMU and then restart the print")} + {% elif printer.mmu.tool|int != -2 and printer.mmu.tool|int != INITIAL_TOOL %} + {action_raise_error("Initial tool ({INITIAL_TOOL}) and MMU tool ({printer.mmu.tool}) are different! Please check your MMU and then restart the print")} + {% endif %} + + {% if verbose %} + {% if printer.mmu.tool|int == -1 %} + RESPOND PREFIX='mmu gate:' MSG=" something get wrong, no active tool!" + {% elif printer.mmu.tool|int == -2 %} + RESPOND PREFIX='mmu gate:' MSG=" bypass mode selected and filament loaded" + {% else %} + RESPOND PREFIX='mmu tool:' MSG=" T{printer.mmu.tool} ready" + {% endif %} + {% endif %} + +# This is just a debug macro that just print a couple of variables related to the MMU and HappyHare +[gcode_macro _MMU_CHECK_STATE] +description: Display some MMU parameters to debug it +gcode: + RESPOND PREFIX= MSG=" Klippain with Happy_Hare_V2.x support in main branch" + RESPOND PREFIX= MSG=" mmu.print_state : {printer.mmu.print_state}" + RESPOND PREFIX= MSG=" mmu.is_locked : {printer.mmu.is_locked}" + RESPOND PREFIX= MSG=" mmu.tool : {printer.mmu.tool}" + RESPOND PREFIX= MSG=" mmu.print_start_detection : {printer.mmu.print_start_detection}" + RESPOND PREFIX= MSG=" mmu.clog_detection : {printer.mmu.clog_detection}" + RESPOND PREFIX= MSG=" mmu.filament : {printer.mmu.filament}" + RESPOND PREFIX= MSG=" mmu.filament_pos : {printer.mmu.filament_pos}" + RESPOND PREFIX= MSG=" mmu.selector_touch_enable : {printer.configfile.config.mmu.selector_touch_enable}" + RESPOND PREFIX= MSG=" mmu.sync_drive : {printer.mmu.sync_drive}" diff --git a/macros/hardware_functions/status_leds.cfg b/macros/hardware_functions/status_leds.cfg index 5642f91c0..a2acdd0c4 100644 --- a/macros/hardware_functions/status_leds.cfg +++ b/macros/hardware_functions/status_leds.cfg @@ -2,7 +2,7 @@ # src : https://github.com/VoronDesign/Voron-Stealthburner/blob/main/Firmware/stealthburner_leds.cfg # Contributed by Voron discord users wile.e, Tetsunosuke, and etherwalker -# Heavily modified by Frix-x to be more adapted for the generic config goal +# Heavily modified by Frix-x to be more adapted for the generic config goal of Klippain # The following status macro is available: @@ -22,6 +22,10 @@ gcode: {% set led = params.LED|string %} {% set idx = (params.IDX|string).split(',') %} {% set transmit_last = params.TRANSMIT|default(1) %} + + {% if printer["gcode_macro _USER_VARIABLES"].status_leds_effects_enabled %} + STOP_LED_EFFECTS LEDS="neopixel:"{led}" ("{params.IDX}")" + {% endif %} {% for led_index in idx %} {% set transmit=transmit_last if loop.last else 0 %} @@ -33,7 +37,7 @@ gcode: gcode: {% set leds_name = params.LEDS %} {% set color_name = params.COLOR %} - {% set color = printer["gcode_macro _USER_VARIABLES"].status_leds_colors[leds_name][color_name] %} + {% set color = printer["gcode_macro _LEDS_COLORS_DEFINITION"].colors[leds_name][color_name] %} {% set led = printer["gcode_macro _USER_VARIABLES"]["status_leds_" + leds_name + "_led_name"] %} {% set idx = printer["gcode_macro _USER_VARIABLES"]["status_leds_" + leds_name + "_idx"] %} {% set transmit = params.TRANSMIT|default(1) %} @@ -46,7 +50,7 @@ gcode: {% set leds_name = params.LEDS %} {% set color_name = params.COLOR %} {% set led = printer["gcode_macro _USER_VARIABLES"]["status_leds_" + leds_name + "_led_name"] %} - {% set color = printer["gcode_macro _USER_VARIABLES"].status_leds_colors[leds_name][color_name] %} + {% set color = printer["gcode_macro _LEDS_COLORS_DEFINITION"].colors[leds_name][color_name] %} {% set transmit = params.TRANSMIT|default(1) %} SET_LED LED={led} RED={color.r} GREEN={color.g} BLUE={color.b} WHITE={color.w} TRANSMIT={transmit} @@ -155,10 +159,16 @@ gcode: 'caselight': 'printing', 'minidisplay': 'on' }, - 'off': { - 'logo': 'off', - 'nozzle': 'off', - 'caselight': 'off', + 'printing': { + 'logo': 'printing', + 'nozzle': 'on', + 'caselight': 'printing', + 'minidisplay': 'on' + }, + 'done_printing': { + 'logo': 'done_printing', + 'nozzle': 'done_printing', + 'caselight': 'done_printing', 'minidisplay': 'off' }, 'on': { @@ -167,12 +177,24 @@ gcode: 'caselight': 'on', 'minidisplay': 'on' }, + 'off': { + 'logo': 'off', + 'nozzle': 'off', + 'caselight': 'off', + 'minidisplay': 'off' + }, 'error': { 'logo': 'error', 'nozzle': 'error', 'caselight': 'error', 'minidisplay': 'error' - } + }, + 'shutdown': { + 'logo': 'off', + 'nozzle': 'off', + 'caselight': 'off', + 'minidisplay': 'shutdown' + } } %} {% if not (color in status_color) %} @@ -180,14 +202,27 @@ gcode: {% endif %} {% if printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} - _SET_LEDS_BY_NAME LEDS="logo" COLOR={status_color[color].logo} TRANSMIT={logo_transmit} - _SET_LEDS_BY_NAME LEDS="nozzle" COLOR={status_color[color].nozzle} TRANSMIT=1 + {% if printer["gcode_macro _USER_VARIABLES"].status_leds_effects_enabled == False %} + _SET_LEDS_BY_NAME LEDS="logo" COLOR={status_color[color].logo} TRANSMIT={logo_transmit} + _SET_LEDS_BY_NAME LEDS="nozzle" COLOR={status_color[color].nozzle} TRANSMIT=1 + {% else %} + SET_LED_EFFECT EFFECT={"sb_logo_" + status_color[color].logo} REPLACE=1 FADETIME=0.5 + SET_LED_EFFECT EFFECT={"sb_nozzle_" + status_color[color].nozzle} REPLACE=1 FADETIME=0.5 + {% endif %} {% endif %} - {% if printer["gcode_macro _USER_VARIABLES"].status_leds_caselight_enabled %} - _SET_ALLLEDS_BY_NAME LEDS="caselight" COLOR={status_color[color].caselight} TRANSMIT=1 + {% if printer["gcode_macro _USER_VARIABLES"].status_leds_caselight_enabled%} + {% if printer["gcode_macro _USER_VARIABLES"].status_leds_effects_enabled == False %} + _SET_ALLLEDS_BY_NAME LEDS="caselight" COLOR={status_color[color].caselight} TRANSMIT=1 + {% else %} + SET_LED_EFFECT EFFECT={"cl_" + status_color[color].caselight} REPLACE=1 FADETIME=0.5 + {% endif %} {% endif %} {% if printer["gcode_macro _USER_VARIABLES"].status_leds_minidisplay_enabled %} - _SET_ALLLEDS_BY_NAME LEDS="minidisplay" COLOR={status_color[color].minidisplay} TRANSMIT=1 + {% if printer["gcode_macro _USER_VARIABLES"].status_leds_minidisplay_knob_only %} + _SET_LEDS_BY_NAME LEDS="minidisplay" COLOR={status_color[color].minidisplay} TRANSMIT=1 + {% else %} + _SET_ALLLEDS_BY_NAME LEDS="minidisplay" COLOR={status_color[color].minidisplay} TRANSMIT=1 + {% endif %} {% endif %} diff --git a/macros/helpers/filament_swap.cfg b/macros/helpers/filament_swap.cfg index bccab66af..2ee6ce78c 100644 --- a/macros/helpers/filament_swap.cfg +++ b/macros/helpers/filament_swap.cfg @@ -2,11 +2,12 @@ description: Do a PAUSE, park the toolhead over the purge bucket and unload the filament gcode: {% set TEMP = params.TEMP|default(printer["gcode_macro _USER_VARIABLES"].print_default_extruder_temp)|float %} + {% set DISTANCE = params.DISTANCE|default(105)|float %} SAVE_GCODE_STATE NAME=CHANGE_FILAMENT_state PAUSE _CONDITIONAL_MOVE_TO_PURGE_BUCKET Z_DROP=0 - UNLOAD_FILAMENT + UNLOAD_FILAMENT TEMP={TEMP} DISTANCE={DISTANCE} RESTORE_GCODE_STATE NAME=CHANGE_FILAMENT_state @@ -18,24 +19,21 @@ gcode: {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} - {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} + {% set re_enable_filament_sensor = 0 %} {% if filament_sensor_enabled %} - SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 - {% if verbose %} - RESPOND MSG="Runout sensor deactivated to unload filament" + {% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 + {% set re_enable_filament_sensor = 1 %} + {% if verbose %} + RESPOND MSG="Runout sensor deactivated to unload filament" + {% endif %} {% endif %} {% endif %} - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - {% if printer.ercf.clog_detection > 0 %} - ERCF_TEST_CONFIG enable_clog_detection=0 - {% if verbose %} - RESPOND MSG="ERCF clog detection deactivated to unload filament" - {% endif %} - {% endif %} - {% endif %} + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_SET_CLOGDETECTION STATE=0 {% endif %} SAVE_GCODE_STATE NAME=UNLOAD_FILAMENT_state @@ -52,22 +50,15 @@ gcode: RESTORE_GCODE_STATE NAME=UNLOAD_FILAMENT_state - {% if filament_sensor_enabled %} + {% if filament_sensor_enabled and re_enable_filament_sensor %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 {% if verbose %} RESPOND MSG="Filament unloaded, runout sensor reactivated" {% endif %} {% endif %} - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - {% if printer.ercf.clog_detection > 0 %} - ERCF_TEST_CONFIG enable_clog_detection={printer.ercf.clog_detection} - {% if verbose %} - RESPOND MSG="Filament unloaded, ERCF clog detection reactivated" - {% endif %} - {% endif %} - {% endif %} + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_SET_CLOGDETECTION STATE={printer.mmu.clog_detection} {% endif %} @@ -79,24 +70,21 @@ gcode: {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} - {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} + {% set re_enable_filament_sensor = 0 %} {% if filament_sensor_enabled %} - SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 - {% if verbose %} - RESPOND MSG="Runout sensor deactivated to load filament" + {% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 + {% set re_enable_filament_sensor = 1 %} + {% if verbose %} + RESPOND MSG="Runout sensor deactivated to load filament" + {% endif %} {% endif %} {% endif %} - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - {% if printer.ercf.clog_detection > 0 %} - ERCF_TEST_CONFIG enable_clog_detection=0 - {% if verbose %} - RESPOND MSG="ERCF clog detection deactivated to load filament" - {% endif %} - {% endif %} - {% endif %} + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_SET_CLOGDETECTION STATE=0 {% endif %} SAVE_GCODE_STATE NAME=LOAD_FILAMENT_state @@ -112,22 +100,15 @@ gcode: G92 E0 RESTORE_GCODE_STATE NAME=LOAD_FILAMENT_state - {% if filament_sensor_enabled %} + {% if filament_sensor_enabled and re_enable_filament_sensor %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 {% if verbose %} RESPOND MSG="Filament loaded, runout sensor reactivated" {% endif %} {% endif %} - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - {% if printer.ercf.clog_detection > 0 %} - ERCF_TEST_CONFIG enable_clog_detection={printer.ercf.clog_detection} - {% if verbose %} - RESPOND MSG="Filament loaded, ERCF clog detection reactivated" - {% endif %} - {% endif %} - {% endif %} + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_SET_CLOGDETECTION STATE={printer.mmu.clog_detection} {% endif %} @@ -138,24 +119,21 @@ gcode: {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} - {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} + {% set re_enable_filament_sensor = 0 %} {% if filament_sensor_enabled %} - SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 - {% if verbose %} - RESPOND MSG="Runout sensor deactivated for filament tip shaping" + {% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 + {% set re_enable_filament_sensor = 1 %} + {% if verbose %} + RESPOND MSG="Runout sensor deactivated for filament tip shaping" + {% endif %} {% endif %} {% endif %} - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - {% if printer.ercf.clog_detection > 0 %} - ERCF_TEST_CONFIG enable_clog_detection=0 - {% if verbose %} - RESPOND MSG="ERCF clog detection deactivated for filament tip shaping" - {% endif %} - {% endif %} - {% endif %} + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_SET_CLOGDETECTION STATE=0 {% endif %} SAVE_GCODE_STATE NAME=TIP_SHAPING_state @@ -179,23 +157,16 @@ gcode: # Flushing Klipper's buffer to ensure the tip shaping sequence is done before continuing M400 - + RESTORE_GCODE_STATE NAME=TIP_SHAPING_state - {% if filament_sensor_enabled %} + {% if filament_sensor_enabled and re_enable_filament_sensor %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 {% if verbose %} RESPOND MSG="Filament tip shaping done, runout sensor reactivated" {% endif %} {% endif %} - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - {% if printer.ercf.clog_detection > 0 %} - ERCF_TEST_CONFIG enable_clog_detection={printer.ercf.clog_detection} - {% if verbose %} - RESPOND MSG="Filament tip shaping done, ERCF clog detection reactivated" - {% endif %} - {% endif %} - {% endif %} + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_SET_CLOGDETECTION STATE={printer.mmu.clog_detection} {% endif %} diff --git a/macros/helpers/heatsoak.cfg b/macros/helpers/heatsoak.cfg index 53bc640ca..7be25f746 100644 --- a/macros/helpers/heatsoak.cfg +++ b/macros/helpers/heatsoak.cfg @@ -44,6 +44,7 @@ gcode: {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% set heaterbed_enabled = printer["gcode_macro _USER_VARIABLES"].heaterbed_enabled %} + {% set heatsoak_bed_enabled = printer["gcode_macro _USER_VARIABLES"].print_default_soak > 0 %} # configured heatsoak default value {% if heaterbed_enabled %} {% if verbose %} @@ -58,7 +59,9 @@ gcode: G4 P{60000 * 1} {% endfor %} {% else %} - RESPOND MSG="No heatsoak needed, continue" + {% if heatsoak_bed_enabled %} + RESPOND MSG="No heatsoak needed, continue" + {% endif %} {% endif %} {% if verbose %} diff --git a/macros/helpers/nozzle_cleaning.cfg b/macros/helpers/nozzle_cleaning.cfg index aa7c599b9..e2869681e 100644 --- a/macros/helpers/nozzle_cleaning.cfg +++ b/macros/helpers/nozzle_cleaning.cfg @@ -25,7 +25,6 @@ gcode: # Set the cleaning acceleration prior to any movement {% set saved_accel = printer.toolhead.max_accel %} - {% set saved_decel = printer.toolhead.max_accel_to_decel %} M204 S{brush_clean_accel} # Move to purge zone (left side) @@ -53,7 +52,7 @@ gcode: G90 # Reset acceleration values to what it was before - SET_VELOCITY_LIMIT ACCEL={saved_accel} ACCEL_TO_DECEL={saved_decel} + SET_VELOCITY_LIMIT ACCEL={saved_accel} {% if purgeclean_servo_enabled %} _SERVO_RETRACT ITEM="clean" @@ -77,6 +76,7 @@ gcode: {% set purgeclean_servo_enabled = printer["gcode_macro _USER_VARIABLES"].purgeclean_servo_enabled %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} + {% set re_enable_filament_sensor = 0 %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% if purge_and_brush_enabled %} @@ -92,7 +92,10 @@ gcode: {% endif %} {% if filament_sensor_enabled %} - SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 + {% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 + {% set re_enable_filament_sensor = 1 %} + {% endif %} {% endif %} G90 @@ -114,7 +117,7 @@ gcode: # No M400 needed here since G4 is also flushing Klipper's buffer G4 P{OOZE_TIME * 1000} - {% if filament_sensor_enabled %} + {% if filament_sensor_enabled and re_enable_filament_sensor %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 {% endif %} diff --git a/macros/helpers/prime_line.cfg b/macros/helpers/prime_line.cfg index fef104b69..549a56914 100644 --- a/macros/helpers/prime_line.cfg +++ b/macros/helpers/prime_line.cfg @@ -1,72 +1,100 @@ [gcode_macro PRIMELINE] gcode: - # Macro parameters + # Base macro parameters {% set prime_line_length = params.LINE_LENGTH|default(printer["gcode_macro _USER_VARIABLES"].prime_line_length)|float %} {% set prime_line_purge_distance = params.PURGE_LENGTH|default(printer["gcode_macro _USER_VARIABLES"].prime_line_purge_distance)|float %} {% set prime_line_flowrate = params.FLOWRATE|default(printer["gcode_macro _USER_VARIABLES"].prime_line_flowrate)|float %} + {% set prime_line_height = params.LINE_HEIGHT|default(printer["gcode_macro _USER_VARIABLES"].prime_line_height)|default(0.6)|float %} + {% set prime_line_adaptive = params.ADAPTIVE_MODE|default(1)|int %} + {% set prime_line_margin = params.LINE_MARGIN|default(printer["gcode_macro _USER_VARIABLES"].prime_line_margin)|default(5.0)|float %} # Used only in adaptive mode + + # If the SIZE parameter is defined and not a dummy placeholder, we use it to do the adaptive bed mesh logic + {% set coordinatesFound = false %} + {% if params.SIZE is defined and params.SIZE != "0_0_0_0" %} + {% set xMinSpec, yMinSpec, xMaxSpec, yMaxSpec = params.SIZE.split('_')|map('trim')|map('int') %} + {% set coordinatesFound = true %} + {% elif printer.exclude_object is defined %} + {% if printer.exclude_object.objects %} + # Else if SIZE is not defined, we fallback to use the [exclude_object] tags + # This method is derived from Kyleisah KAMP repository: https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging) + {% set eo_points = printer.exclude_object.objects|map(attribute='polygon')|sum(start=[]) %} + {% set xMinSpec = eo_points|map(attribute=0)|min %} + {% set yMinSpec = eo_points|map(attribute=1)|min %} + {% set xMaxSpec = eo_points|map(attribute=0)|max %} + {% set yMaxSpec = eo_points|map(attribute=1)|max %} + {% set coordinatesFound = true %} + {% endif %} + {% endif %} - # Set internal macro vars + # We get the default prime line position parameters {% set prime_line_x, prime_line_y = printer["gcode_macro _USER_VARIABLES"].prime_line_xy|map('float') %} - {% set prime_line_direction = printer["gcode_macro _USER_VARIABLES"].prime_line_direction|string|upper %} + {% set prime_line_x = params.START_X|default(prime_line_x)|float %} + {% set prime_line_y = params.START_Y|default(prime_line_y)|float %} + {% set prime_line_direction = params.LINE_DIRECTION|default(printer["gcode_macro _USER_VARIABLES"].prime_line_direction)|string|upper %} + + {% set center_x, center_y = [printer.toolhead.axis_maximum.x / 2, printer.toolhead.axis_maximum.y / 2]|map("float") %} + + # If first layer coordinates are retrieved and adaptive mode is enabled, then we replace the coordinates to + # do an adaptive purge while being careful to have the line stay on the bed when the first layer + # is in an opposite bed quadrant than the prime line initial coordinates (due to mirrored coordinates from center axes)... + {% if coordinatesFound and prime_line_adaptive == 1 %} + {% set prime_line_x = 2*center_x - prime_line_x if (prime_line_x > center_x and xMaxSpec < center_x) or (prime_line_x < center_x and xMinSpec > center_x) + else prime_line_x %} + {% set prime_line_y = 2*center_y - prime_line_y if (prime_line_y > center_y and yMaxSpec < center_y) or (prime_line_y < center_y and yMinSpec > center_y) + else prime_line_y %} + {% set prime_line_x = [[prime_line_x, xMinSpec - prime_line_margin]|max, xMaxSpec + prime_line_margin]|min %} + {% set prime_line_y = [[prime_line_y, yMinSpec - prime_line_margin]|max, yMaxSpec + prime_line_margin]|min %} + {% endif %} + + # Choose the way of printing the primeline (in + or -) alongside the direction to avoid going outside the bed boundaries + {% set prime_line_way = -1 if (prime_line_direction == "X" and prime_line_x > center_x) or (prime_line_direction == "Y" and prime_line_y > center_y) else 1 %} {% set St = printer["gcode_macro _USER_VARIABLES"].travel_speed * 60 %} {% set Sz = printer["gcode_macro _USER_VARIABLES"].z_drop_speed * 60 %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} - {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} + {% set re_enable_filament_sensor = 0 %} {% set max_extrude_cross_section = printer["configfile"].config["extruder"]["max_extrude_cross_section"]|float %} {% set filament_diameter = printer["configfile"].config["extruder"]["filament_diameter"]|float %} - {% set line_height = 0.6 %} - - # some more Macro parameters after retrieving defaults - {% set prime_line_x = params.START_X|default(prime_line_x)|float %} - {% set prime_line_y = params.START_Y|default(prime_line_y)|float %} - {% set prime_line_direction = params.LINE_DIRECTION|default(printer["gcode_macro _USER_VARIABLES"].prime_line_direction)|string|upper %} - # We first compute the width of the prime line {% set purge_volume = prime_line_purge_distance * 3.14159 * (filament_diameter / 2)**2 %} - {% set line_width = purge_volume / (line_height * prime_line_length) %} + {% set line_width = purge_volume / (prime_line_height * prime_line_length) %} # Then we check that the prime line cross section will not be problematic (exceeding Klipper max_extrude_cross_section) # or, if it's the case, we warn the user and add a correction to the length of filament to be purged - {% if (line_height * line_width) > max_extrude_cross_section %} + {% if (prime_line_height * line_width) > max_extrude_cross_section %} {% if verbose %} {action_respond_info("The prime_line_purge_distance of %.4f mm is too high and will exceed the max_extrude_cross_section!" % prime_line_purge_distance)} {% endif %} {% set prime_line_purge_distance = 0.98 * (max_extrude_cross_section * prime_line_length) / (3.14159 * (filament_diameter / 2)**2) %} {% set purge_volume = prime_line_purge_distance * 3.14159 * (filament_diameter / 2)**2 %} - {% set line_width = purge_volume / (line_height * prime_line_length) %} + {% set line_width = purge_volume / (prime_line_height * prime_line_length) %} {% if verbose %} {action_respond_info("Klippain corrected the prime_line_purge_distance to %.4f mm" % prime_line_purge_distance)} {% endif %} {% endif %} # We then compute the height to width ratio and validate that the prime line will not be too thin - {% if (line_height / line_width) >= 0.5 %} # TODO: validate this 1/2 ratio is good for all - {% if verbose %} - {action_raise_error("The prime line will be too thin and will probably not stick properly to the bed. Increase its purge distance or decrease its length! Aborting...")} - {% endif %} + {% if (prime_line_height / line_width) >= 0.5 %} # TODO: validate this 1/2 ratio is good for all + {action_raise_error("The prime line will be too thin and will probably not stick properly to the bed. Increase its purge distance or decrease its length!")} {% endif %} # Finally we compute the speed to get the correct flowrate for the prime line - {% set speed = (prime_line_flowrate / (line_height * line_width)) * 60 |float %} - - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - {% if printer.ercf.clog_detection > 0 %} - {% if verbose %} - RESPOND MSG="ERCF clog detection deactivated for the prime line" - {% endif %} - ERCF_TEST_CONFIG enable_clog_detection=0 - {% endif %} - {% endif %} + {% set speed = (prime_line_flowrate / (prime_line_height * line_width)) * 60 |float %} + + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_SET_CLOGDETECTION STATE=0 {% endif %} {% if filament_sensor_enabled %} - SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 + {% if (printer['filament_motion_sensor runout_sensor'] is defined and printer['filament_motion_sensor runout_sensor'].enabled) or (printer['filament_switch_sensor runout_sensor'] is defined and printer['filament_switch_sensor runout_sensor'].enabled) %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 + {% set re_enable_filament_sensor = 1 %} + {% endif %} {% endif %} G91 @@ -78,7 +106,7 @@ gcode: # Starting position G90 G0 X{prime_line_x} Y{prime_line_y} F{St} - G1 Z{line_height} F{Sz|int / 2} + G1 Z{prime_line_height} F{Sz|int / 2} # Add pressure in the nozzle G92 E0 @@ -87,9 +115,9 @@ gcode: # Prime line G92 E0 {% if prime_line_direction == "X" %} - G1 X{prime_line_x + prime_line_length} E{prime_line_purge_distance} F{speed} + G1 X{prime_line_x + prime_line_way*prime_line_length} E{prime_line_purge_distance} F{speed} {% elif prime_line_direction == "Y" %} - G1 Y{prime_line_y + prime_line_length} E{prime_line_purge_distance} F{speed} + G1 Y{prime_line_y + prime_line_way*prime_line_length} E{prime_line_purge_distance} F{speed} {% else %} { action_respond_error("Prime line direction is not valid. Choose either X or Y in the variables.cfg file!") } {% endif %} @@ -99,21 +127,20 @@ gcode: G1 E-0.2 F2100 G92 E0 G1 Z3 F{Sz} + + # Additional small movement to get out of the line as some slicers directly emmit + # a Z- move as a first step that make the toolhead crash back in the line and get dirty + G91 + G1 X2 Y2 F{St} + G90 # Flushing Klipper's buffer to ensure the primeline sequence is done before continuing M400 - {% if klippain_ercf_enabled %} - {% if printer.ercf.enabled %} - {% if printer.ercf.clog_detection > 0 %} - {% if verbose %} - RESPOND MSG="ERCF clog detection reactivated after the prime line" - {% endif %} - ERCF_TEST_CONFIG enable_clog_detection={printer.ercf.clog_detection} - {% endif %} - {% endif %} + {% if klippain_mmu_enabled %} + _KLIPPAIN_MMU_SET_CLOGDETECTION STATE={printer.mmu.clog_detection} {% endif %} - {% if filament_sensor_enabled %} + {% if filament_sensor_enabled and re_enable_filament_sensor %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 {% endif %} diff --git a/macros/helpers/spoolman.cfg b/macros/helpers/spoolman.cfg new file mode 100644 index 000000000..827d17bfb --- /dev/null +++ b/macros/helpers/spoolman.cfg @@ -0,0 +1,20 @@ +[gcode_macro SET_ACTIVE_SPOOL] +description: Set Spoolman active spool +gcode: + {% if params.SPOOL_ID %} + {% set spool_id = params.SPOOL_ID|int %} + {action_call_remote_method( + "spoolman_set_active_spool", + spool_id=spool_id + )} + {% else %} + {action_respond_info("Parameter 'SPOOL_ID' is required")} + {% endif %} + +[gcode_macro CLEAR_ACTIVE_SPOOL] +description: Clear Spoolman active spool +gcode: + {action_call_remote_method( + "spoolman_set_active_spool", + spool_id=None + )} diff --git a/macros/helpers/tachometer_check.cfg b/macros/helpers/tachometer_check.cfg new file mode 100644 index 000000000..a39d9f84a --- /dev/null +++ b/macros/helpers/tachometer_check.cfg @@ -0,0 +1,44 @@ +## This config file contains macros that are used in conjuction with tacho-enabled hotend and part fans + +# Monitoring loop for hotend fan safety check +[delayed_gcode _BACKGROUND_HOTEND_TACHO_CHECK] +gcode: + _HOTEND_FAN_CHECK + UPDATE_DELAYED_GCODE ID=_BACKGROUND_HOTEND_TACHO_CHECK DURATION=3 + +[gcode_macro _HOTEND_FAN_CHECK] +description: Check the hotend fan tachometer to verify that it is running effectively +variable_he_stop_count: 0 +gcode: + {% set min_rpm = 1000|float %} # This is a relatively low value adapted to all fans to check that they are effectively running + {% set max_consecutive_stops = 3 %} + {% set rpm = printer['heater_fan hotend_fan'].rpm|float %} + {% set he_target = printer[printer.toolhead.extruder].target|float %} + {% set he_temp = printer[printer.toolhead.extruder].temperature|float %} + {% set fan_on_temp = printer.configfile.settings['heater_fan hotend_fan'].heater_temp|float %} + {% set he_stop_count = printer["gcode_macro _HOTEND_FAN_CHECK"].he_stop_count|int %} + + {% if (he_target >= fan_on_temp) and (rpm < min_rpm) and (he_temp >= fan_on_temp) %} + SET_GCODE_VARIABLE MACRO=_HOTEND_FAN_CHECK VARIABLE=he_stop_count VALUE={he_stop_count + 1} + RESPOND MSG="Hotend fan stoppage detected for {(he_stop_count+1)*3}sec (max {max_consecutive_stops*3}sec allowed)" + M400 + {% if printer["gcode_macro _HOTEND_FAN_CHECK"].he_stop_count|int >= max_consecutive_stops-1 %} + CANCEL_PRINT + {% endif %} + {% else %} + SET_GCODE_VARIABLE MACRO=_HOTEND_FAN_CHECK VARIABLE=he_stop_count VALUE=0 + {% endif %} + + +[gcode_macro _PART_FAN_CHECK] +description: Check the part fan tachometer to verify that it is running effectively +gcode: + {% if printer.fan.rpm is not none %} + {% if printer.fan.rpm > 1000 %} # This is a relatively low value adapted to all fans to check that they are effectively running + {action_respond_info("Part fan OK!")} + {% else %} + M400 + CANCEL_PRINT + {action_raise_error("Hotend fan stoppage detected, print was canceled!")} + {% endif %} + {% endif %} diff --git a/macros/miscs/compatibility.cfg b/macros/miscs/compatibility.cfg index 3a1c9b665..5f3bbc73c 100644 --- a/macros/miscs/compatibility.cfg +++ b/macros/miscs/compatibility.cfg @@ -30,14 +30,12 @@ gcode: {% endif %} [gcode_macro M204] -description: Map M204 to SET_VELOCITY_LIMIT for ACCEL and ACCEL_TO_DECEL +description: Map M204 to SET_VELOCITY_LIMIT for ACCEL rename_existing: M204.1 gcode: - {% set F = params.F|default(printer["gcode_macro _USER_VARIABLES"].accel_to_decel_factor)|float %} - {% if 'S' in params %} {% set S = params.S|float %} - SET_VELOCITY_LIMIT ACCEL={S} ACCEL_TO_DECEL={S * F} + SET_VELOCITY_LIMIT ACCEL={S} {% endif %} [gcode_macro M205] diff --git a/macros/miscs/startup.cfg b/macros/miscs/startup.cfg index 2ffd2719d..e9ebc2258 100644 --- a/macros/miscs/startup.cfg +++ b/macros/miscs/startup.cfg @@ -9,6 +9,11 @@ gcode: [gcode_macro _KLIPPAIN_STARTUP] gcode: + ## Set boot logo + {% if printer["gcode_macro _USER_VARIABLES"].minidisplay_bootlogo_enabled %} + _INIT_BOOT_LOGO + {% endif %} + # Print system information using the system_info.py script to log them in the klippy.log RUN_SHELL_COMMAND CMD=system_info @@ -30,21 +35,40 @@ gcode: _INIT_TMC2240 {% endif %} - # If ERCF is included in Klippain, we also check that HH is installed + # If an MMU/ERCF is included in Klippain, we also check that the correct HH version is installed + {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %} {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} - {% if klippain_ercf_enabled %} - _INIT_CHECK_ERCF + {% if klippain_mmu_enabled or klippain_ercf_enabled %} + _INIT_CHECK_MMU {% endif %} + ## Set the startup status LED + _INIT_LEDS + # User custom startup process. Define them in your overrides.cfg if needed :) _INIT_USERCUSTOM - RESPOND MSG="Klippain started and ready !" + {% if klippain_mmu_enabled %} + RESPOND MSG="Klippain with MMU support started and ready!" + {% else %} + RESPOND MSG="Klippain started and ready!" + {% endif %} + + +[gcode_macro _INIT_LEDS] +gcode: + {% if printer["gcode_macro _USER_VARIABLES"].status_leds_enabled or printer["gcode_macro _USER_VARIABLES"].status_leds_caselight_enabled %} + {% if printer["gcode_macro _USER_VARIABLES"].caselight_on_at_startup|default(False) %} + STATUS_LEDS COLOR="READY" + {% else %} + STATUS_LEDS COLOR="OFF" + {% endif %} + {% endif %} [gcode_macro _INIT_TMC2240] gcode: - # This macro can be copied over to overrides.cfg and will allow the values to defined automatically on klipper startup + # This macro can be copied over to overrides.cfg and will allow the values to be defined automatically on klipper startup # TMC2240 extruder initialization macro to set the driver registers based on Esoterical's github page. These settings are not # universal and not necessary for all SB2240 owners. Adapt them to your needs! # https://github.com/Esoterical/voron_canbus/blob/main/toolhead_flashing/common_hardware/BigTreeTech%20SB2209%20and%20SB2240/SB2240%20Stepper%20Configuration%20and%20Undervoltage.md @@ -88,6 +112,8 @@ gcode: {% if zcalib_plugin_enabled %} {% if probe_type_enabled == "vorontap" %} { action_raise_error("Voron TAP Probe and Z calibration plugin cannot be used at the same time in Klippain!") } + {% elif probe_type_enabled == "bltouch" %} + { action_raise_error("BLTouch Probe and Z calibration plugin cannot be used at the same time in Klippain!") } {% elif probe_type_enabled == "inductive" %} { action_raise_error("Inductive probe and Z calibration plugin cannot be used at the same time in Klippain!") } {% elif probe_type_enabled == "dockable_virtual" or probe_type_enabled == "inductive_virtual" %} @@ -125,12 +151,22 @@ gcode: {action_respond_info(parameters.output)} -[gcode_macro _INIT_CHECK_ERCF] +[gcode_macro _INIT_CHECK_MMU] gcode: - {% if printer.ercf is not defined %} - { action_raise_error("ERCF is enabled in Klippain, but Happy Hare, the supported ERCF backend software is not detected. Please install it now from https://github.com/moggieuk/ERCF-Software-V3 !") } + {% if printer.mmu is not defined %} + {% if printer.ercf is not defined %} + { action_raise_error("MMU support is enabled in Klippain, but HappyHare, the supported MMU/ERCF backend software is not detected. See the corresponding documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md") } + {% else %} + { action_raise_error("ERCF support is enabled in Klippain, but the old version of version of HappyHare (ie. ERCF-Software-V3) is installed. Please uninstall it and install the latest HappyHare instead. See the corresponding documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md") } + {% endif %} + {% elif printer['gcode_macro _USER_VARIABLES'].mmu_force_homing_in_start_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_unload_on_cancel_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_unload_on_end_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_check_gates_on_start_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print is not defined %} + { action_raise_error("MMU support is enabled in Klippain, but some variables are missing from your variables.cfg. Please update your template or refer to the corresponding documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md") } + {% elif printer["gcode_macro _USER_VARIABLES"].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 1 %} + RESPOND MSG="The HappyHare function to automatically detect the start and end of a print has been automatically disabled to allow early detection of an error during the Klippain START_PRINT sequence. This allow a more efficient debugging of the MMU. Refer to the Klippain MMU documentation" + MMU_TEST_CONFIG print_start_detection=0 # Override this value to disable the HappyHare auto detection of start and end of print in order to call _MMU_PRINT_START and _MMU_PRINT_END manually {% endif %} + [gcode_macro _INIT_USERCUSTOM] gcode: # ---- CUSTOM Macro section diff --git a/moonraker/base.conf b/moonraker/base.conf index 942070eee..e6ac5a6bb 100644 --- a/moonraker/base.conf +++ b/moonraker/base.conf @@ -35,11 +35,11 @@ trusted_clients: [update_manager] enable_auto_refresh: True + [update_manager Klippain] type: git_repo path: ~/klippain_config -channel: beta -origin: https://github.com/ksummers92/klippain.git +origin: https://github.com/Frix-x/klippain.git primary_branch: main managed_services: moonraker klipper install_script: install.sh diff --git a/moonraker/led_effect.conf b/moonraker/led_effect.conf new file mode 100644 index 000000000..8868bb4a3 --- /dev/null +++ b/moonraker/led_effect.conf @@ -0,0 +1,5 @@ +[update_manager led_effect] +type: git_repo +path: ~/klipper-led_effect +origin: https://github.com/julianschill/klipper-led_effect.git +is_system_service: False diff --git a/moonraker/spoolman.conf b/moonraker/spoolman.conf new file mode 100644 index 000000000..f2e90e9a6 --- /dev/null +++ b/moonraker/spoolman.conf @@ -0,0 +1,6 @@ +[spoolman] +server: http://localhost:7912 +# URL to the Spoolman instance. This parameter must be provided. +sync_rate: 5 +# The interval, in seconds, between sync requests with the +# Spoolman server. The default is 5. diff --git a/moonraker/tmc_autotune.conf b/moonraker/tmc_autotune.conf new file mode 100644 index 000000000..c26fe334d --- /dev/null +++ b/moonraker/tmc_autotune.conf @@ -0,0 +1,8 @@ +[update_manager klipper_tmc_autotune] +type: git_repo +channel: dev +path: ~/klipper_tmc_autotune +origin: https://github.com/andrewmcgr/klipper_tmc_autotune.git +managed_services: klipper +primary_branch: main +install_script: install.sh diff --git a/scripts/is_workflow/graph_belts.py b/scripts/is_workflow/graph_belts.py deleted file mode 100755 index 4c31f8fd2..000000000 --- a/scripts/is_workflow/graph_belts.py +++ /dev/null @@ -1,638 +0,0 @@ -#!/usr/bin/env python3 - -################################################# -######## CoreXY BELTS CALIBRATION SCRIPT ######## -################################################# -# Written by Frix_x#0161 # -# @version: 2.1 - -# CHANGELOG: -# v2.1: replaced the TwoSlopNorm by a custom made norm to allow the script to work on older versions of matplotlib -# v2.0: updated the script to align it to the new K-Shake&Tune module -# v1.0: first version of this tool for enhanced vizualisation of belt graphs - - -# Be sure to make this script executable using SSH: type 'chmod +x ./graph_belts.py' when in the folder! - -##################################################################### -################ !!! DO NOT EDIT BELOW THIS LINE !!! ################ -##################################################################### - -import optparse, matplotlib, sys, importlib, os -from textwrap import wrap -from collections import namedtuple -import numpy as np -import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager -import matplotlib.ticker, matplotlib.gridspec, matplotlib.colors -import matplotlib.patches -import locale -from datetime import datetime - -matplotlib.use('Agg') - - -ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" # For paired peaks names - -PEAKS_DETECTION_THRESHOLD = 0.20 -CURVE_SIMILARITY_SIGMOID_K = 0.6 -DC_GRAIN_OF_SALT_FACTOR = 0.75 -DC_THRESHOLD_METRIC = 1.5e9 -DC_MAX_UNPAIRED_PEAKS_ALLOWED = 4 - -# Define the SignalData namedtuple -SignalData = namedtuple('CalibrationData', ['freqs', 'psd', 'peaks', 'paired_peaks', 'unpaired_peaks']) - -KLIPPAIN_COLORS = { - "purple": "#70088C", - "orange": "#FF8D32", - "dark_purple": "#150140", - "dark_orange": "#F24130", - "red_pink": "#F2055C" -} - - -# Set the best locale for time and date formating (generation of the titles) -try: - locale.setlocale(locale.LC_TIME, locale.getdefaultlocale()) -except locale.Error: - locale.setlocale(locale.LC_TIME, 'C') - -# Override the built-in print function to avoid problem in Klipper due to locale settings -original_print = print -def print_with_c_locale(*args, **kwargs): - original_locale = locale.setlocale(locale.LC_ALL, None) - locale.setlocale(locale.LC_ALL, 'C') - original_print(*args, **kwargs) - locale.setlocale(locale.LC_ALL, original_locale) -print = print_with_c_locale - - -###################################################################### -# Computation of the PSD graph -###################################################################### - -# Calculate estimated "power spectral density" using existing Klipper tools -def calc_freq_response(data): - helper = shaper_calibrate.ShaperCalibrate(printer=None) - return helper.process_accelerometer_data(data) - - -# Calculate or estimate a "similarity" factor between two PSD curves and scale it to a percentage. This is -# used here to quantify how close the two belts path behavior and responses are close together. -def compute_curve_similarity_factor(signal1, signal2): - freqs1 = signal1.freqs - psd1 = signal1.psd - freqs2 = signal2.freqs - psd2 = signal2.psd - - # Interpolate PSDs to match the same frequency bins and do a cross-correlation - psd2_interp = np.interp(freqs1, freqs2, psd2) - cross_corr = np.correlate(psd1, psd2_interp, mode='full') - - # Find the peak of the cross-correlation and compute a similarity normalized by the energy of the signals - peak_value = np.max(cross_corr) - similarity = peak_value / (np.sqrt(np.sum(psd1**2) * np.sum(psd2_interp**2))) - - # Apply sigmoid scaling to get better numbers and get a final percentage value - scaled_similarity = sigmoid_scale(-np.log(1 - similarity), CURVE_SIMILARITY_SIGMOID_K) - - return scaled_similarity - - -# This find all the peaks in a curve by looking at when the derivative term goes from positive to negative -# Then only the peaks found above a threshold are kept to avoid capturing peaks in the low amplitude noise of a signal -def detect_peaks(psd, freqs, window_size=5, vicinity=3): - # Smooth the curve using a moving average to avoid catching peaks everywhere in noisy signals - kernel = np.ones(window_size) / window_size - smoothed_psd = np.convolve(psd, kernel, mode='valid') - mean_pad = [np.mean(psd[:window_size])] * (window_size // 2) - smoothed_psd = np.concatenate((mean_pad, smoothed_psd)) - - # Find peaks on the smoothed curve - smoothed_peaks = np.where((smoothed_psd[:-2] < smoothed_psd[1:-1]) & (smoothed_psd[1:-1] > smoothed_psd[2:]))[0] + 1 - detection_threshold = PEAKS_DETECTION_THRESHOLD * psd.max() - smoothed_peaks = smoothed_peaks[smoothed_psd[smoothed_peaks] > detection_threshold] - - # Refine peak positions on the original curve - refined_peaks = [] - for peak in smoothed_peaks: - local_max = peak + np.argmax(psd[max(0, peak-vicinity):min(len(psd), peak+vicinity+1)]) - vicinity - refined_peaks.append(local_max) - - return np.array(refined_peaks), freqs[refined_peaks] - - -# This function create pairs of peaks that are close in frequency on two curves (that are known -# to be resonances points and must be similar on both belts on a CoreXY kinematic) -def pair_peaks(peaks1, freqs1, psd1, peaks2, freqs2, psd2): - # Compute a dynamic detection threshold to filter and pair peaks efficiently - # even if the signal is very noisy (this get clipped to a maximum of 10Hz diff) - distances = [] - for p1 in peaks1: - for p2 in peaks2: - distances.append(abs(freqs1[p1] - freqs2[p2])) - distances = np.array(distances) - - median_distance = np.median(distances) - iqr = np.percentile(distances, 75) - np.percentile(distances, 25) - - threshold = median_distance + 1.5 * iqr - threshold = min(threshold, 10) - - # Pair the peaks using the dynamic thresold - paired_peaks = [] - unpaired_peaks1 = list(peaks1) - unpaired_peaks2 = list(peaks2) - - while unpaired_peaks1 and unpaired_peaks2: - min_distance = threshold + 1 - pair = None - - for p1 in unpaired_peaks1: - for p2 in unpaired_peaks2: - distance = abs(freqs1[p1] - freqs2[p2]) - if distance < min_distance: - min_distance = distance - pair = (p1, p2) - - if pair is None: # No more pairs below the threshold - break - - p1, p2 = pair - paired_peaks.append(((p1, freqs1[p1], psd1[p1]), (p2, freqs2[p2], psd2[p2]))) - unpaired_peaks1.remove(p1) - unpaired_peaks2.remove(p2) - - return paired_peaks, unpaired_peaks1, unpaired_peaks2 - - -###################################################################### -# Computation of a basic signal spectrogram -###################################################################### - -def compute_spectrogram(data): - N = data.shape[0] - Fs = N / (data[-1,0] - data[0,0]) - # Round up to a power of 2 for faster FFT - M = 1 << int(.5 * Fs - 1).bit_length() - window = np.kaiser(M, 6.) - def _specgram(x): - return matplotlib.mlab.specgram( - x, Fs=Fs, NFFT=M, noverlap=M//2, window=window, - mode='psd', detrend='mean', scale_by_freq=False) - - d = {'x': data[:,1], 'y': data[:,2], 'z': data[:,3]} - pdata, bins, t = _specgram(d['x']) - for ax in 'yz': - pdata += _specgram(d[ax])[0] - return pdata, bins, t - - -###################################################################### -# Computation of the differential spectrogram -###################################################################### - -# Performs a standard bilinear interpolation for a given x, y point based on surrounding input grid values. This function -# is part of the logic to re-align both belts spectrogram in order to combine them in the differential spectrogram. -def bilinear_interpolate(x, y, points, values): - x1, x2 = points[0] - y1, y2 = points[1] - - f11, f12 = values[0] - f21, f22 = values[1] - - interpolated_value = ( - (f11 * (x2 - x) * (y2 - y) + - f21 * (x - x1) * (y2 - y) + - f12 * (x2 - x) * (y - y1) + - f22 * (x - x1) * (y - y1)) / ((x2 - x1) * (y2 - y1)) - ) - - return interpolated_value - - -# Interpolate source_data (2D) to match target_x and target_y in order to interpolate and -# get similar time and frequency dimensions for the differential spectrogram -def interpolate_2d(target_x, target_y, source_x, source_y, source_data): - interpolated_data = np.zeros((len(target_y), len(target_x))) - - for i, y in enumerate(target_y): - for j, x in enumerate(target_x): - # Find indices of surrounding points in source data - # and ensure we don't exceed array bounds - x_indices = np.searchsorted(source_x, x) - 1 - y_indices = np.searchsorted(source_y, y) - 1 - x_indices = max(0, min(len(source_x) - 1, x_indices)) - y_indices = max(0, min(len(source_y) - 1, y_indices)) - - if x_indices == len(source_x) - 2: - x_indices -= 1 - if y_indices == len(source_y) - 2: - y_indices -= 1 - - x1, x2 = source_x[x_indices], source_x[x_indices + 1] - y1, y2 = source_y[y_indices], source_y[y_indices + 1] - - f11 = source_data[y_indices, x_indices] - f12 = source_data[y_indices, x_indices + 1] - f21 = source_data[y_indices + 1, x_indices] - f22 = source_data[y_indices + 1, x_indices + 1] - - interpolated_data[i, j] = bilinear_interpolate(x, y, ((x1, x2), (y1, y2)), ((f11, f12), (f21, f22))) - - return interpolated_data - - -# This function identifies a "ridge" of high gradient magnitude in a spectrogram (pdata) - ie. a resonance diagonal line. Starting from -# the maximum value in the first column, it iteratively follows the direction of the highest gradient in the vicinity (window configured using -# the n_average parameter). The result is a sequence of indices that traces the resonance line across the original spectrogram. -def detect_ridge(pdata, n_average=3): - grad_y, grad_x = np.gradient(pdata) - magnitude = np.sqrt(grad_x**2 + grad_y**2) - - # Start at the maximum value in the first column - start_idx = np.argmax(pdata[:, 0]) - path = [start_idx] - - # Walk through the spectrogram following the path of the ridge - for j in range(1, pdata.shape[1]): - # Look in the vicinity of the previous point - vicinity = magnitude[max(0, path[-1]-n_average):min(pdata.shape[0], path[-1]+n_average+1), j] - # Take an average of top few points - sorted_indices = np.argsort(vicinity) - top_indices = sorted_indices[-n_average:] - next_idx = int(np.mean(top_indices) + max(0, path[-1]-n_average)) - path.append(next_idx) - - return np.array(path) - - -# This function calculates the time offset between two resonances lines (ridge1 and ridge2) using cross-correlation in -# the frequency domain (using FFT). The result provides the lag (or offset) at which the two sequences are most similar. -# This is used to re-align both belts spectrograms on their resonances lines in order to create the combined spectrogram. -def compute_cross_correlation_offset(ridge1, ridge2): - # Ensure that the two arrays have the same shape - if len(ridge1) < len(ridge2): - ridge1 = np.pad(ridge1, (0, len(ridge2) - len(ridge1))) - elif len(ridge1) > len(ridge2): - ridge2 = np.pad(ridge2, (0, len(ridge1) - len(ridge2))) - - cross_corr = np.fft.fftshift(np.fft.ifft(np.fft.fft(ridge1) * np.conj(np.fft.fft(ridge2)))) - return np.argmax(np.abs(cross_corr)) - len(ridge1) // 2 - - -# This function shifts data along its second dimension - ie. time here - by a specified shift_amount -def shift_data_in_time(data, shift_amount): - if shift_amount > 0: - return np.pad(data, ((0, 0), (shift_amount, 0)), mode='constant')[:, :-shift_amount] - elif shift_amount < 0: - return np.pad(data, ((0, 0), (0, -shift_amount)), mode='constant')[:, -shift_amount:] - else: - return data - - -# Main logic function to combine two similar spectrogram - ie. from both belts paths - by detecting similarities (ridges), computing -# the time lag and realigning them. Finally this function combine (by substracting signals) the aligned spectrograms in a new one. -# This result of a mostly zero-ed new spectrogram with some colored zones highlighting differences in the belts paths. -def combined_spectrogram(data1, data2): - pdata1, bins1, t1 = compute_spectrogram(data1) - pdata2, _, _ = compute_spectrogram(data2) - - # Detect ridges - ridge1 = detect_ridge(pdata1) - ridge2 = detect_ridge(pdata2) - - # Compute offset using cross-correlation and shit/align and interpolate the spectrograms - offset = compute_cross_correlation_offset(ridge1, ridge2) - pdata2_aligned = shift_data_in_time(pdata2, offset) - pdata2_interpolated = interpolate_2d(t1, bins1, t1, bins1, pdata2_aligned) - - # Combine the spectrograms - combined_data = np.abs(pdata1 - pdata2_interpolated) - return combined_data, bins1, t1 - - -# Compute a composite and highly subjective value indicating the "mechanical health of the printer (0 to 100%)" that represent the -# likelihood of mechanical issues on the printer. It is based on the differential spectrogram sum of gradient, salted with a bit -# of the estimated similarity cross-correlation from compute_curve_similarity_factor() and with a bit of the number of unpaired peaks. -# This result in a percentage value quantifying the machine behavior around the main resonances that give an hint if only touching belt tension -# will give good graphs or if there is a chance of mechanical issues in the background (above 50% should be considered as probably problematic) -def compute_mhi(combined_data, similarity_coefficient, num_unpaired_peaks): - filtered_data = combined_data[combined_data > 100] - - # First compute a "total variability metric" based on the sum of the gradient that sum the magnitude of will emphasize regions of the - # spectrogram where there are rapid changes in magnitude (like the edges of resonance peaks). - total_variability_metric = np.sum(np.abs(np.gradient(filtered_data))) - # Scale the metric to a percentage using the threshold (found empirically on a large number of user data shared to me) - base_percentage = (np.log1p(total_variability_metric) / np.log1p(DC_THRESHOLD_METRIC)) * 100 - - # Adjust the percentage based on the similarity_coefficient to add a grain of salt - adjusted_percentage = base_percentage * (1 - DC_GRAIN_OF_SALT_FACTOR * (similarity_coefficient / 100)) - - # Adjust the percentage again based on the number of unpaired peaks to add a second grain of salt - peak_confidence = num_unpaired_peaks / DC_MAX_UNPAIRED_PEAKS_ALLOWED - final_percentage = (1 - peak_confidence) * adjusted_percentage + peak_confidence * 100 - - # Ensure the result lies between 0 and 100 by clipping the computed value - final_percentage = np.clip(final_percentage, 0, 100) - - return final_percentage, mhi_lut(final_percentage) - - -# LUT to transform the MHI into a textual value easy to understand for the users of the script -def mhi_lut(mhi): - if 0 <= mhi <= 30: - return "Excellent mechanical health" - elif 30 < mhi <= 45: - return "Good mechanical health" - elif 45 < mhi <= 55: - return "Acceptable mechanical health" - elif 55 < mhi <= 70: - return "Potential signs of a mechanical issue" - elif 70 < mhi <= 85: - return "Likely a mechanical issue" - elif 85 < mhi <= 100: - return "Mechanical issue detected" - - -###################################################################### -# Graphing -###################################################################### - -def plot_compare_frequency(ax, lognames, signal1, signal2, max_freq): - # Get the belt name for the legend to avoid putting the full file name - signal1_belt = (lognames[0].split('/')[-1]).split('_')[-1][0] - signal2_belt = (lognames[1].split('/')[-1]).split('_')[-1][0] - - if signal1_belt == 'A' and signal2_belt == 'B': - signal1_belt += " (axis 1,-1)" - signal2_belt += " (axis 1, 1)" - elif signal1_belt == 'B' and signal2_belt == 'A': - signal1_belt += " (axis 1, 1)" - signal2_belt += " (axis 1,-1)" - else: - print("Warning: belts doesn't seem to have the correct name A and B (extracted from the filename.csv)") - - # Plot the two belts PSD signals - ax.plot(signal1.freqs, signal1.psd, label="Belt " + signal1_belt, color=KLIPPAIN_COLORS['purple']) - ax.plot(signal2.freqs, signal2.psd, label="Belt " + signal2_belt, color=KLIPPAIN_COLORS['orange']) - - # Trace the "relax region" (also used as a threshold to filter and detect the peaks) - psd_lowest_max = min(signal1.psd.max(), signal2.psd.max()) - peaks_warning_threshold = PEAKS_DETECTION_THRESHOLD * psd_lowest_max - ax.axhline(y=peaks_warning_threshold, color='black', linestyle='--', linewidth=0.5) - ax.fill_between(signal1.freqs, 0, peaks_warning_threshold, color='green', alpha=0.15, label='Relax Region') - - # Trace and annotate the peaks on the graph - paired_peak_count = 0 - unpaired_peak_count = 0 - offsets_table_data = [] - - for _, (peak1, peak2) in enumerate(signal1.paired_peaks): - label = ALPHABET[paired_peak_count] - amplitude_offset = abs(((signal2.psd[peak2[0]] - signal1.psd[peak1[0]]) / max(signal1.psd[peak1[0]], signal2.psd[peak2[0]])) * 100) - frequency_offset = abs(signal2.freqs[peak2[0]] - signal1.freqs[peak1[0]]) - offsets_table_data.append([f"Peaks {label}", f"{frequency_offset:.1f} Hz", f"{amplitude_offset:.1f} %"]) - - ax.plot(signal1.freqs[peak1[0]], signal1.psd[peak1[0]], "x", color='black') - ax.plot(signal2.freqs[peak2[0]], signal2.psd[peak2[0]], "x", color='black') - ax.plot([signal1.freqs[peak1[0]], signal2.freqs[peak2[0]]], [signal1.psd[peak1[0]], signal2.psd[peak2[0]]], ":", color='gray') - - ax.annotate(label + "1", (signal1.freqs[peak1[0]], signal1.psd[peak1[0]]), - textcoords="offset points", xytext=(8, 5), - ha='left', fontsize=13, color='black') - ax.annotate(label + "2", (signal2.freqs[peak2[0]], signal2.psd[peak2[0]]), - textcoords="offset points", xytext=(8, 5), - ha='left', fontsize=13, color='black') - paired_peak_count += 1 - - for peak in signal1.unpaired_peaks: - ax.plot(signal1.freqs[peak], signal1.psd[peak], "x", color='black') - ax.annotate(str(unpaired_peak_count + 1), (signal1.freqs[peak], signal1.psd[peak]), - textcoords="offset points", xytext=(8, 5), - ha='left', fontsize=13, color='red', weight='bold') - unpaired_peak_count += 1 - - for peak in signal2.unpaired_peaks: - ax.plot(signal2.freqs[peak], signal2.psd[peak], "x", color='black') - ax.annotate(str(unpaired_peak_count + 1), (signal2.freqs[peak], signal2.psd[peak]), - textcoords="offset points", xytext=(8, 5), - ha='left', fontsize=13, color='red', weight='bold') - unpaired_peak_count += 1 - - # Compute the similarity (using cross-correlation of the PSD signals) - ax2 = ax.twinx() # To split the legends in two box - ax2.yaxis.set_visible(False) - similarity_factor = compute_curve_similarity_factor(signal1, signal2) - ax2.plot([], [], ' ', label=f'Estimated similarity: {similarity_factor:.1f}%') - ax2.plot([], [], ' ', label=f'Number of unpaired peaks: {unpaired_peak_count}') - print(f"Belts estimated similarity: {similarity_factor:.1f}%") - - # Setting axis parameters, grid and graph title - ax.set_xlabel('Frequency (Hz)') - ax.set_xlim([0, max_freq]) - ax.set_ylabel('Power spectral density') - psd_highest_max = max(signal1.psd.max(), signal2.psd.max()) - ax.set_ylim([0, psd_highest_max + psd_highest_max * 0.05]) - - ax.xaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator()) - ax.yaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator()) - ax.ticklabel_format(axis='y', style='scientific', scilimits=(0,0)) - ax.grid(which='major', color='grey') - ax.grid(which='minor', color='lightgrey') - fontP = matplotlib.font_manager.FontProperties() - fontP.set_size('small') - ax.set_title('Belts Frequency Profiles (estimated similarity: {:.1f}%)'.format(similarity_factor), fontsize=14, color=KLIPPAIN_COLORS['dark_orange'], weight='bold') - - # Print the table of offsets ontop of the graph below the original legend (upper right) - if len(offsets_table_data) > 0: - columns = ["", "Frequency delta", "Amplitude delta", ] - offset_table = ax.table(cellText=offsets_table_data, colLabels=columns, bbox=[0.66, 0.75, 0.33, 0.15], loc='upper right', cellLoc='center') - offset_table.auto_set_font_size(False) - offset_table.set_fontsize(8) - offset_table.auto_set_column_width([0, 1, 2]) - offset_table.set_zorder(100) - cells = [key for key in offset_table.get_celld().keys()] - for cell in cells: - offset_table[cell].set_facecolor('white') - offset_table[cell].set_alpha(0.6) - - ax.legend(loc='upper left', prop=fontP) - ax2.legend(loc='upper right', prop=fontP) - - return similarity_factor, unpaired_peak_count - - -def plot_difference_spectrogram(ax, data1, data2, signal1, signal2, similarity_factor, max_freq): - combined_data, bins, t = combined_spectrogram(data1, data2) - - # Compute the MHI value from the differential spectrogram sum of gradient, salted with - # the similarity factor and the number or unpaired peaks from the belts frequency profile - # Be careful, this value is highly opinionated and is pretty experimental! - mhi, textual_mhi = compute_mhi(combined_data, similarity_factor, len(signal1.unpaired_peaks) + len(signal2.unpaired_peaks)) - print(f"[experimental] Mechanical Health Indicator: {textual_mhi.lower()} ({mhi:.1f}%)") - ax.set_title(f"Differential Spectrogram", fontsize=14, color=KLIPPAIN_COLORS['dark_orange'], weight='bold') - ax.plot([], [], ' ', label=f'{textual_mhi} (experimental)') - - # Draw the differential spectrogram with a specific custom norm to get white or light orange zero values and red for max values - colors = ['white', 'bisque', 'red', 'black'] - n_bins = [0, 0.12, 0.9, 1] # These values where found experimentaly to get a good higlhlighting of the differences only - cm = matplotlib.colors.LinearSegmentedColormap.from_list('WhiteToRed', list(zip(n_bins, colors))) - norm = matplotlib.colors.Normalize(vmin=np.min(combined_data), vmax=np.max(combined_data)) - ax.pcolormesh(bins, t, combined_data.T, cmap=cm, norm=norm, shading='gouraud') - - ax.set_xlabel('Frequency (hz)') - ax.set_xlim([0., max_freq]) - ax.set_ylabel('Time (s)') - ax.set_ylim([0, t[-1]]) - - fontP = matplotlib.font_manager.FontProperties() - fontP.set_size('medium') - ax.legend(loc='best', prop=fontP) - - # Plot vertical lines for unpaired peaks - unpaired_peak_count = 0 - for _, peak in enumerate(signal1.unpaired_peaks): - ax.axvline(signal1.freqs[peak], color='red', linestyle='dotted', linewidth=1.5) - ax.annotate(f"Peak {unpaired_peak_count + 1}", (signal1.freqs[peak], t[-1]*0.05), - textcoords="data", color='red', rotation=90, fontsize=10, - verticalalignment='bottom', horizontalalignment='right') - unpaired_peak_count +=1 - - for _, peak in enumerate(signal2.unpaired_peaks): - ax.axvline(signal2.freqs[peak], color='red', linestyle='dotted', linewidth=1.5) - ax.annotate(f"Peak {unpaired_peak_count + 1}", (signal2.freqs[peak], t[-1]*0.05), - textcoords="data", color='red', rotation=90, fontsize=10, - verticalalignment='bottom', horizontalalignment='right') - unpaired_peak_count +=1 - - # Plot vertical lines and zones for paired peaks - for idx, (peak1, peak2) in enumerate(signal1.paired_peaks): - label = ALPHABET[idx] - x_min = min(peak1[1], peak2[1]) - x_max = max(peak1[1], peak2[1]) - ax.axvline(x_min, color=KLIPPAIN_COLORS['purple'], linestyle='dotted', linewidth=1.5) - ax.axvline(x_max, color=KLIPPAIN_COLORS['purple'], linestyle='dotted', linewidth=1.5) - ax.fill_between([x_min, x_max], 0, np.max(combined_data), color=KLIPPAIN_COLORS['purple'], alpha=0.3) - ax.annotate(f"Peaks {label}", (x_min, t[-1]*0.05), - textcoords="data", color=KLIPPAIN_COLORS['purple'], rotation=90, fontsize=10, - verticalalignment='bottom', horizontalalignment='right') - - return - - -###################################################################### -# Custom tools -###################################################################### - -# Simple helper to compute a sigmoid scalling (from 0 to 100%) -def sigmoid_scale(x, k=1): - return 1 / (1 + np.exp(-k * x)) * 100 - -# Original Klipper function to get the PSD data of a raw accelerometer signal -def compute_signal_data(data, max_freq): - calibration_data = calc_freq_response(data) - freqs = calibration_data.freq_bins[calibration_data.freq_bins <= max_freq] - psd = calibration_data.get_psd('all')[calibration_data.freq_bins <= max_freq] - peaks, _ = detect_peaks(psd, freqs) - return SignalData(freqs=freqs, psd=psd, peaks=peaks, paired_peaks=None, unpaired_peaks=None) - - -###################################################################### -# Startup and main routines -###################################################################### - -def parse_log(logname): - with open(logname) as f: - for header in f: - if not header.startswith('#'): - break - if not header.startswith('freq,psd_x,psd_y,psd_z,psd_xyz'): - # Raw accelerometer data - return np.loadtxt(logname, comments='#', delimiter=',') - # Power spectral density data or shaper calibration data - raise ValueError("File %s does not contain raw accelerometer data and therefore " - "is not supported by this script. Please use the official Klipper " - "graph_accelerometer.py script to process it instead." % (logname,)) - - -def setup_klipper_import(kdir): - global shaper_calibrate - kdir = os.path.expanduser(kdir) - sys.path.append(os.path.join(kdir, 'klippy')) - shaper_calibrate = importlib.import_module('.shaper_calibrate', 'extras') - - -def belts_calibration(lognames, klipperdir="~/klipper", max_freq=200.): - setup_klipper_import(klipperdir) - - # Parse data - datas = [parse_log(fn) for fn in lognames] - if len(datas) > 2: - raise ValueError("Incorrect number of .csv files used (this function needs two files to compare them)") - - # Compute calibration data for the two datasets with automatic peaks detection - signal1 = compute_signal_data(datas[0], max_freq) - signal2 = compute_signal_data(datas[1], max_freq) - - # Pair the peaks across the two datasets - paired_peaks, unpaired_peaks1, unpaired_peaks2 = pair_peaks(signal1.peaks, signal1.freqs, signal1.psd, - signal2.peaks, signal2.freqs, signal2.psd) - signal1 = signal1._replace(paired_peaks=paired_peaks, unpaired_peaks=unpaired_peaks1) - signal2 = signal2._replace(paired_peaks=paired_peaks, unpaired_peaks=unpaired_peaks2) - - fig = matplotlib.pyplot.figure() - gs = matplotlib.gridspec.GridSpec(2, 1, height_ratios=[4, 3]) - ax1 = fig.add_subplot(gs[0]) - ax2 = fig.add_subplot(gs[1]) - - # Add title - title_line1 = "RELATIVE BELT CALIBRATION TOOL" - fig.text(0.12, 0.965, title_line1, ha='left', va='bottom', fontsize=20, color=KLIPPAIN_COLORS['purple'], weight='bold') - try: - filename = lognames[0].split('/')[-1] - dt = datetime.strptime(f"{filename.split('_')[1]} {filename.split('_')[2]}", "%Y%m%d %H%M%S") - title_line2 = dt.strftime('%x %X') - except: - print("Warning: CSV filenames look to be different than expected (%s , %s)" % (lognames[0], lognames[1])) - title_line2 = lognames[0].split('/')[-1] + " / " + lognames[1].split('/')[-1] - fig.text(0.12, 0.957, title_line2, ha='left', va='top', fontsize=16, color=KLIPPAIN_COLORS['dark_purple']) - - # Plot the graphs - similarity_factor, _ = plot_compare_frequency(ax1, lognames, signal1, signal2, max_freq) - plot_difference_spectrogram(ax2, datas[0], datas[1], signal1, signal2, similarity_factor, max_freq) - - fig.set_size_inches(8.3, 11.6) - fig.tight_layout() - fig.subplots_adjust(top=0.89) - - # Adding a small Klippain logo to the top left corner of the figure - ax_logo = fig.add_axes([0.001, 0.899, 0.1, 0.1], anchor='NW', zorder=-1) - ax_logo.imshow(matplotlib.pyplot.imread(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'klippain.png'))) - ax_logo.axis('off') - - return fig - - -def main(): - # Parse command-line arguments - usage = "%prog [options] " - opts = optparse.OptionParser(usage) - opts.add_option("-o", "--output", type="string", dest="output", - default=None, help="filename of output graph") - opts.add_option("-f", "--max_freq", type="float", default=200., - help="maximum frequency to graph") - opts.add_option("-k", "--klipper_dir", type="string", dest="klipperdir", - default="~/klipper", help="main klipper directory") - options, args = opts.parse_args() - if len(args) < 1: - opts.error("Incorrect number of arguments") - if options.output is None: - opts.error("You must specify an output file.png to use the script (option -o)") - - fig = belts_calibration(args, options.klipperdir, options.max_freq) - fig.savefig(options.output) - - -if __name__ == '__main__': - main() diff --git a/scripts/is_workflow/graph_shaper.py b/scripts/is_workflow/graph_shaper.py deleted file mode 100755 index fdada5fa3..000000000 --- a/scripts/is_workflow/graph_shaper.py +++ /dev/null @@ -1,395 +0,0 @@ -#!/usr/bin/env python3 - -################################################# -######## INPUT SHAPER CALIBRATION SCRIPT ######## -################################################# -# Derived from the calibrate_shaper.py official Klipper script -# Copyright (C) 2020 Dmitry Butyugin -# Copyright (C) 2020 Kevin O'Connor -# -# Written by Frix_x#0161 # -# @version: 2.0 - -# CHANGELOG: -# v2.0: updated the script to align it to the new K-Shake&Tune module -# v1.1: - improved the damping ratio computation with linear approximation for more precision -# - reworked the top graph to add more information to it with colored zones, -# automated peak detection, etc... -# - added a full spectrogram of the signal on the bottom to allow deeper analysis -# v1.0: first version of this script inspired from the official Klipper -# shaper calibration script to add an automatic damping ratio estimation to it - - -# Be sure to make this script executable using SSH: type 'chmod +x ./graph_shaper.py' when in the folder! - -##################################################################### -################ !!! DO NOT EDIT BELOW THIS LINE !!! ################ -##################################################################### - -import optparse, matplotlib, sys, importlib, os, math -from textwrap import wrap -import numpy as np -import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager -import matplotlib.ticker, matplotlib.gridspec -import locale -from datetime import datetime - -matplotlib.use('Agg') - - -PEAKS_DETECTION_THRESHOLD = 0.05 -PEAKS_EFFECT_THRESHOLD = 0.12 -SPECTROGRAM_LOW_PERCENTILE_FILTER = 5 -MAX_SMOOTHING = 0.1 - -KLIPPAIN_COLORS = { - "purple": "#70088C", - "dark_purple": "#150140", - "dark_orange": "#F24130" -} - - -# Set the best locale for time and date formating (generation of the titles) -try: - locale.setlocale(locale.LC_TIME, locale.getdefaultlocale()) -except locale.Error: - locale.setlocale(locale.LC_TIME, 'C') - -# Override the built-in print function to avoid problem in Klipper due to locale settings -original_print = print -def print_with_c_locale(*args, **kwargs): - original_locale = locale.setlocale(locale.LC_ALL, None) - locale.setlocale(locale.LC_ALL, 'C') - original_print(*args, **kwargs) - locale.setlocale(locale.LC_ALL, original_locale) -print = print_with_c_locale - - -###################################################################### -# Computation -###################################################################### - -# Find the best shaper parameters using Klipper's official algorithm selection -def calibrate_shaper_with_damping(datas, max_smoothing): - helper = shaper_calibrate.ShaperCalibrate(printer=None) - - calibration_data = helper.process_accelerometer_data(datas[0]) - for data in datas[1:]: - calibration_data.add_data(helper.process_accelerometer_data(data)) - - calibration_data.normalize_to_frequencies() - - shaper, all_shapers = helper.find_best_shaper(calibration_data, max_smoothing, print) - - freqs = calibration_data.freq_bins - psd = calibration_data.psd_sum - fr, zeta = compute_damping_ratio(psd, freqs) - - print("Recommended shaper is %s @ %.1f Hz" % (shaper.name, shaper.freq)) - print("Axis has a main resonant frequency at %.1fHz with an estimated damping ratio of %.3f" % (fr, zeta)) - - return shaper.name, all_shapers, calibration_data, fr, zeta - - -# Compute damping ratio by using the half power bandwidth method with interpolated frequencies -def compute_damping_ratio(psd, freqs): - max_power_index = np.argmax(psd) - fr = freqs[max_power_index] - max_power = psd[max_power_index] - - half_power = max_power / math.sqrt(2) - idx_below = np.where(psd[:max_power_index] <= half_power)[0][-1] - idx_above = np.where(psd[max_power_index:] <= half_power)[0][0] + max_power_index - freq_below_half_power = freqs[idx_below] + (half_power - psd[idx_below]) * (freqs[idx_below + 1] - freqs[idx_below]) / (psd[idx_below + 1] - psd[idx_below]) - freq_above_half_power = freqs[idx_above - 1] + (half_power - psd[idx_above - 1]) * (freqs[idx_above] - freqs[idx_above - 1]) / (psd[idx_above] - psd[idx_above - 1]) - - bandwidth = freq_above_half_power - freq_below_half_power - zeta = bandwidth / (2 * fr) - - return fr, zeta - - -def compute_spectrogram(data): - N = data.shape[0] - Fs = N / (data[-1,0] - data[0,0]) - # Round up to a power of 2 for faster FFT - M = 1 << int(.5 * Fs - 1).bit_length() - window = np.kaiser(M, 6.) - def _specgram(x): - return matplotlib.mlab.specgram( - x, Fs=Fs, NFFT=M, noverlap=M//2, window=window, - mode='psd', detrend='mean', scale_by_freq=False) - - d = {'x': data[:,1], 'y': data[:,2], 'z': data[:,3]} - pdata, bins, t = _specgram(d['x']) - for ax in 'yz': - pdata += _specgram(d[ax])[0] - return pdata, bins, t - - -# This find all the peaks in a curve by looking at when the derivative term goes from positive to negative -# Then only the peaks found above a threshold are kept to avoid capturing peaks in the low amplitude noise of a signal -# An added "virtual" threshold allow me to quantify in an opiniated way the peaks that "could have" effect on the printer -# behavior and are likely known to produce or contribute to the ringing/ghosting in printed parts -def detect_peaks(psd, freqs, window_size=5, vicinity=3): - # Smooth the curve using a moving average to avoid catching peaks everywhere in noisy signals - kernel = np.ones(window_size) / window_size - smoothed_psd = np.convolve(psd, kernel, mode='valid') - mean_pad = [np.mean(psd[:window_size])] * (window_size // 2) - smoothed_psd = np.concatenate((mean_pad, smoothed_psd)) - - # Find peaks on the smoothed curve - smoothed_peaks = np.where((smoothed_psd[:-2] < smoothed_psd[1:-1]) & (smoothed_psd[1:-1] > smoothed_psd[2:]))[0] + 1 - detection_threshold = PEAKS_DETECTION_THRESHOLD * psd.max() - effect_threshold = PEAKS_EFFECT_THRESHOLD * psd.max() - smoothed_peaks = smoothed_peaks[smoothed_psd[smoothed_peaks] > detection_threshold] - - # Refine peak positions on the original curve - refined_peaks = [] - for peak in smoothed_peaks: - local_max = peak + np.argmax(psd[max(0, peak-vicinity):min(len(psd), peak+vicinity+1)]) - vicinity - refined_peaks.append(local_max) - - peak_freqs = ["{:.1f}".format(f) for f in freqs[refined_peaks]] - - num_peaks = len(refined_peaks) - num_peaks_above_effect_threshold = np.sum(psd[refined_peaks] > effect_threshold) - - print("Peaks detected on the graph: %d @ %s Hz (%d above effect threshold)" % (num_peaks, ", ".join(map(str, peak_freqs)), num_peaks_above_effect_threshold)) - - return np.array(refined_peaks), num_peaks, num_peaks_above_effect_threshold - - -###################################################################### -# Graphing -###################################################################### - -def plot_freq_response_with_damping(ax, calibration_data, shapers, performance_shaper, fr, zeta, max_freq): - freqs = calibration_data.freq_bins - psd = calibration_data.psd_sum[freqs <= max_freq] - px = calibration_data.psd_x[freqs <= max_freq] - py = calibration_data.psd_y[freqs <= max_freq] - pz = calibration_data.psd_z[freqs <= max_freq] - freqs = freqs[freqs <= max_freq] - - fontP = matplotlib.font_manager.FontProperties() - fontP.set_size('x-small') - - ax.set_xlabel('Frequency (Hz)') - ax.set_xlim([0, max_freq]) - ax.set_ylabel('Power spectral density') - ax.set_ylim([0, psd.max() + psd.max() * 0.05]) - - ax.plot(freqs, psd, label='X+Y+Z', color='purple') - ax.plot(freqs, px, label='X', color='red') - ax.plot(freqs, py, label='Y', color='green') - ax.plot(freqs, pz, label='Z', color='blue') - - ax.xaxis.set_minor_locator(matplotlib.ticker.MultipleLocator(5)) - ax.yaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator()) - ax.ticklabel_format(axis='y', style='scientific', scilimits=(0,0)) - ax.grid(which='major', color='grey') - ax.grid(which='minor', color='lightgrey') - - ax2 = ax.twinx() - ax2.yaxis.set_visible(False) - - lowvib_shaper_vibrs = float('inf') - lowvib_shaper = None - lowvib_shaper_freq = None - lowvib_shaper_accel = 0 - - # Draw the shappers curves and add their specific parameters in the legend - # This adds also a way to find the best shaper with a low level of vibrations (with a resonable level of smoothing) - for shaper in shapers: - shaper_max_accel = round(shaper.max_accel / 100.) * 100. - label = "%s (%.1f Hz, vibr=%.1f%%, sm~=%.2f, accel<=%.f)" % ( - shaper.name.upper(), shaper.freq, - shaper.vibrs * 100., shaper.smoothing, - shaper_max_accel) - ax2.plot(freqs, shaper.vals, label=label, linestyle='dotted') - - # Get the performance shaper - if shaper.name == performance_shaper: - performance_shaper_freq = shaper.freq - performance_shaper_vibr = shaper.vibrs * 100. - performance_shaper_vals = shaper.vals - - # Get the low vibration shaper - if (shaper.vibrs * 100 < lowvib_shaper_vibrs or (shaper.vibrs * 100 == lowvib_shaper_vibrs and shaper_max_accel > lowvib_shaper_accel)) and shaper.smoothing < MAX_SMOOTHING: - lowvib_shaper_accel = shaper_max_accel - lowvib_shaper = shaper.name - lowvib_shaper_freq = shaper.freq - lowvib_shaper_vibrs = shaper.vibrs * 100 - lowvib_shaper_vals = shaper.vals - - # User recommendations are added to the legend: one is Klipper's original suggestion that is usually good for performances - # and the other one is the custom "low vibration" recommendation that looks for a suitable shaper that doesn't have excessive - # smoothing and that have a lower vibration level. If both recommendation are the same shaper, or if no suitable "low - # vibration" shaper is found, then only a single line as the "best shaper" recommendation is added to the legend - if lowvib_shaper != None and lowvib_shaper != performance_shaper and lowvib_shaper_vibrs <= performance_shaper_vibr: - ax2.plot([], [], ' ', label="Recommended performance shaper: %s @ %.1f Hz" % (performance_shaper.upper(), performance_shaper_freq)) - ax.plot(freqs, psd * performance_shaper_vals, label='With %s applied' % (performance_shaper.upper()), color='cyan') - ax2.plot([], [], ' ', label="Recommended low vibrations shaper: %s @ %.1f Hz" % (lowvib_shaper.upper(), lowvib_shaper_freq)) - ax.plot(freqs, psd * lowvib_shaper_vals, label='With %s applied' % (lowvib_shaper.upper()), color='lime') - else: - ax2.plot([], [], ' ', label="Recommended best shaper: %s @ %.1f Hz" % (performance_shaper.upper(), performance_shaper_freq)) - ax.plot(freqs, psd * performance_shaper_vals, label='With %s applied' % (performance_shaper.upper()), color='cyan') - - # And the estimated damping ratio is finally added at the end of the legend - ax2.plot([], [], ' ', label="Estimated damping ratio (ζ): %.3f" % (zeta)) - - # Draw the detected peaks and name them - # This also draw the detection threshold and warning threshold (aka "effect zone") - peaks, _, _ = detect_peaks(psd, freqs) - peaks_warning_threshold = PEAKS_DETECTION_THRESHOLD * psd.max() - peaks_effect_threshold = PEAKS_EFFECT_THRESHOLD * psd.max() - - ax.plot(freqs[peaks], psd[peaks], "x", color='black', markersize=8) - for idx, peak in enumerate(peaks): - if psd[peak] > peaks_effect_threshold: - fontcolor = 'red' - fontweight = 'bold' - else: - fontcolor = 'black' - fontweight = 'normal' - ax.annotate(f"{idx+1}", (freqs[peak], psd[peak]), - textcoords="offset points", xytext=(8, 5), - ha='left', fontsize=13, color=fontcolor, weight=fontweight) - ax.axhline(y=peaks_warning_threshold, color='black', linestyle='--', linewidth=0.5) - ax.axhline(y=peaks_effect_threshold, color='black', linestyle='--', linewidth=0.5) - ax.fill_between(freqs, 0, peaks_warning_threshold, color='green', alpha=0.15, label='Relax Region') - ax.fill_between(freqs, peaks_warning_threshold, peaks_effect_threshold, color='orange', alpha=0.2, label='Warning Region') - - - # Add the main resonant frequency and damping ratio of the axis to the graph title - ax.set_title("Axis Frequency Profile (ω0=%.1fHz, ζ=%.3f)" % (fr, zeta), fontsize=14, color=KLIPPAIN_COLORS['dark_orange'], weight='bold') - ax.legend(loc='upper left', prop=fontP) - ax2.legend(loc='upper right', prop=fontP) - - return freqs[peaks] - - -# Plot a time-frequency spectrogram to see how the system respond over time during the -# resonnance test. This can highlight hidden spots from the standard PSD graph from other harmonics -def plot_spectrogram(ax, data, peaks, max_freq): - pdata, bins, t = compute_spectrogram(data) - - # We need to normalize the data to get a proper signal on the spectrogram - # However, while using "LogNorm" provide too much background noise, using - # "Normalize" make only the resonnance appearing and hide interesting elements - # So we need to filter out the lower part of the data (ie. find the proper vmin for LogNorm) - vmin_value = np.percentile(pdata, SPECTROGRAM_LOW_PERCENTILE_FILTER) - - ax.set_title("Time-Frequency Spectrogram", fontsize=14, color=KLIPPAIN_COLORS['dark_orange'], weight='bold') - ax.pcolormesh(bins, t, pdata.T, norm=matplotlib.colors.LogNorm(vmin=vmin_value), - cmap='inferno', shading='gouraud') - - # Add peaks lines in the spectrogram to get hint from peaks found in the first graph - if peaks is not None: - for idx, peak in enumerate(peaks): - ax.axvline(peak, color='cyan', linestyle='dotted', linewidth=0.75) - ax.annotate(f"Peak {idx+1}", (peak, t[-1]*0.9), - textcoords="data", color='cyan', rotation=90, fontsize=10, - verticalalignment='top', horizontalalignment='right') - - ax.set_xlim([0., max_freq]) - ax.set_ylabel('Time (s)') - ax.set_xlabel('Frequency (Hz)') - - return - - -###################################################################### -# Startup and main routines -###################################################################### - -def parse_log(logname): - with open(logname) as f: - for header in f: - if not header.startswith('#'): - break - if not header.startswith('freq,psd_x,psd_y,psd_z,psd_xyz'): - # Raw accelerometer data - return np.loadtxt(logname, comments='#', delimiter=',') - # Power spectral density data or shaper calibration data - raise ValueError("File %s does not contain raw accelerometer data and therefore " - "is not supported by this script. Please use the official Klipper " - "calibrate_shaper.py script to process it instead." % (logname,)) - - -def setup_klipper_import(kdir): - global shaper_calibrate - kdir = os.path.expanduser(kdir) - sys.path.append(os.path.join(kdir, 'klippy')) - shaper_calibrate = importlib.import_module('.shaper_calibrate', 'extras') - - -def shaper_calibration(lognames, klipperdir="~/klipper", max_smoothing=None, max_freq=200.): - setup_klipper_import(klipperdir) - - # Parse data - datas = [parse_log(fn) for fn in lognames] - - # Calibrate shaper and generate outputs - performance_shaper, shapers, calibration_data, fr, zeta = calibrate_shaper_with_damping(datas, max_smoothing) - - fig = matplotlib.pyplot.figure() - gs = matplotlib.gridspec.GridSpec(2, 1, height_ratios=[4, 3]) - ax1 = fig.add_subplot(gs[0]) - ax2 = fig.add_subplot(gs[1]) - - # Add title - title_line1 = "INPUT SHAPER CALIBRATION TOOL" - fig.text(0.12, 0.965, title_line1, ha='left', va='bottom', fontsize=20, color=KLIPPAIN_COLORS['purple'], weight='bold') - try: - filename_parts = (lognames[0].split('/')[-1]).split('_') - dt = datetime.strptime(f"{filename_parts[1]} {filename_parts[2]}", "%Y%m%d %H%M%S") - title_line2 = dt.strftime('%x %X') + ' -- ' + filename_parts[3].upper().split('.')[0] + ' axis' - except: - print("Warning: CSV filename look to be different than expected (%s)" % (lognames[0])) - title_line2 = lognames[0].split('/')[-1] - fig.text(0.12, 0.957, title_line2, ha='left', va='top', fontsize=16, color=KLIPPAIN_COLORS['dark_purple']) - - # Plot the graphs - peaks = plot_freq_response_with_damping(ax1, calibration_data, shapers, performance_shaper, fr, zeta, max_freq) - plot_spectrogram(ax2, datas[0], peaks, max_freq) - - fig.set_size_inches(8.3, 11.6) - fig.tight_layout() - fig.subplots_adjust(top=0.89) - - # Adding a small Klippain logo to the top left corner of the figure - ax_logo = fig.add_axes([0.001, 0.899, 0.1, 0.1], anchor='NW', zorder=-1) - ax_logo.imshow(matplotlib.pyplot.imread(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'klippain.png'))) - ax_logo.axis('off') - - return fig - - -def main(): - # Parse command-line arguments - usage = "%prog [options] " - opts = optparse.OptionParser(usage) - opts.add_option("-o", "--output", type="string", dest="output", - default=None, help="filename of output graph") - opts.add_option("-f", "--max_freq", type="float", default=200., - help="maximum frequency to graph") - opts.add_option("-s", "--max_smoothing", type="float", default=None, - help="maximum shaper smoothing to allow") - opts.add_option("-k", "--klipper_dir", type="string", dest="klipperdir", - default="~/klipper", help="main klipper directory") - options, args = opts.parse_args() - if len(args) < 1: - opts.error("Incorrect number of arguments") - if options.output is None: - opts.error("You must specify an output file.png to use the script (option -o)") - if options.max_smoothing is not None and options.max_smoothing < 0.05: - opts.error("Too small max_smoothing specified (must be at least 0.05)") - - fig = shaper_calibration(args, options.klipperdir, options.max_smoothing, options.max_freq) - fig.savefig(options.output) - - -if __name__ == '__main__': - main() diff --git a/scripts/is_workflow/graph_vibrations.py b/scripts/is_workflow/graph_vibrations.py deleted file mode 100755 index 0ba6a632c..000000000 --- a/scripts/is_workflow/graph_vibrations.py +++ /dev/null @@ -1,439 +0,0 @@ -#!/usr/bin/env python3 - -################################################## -###### SPEED AND VIBRATIONS PLOTTING SCRIPT ###### -################################################## -# Written by Frix_x#0161 # -# @version: 2.0 - -# CHANGELOG: -# v2.0: - updated the script to align it to the new K-Shake&Tune module -# - new features for peaks detection and advised speed zones -# v1.2: fixed a bug that could happen when username is not "pi" (thanks @spikeygg) -# v1.1: better graph formatting -# v1.0: first version of the script - - -# Be sure to make this script executable using SSH: type 'chmod +x ./graph_vibrations.py' when in the folder ! - -##################################################################### -################ !!! DO NOT EDIT BELOW THIS LINE !!! ################ -##################################################################### - -import optparse, matplotlib, re, sys, importlib, os, operator -from collections import OrderedDict -import numpy as np -import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager -import matplotlib.ticker, matplotlib.gridspec -import locale -from datetime import datetime - -matplotlib.use('Agg') - - -PEAKS_DETECTION_THRESHOLD = 0.05 -PEAKS_RELATIVE_HEIGHT_THRESHOLD = 0.04 -VALLEY_DETECTION_THRESHOLD = 0.1 # Lower is more sensitive - -KLIPPAIN_COLORS = { - "purple": "#70088C", - "dark_purple": "#150140", - "dark_orange": "#F24130" -} - - -# Set the best locale for time and date formating (generation of the titles) -try: - locale.setlocale(locale.LC_TIME, locale.getdefaultlocale()) -except locale.Error: - locale.setlocale(locale.LC_TIME, 'C') - -# Override the built-in print function to avoid problem in Klipper due to locale settings -original_print = print -def print_with_c_locale(*args, **kwargs): - original_locale = locale.setlocale(locale.LC_ALL, None) - locale.setlocale(locale.LC_ALL, 'C') - original_print(*args, **kwargs) - locale.setlocale(locale.LC_ALL, original_locale) -print = print_with_c_locale - - -###################################################################### -# Computation -###################################################################### - -def calc_freq_response(data): - # Use Klipper standard input shaper objects to do the computation - helper = shaper_calibrate.ShaperCalibrate(printer=None) - return helper.process_accelerometer_data(data) - - -def calc_psd(datas, group, max_freq): - psd_list = [] - first_freqs = None - signal_axes = ['x', 'y', 'z', 'all'] - - for i in range(0, len(datas), group): - - # Round up to the nearest power of 2 for faster FFT - N = datas[i].shape[0] - T = datas[i][-1,0] - datas[i][0,0] - M = 1 << int((N/T) * 0.5 - 1).bit_length() - if N <= M: - # If there is not enough lines in the array to be able to round up to the - # nearest power of 2, we need to pad some zeros at the end of the array to - # avoid entering a blocking state from Klipper shaper_calibrate.py - datas[i] = np.pad(datas[i], [(0, (M-N)+1), (0, 0)], mode='constant', constant_values=0) - - freqrsp = calc_freq_response(datas[i]) - for n in range(group - 1): - data = datas[i + n + 1] - - # Round up to the nearest power of 2 for faster FFT - N = data.shape[0] - T = data[-1,0] - data[0,0] - M = 1 << int((N/T) * 0.5 - 1).bit_length() - if N <= M: - # If there is not enough lines in the array to be able to round up to the - # nearest power of 2, we need to pad some zeros at the end of the array to - # avoid entering a blocking state from Klipper shaper_calibrate.py - data = np.pad(data, [(0, (M-N)+1), (0, 0)], mode='constant', constant_values=0) - - freqrsp.add_data(calc_freq_response(data)) - - if not psd_list: - # First group, just put it in the result list - first_freqs = freqrsp.freq_bins - psd = freqrsp.psd_sum[first_freqs <= max_freq] - px = freqrsp.psd_x[first_freqs <= max_freq] - py = freqrsp.psd_y[first_freqs <= max_freq] - pz = freqrsp.psd_z[first_freqs <= max_freq] - psd_list.append([psd, px, py, pz]) - else: - # Not the first group, we need to interpolate every new signals - # to the first one to equalize the frequency_bins between them - signal_normalized = dict() - freqs = freqrsp.freq_bins - for axe in signal_axes: - signal = freqrsp.get_psd(axe) - signal_normalized[axe] = np.interp(first_freqs, freqs, signal) - - # Remove data above max_freq on all axes and add to the result list - psd = signal_normalized['all'][first_freqs <= max_freq] - px = signal_normalized['x'][first_freqs <= max_freq] - py = signal_normalized['y'][first_freqs <= max_freq] - pz = signal_normalized['z'][first_freqs <= max_freq] - psd_list.append([psd, px, py, pz]) - - return first_freqs[first_freqs <= max_freq], psd_list - - -def calc_powertot(psd_list, freqs): - pwrtot_sum = [] - pwrtot_x = [] - pwrtot_y = [] - pwrtot_z = [] - - for psd in psd_list: - pwrtot_sum.append(np.trapz(psd[0], freqs)) - pwrtot_x.append(np.trapz(psd[1], freqs)) - pwrtot_y.append(np.trapz(psd[2], freqs)) - pwrtot_z.append(np.trapz(psd[3], freqs)) - - return [pwrtot_sum, pwrtot_x, pwrtot_y, pwrtot_z] - - -# This find all the peaks in a curve by looking at when the derivative term goes from positive to negative -# Then only the peaks found above a threshold are kept to avoid capturing peaks in the low amplitude noise of a signal -# Additionaly, we validate that a peak is a real peak based of its neighbors as we can have pretty flat zones in vibration -# graphs with a lot of false positive due to small "noise" in these flat zones -def detect_peaks(power_total, speeds, window_size=10, vicinity=10): - # Smooth the curve using a moving average to avoid catching peaks everywhere in noisy signals - kernel = np.ones(window_size) / window_size - smoothed_psd = np.convolve(power_total, kernel, mode='valid') - mean_pad = [np.mean(power_total[:window_size])] * (window_size // 2) - smoothed_psd = np.concatenate((mean_pad, smoothed_psd)) - - # Find peaks on the smoothed curve (and excluding the last value of the serie often detected when in a flat zone) - smoothed_peaks = np.where((smoothed_psd[:-3] < smoothed_psd[1:-2]) & (smoothed_psd[1:-2] > smoothed_psd[2:-1]))[0] + 1 - detection_threshold = PEAKS_DETECTION_THRESHOLD * power_total.max() - - valid_peaks = [] - for peak in smoothed_peaks: - peak_height = smoothed_psd[peak] - np.min(smoothed_psd[max(0, peak-vicinity):min(len(smoothed_psd), peak+vicinity+1)]) - if peak_height > PEAKS_RELATIVE_HEIGHT_THRESHOLD * smoothed_psd[peak] and smoothed_psd[peak] > detection_threshold: - valid_peaks.append(peak) - - # Refine peak positions on the original curve - refined_peaks = [] - for peak in valid_peaks: - local_max = peak + np.argmax(power_total[max(0, peak-vicinity):min(len(power_total), peak+vicinity+1)]) - vicinity - refined_peaks.append(local_max) - - peak_speeds = ["{:.1f}".format(speeds[i]) for i in refined_peaks] - num_peaks = len(refined_peaks) - print("Vibrations peaks detected: %d @ %s mm/s (avoid running these speeds in your slicer profile)" % (num_peaks, ", ".join(map(str, peak_speeds)))) - - return np.array(refined_peaks), num_peaks - - -# The goal is to find zone outside of peaks (flat low energy zones) to advise them as good speeds range to use in the slicer -def identify_low_energy_zones(power_total): - valleys = [] - - # Calculate the mean and standard deviation of the entire power_total - mean_energy = np.mean(power_total) - std_energy = np.std(power_total) - - # Define a threshold value as mean minus a certain number of standard deviations - threshold_value = mean_energy - VALLEY_DETECTION_THRESHOLD * std_energy - - # Find valleys in power_total based on the threshold - in_valley = False - start_idx = 0 - for i, value in enumerate(power_total): - if not in_valley and value < threshold_value: - in_valley = True - start_idx = i - elif in_valley and value >= threshold_value: - in_valley = False - valleys.append((start_idx, i)) - - # If the last point is still in a valley, close the valley - if in_valley: - valleys.append((start_idx, len(power_total) - 1)) - - max_signal = np.max(power_total) - - # Calculate mean energy for each valley as a percentage of the maximum of the signal - valley_means_percentage = [] - for start, end in valleys: - if not np.isnan(np.mean(power_total[start:end])): - valley_means_percentage.append((start, end, (np.mean(power_total[start:end]) / max_signal) * 100)) - - # Sort valleys based on mean percentage values - sorted_valleys = sorted(valley_means_percentage, key=lambda x: x[2]) - - return sorted_valleys - - -# Resample the signal to achieve denser data points in order to get more precise valley placing and -# avoid having to use the original sampling of the signal (that is equal to the speed increment used for the test) -def resample_signal(speeds, power_total, new_spacing=0.1): - new_speeds = np.arange(speeds[0], speeds[-1] + new_spacing, new_spacing) - new_power_total = np.interp(new_speeds, speeds, power_total) - return new_speeds, new_power_total - - -###################################################################### -# Graphing -###################################################################### - -def plot_total_power(ax, speeds, power_total): - resampled_speeds, resampled_power_total = resample_signal(speeds, power_total[0]) - - ax.set_title("Vibrations decomposition", fontsize=14, color=KLIPPAIN_COLORS['dark_orange'], weight='bold') - ax.set_xlabel('Speed (mm/s)') - ax.set_ylabel('Energy') - - ax2 = ax.twinx() - ax2.yaxis.set_visible(False) - - power_total_sum = np.array(resampled_power_total) - speed_array = np.array(resampled_speeds) - max_y = power_total_sum.max() + power_total_sum.max() * 0.05 - ax.set_xlim([speed_array.min(), speed_array.max()]) - ax.set_ylim([0, max_y]) - ax2.set_ylim([0, max_y]) - - ax.plot(resampled_speeds, resampled_power_total, label="X+Y+Z", color='purple') - ax.plot(speeds, power_total[1], label="X", color='red') - ax.plot(speeds, power_total[2], label="Y", color='green') - ax.plot(speeds, power_total[3], label="Z", color='blue') - - peaks, num_peaks = detect_peaks(resampled_power_total, resampled_speeds) - low_energy_zones = identify_low_energy_zones(resampled_power_total) - - if peaks.size: - ax.plot(speed_array[peaks], power_total_sum[peaks], "x", color='black', markersize=8) - for idx, peak in enumerate(peaks): - fontcolor = 'red' - fontweight = 'bold' - ax.annotate(f"{idx+1}", (speed_array[peak], power_total_sum[peak]), - textcoords="offset points", xytext=(8, 5), - ha='left', fontsize=13, color=fontcolor, weight=fontweight) - ax2.plot([], [], ' ', label=f'Number of peaks: {num_peaks}') - else: - ax2.plot([], [], ' ', label=f'No peaks detected') - - for idx, (start, end, energy) in enumerate(low_energy_zones): - ax.axvline(speed_array[start], color='red', linestyle='dotted', linewidth=1.5) - ax.axvline(speed_array[end], color='red', linestyle='dotted', linewidth=1.5) - ax2.fill_between(speed_array[start:end], 0, power_total_sum[start:end], color='green', alpha=0.2, label=f'Zone {idx+1}: {speed_array[start]:.1f} to {speed_array[end]:.1f} mm/s (mean energy: {energy:.2f}%)') - - ax.xaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator()) - ax.yaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator()) - ax.grid(which='major', color='grey') - ax.grid(which='minor', color='lightgrey') - fontP = matplotlib.font_manager.FontProperties() - fontP.set_size('small') - ax.legend(loc='upper left', prop=fontP) - ax2.legend(loc='upper right', prop=fontP) - - if peaks.size: - return speed_array[peaks] - else: - return None - - -def plot_spectrogram(ax, speeds, freqs, power_spectral_densities, peaks, max_freq): - spectrum = np.empty([len(freqs), len(speeds)]) - - for i in range(len(speeds)): - for j in range(len(freqs)): - spectrum[j, i] = power_spectral_densities[i][0][j] - - ax.set_title("Vibrations spectrogram", fontsize=14, color=KLIPPAIN_COLORS['dark_orange'], weight='bold') - ax.pcolormesh(speeds, freqs, spectrum, norm=matplotlib.colors.LogNorm(), - cmap='inferno', shading='gouraud') - - # Add peaks lines in the spectrogram to get hint from peaks found in the first graph - if peaks is not None: - for idx, peak in enumerate(peaks): - ax.axvline(peak, color='cyan', linestyle='dotted', linewidth=0.75) - ax.annotate(f"Peak {idx+1}", (peak, freqs[-1]*0.9), - textcoords="data", color='cyan', rotation=90, fontsize=10, - verticalalignment='top', horizontalalignment='right') - - ax.set_ylim([0., max_freq]) - ax.set_ylabel('Frequency (hz)') - ax.set_xlabel('Speed (mm/s)') - - return - - -###################################################################### -# Startup and main routines -###################################################################### - -def parse_log(logname): - with open(logname) as f: - for header in f: - if not header.startswith('#'): - break - if not header.startswith('freq,psd_x,psd_y,psd_z,psd_xyz'): - # Raw accelerometer data - return np.loadtxt(logname, comments='#', delimiter=',') - # Power spectral density data or shaper calibration data - raise ValueError("File %s does not contain raw accelerometer data and therefore " - "is not supported by graph_vibrations.py script. Please use " - "calibrate_shaper.py script to process it instead." % (logname,)) - - -def extract_speed(logname): - try: - speed = re.search('sp(.+?)n', os.path.basename(logname)).group(1).replace('_','.') - except AttributeError: - raise ValueError("File %s does not contain speed in its name and therefore " - "is not supported by graph_vibrations.py script." % (logname,)) - return float(speed) - - -def sort_and_slice(raw_speeds, raw_datas, remove): - # Sort to get the speeds and their datas aligned and in ascending order - raw_speeds, raw_datas = zip(*sorted(zip(raw_speeds, raw_datas), key=operator.itemgetter(0))) - - # Remove beginning and end of the datas for each file to get only - # constant speed data and remove the start/stop phase of the movements - datas = [] - for data in raw_datas: - sliced = round((len(data) * remove / 100) / 2) - datas.append(data[sliced:len(data)-sliced]) - - return raw_speeds, datas - - -def setup_klipper_import(kdir): - global shaper_calibrate - kdir = os.path.expanduser(kdir) - sys.path.append(os.path.join(kdir, 'klippy')) - shaper_calibrate = importlib.import_module('.shaper_calibrate', 'extras') - - -def vibrations_calibration(lognames, klipperdir="~/klipper", axisname=None, max_freq=1000., remove=0): - setup_klipper_import(klipperdir) - - # Parse the raw data and get them ready for analysis - raw_datas = [parse_log(filename) for filename in lognames] - raw_speeds = [extract_speed(filename) for filename in lognames] - speeds, datas = sort_and_slice(raw_speeds, raw_datas, remove) - - # As we assume that we have the same number of file for each speeds. We can group - # the PSD results by this number (to combine vibrations at given speed on all movements) - group_by = speeds.count(speeds[0]) - # Compute psd and total power of the signal - freqs, power_spectral_densities = calc_psd(datas, group_by, max_freq) - power_total = calc_powertot(power_spectral_densities, freqs) - - fig = matplotlib.pyplot.figure() - gs = matplotlib.gridspec.GridSpec(2, 1, height_ratios=[4, 3]) - ax1 = fig.add_subplot(gs[0]) - ax2 = fig.add_subplot(gs[1]) - - title_line1 = "VIBRATIONS MEASUREMENT TOOL" - fig.text(0.12, 0.965, title_line1, ha='left', va='bottom', fontsize=20, color=KLIPPAIN_COLORS['purple'], weight='bold') - try: - filename_parts = (lognames[0].split('/')[-1]).split('_') - dt = datetime.strptime(f"{filename_parts[1]} {filename_parts[2].split('-')[0]}", "%Y%m%d %H%M%S") - title_line2 = dt.strftime('%x %X') + ' -- ' + axisname.upper() + ' axis' - except: - print("Warning: CSV filename look to be different than expected (%s)" % (lognames[0])) - title_line2 = lognames[0].split('/')[-1] - fig.text(0.12, 0.957, title_line2, ha='left', va='top', fontsize=16, color=KLIPPAIN_COLORS['dark_purple']) - - # Remove speeds duplicates and graph the processed datas - speeds = list(OrderedDict((x, True) for x in speeds).keys()) - - peaks = plot_total_power(ax1, speeds, power_total) - plot_spectrogram(ax2, speeds, freqs, power_spectral_densities, peaks, max_freq) - - fig.set_size_inches(8.3, 11.6) - fig.tight_layout() - fig.subplots_adjust(top=0.89) - - # Adding a small Klippain logo to the top left corner of the figure - ax_logo = fig.add_axes([0.001, 0.899, 0.1, 0.1], anchor='NW', zorder=-1) - ax_logo.imshow(matplotlib.pyplot.imread(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'klippain.png'))) - ax_logo.axis('off') - - return fig - - -def main(): - # Parse command-line arguments - usage = "%prog [options] " - opts = optparse.OptionParser(usage) - opts.add_option("-o", "--output", type="string", dest="output", - default=None, help="filename of output graph") - opts.add_option("-a", "--axis", type="string", dest="axisname", - default=None, help="axis name to be shown on the side of the graph") - opts.add_option("-f", "--max_freq", type="float", default=1000., - help="maximum frequency to graph") - opts.add_option("-r", "--remove", type="int", default=0, - help="percentage of data removed at start/end of each files") - opts.add_option("-k", "--klipper_dir", type="string", dest="klipperdir", - default="~/klipper", help="main klipper directory") - options, args = opts.parse_args() - if len(args) < 1: - opts.error("No CSV file(s) to analyse") - if options.output is None: - opts.error("You must specify an output file.png to use the script (option -o)") - if options.remove > 50 or options.remove < 0: - opts.error("You must specify a correct percentage (option -r) in the 0-50 range") - - fig = vibrations_calibration(args, options.klipperdir, options.axisname, options.max_freq, options.remove) - fig.savefig(options.output) - - -if __name__ == '__main__': - main() diff --git a/scripts/is_workflow/is_workflow.py b/scripts/is_workflow/is_workflow.py deleted file mode 100755 index be38addb2..000000000 --- a/scripts/is_workflow/is_workflow.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/env python3 -############################################ -###### INPUT SHAPER KLIPPAIN WORKFLOW ###### -############################################ -# Written by Frix_x#0161 # -# @version: 2.0 - -# CHANGELOG: -# v2.0: new version of this as a Python script (to replace the old bash script) and implement the newer and improved shaper plotting scripts -# v1.7: updated the handling of shaper files to account for the new analysis scripts as we are now using raw data directly -# v1.6: - updated the handling of shaper graph files to be able to optionnaly account for added positions in the filenames and remove them -# - fixed a bug in the belt graph on slow SD card or Pi clones (Klipper was still writing in the file while we were already reading it) -# v1.5: fixed klipper unnexpected fail at the end of the execution, even if graphs were correctly generated (unicode decode error fixed) -# v1.4: added the ~/klipper dir parameter to the call of graph_vibrations.py for a better user handling (in case user is not "pi") -# v1.3: some documentation improvement regarding the line endings that needs to be LF for this file -# v1.2: added the movement name to be transfered to the Python script in vibration calibration (to print it on the result graphs) -# v1.1: multiple fixes and tweaks (mainly to avoid having empty files read by the python scripts after the mv command) -# v1.0: first version of the script based on a Zellneralex script - -# Usage: -# This script was designed to be used with gcode_shell_commands directly from Klipper -# Parameters availables: -# BELTS - To generate belts diagrams after calling the Klipper TEST_RESONANCES AXIS=1,(-)1 OUTPUT=raw_data -# SHAPER - To generate input shaper diagrams after calling the Klipper TEST_RESONANCES AXIS=X/Y OUTPUT=raw_data -# VIBRATIONS - To generate vibration diagram after calling the custom (Frix_x#0161) VIBRATIONS_CALIBRATION macro - - - -import os -import time -import glob -import sys -import shutil -import tarfile -from datetime import datetime - -################################################################################################################# -RESULTS_FOLDER = os.path.expanduser('~/printer_data/config/K-ShakeTune_results') -KLIPPER_FOLDER = os.path.expanduser('~/klipper') -STORE_RESULTS = 3 -################################################################################################################# - -from graph_belts import belts_calibration -from graph_shaper import shaper_calibration -from graph_vibrations import vibrations_calibration - -RESULTS_SUBFOLDERS = ['belts', 'inputshaper', 'vibrations'] - - -def is_file_open(filepath): - for proc in os.listdir('/proc'): - if proc.isdigit(): - for fd in glob.glob(f'/proc/{proc}/fd/*'): - try: - if os.path.samefile(fd, filepath): - return True - except FileNotFoundError: - pass - return False - - -def get_belts_graph(): - current_date = datetime.now().strftime('%Y%m%d_%H%M%S') - lognames = [] - - globbed_files = glob.glob('/tmp/raw_data_axis*.csv') - if not globbed_files: - print("No CSV files found in the /tmp folder to create the belt graphs!") - sys.exit(1) - if len(globbed_files) < 2: - print("Not enough CSV files found in the /tmp folder. Two files are required for the belt graphs!") - sys.exit(1) - sorted_files = sorted(globbed_files, key=os.path.getmtime, reverse=True) - - for filename in sorted_files[:2]: - # Wait for the file handler to be released by Klipper - while is_file_open(filename): - time.sleep(3) - - # Extract the tested belt from the filename and rename/move the CSV file to the result folder - belt = os.path.basename(filename).split('_')[3].split('.')[0].upper() - new_file = os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[0], f'belt_{current_date}_{belt}.csv') - shutil.move(filename, new_file) - - # Save the file path for later - lognames.append(new_file) - - # Generate the belts graph and its name - fig = belts_calibration(lognames, KLIPPER_FOLDER) - png_filename = os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[0], f'belts_{current_date}.png') - - return fig, png_filename - - -def get_shaper_graph(): - current_date = datetime.now().strftime('%Y%m%d_%H%M%S') - - # Get all the files and sort them based on last modified time to select the most recent one - globbed_files = glob.glob('/tmp/raw_data*.csv') - if not globbed_files: - print("No CSV files found in the /tmp folder to create the input shaper graphs!") - sys.exit(1) - sorted_files = sorted(globbed_files, key=os.path.getmtime, reverse=True) - filename = sorted_files[0] - - # Wait for the file handler to be released by Klipper - while is_file_open(filename): - time.sleep(3) - - # Extract the tested axis from the filename and rename/move the CSV file to the result folder - axis = os.path.basename(filename).split('_')[3].split('.')[0].upper() - new_file = os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[1], f'resonances_{current_date}_{axis}.csv') - shutil.move(filename, new_file) - - # Generate the shaper graph and its name - fig = shaper_calibration([new_file], KLIPPER_FOLDER) - png_filename = os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[1], f'resonances_{current_date}_{axis}.png') - - return fig, png_filename - - -def get_vibrations_graph(axis_name): - current_date = datetime.now().strftime('%Y%m%d_%H%M%S') - lognames = [] - - globbed_files = glob.glob('/tmp/adxl345-*.csv') - if not globbed_files: - print("No CSV files found in the /tmp folder to create the vibration graphs!") - sys.exit(1) - if len(globbed_files) < 3: - print("Not enough CSV files found in the /tmp folder. At least 3 files are required for the vibration graphs!") - sys.exit(1) - - for filename in globbed_files: - # Wait for the file handler to be released by Klipper - while is_file_open(filename): - time.sleep(3) - - # Cleanup of the filename and moving it in the result folder - cleanfilename = os.path.basename(filename).replace('adxl345', f'vibr_{current_date}') - new_file = os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[2], cleanfilename) - shutil.move(filename, new_file) - - # Save the file path for later - lognames.append(new_file) - - # Sync filesystem to avoid problems as there is a lot of file copied - os.sync() - - # Generate the vibration graph and its name - fig = vibrations_calibration(lognames, KLIPPER_FOLDER, axis_name) - png_filename = os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[2], f'vibrations_{current_date}_{axis_name}.png') - - # Archive all the csv files in a tarball and remove them to clean up the results folder - with tarfile.open(os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[2], f'vibrations_{current_date}_{axis_name}.tar.gz'), 'w:gz') as tar: - for csv_file in glob.glob(os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[2], f'vibr_{current_date}*.csv')): - tar.add(csv_file, recursive=False) - os.remove(csv_file) - - return fig, png_filename - - -# Utility function to get old files based on their modification time -def get_old_files(folder, extension, limit): - files = [os.path.join(folder, f) for f in os.listdir(folder) if f.endswith(extension)] - files.sort(key=lambda x: os.path.getmtime(x), reverse=True) - return files[limit:] - -def clean_files(): - # Define limits based on STORE_RESULTS - keep1 = STORE_RESULTS + 1 - keep2 = 2 * STORE_RESULTS + 1 - - # Find old files in each directory - old_belts_files = get_old_files(os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[0]), '.png', keep1) - old_inputshaper_files = get_old_files(os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[1]), '.png', keep2) - old_vibrations_files = get_old_files(os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[2]), '.png', keep1) - - # Remove the old belt files - for old_file in old_belts_files: - file_date = "_".join(os.path.splitext(os.path.basename(old_file))[0].split('_')[1:3]) - for suffix in ['A', 'B']: - csv_file = os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[0], f'belt_{file_date}_{suffix}.csv') - if os.path.exists(csv_file): - os.remove(csv_file) - os.remove(old_file) - - # Remove the old shaper files - for old_file in old_inputshaper_files: - csv_file = os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[1], os.path.splitext(os.path.basename(old_file))[0] + ".csv") - if os.path.exists(csv_file): - os.remove(csv_file) - os.remove(old_file) - - # Remove the old vibrations files - for old_file in old_vibrations_files: - os.remove(old_file) - tar_file = os.path.join(RESULTS_FOLDER, RESULTS_SUBFOLDERS[2], os.path.splitext(os.path.basename(old_file))[0] + ".tar.gz") - if os.path.exists(tar_file): - os.remove(tar_file) - - -def main(): - # Check if results folders are there or create them - for result_subfolder in RESULTS_SUBFOLDERS: - folder = os.path.join(RESULTS_FOLDER, result_subfolder) - if not os.path.exists(folder): - os.makedirs(folder) - - if len(sys.argv) < 2: - print("Usage: plot_graphs.py [SHAPER|BELTS|VIBRATIONS]") - sys.exit(1) - - if sys.argv[1].lower() == 'belts': - fig, png_filename = get_belts_graph() - elif sys.argv[1].lower() == 'shaper': - fig, png_filename = get_shaper_graph() - elif sys.argv[1].lower() == 'vibrations': - fig, png_filename = get_vibrations_graph(axis_name=sys.argv[2]) - else: - print("Usage: plot_graphs.py [SHAPER|BELTS|VIBRATIONS]") - sys.exit(1) - - fig.savefig(png_filename) - - clean_files() - print(f"Graphs created. You will find the results in {RESULTS_FOLDER}") - - -if __name__ == '__main__': - main() diff --git a/scripts/is_workflow/is_workflow_cmd.cfg b/scripts/is_workflow/is_workflow_cmd.cfg deleted file mode 100644 index be19f8a8e..000000000 --- a/scripts/is_workflow/is_workflow_cmd.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[gcode_shell_command plot_graph] -command: ~/printer_data/config/scripts/is_workflow/is_workflow.py -timeout: 600.0 -verbose: True diff --git a/scripts/is_workflow/klippain.png b/scripts/is_workflow/klippain.png deleted file mode 100644 index 7b8ce84a9..000000000 Binary files a/scripts/is_workflow/klippain.png and /dev/null differ diff --git a/scripts/shell_commands.cfg b/scripts/shell_commands.cfg index c6723f0a1..5bc2bc88b 100644 --- a/scripts/shell_commands.cfg +++ b/scripts/shell_commands.cfg @@ -6,5 +6,3 @@ command: ~/printer_data/config/scripts/system_info.py timeout: 5.0 verbose: True - -[include is_workflow/is_workflow_cmd.cfg] diff --git a/uninstall.sh b/uninstall.sh index 71d543575..378e251ea 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -82,6 +82,11 @@ function delete_current_klippain { function restore_latest_backup { local restore_backup latest_backup + if [[ ! -e "${BACKUP_PATH}" ]]; then + printf "[RESTORE] No backup folder found! Skipping...\n\n" + return + fi + read < /dev/tty -rp "[RESTORE] Would you like to restore your last config backup? This script will look for the last one before running Klippain (Y/n) " restore_backup if [[ -z "$restore_backup" ]]; then restore_backup="y" @@ -94,7 +99,7 @@ function restore_latest_backup { return fi - latest_backup=$(find ${BACKUP_PATH} -type d -not -path "${BACKUP_PATH}" -exec sh -c 'if [ ! -f "$1/.VERSION" ]; then echo "$1"; fi' sh {} \; | sort -r | head -n 1) + latest_backup=$(find ${BACKUP_PATH} -maxdepth 1 -type d -not -path "${BACKUP_PATH}" -exec sh -c 'if [ ! -f "$1/.VERSION" ]; then echo "$1"; fi' sh {} \; | sort -r | head -n 1) if [ -n "${latest_backup}" ]; then cp -fa ${latest_backup}/. ${USER_CONFIG_PATH} 2>/dev/null || : printf "[RESTORE] Latest backup restored from: ${latest_backup}\n\n" diff --git a/user_templates/mcu.cfg b/user_templates/mcu.cfg index 94aa22eb9..cd9439758 100644 --- a/user_templates/mcu.cfg +++ b/user_templates/mcu.cfg @@ -36,6 +36,9 @@ # [include config/hardware/axis/Z/TMC/TMC2240_1-Motor.cfg] # [include config/hardware/axis/Z/TMC/TMC2240_3-Motors.cfg] # [include config/hardware/axis/Z/TMC/TMC2240_4-Motors.cfg] +# [include config/hardware/axis/Z/TMC/TMC5160_1-Motor.cfg] +# [include config/hardware/axis/Z/TMC/TMC5160_3-Motors.cfg] +# [include config/hardware/axis/Z/TMC/TMC5160_4-Motors.cfg] # ---------------------------------------------------------------------------------------- @@ -44,4 +47,3 @@ # [include config/hardware/extruder/TMC/TMC2209.cfg] # [include config/hardware/extruder/TMC/TMC2240.cfg] # ---------------------------------------------------------------------------------------- - diff --git a/user_templates/mcu_defaults/ercf/BTT_MMB_CAN_v1.0.cfg b/user_templates/mcu_defaults/ercf/BTT_MMB_CAN_v1.0.cfg deleted file mode 100644 index 5e665890b..000000000 --- a/user_templates/mcu_defaults/ercf/BTT_MMB_CAN_v1.0.cfg +++ /dev/null @@ -1,31 +0,0 @@ - -#---------------------------------------------# -#### BTT MMB CAN 1.0 MCU definition ########### -#---------------------------------------------# - -[mcu ercf] -##-------------------------------------------------------------------- -serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path -# canbus_uuid: change-me-to-the-correct-canbus-id -##-------------------------------------------------------------------- - -# If you want to override the wiring of the BTT MMB CAN, keep in mind that this -# board is defined using the "ercf" name. So you should use "pin: ercf:PIN_NAME" -# in your own overrides.cfg files. - -[include config/mcu_definitions/ercf/BTT_MMB_CAN_v1.0.cfg] # Do not remove this line -[board_pins mcu_ercf] -mcu: ercf -aliases: - GEAR_STEP=MCU_MOTOR1_STEP , GEAR_DIR=MCU_MOTOR1_DIR , GEAR_ENABLE=MCU_MOTOR1_EN , GEAR_TMCUART=MCU_MOTOR1_CS , - SELECTOR_STEP=MCU_MOTOR2_STEP , SELECTOR_DIR=MCU_MOTOR2_DIR , SELECTOR_ENABLE=MCU_MOTOR2_EN , SELECTOR_TMCUART=MCU_MOTOR2_CS , - SELECTOR_DIAG=MCU_STP2 , - - GEAR_STOP=MCU_ENDSTOP , SELECTOR_STOP=MCU_ENDSTOP , - - TOOLHEAD_SENSOR=MCU_STP1 , # double used with MOTOR1_DIAG, so might collide - ERCF_SERVO=MCU_MOT , - ERCF_ENCODER=MCU_SENSOR , - ERCF_NEOPIXEL=MCU_RGB , - - diff --git a/user_templates/mcu_defaults/ercf/Fysetc_ERCF_ERB.cfg b/user_templates/mcu_defaults/ercf/Fysetc_ERCF_ERB.cfg deleted file mode 100644 index 2489a0207..000000000 --- a/user_templates/mcu_defaults/ercf/Fysetc_ERCF_ERB.cfg +++ /dev/null @@ -1,37 +0,0 @@ - -#---------------------------------------------# -#### Fysetc ERCF ERB MCU definition ########### -#---------------------------------------------# - -[mcu ercf] -##-------------------------------------------------------------------- -serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path -##-------------------------------------------------------------------- - -# If you want to override the wiring of the Fystec ERCF ERB, keep in mind that this -# board is defined using the "ercf" name. So you should use "pin: ercf:PIN_NAME" -# in your own overrides.cfg files. - -[include config/mcu_definitions/ercf/Fysetc_ERCF_ERB.cfg] # Do not remove this line -[board_pins mcu_ercf] -mcu: ercf -aliases: - GEAR_STEP=MCU_GEAR_MOTOR_STEP , GEAR_DIR=MCU_GEAR_MOTOR_DIR , GEAR_ENABLE=MCU_GEAR_MOTOR_EN , GEAR_TMCUART=MCU_GEAR_MOTOR_UART , - SELECTOR_STEP=MCU_SELECTOR_MOTOR_STEP , SELECTOR_DIR=MCU_SELECTOR_MOTOR_DIR , SELECTOR_ENABLE=MCU_SELECTOR_MOTOR_EN , SELECTOR_TMCUART=MCU_SELECTOR_MOTOR_UART , - SELECTOR_DIAG=MCU_SELECTOR_MOTOR_DIAG , - - GEAR_STOP=MCU_ENDSTOP , SELECTOR_STOP=MCU_ENDSTOP , - - TOOLHEAD_SENSOR=MCU_HALL_SENSOR , - ERCF_SERVO=MCU_SERVO , - ERCF_ENCODER=MCU_ENCODER , - ERCF_NEOPIXEL=MCU_RGB , - - EXTRA_PINS1=MCU_UART0_TX , EXTRA_PINS2=MCU_UART0_RX , - EXTRA_PINS3=MCU_SPI0_SCK , EXTRA_PINS4=MCU_SPI0_MISO , - EXTRA_PINS5=MCU_SPI0_MOSI , EXTRA_PINS6=MCU_SPI0_CS , - EXTRA_PINS7=MCU_I2C1_SDA , EXTRA_PINS8=MCU_I2C1_SCL , - EXTRA_PINS9=MCU_ADC0 , EXTRA_PINS10=MCU_ADC1 , - EXTRA_PINS11=MCU_ADC2 , EXTRA_PINS12=MCU_ADC3 , - EXTRA_PINS13= , EXTRA_PINS14=<5V> , - diff --git a/user_templates/mcu_defaults/ercf/Mellow_fly_ERCF.cfg b/user_templates/mcu_defaults/ercf/Mellow_fly_ERCF.cfg deleted file mode 100644 index 7a33e9ef2..000000000 --- a/user_templates/mcu_defaults/ercf/Mellow_fly_ERCF.cfg +++ /dev/null @@ -1,38 +0,0 @@ - -#---------------------------------------------# -#### Mellow Fly ERCF MCU definition ########### -#---------------------------------------------# - -[mcu ercf] -##-------------------------------------------------------------------- -serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path -##-------------------------------------------------------------------- - -# If you want to override the wiring of the Mellow Fly ERCF board, keep in mind that this -# board is defined using the "ercf" name. So you should use "pin: ercf:PIN_NAME" -# in your own overrides.cfg files. - -[include config/mcu_definitions/ercf/Mellow_fly_ERCF.cfg] # Do not remove this line -[board_pins mcu_ercf] -mcu: ercf -aliases: - GEAR_STEP=MCU_GEAR_STEP , GEAR_DIR=MCU_GEAR_DIR , GEAR_ENABLE=MCU_GEAR_EN , GEAR_TMCUART=MCU_GEAR_UART , - SELECTOR_STEP=MCU_SELECTOR_STEP , SELECTOR_DIR=MCU_SELECTOR_DIR , SELECTOR_ENABLE=MCU_SELECTOR_EN , SELECTOR_TMCUART=MCU_SELECTOR_UART , - SELECTOR_DIAG=MCU_SELECTOR_DIAG , - - GEAR_STOP=MCU_ENDSTOP , SELECTOR_STOP=MCU_ENDSTOP , - - SPI_SCLK=MCU_SCK , SPI_MOSI=MCU_MOSI , SPI_MISO=MCU_MISO , - - TOOLHEAD_SENSOR=MCU_EXTRA , - ERCF_SERVO=MCU_SERVO , - ERCF_ENCODER=MCU_ENCODER , - - EXTRA_PINS1= , EXTRA_PINS2= , - EXTRA_PINS3=<3.3V> , EXTRA_PINS4=<3.3V> , - EXTRA_PINS5=MCU_P26 , EXTRA_PINS6=MCU_P10 , - EXTRA_PINS7=MCU_P27 , EXTRA_PINS8=MCU_P11 , - EXTRA_PINS9=MCU_P28 , EXTRA_PINS10=MCU_P12 , - EXTRA_PINS11=MCU_P29 , EXTRA_PINS12=MCU_P24 , - EXTRA_PINS13=MCU_P25 , EXTRA_PINS14=MCU_P13 , - diff --git a/user_templates/mcu_defaults/ercf/Tircown_ERCF_easy_brd.cfg b/user_templates/mcu_defaults/ercf/Tircown_ERCF_easy_brd.cfg deleted file mode 100644 index 843d925ee..000000000 --- a/user_templates/mcu_defaults/ercf/Tircown_ERCF_easy_brd.cfg +++ /dev/null @@ -1,28 +0,0 @@ - -#--------------------------------------------------# -#### Tircown ERCF easybrd MCU definition ########### -#--------------------------------------------------# - -[mcu ercf] -##-------------------------------------------------------------------- -serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path -##-------------------------------------------------------------------- - -# If you want to override the wiring of the ERCF easy brd, keep in mind that this -# board is defined using the "ercf" name. So you should use "pin: ercf:PIN_NAME" -# in your own overrides.cfg files. - -[include config/mcu_definitions/ercf/Tircown_ERCF_easy_brd.cfg] # Do not remove this line -[board_pins mcu_ercf] -mcu: ercf -aliases: - GEAR_STEP=MCU_GEAR_STEP , GEAR_DIR=MCU_GEAR_DIR , GEAR_ENABLE=MCU_GEAR_ENABLE , GEAR_TMCUART=MCU_TMCUART , - SELECTOR_STEP=MCU_SELECTOR_STEP , SELECTOR_DIR=MCU_SELECTOR_DIR , SELECTOR_ENABLE=MCU_SELECTOR_ENABLE , SELECTOR_TMCUART=MCU_TMCUART , - SELECTOR_DIAG=MCU_SELECTOR_DIAG , - - GEAR_STOP=MCU_GEAR_STOP , SELECTOR_STOP=MCU_SELECTOR_STOP , - - ERCF_SERVO=MCU_SERVO , - - ERCF_ENCODER=MCU_ENCODER , - diff --git a/user_templates/mcu_defaults/main/BTT_Kraken_v1.0.cfg b/user_templates/mcu_defaults/main/BTT_Kraken_v1.0.cfg new file mode 100644 index 000000000..4b29f6c91 --- /dev/null +++ b/user_templates/mcu_defaults/main/BTT_Kraken_v1.0.cfg @@ -0,0 +1,53 @@ + +#--------------------------------------# +##### BTT Kraken MCU definition ######## +#--------------------------------------# + +[mcu] +##-------------------------------------------------------------------- +# This board work by using a serial connection by default. If you +# want to use CAN, invert the commented lines and use canbus_uuid. + +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/BTT_Kraken_v1.0.cfg] # Do not remove this line +[board_pins kraken_mcu] +mcu: mcu +aliases: + X_STEP=MCU_S1_STEP , X_DIR=MCU_S1_DIR , X_ENABLE=MCU_S1_ENABLE , X_TMCUART=MCU_S1_UART , + Y_STEP=MCU_S2_STEP , Y_DIR=MCU_S2_DIR , Y_ENABLE=MCU_S2_ENABLE , Y_TMCUART=MCU_S2_UART , + + Z_STEP=MCU_S5_STEP , Z_DIR=MCU_S5_DIR , Z_ENABLE=MCU_S5_ENABLE , Z_TMCUART=MCU_S5_UART , + Z1_STEP=MCU_S6_STEP , Z1_DIR=MCU_S6_DIR , Z1_ENABLE=MCU_S6_ENABLE , Z1_TMCUART=MCU_S6_UART , + Z2_STEP=MCU_S7_STEP , Z2_DIR=MCU_S7_DIR , Z2_ENABLE=MCU_S7_ENABLE , Z2_TMCUART=MCU_S7_UART , + Z3_STEP=MCU_S8_STEP , Z3_DIR=MCU_S8_DIR , Z3_ENABLE=MCU_S8_ENABLE , Z3_TMCUART=MCU_S8_UART , + + E_STEP=MCU_S3_STEP , E_DIR=MCU_S3_DIR , E_ENABLE=MCU_S3_ENABLE , E_TMCUART=MCU_S3_UART , + + DRIVER_SPI_MOSI=MCU_MOSI , # Used in case of SPI drivers + DRIVER_SPI_MISO=MCU_MISO , # Used in case of SPI drivers + DRIVER_SPI_SCK=MCU_SCK , # Used in case of SPI drivers + + X_STOP= MCU_MIN1 , Y_STOP=MCU_MIN2 , Z_STOP=MCU_MIN5 , + PROBE_INPUT=MCU_IND_DET , + RUNOUT_SENSOR=MCU_MIN4 , + + E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_T0 , + BED_HEATER=MCU_BED_OUT , BED_TEMPERATURE=MCU_TB , + + PART_FAN=MCU_FAN7 , E_FAN=MCU_FAN6 , + CONTROLLER_FAN=MCU_FAN2 , + EXHAUST_FAN=MCU_FAN3 , + FILTER_FAN=MCU_FAN4 , + HOST_CONTROLLER_FAN=MCU_FAN5 , + + CHAMBER_TEMPERATURE=MCU_T1 , ELECTRICAL_CABINET_TEMPERATURE=MCU_T2 , + + LIGHT_OUTPUT=MCU_HE2 , + LIGHT_NEOPIXEL=MCU_RGB1 , + STATUS_NEOPIXEL=MCU_RGB2 , + + SERVO_PIN=MCU_MOTOR_SERVO , + diff --git a/user_templates/mcu_defaults/main/BTT_Manta_M5P_v1.0.cfg b/user_templates/mcu_defaults/main/BTT_Manta_M5P_v1.0.cfg new file mode 100644 index 000000000..6716040f7 --- /dev/null +++ b/user_templates/mcu_defaults/main/BTT_Manta_M5P_v1.0.cfg @@ -0,0 +1,46 @@ +#--------------------------------------------# +#### BTT MANTA M5P v1.0 MCU definition ##### +#--------------------------------------------# +[mcu] +##-------------------------------------------------------------------- +# This board works by using a serial connection by default. If you +# want to use CAN, invert the commented lines and use canbus_uuid. + +#serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/BTT_Manta_M5P_v1.0.cfg] # Do not remove this line +[board_pins mantam5p10_mcu] +mcu: mcu +aliases: + X_STEP=MCU_M1_STEP , X_DIR=MCU_M1_DIR , X_ENABLE=MCU_M1_EN , X_TMCUART=MCU_M1_CS , + Y_STEP=MCU_M2_STEP , Y_DIR=MCU_M2_DIR , Y_ENABLE=MCU_M2_EN , Y_TMCUART=MCU_M2_CS , + + Z_STEP=MCU_M3_STEP , Z_DIR=MCU_M3_DIR , Z_ENABLE=MCU_M3_EN , Z_TMCUART=MCU_M3_CS , + Z1_STEP=MCU_M4_STEP , Z1_DIR=MCU_M4_DIR , Z1_ENABLE=MCU_M4_EN , Z1_TMCUART=MCU_M4_CS , + Z2_STEP=MCU_M5_STEP , Z2_DIR=MCU_M5_DIR , Z2_ENABLE=MCU_M5_EN , Z2_TMCUART=MCU_M5_CS , + + #E_STEP=MCU_M5_STEP , E_DIR=MCU_M5_DIR , E_ENABLE=MCU_M5_EN , E_TMCUART=MCU_M5_CS , + + DRIVER_SPI_MOSI=MCU_SPI2_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_SPI2_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_SPI2_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + + X_STOP=MCU_M1_STOP , Y_STOP=MCU_M3_STOP , Z_STOP=MCU_M4_STOP , + PROBE_INPUT=MCU_PROBE2 , + RUNOUT_SENSOR=MCU_M4_STOP , + + E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_TH0 , + BED_HEATER=MCU_BED_OUT , BED_TEMPERATURE=MCU_THB , + + FILTER_FAN=MCU_FAN0 , + CONTROLLER_FAN=MCU_FAN1 , + + CHAMBER_TEMPERATURE=MCU_TH1 , + + LIGHT_OUTPUT=MCU_HE1 , + STATUS_NEOPIXEL=MCU_RGB1 , + MCU_PS_ON=MCU_RGB2 , + + SERVO_PIN=MCU_PROBE1 , diff --git a/user_templates/mcu_defaults/main/BTT_Manta_M8P_v2.0.cfg b/user_templates/mcu_defaults/main/BTT_Manta_M8P_v2.0.cfg index a91c6a0eb..8f5851bfc 100644 --- a/user_templates/mcu_defaults/main/BTT_Manta_M8P_v2.0.cfg +++ b/user_templates/mcu_defaults/main/BTT_Manta_M8P_v2.0.cfg @@ -26,9 +26,9 @@ aliases: E_STEP=MCU_M7_STEP , E_DIR=MCU_M7_DIR , E_ENABLE=MCU_M7_EN , E_TMCUART=MCU_M7_CS , - DRIVER_SPI_MOSI=MCU_SPI2_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 - DRIVER_SPI_MISO=MCU_SPI2_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 - DRIVER_SPI_SCK=MCU_SPI2_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MOSI=MCU_M_SPI_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_M_SPI_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_M_SPI_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 X_STOP=MCU_M1_STOP , Y_STOP=MCU_M2_STOP , Z_STOP=MCU_M3_STOP , PROBE_INPUT=MCU_PROBE2 , @@ -51,3 +51,4 @@ aliases: LIGHT_NEOPIXEL=MCU_M5_STOP , SERVO_PIN=MCU_PROBE1 , + diff --git a/user_templates/mcu_defaults/main/BTT_Octopus_Pro_v1.0.cfg b/user_templates/mcu_defaults/main/BTT_Octopus_Pro_v1.0.cfg new file mode 100644 index 000000000..e6cae3e7d --- /dev/null +++ b/user_templates/mcu_defaults/main/BTT_Octopus_Pro_v1.0.cfg @@ -0,0 +1,53 @@ + +#--------------------------------------# +#### BTT Octopus MCU definition ######## +#--------------------------------------# + +[mcu] +##-------------------------------------------------------------------- +# This board work by using a serial connection by default. If you +# want to use CAN, invert the commented lines and use canbus_uuid. + +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/BTT_Octopus.cfg] # Do not remove this line +[board_pins octopus_mcu] +mcu: mcu +aliases: + X_STEP=MCU_MOTOR0_STEP , X_DIR=MCU_MOTOR0_DIR , X_ENABLE=MCU_MOTOR0_ENABLE , X_TMCUART=MCU_MOTOR0_UART , + Y_STEP=MCU_MOTOR1_STEP , Y_DIR=MCU_MOTOR1_DIR , Y_ENABLE=MCU_MOTOR1_ENABLE , Y_TMCUART=MCU_MOTOR1_UART , + + Z_STEP=MCU_MOTOR2_1_STEP , Z_DIR=MCU_MOTOR2_1_DIR , Z_ENABLE=MCU_MOTOR2_1_ENABLE , Z_TMCUART=MCU_MOTOR2_1_UART , + Z1_STEP=MCU_MOTOR3_STEP , Z1_DIR=MCU_MOTOR3_DIR , Z1_ENABLE=MCU_MOTOR3_ENABLE , Z1_TMCUART=MCU_MOTOR3_UART , + Z2_STEP=MCU_MOTOR4_STEP , Z2_DIR=MCU_MOTOR4_DIR , Z2_ENABLE=MCU_MOTOR4_ENABLE , Z2_TMCUART=MCU_MOTOR4_UART , + Z3_STEP=MCU_MOTOR5_STEP , Z3_DIR=MCU_MOTOR5_DIR , Z3_ENABLE=MCU_MOTOR5_ENABLE , Z3_TMCUART=MCU_MOTOR5_UART , + + E_STEP=MCU_MOTOR6_STEP , E_DIR=MCU_MOTOR6_DIR , E_ENABLE=MCU_MOTOR6_ENABLE , E_TMCUART=MCU_MOTOR6_UART , + + # DRIVER_SPI_MOSI=EXP2_6 , # Used in case of SPI drivers such as TMC2240 or TMC5160 + # DRIVER_SPI_MISO=EXP2_1 , # Used in case of SPI drivers such as TMC2240 or TMC5160 + # DRIVER_SPI_SCK=EXP2_2 , # Used in case of SPI drivers such as TMC2240 or TMC5160 + + X_STOP=MCU_STOP0 , Y_STOP=MCU_STOP1 , Z_STOP=MCU_STOP2 , + PROBE_INPUT=MCU_STOP7 , + RUNOUT_SENSOR=MCU_STOP3 , + + E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_T0 , + BED_HEATER=MCU_HE1 , BED_TEMPERATURE=MCU_TB , + + PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN1 , + CONTROLLER_FAN=MCU_FAN2 , + EXHAUST_FAN=MCU_FAN3 , + FILTER_FAN=MCU_FAN4 , + HOST_CONTROLLER_FAN=MCU_FAN5 , + + CHAMBER_TEMPERATURE=MCU_T1 , ELECTRICAL_CABINET_TEMPERATURE=MCU_T2 , + + LIGHT_OUTPUT=MCU_HE2 , + LIGHT_NEOPIXEL=MCU_STOP5 , + STATUS_NEOPIXEL=MCU_NEOPIXEL , + + SERVO_PIN=MCU_SERVOS , + diff --git a/user_templates/mcu_defaults/main/BTT_Octopus_Pro_v1.1.cfg b/user_templates/mcu_defaults/main/BTT_Octopus_Pro_v1.1.cfg new file mode 100644 index 000000000..19aa78971 --- /dev/null +++ b/user_templates/mcu_defaults/main/BTT_Octopus_Pro_v1.1.cfg @@ -0,0 +1,53 @@ + +#--------------------------------------# +#### BTT Octopus MCU definition ######## +#--------------------------------------# + +[mcu] +##-------------------------------------------------------------------- +# This board work by using a serial connection by default. If you +# want to use CAN, invert the commented lines and use canbus_uuid. + +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/BTT_Octopus_Pro_v1.1.cfg] # Do not remove this line +[board_pins octopus_mcu] +mcu: mcu +aliases: + X_STEP=MCU_MOTOR0_STEP , X_DIR=MCU_MOTOR0_DIR , X_ENABLE=MCU_MOTOR0_ENABLE , X_TMCUART=MCU_MOTOR0_UART , + Y_STEP=MCU_MOTOR1_STEP , Y_DIR=MCU_MOTOR1_DIR , Y_ENABLE=MCU_MOTOR1_ENABLE , Y_TMCUART=MCU_MOTOR1_UART , + + Z_STEP=MCU_MOTOR2_1_STEP , Z_DIR=MCU_MOTOR2_1_DIR , Z_ENABLE=MCU_MOTOR2_1_ENABLE , Z_TMCUART=MCU_MOTOR2_1_UART , + Z1_STEP=MCU_MOTOR3_STEP , Z1_DIR=MCU_MOTOR3_DIR , Z1_ENABLE=MCU_MOTOR3_ENABLE , Z1_TMCUART=MCU_MOTOR3_UART , + Z2_STEP=MCU_MOTOR4_STEP , Z2_DIR=MCU_MOTOR4_DIR , Z2_ENABLE=MCU_MOTOR4_ENABLE , Z2_TMCUART=MCU_MOTOR4_UART , + Z3_STEP=MCU_MOTOR5_STEP , Z3_DIR=MCU_MOTOR5_DIR , Z3_ENABLE=MCU_MOTOR5_ENABLE , Z3_TMCUART=MCU_MOTOR5_UART , + + E_STEP=MCU_MOTOR6_STEP , E_DIR=MCU_MOTOR6_DIR , E_ENABLE=MCU_MOTOR6_ENABLE , E_TMCUART=MCU_MOTOR6_UART , + + # DRIVER_SPI_MOSI=EXP2_6 , # Used in case of SPI drivers such as TMC2240 or TMC5160 + # DRIVER_SPI_MISO=EXP2_1 , # Used in case of SPI drivers such as TMC2240 or TMC5160 + # DRIVER_SPI_SCK=EXP2_2 , # Used in case of SPI drivers such as TMC2240 or TMC5160 + + X_STOP=MCU_STOP0 , Y_STOP=MCU_STOP1 , Z_STOP=MCU_STOP2 , + PROBE_INPUT=MCU_STOP7 , + RUNOUT_SENSOR=MCU_STOP3 , + + E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_T0 , + BED_HEATER=MCU_HE1 , BED_TEMPERATURE=MCU_TB , + + PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN1 , + CONTROLLER_FAN=MCU_FAN2 , + EXHAUST_FAN=MCU_FAN3 , + FILTER_FAN=MCU_FAN4 , + HOST_CONTROLLER_FAN=MCU_FAN5 , + + CHAMBER_TEMPERATURE=MCU_T1 , ELECTRICAL_CABINET_TEMPERATURE=MCU_T2 , + + LIGHT_OUTPUT=MCU_HE2 , + LIGHT_NEOPIXEL=MCU_STOP5 , + STATUS_NEOPIXEL=MCU_NEOPIXEL , + + SERVO_PIN=MCU_SERVOS , + diff --git a/user_templates/mcu_defaults/main/BTT_SKR_2.cfg b/user_templates/mcu_defaults/main/BTT_SKR_2.cfg new file mode 100644 index 000000000..a3bfe70a6 --- /dev/null +++ b/user_templates/mcu_defaults/main/BTT_SKR_2.cfg @@ -0,0 +1,44 @@ +#-------------------------------# +#### BTT SKR2 MCU definition #### +#-------------------------------# + +[mcu] +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/BTT_SKR_2.cfg] # Do not remove this line +[board_pins SKR_2_mcu] +mcu: mcu +aliases: + X_STEP=MCU_XM_STEP , X_DIR=MCU_XM_DIR , X_ENABLE=MCU_XM_ENABLE , X_TMCUART=MCU_XM_UART , + Y_STEP=MCU_YM_STEP , Y_DIR=MCU_YM_DIR , Y_ENABLE=MCU_YM_ENABLE , Y_TMCUART=MCU_YM_UART , + Z_STEP=MCU_ZM_STEP , Z_DIR=MCU_ZM_DIR , Z_ENABLE=MCU_ZM_ENABLE , Z_TMCUART=MCU_ZM_UART , + E_STEP=MCU_E0M_STEP , E_DIR=MCU_E0M_DIR , E_ENABLE=MCU_E0M_ENABLE , E_TMCUART=MCU_E0M_UART , + E1_STEP=MCU_E1M_STEP , E1_DIR=MCU_E1M_DIR , E1_ENABLE=MCU_E1M_ENABLE , E1_TMCUART=MCU_E1M_UART , + + X_STOP=MCU_XSTOP , Y_STOP=MCU_YSTOP , Z_STOP=MCU_ZSTOP , + RUNOUT_SENSOR=MCU_E0DET , RUNOUT_SENSOR1=MCU_E1DET , POWER_DETECT=MCU_PWRDET , + PROBE_INPUT=MCU_PROBE , + SERVO_PIN=MCU_SERVOS , + + E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_TH0 , E1_HEATER=MCU_HE1 , E1_TEMPERATURE=MCU_TH1 , + BED_HEATER=MCU_BED , BED_TEMPERATURE=MCU_TB , + + PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN1 , CONTROLLER_FAN=MCU_FAN2 , + + STATUS_NEOPIXEL=MCU_RGB , + # LIGHT_NEOPIXEL=MCU_RGB , + +######################################## +# Motor Power Pin +######################################## +# Due to BTT implementing a Marlin-specific safety feature, +# "anti-reversal stepper protection", this pin needs pulling +# high to pass power to stepper drivers and most FETs + +[output_pin motor_power] +pin: MCU_MPWR +value: 1 + diff --git a/user_templates/mcu_defaults/main/BTT_SKR_3.cfg b/user_templates/mcu_defaults/main/BTT_SKR_3.cfg index 1215052dd..47d4addcf 100644 --- a/user_templates/mcu_defaults/main/BTT_SKR_3.cfg +++ b/user_templates/mcu_defaults/main/BTT_SKR_3.cfg @@ -1,3 +1,4 @@ + #-------------------------------------# #### BTT SKR3 definition #### #-------------------------------------# diff --git a/user_templates/mcu_defaults/main/BTT_SKR_Mini_E3_v2.cfg b/user_templates/mcu_defaults/main/BTT_SKR_Mini_E3_v2.cfg index 19c2844c1..2ca40ae42 100644 --- a/user_templates/mcu_defaults/main/BTT_SKR_Mini_E3_v2.cfg +++ b/user_templates/mcu_defaults/main/BTT_SKR_Mini_E3_v2.cfg @@ -48,7 +48,7 @@ uart_pin: TMCUART tx_pin: TMCTX uart_address: 1 -# comment this section if you are using a toolhead with own mcu +# Comment this section if you are using a toolhead with its own MCU [tmc2209 extruder] uart_pin: TMCUART tx_pin: TMCTX diff --git a/user_templates/mcu_defaults/main/BTT_SKR_Mini_E3_v3.cfg b/user_templates/mcu_defaults/main/BTT_SKR_Mini_E3_v3.cfg index f03eed60f..39ca708cf 100644 --- a/user_templates/mcu_defaults/main/BTT_SKR_Mini_E3_v3.cfg +++ b/user_templates/mcu_defaults/main/BTT_SKR_Mini_E3_v3.cfg @@ -48,7 +48,7 @@ uart_pin: TMCUART tx_pin: TMCTX uart_address: 1 -# comment this section if you are using a toolhead with own mcu +# Comment this section if you are using a toolhead with its own MCU [tmc2209 extruder] uart_pin: TMCUART tx_pin: TMCTX diff --git a/user_templates/mcu_defaults/main/BTT_SKR_Pico_v1.0.cfg b/user_templates/mcu_defaults/main/BTT_SKR_Pico_v1.0.cfg index ceeaba930..684cf6e1f 100644 --- a/user_templates/mcu_defaults/main/BTT_SKR_Pico_v1.0.cfg +++ b/user_templates/mcu_defaults/main/BTT_SKR_Pico_v1.0.cfg @@ -46,7 +46,7 @@ uart_pin: TMCUART tx_pin: TMCTX uart_address: 1 -# comment this section if you are using a toolhead with own mcu OR if you use an MMU with Happy_Hare V2 +# Comment this section if you are using a toolhead with its own MCU [tmc2209 extruder] uart_pin: TMCUART tx_pin: TMCTX diff --git a/user_templates/mcu_defaults/main/BTT_SKR_Pro_V1.2.cfg b/user_templates/mcu_defaults/main/BTT_SKR_Pro_V1.2.cfg new file mode 100644 index 000000000..0d24e295a --- /dev/null +++ b/user_templates/mcu_defaults/main/BTT_SKR_Pro_V1.2.cfg @@ -0,0 +1,32 @@ + +#----------------------------------------# +#### BTT SKR Pro v1.2 definition ######## +#----------------------------------------# + +[mcu] +##------------------------------------------------------------------------------- +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +##------------------------------------------------------------------------------- + +[include config/mcu_definitions/main/BTT_SKR_Pro_V1.2.cfg] # Do not remove this line +[board_pins xyze_SKR_mcu] +mcu: mcu +aliases: + X_STEP=MCU_XM_STEP , X_DIR=MCU_XM_DIR , X_ENABLE=MCU_XM_ENABLE , X_TMCUART=MCU_XM_TMCUART , + Y_STEP=MCU_YM_STEP , Y_DIR=MCU_YM_DIR , Y_ENABLE=MCU_YM_ENABLE , Y_TMCUART=MCU_YM_TMCUART , + Z_STEP=MCU_ZM_STEP , Z_DIR=MCU_ZM_DIR , Z_ENABLE=MCU_ZM_ENABLE , Z_TMCUART=MCU_ZM_TMCUART , + + E_STEP=MCU_E0M_STEP , E_DIR=MCU_E0M_DIR , E_ENABLE=MCU_E0M_ENABLE , E_TMCUART=MCU_E0M_TMCUART , + + TOOLHEAD_SENSOR=MCU_E0STOP , SERVO_PIN=MCU_PROBE , + + X_STOP=MCU_XSTOP , Y_STOP=MCU_YSTOP , Z_STOP=MCU_E1STOP , PROBE_INPUT=MCU_ZSTOP , + + E_HEATER=MCU_HEAT0 , E_TEMPERATURE=MCU_T0 , + BED_HEATER=MCU_BED , BED_TEMPERATURE=MCU_T1 , + + PART_FAN=MCU_FAN1 , E_FAN=MCU_FAN0 , + + LIGHT_NEOPIXEL=MCU_SERVOS , + STATUS_NEOPIXEL=MCU_IO2 + diff --git a/user_templates/mcu_defaults/main/Double_BTT_SKR_v1.4.cfg b/user_templates/mcu_defaults/main/Double_BTT_SKR_v1.4.cfg index 2c2f4ed0c..0c7c97bd3 100644 --- a/user_templates/mcu_defaults/main/Double_BTT_SKR_v1.4.cfg +++ b/user_templates/mcu_defaults/main/Double_BTT_SKR_v1.4.cfg @@ -26,15 +26,15 @@ aliases: E_STEP=MCU_E0M_STEP , E_DIR=MCU_E0M_DIR , E_ENABLE=MCU_E0M_ENABLE , E_TMCUART=MCU_E0M_UART , - GEAR_STEP=MCU_ZM_STEP , GEAR_DIR=MCU_ZM_DIR , GEAR_ENABLE=MCU_ZM_ENABLE , GEAR_TMCUART=MCU_ZM_UART , - SELECTOR_STEP=MCU_E1M_STEP , SELECTOR_DIR=MCU_E1M_DIR , SELECTOR_ENABLE=MCU_E1M_ENABLE , SELECTOR_TMCUART=MCU_E1M_UART , - SELECTOR_DIAG=MCU_ZSTOP , + MMU_GEAR_STEP=MCU_ZM_STEP , MMU_GEAR_DIR=MCU_ZM_DIR , MMU_GEAR_ENABLE=MCU_ZM_ENABLE , MMU_GEAR_UART=MCU_ZM_UART , + SELECTOR_STEP=MCU_E1M_STEP , MMU_SEL_DIR=MCU_E1M_DIR , MMU_SEL_ENABLE=MCU_E1M_ENABLE , MMU_SEL_UART=MCU_E1M_UART , + MMU_SEL_DIAG=MCU_ZSTOP , - GEAR_STOP=MCU_E1DET , SELECTOR_STOP=MCU_E1DET , + MMU_GEAR_ENDSTOP=MCU_E1DET , MMU_SEL_ENDSTOP=MCU_E1DET , - ERCF_SERVO=MCU_E0DET , - ERCF_ENCODER=MCU_PWRDET , - TOOLHEAD_SENSOR=MCU_ZSTOP , + MMU_SERVO=MCU_E0DET , + MMU_ENCODER=MCU_PWRDET , + TOOLHEAD_SENSORR=MCU_ZSTOP , X_STOP=MCU_XSTOP , Y_STOP=MCU_YSTOP , diff --git a/user_templates/mcu_defaults/main/Fysetc_Catalyst_v1.x.cfg b/user_templates/mcu_defaults/main/Fysetc_Catalyst_v1.x.cfg new file mode 100644 index 000000000..8e5e621ad --- /dev/null +++ b/user_templates/mcu_defaults/main/Fysetc_Catalyst_v1.x.cfg @@ -0,0 +1,37 @@ + +#---------------------------------------------# +#### Fysetc Catalyst v1.x MCU definition ###### +#---------------------------------------------# + +[mcu] +##-------------------------------------------------------------------- +# This board work by using a serial connection by default. If you +# want to use CAN, invert the commented lines and use canbus_uuid. + +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/Fysetc_Catalyst_v1.x.cfg] # Do not remove this line +[board_pins catalyst_mcu] +mcu: mcu +aliases: + X_STEP=MCU_B_MOT_STEP , X_DIR=MCU_B_MOT_DIR , X_ENABLE=MCU_B_MOT_ENABLE , X_TMCUART=MCU_B_MOT_CS_PDN , + Y_STEP=MCU_A_MOT_STEP , Y_DIR=MCU_A_MOT_DIR , Y_ENABLE=MCU_A_MOT_ENABLE , Y_TMCUART=MCU_A_MOT_CS_PDN , + Z_STEP=MCU_Z_MOT_STEP , Z_DIR=MCU_Z_MOT_DIR , Z_ENABLE=MCU_Z_MOT_ENABLE , Z_TMCUART=MCU_Z_MOT_CS_PDN , + E_STEP=MCU_E_MOT_STEP , E_DIR=MCU_E_MOT_DIR , E_ENABLE=MCU_E_MOT_ENABLE , E_TMCUART=MCU_E_MOT_CS_PDN , + + DRIVER_SPI_MOSI=MCU_SPI_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_SPI_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_SPI_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + + PROBE_INPUT=MCU_PROBE , + + E_HEATER=MCU_HEAT , E_TEMPERATURE=MCU_T0 , + BED_HEATER=MCU_BED , BED_TEMPERATURE=MCU_T1 , + + PART_FAN=MCU_FAN1 , E_FAN=MCU_FAN0 , + CONTROLLER_FAN=MCU_FAN2 , + + LIGHT_NEOPIXEL=MCU_NEOPIXEL , + diff --git a/user_templates/mcu_defaults/main/Fysetc_S6_v2.x.cfg b/user_templates/mcu_defaults/main/Fysetc_S6_v2.x.cfg new file mode 100644 index 000000000..3ed3e9fe5 --- /dev/null +++ b/user_templates/mcu_defaults/main/Fysetc_S6_v2.x.cfg @@ -0,0 +1,50 @@ + +#---------------------------------------------# +#### Fysetc S6 v2.x MCU definition ######## +#---------------------------------------------# + +[mcu] +##-------------------------------------------------------------------- +# This board work by using a serial connection by default. If you +# want to use CAN, invert the commented lines and use canbus_uuid. + +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/Fysetc_S6_v2.x.cfg] # Do not remove this line +[board_pins s6_mcu] +mcu: mcu +aliases: + X_STEP=MCU_X_MOT_STEP , X_DIR=MCU_X_MOT_DIR , X_ENABLE=MCU_X_MOT_ENABLE , X_TMCUART=MCU_X_MOT_UART , # Replace with X_TMCUART=MCU_X_MOT_CS_PDN if you're using SPI drivers such as TMC2240 or TMC5160 + Y_STEP=MCU_Y_MOT_STEP , Y_DIR=MCU_Y_MOT_DIR , Y_ENABLE=MCU_Y_MOT_ENABLE , Y_TMCUART=MCU_Y_MOT_UART , # Replace with Y_TMCUART=MCU_Y_MOT_CS_PDN if you're using SPI drivers such as TMC2240 or TMC5160 + + Z_STEP=MCU_Z_MOT_STEP , Z_DIR=MCU_Z_MOT_DIR , Z_ENABLE=MCU_Z_MOT_ENABLE , Z_TMCUART=MCU_Z_MOT_UART , # Replace with Z_TMCUART=MCU_Z_MOT_CS_PDN if you're using SPI drivers such as TMC2240 or TMC5160 + Z1_STEP=MCU_E1_MOT_STEP , Z1_DIR=MCU_E1_MOT_DIR , Z1_ENABLE=MCU_E1_MOT_ENABLE , Z1_TMCUART=MCU_E1_MOT_UART , # Replace with Z1_TMCUART=MCU_E1_MOT_CS_PDN if you're using SPI drivers such as TMC2240 or TMC5160 + Z2_STEP=MCU_E2_MOT_STEP , Z2_DIR=MCU_E2_MOT_DIR , Z2_ENABLE=MCU_E2_MOT_ENABLE , Z2_TMCUART=MCU_E2_MOT_UART , # Replace with Z2_TMCUART=MCU_E2_MOT_CS_PDN if you're using SPI drivers such as TMC2240 or TMC5160 + + E_STEP=MCU_E0_MOT_STEP , E_DIR=MCU_E0_MOT_DIR , E_ENABLE=MCU_E0_MOT_ENABLE , E_TMCUART=MCU_E0_MOT_UART , # Replace with E_TMCUART=MCU_E0_MOT_CS_PDN if you're using SPI drivers such as TMC2240 or TMC5160 + + DRIVER_SPI_MOSI=MCU_TMC_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_TMC_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_TMC_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + + X_STOP=MCU_X_MIN , Y_STOP=MCU_Y_MIN , Z_STOP=MCU_Z_MIN , + PROBE_INPUT=MCU_Z_MAX , + RUNOUT_SENSOR=MCU_Y_MAX , + + E_HEATER=MCU_E0_OUT , E_TEMPERATURE=MCU_TE0 , + BED_HEATER=MCU_BED_OUT , BED_TEMPERATURE=MCU_TB , + + PART_FAN=MCU_FAN1 , E_FAN=MCU_FAN0 , + CONTROLLER_FAN=MCU_FAN2 , + EXHAUST_FAN=MCU_E2_OUT , + FILTER_FAN=MCU_RGB_R , + HOST_CONTROLLER_FAN=MCU_RGB_G , + + CHAMBER_TEMPERATURE=MCU_TE1 , ELECTRICAL_CABINET_TEMPERATURE=MCU_TE2 , + + LIGHT_OUTPUT=MCU_E1_OUT , + #LIGHT_NEOPIXEL= , # You can use MCU_X_MAX if you bridge the pads to have 5V on this pin + STATUS_NEOPIXEL=MCU_RGB_B , + diff --git a/user_templates/mcu_defaults/main/Fysetc_Spider_v1.x.cfg b/user_templates/mcu_defaults/main/Fysetc_Spider_v1.x.cfg index 84d632764..4b974fd28 100644 --- a/user_templates/mcu_defaults/main/Fysetc_Spider_v1.x.cfg +++ b/user_templates/mcu_defaults/main/Fysetc_Spider_v1.x.cfg @@ -33,6 +33,7 @@ aliases: X_STOP=MCU_X_MAX , Y_STOP=MCU_Y_MAX , Z_STOP=MCU_Z_MIN , PROBE_INPUT=MCU_Z_MAX , RUNOUT_SENSOR=MCU_Y_MIN , # If using sensorless homing: you will need to move the runout sensor on another pin + SERVO_PIN=MCU_X_MIN , # If using sensorless homing: you will need to move the servo on another pin E_HEATER=MCU_E0_OUT , E_TEMPERATURE=MCU_TE0 , BED_HEATER=MCU_BED_OUT , BED_TEMPERATURE=MCU_TB , diff --git a/user_templates/mcu_defaults/main/Fysetc_Spider_v2.x.cfg b/user_templates/mcu_defaults/main/Fysetc_Spider_v2.x.cfg index 2c5e4a7e6..bf61860f7 100644 --- a/user_templates/mcu_defaults/main/Fysetc_Spider_v2.x.cfg +++ b/user_templates/mcu_defaults/main/Fysetc_Spider_v2.x.cfg @@ -33,6 +33,7 @@ aliases: X_STOP=MCU_X_MAX , Y_STOP=MCU_Y_MAX , Z_STOP=MCU_Z_MIN , PROBE_INPUT=MCU_Z_MAX , RUNOUT_SENSOR=MCU_Y_MIN , # If using sensorless homing: you will need to move the runout sensor on another pin + SERVO_PIN=MCU_X_MIN , # If using sensorless homing: you will need to move the servo on another pin E_HEATER=MCU_E0_OUT , E_TEMPERATURE=MCU_TE0 , BED_HEATER=MCU_BED_OUT , BED_TEMPERATURE=MCU_TB , diff --git a/user_templates/mcu_defaults/main/Fysetc_Spider_v3.x.cfg b/user_templates/mcu_defaults/main/Fysetc_Spider_v3.x.cfg index 0069a89ff..68f7e8550 100644 --- a/user_templates/mcu_defaults/main/Fysetc_Spider_v3.x.cfg +++ b/user_templates/mcu_defaults/main/Fysetc_Spider_v3.x.cfg @@ -39,10 +39,10 @@ aliases: BED_HEATER=MCU_BED_OUT , BED_TEMPERATURE=MCU_TB , PART_FAN=MCU_FAN1 , E_FAN=MCU_FAN0 , - CONTROLLER_FAN=MCU_FAN2 , - EXHAUST_FAN=MCU_HEAT2 , - FILTER_FAN=MCU_RGB_R , - HOST_CONTROLLER_FAN=MCU_RGB_G , + CONTROLLER_FAN=MCU_FAN2 , + EXHAUST_FAN=MCU_HEAT2 , + FILTER_FAN=MCU_FAN4 , + HOST_CONTROLLER_FAN=MCU_FAN3 , CHAMBER_TEMPERATURE=MCU_TE1 , ELECTRICAL_CABINET_TEMPERATURE=MCU_TE2 , diff --git a/user_templates/mcu_defaults/main/LDO_Leviathan_v1.2.cfg b/user_templates/mcu_defaults/main/LDO_Leviathan_v1.2.cfg new file mode 100644 index 000000000..62ddb37b2 --- /dev/null +++ b/user_templates/mcu_defaults/main/LDO_Leviathan_v1.2.cfg @@ -0,0 +1,48 @@ + +#--------------------------------------# +#### LDO Leviathan MCU definition ###### +#--------------------------------------# + +[mcu] +##-------------------------------------------------------------------- +# This board work by using a serial connection by default. If you +# want to use CAN, invert the commented lines and use canbus_uuid. + +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/LDO_Leviathan_v1.2.cfg] # Do not remove this line +[board_pins leviathan_mcu] +mcu: mcu +aliases: + X_STEP=MCU_HV-STEPPER0_STEP , X_DIR=MCU_HV-STEPPER0_DIR , X_ENABLE=MCU_HV-STEPPER0_EN , X_TMCUART=MCU_HV-STEPPER0_CS , + Y_STEP=MCU_HV-STEPPER1_STEP , Y_DIR=MCU_HV-STEPPER1_DIR , Y_ENABLE=MCU_HV-STEPPER1_EN , Y_TMCUART=MCU_HV-STEPPER1_CS , + + DRIVER_SPI_MOSI=MCU_SPI2_MOSI , # Used for TMC5160 (HV-STEPPER0 and HV-STEPPER1) + DRIVER_SPI_MISO=MCU_SPI2_MISO , # Used for TMC5160 (HV-STEPPER0 and HV-STEPPER1) + DRIVER_SPI_SCK=MCU_SPI2_SCK , # Used for TMC5160 (HV-STEPPER0 and HV-STEPPER1) + + Z_STEP=MCU_STEPPER0_STEP , Z_DIR=MCU_STEPPER0_DIR , Z_ENABLE=MCU_STEPPER0_EN , Z_TMCUART=MCU_STEPPER0_UART , + Z1_STEP=MCU_STEPPER1_STEP , Z1_DIR=MCU_STEPPER1_DIR , Z1_ENABLE=MCU_STEPPER1_EN , Z1_TMCUART=MCU_STEPPER1_UART , + Z2_STEP=MCU_STEPPER2_STEP , Z2_DIR=MCU_STEPPER2_DIR , Z2_ENABLE=MCU_STEPPER2_EN , Z2_TMCUART=MCU_STEPPER2_UART , + Z3_STEP=MCU_STEPPER3_STEP , Z3_DIR=MCU_STEPPER3_DIR , Z3_ENABLE=MCU_STEPPER3_EN , Z3_TMCUART=MCU_STEPPER3_UART , + + E_STEP=MCU_STEPPER4_STEP , E_DIR=MCU_STEPPER4_DIR , E_ENABLE=MCU_STEPPER4_EN , E_TMCUART=MCU_STEPPER4_UART , + + X_STOP=MCU_STOP_X , Y_STOP=MCU_STOP_Y , Z_STOP=MCU_STOP_Z, + PROBE_INPUT=MCU_Z_PROBE, + RUNOUT_SENSOR=MCU_STOP_E0, + + E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_T1 , + BED_HEATER=MCU_BED0 , BED_TEMPERATURE=MCU_T0 , + + PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN1 , + CONTROLLER_FAN=MCU_FAN2 , + EXHAUST_FAN=MCU_FAN3 , + + CHAMBER_TEMPERATURE=MCU_T2 , ELECTRICAL_CABINET_TEMPERATURE=MCU_T3, + + LIGHT_OUTPUT=MCU_LED , + STATUS_NEOPIXEL=MCU_NEOPIXEL, + diff --git a/user_templates/mcu_defaults/main/MY-OWN-CUSTOM-TEMPLATE.cfg b/user_templates/mcu_defaults/main/MY-OWN-CUSTOM-TEMPLATE.cfg index f75465e9a..0ba4765fe 100644 --- a/user_templates/mcu_defaults/main/MY-OWN-CUSTOM-TEMPLATE.cfg +++ b/user_templates/mcu_defaults/main/MY-OWN-CUSTOM-TEMPLATE.cfg @@ -37,7 +37,9 @@ aliases: E_HEATER= , E_TEMPERATURE= , BED_HEATER= , BED_TEMPERATURE= , - PART_FAN= , E_FAN= , + PART_FAN= , E_FAN= , + PART_FAN_TACHO , E_FAN_TACHO , + CONTROLLER_FAN= , EXHAUST_FAN= , FILTER_FAN= , @@ -51,3 +53,4 @@ aliases: STATUS_NEOPIXEL= , SERVO_PIN= , + diff --git a/user_templates/mcu_defaults/main/Mellow_Fly_Gemini_v3.cfg b/user_templates/mcu_defaults/main/Mellow_Fly_Gemini_v3.cfg new file mode 100644 index 000000000..d2f9073ac --- /dev/null +++ b/user_templates/mcu_defaults/main/Mellow_Fly_Gemini_v3.cfg @@ -0,0 +1,37 @@ + +#------------------------------------------# +#### Mellow Fly Gemini V3 MCU definition ### +#------------------------------------------# + +[mcu] +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/Mellow_Fly_Gemini_v3.cfg] # Do not remove this line +[board_pins fly_Gemini_v3_mcu] +mcu: mcu +aliases: + X_STEP=MCU_DRIVE0_STEP , X_DIR=MCU_DRIVE0_DIR , X_ENABLE=MCU_DRIVE0_EN , X_TMCUART=MCU_DRIVE0_UART , + Y_STEP=MCU_DRIVE1_STEP , Y_DIR=MCU_DRIVE1_DIR , Y_ENABLE=MCU_DRIVE1_EN , Y_TMCUART=MCU_DRIVE1_UART , + Z_STEP=MCU_DRIVE2_STEP , Z_DIR=MCU_DRIVE2_DIR , Z_ENABLE=MCU_DRIVE2_EN , Z_TMCUART=MCU_DRIVE2_UART , + + E_STEP=MCU_DRIVE3_STEP , E_DIR=MCU_DRIVE3_DIR , E_ENABLE=MCU_DRIVE3_EN , E_TMCUART=MCU_DRIVE3_UART , + + DRIVER_SPI_MOSI=MCU_TMC_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_TMC_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_TMC_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + + X_STOP=MCU_DRIVE0_STOP , Y_STOP=MCU_DRIVE1_STOP , Z_STOP=MCU_DRIVE2_STOP , + PROBE_INPUT=MCU_PROBE , + RUNOUT_SENSOR=MCU_DRIVE3_STOP , + + E_HEATER=MCU_HEAT0 , E_TEMPERATURE=MCU_TH0 , + BED_HEATER=MCU_BED , BED_TEMPERATURE=MCU_THB , + + PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN2 , # MCU_FAN2 is always on + CONTROLLER_FAN=MCU_FAN1 , + + SERVO_PIN=MCU_SERVO , + diff --git a/user_templates/mcu_defaults/main/Mellow_Fly_Super8_v1.x.cfg b/user_templates/mcu_defaults/main/Mellow_Fly_Super8_v1.x.cfg new file mode 100644 index 000000000..7b656092e --- /dev/null +++ b/user_templates/mcu_defaults/main/Mellow_Fly_Super8_v1.x.cfg @@ -0,0 +1,55 @@ + +#------------------------------------------# +#### CUSTOM TEMPLATE MCU definition ######## +#------------------------------------------# + +# This template file is a pre-filled file with Klippain pins alias conventions +# that can be used if your MCU board is not yet officially supported. Just fill +# in your MCU pins and you will be good to go :) + +[mcu] +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/Mellow_Fly_Super8_v1.x.cfg] # Do not remove this line +[board_pins fly_Super8_mcu] +mcu: mcu +aliases: + X_STEP=MCU_DRIVE0_STEP , X_DIR=MCU_DRIVE0_DIR , X_ENABLE=MCU_DRIVE0_EN , X_TMCUART=MCU_DRIVE0_UART , + Y_STEP=MCU_DRIVE1_STEP , Y_DIR=MCU_DRIVE1_DIR , Y_ENABLE=MCU_DRIVE1_EN , Y_TMCUART=MCU_DRIVE1_UART , + + Z_STEP=MCU_DRIVE3_STEP , Z_DIR=MCU_DRIVE3_DIR , Z_ENABLE=MCU_DRIVE3_EN , Z_TMCUART=MCU_DRIVE3_UART , + Z1_STEP=MCU_DRIVE4_STEP , Z1_DIR=MCU_DRIVE4_DIR , Z1_ENABLE=MCU_DRIVE4_EN , Z1_TMCUART=MCU_DRIVE4_UART , + Z2_STEP=MCU_DRIVE5_STEP , Z2_DIR=MCU_DRIVE5_DIR , Z2_ENABLE=MCU_DRIVE5_EN , Z2_TMCUART=MCU_DRIVE5_UART , + Z3_STEP=MCU_DRIVE6_STEP , Z3_DIR=MCU_DRIVE6_DIR , Z3_ENABLE=MCU_DRIVE6_EN , Z3_TMCUART=MCU_DRIVE6_UART , + + E_STEP=MCU_DRIVE2_STEP , E_DIR=MCU_DRIVE2_DIR , E_ENABLE=MCU_DRIVE2_EN , E_TMCUART=MCU_DRIVE2_UART , + + DRIVER_SPI_MOSI=MCU_TMC_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_TMC_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_TMC_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + + X_STOP=MCU_IO0 , Y_STOP=MCU_IO1 , Z_STOP=MCU_IO3 , + PROBE_INPUT=MCU_HV_IN , + RUNOUT_SENSOR=MCU_IO4 , + + E_HEATER=MCU_HEAT0 , E_TEMPERATURE=MCU_ADC_0 , + BED_HEATER=MCU_BED , BED_TEMPERATURE=MCU_ADC_5 , + + PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN1 , + CONTROLLER_FAN=MCU_FAN2 , + EXHAUST_FAN=MCU_FAN3 , + FILTER_FAN=MCU_FAN4 , + HOST_CONTROLLER_FAN=MCU_FAN5 , + + CHAMBER_TEMPERATURE=MCU_ADC_1 , + ELECTRICAL_CABINET_TEMPERATURE=MCU_ADC_2 , + + LIGHT_OUTPUT=MCU_HEAT1 , +# LIGHT_NEOPIXEL= , +# STATUS_NEOPIXEL= , + + SERVO_PIN=MCU_SERVO , + diff --git a/user_templates/mcu_defaults/mmu/BTT_MMB_CAN_v1.0.cfg b/user_templates/mcu_defaults/mmu/BTT_MMB_CAN_v1.0.cfg new file mode 100644 index 000000000..12a00f67b --- /dev/null +++ b/user_templates/mcu_defaults/mmu/BTT_MMB_CAN_v1.0.cfg @@ -0,0 +1,53 @@ + +#-----------------------------------------------# +#### BTT MMB CAN board MCU definition ########### +#-----------------------------------------------# + +[mcu mmu] +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +# If you want to override the wiring of the BTT MMB CAN board, keep in mind that this +# board is defined using the "mmu" name. So you should use "pin: mmu:PIN_NAME" +# in your own overrides.cfg files. + +[include config/mcu_definitions/mmu/BTT_MMB_CAN_v1.0.cfg] # Do not remove this line +[board_pins mmu_mcu] +mcu: mmu +aliases: + MMU_GEAR_STEP=MCU_M1_STEP , MMU_GEAR_DIR=MCU_M1_DIR , MMU_GEAR_ENABLE=MCU_M1_EN , MMU_GEAR_UART=MCU_M1_UART , + MMU_SEL_STEP=MCU_M2_STEP , MMU_SEL_DIR=MCU_M2_DIR , MMU_SEL_ENABLE=MCU_M2_EN , MMU_SEL_UART=MCU_M2_UART , + + MMU_GEAR_DIAG=MCU_STP1 , # Shared with MCU_STP1 + MMU_SEL_DIAG=MCU_STP2 , # Shared with MCU_STP2 + + MMU_SEL_ENDSTOP=MCU_STP11 , + + MMU_SERVO=MCU_MOT , + MMU_ENCODER=MCU_SENSOR , + MMU_NEOPIXEL=MCU_RGB , + # MMU_GATE_SENSOR=MCU_STP1 , # (if not GEAR DIAG!) + + MMU_PRE_GATE_0=MCU_STP3 , + MMU_PRE_GATE_1=MCU_STP4 , + MMU_PRE_GATE_2=MCU_STP5 , + MMU_PRE_GATE_3=MCU_STP6 , + MMU_PRE_GATE_4=MCU_STP7 , + MMU_PRE_GATE_5=MCU_STP8 , + MMU_PRE_GATE_6=MCU_STP9 , + MMU_PRE_GATE_7=MCU_STP10 , + # MMU_PRE_GATE_8="" , + # MMU_PRE_GATE_9="" , + # MMU_PRE_GATE_10="" , + # MMU_PRE_GATE_11="" , + + SPI_SCLK=MCU_SCK , SPI_MOSI=MCU_MOSI , SPI_MISO=MCU_MISO , + + ## I2C header + I2C_SDA=MCU_I2C_SDA , I2C_SCL=MCU_I2C_SCL , I2C_GND= , I2C_5V=<5V> , + + ## SWD header + SWD_Reset= , SWD_PA14=MCU_SWD_PA14 , SWD_GND= , SWD_PA13=MCU_SWD_PA13 , SWD_3.3V=<3.3V> , + diff --git a/user_templates/mcu_defaults/mmu/BTT_SKR_Pico_v1.0.cfg b/user_templates/mcu_defaults/mmu/BTT_SKR_Pico_v1.0.cfg new file mode 100644 index 000000000..a77860f0d --- /dev/null +++ b/user_templates/mcu_defaults/mmu/BTT_SKR_Pico_v1.0.cfg @@ -0,0 +1,27 @@ + +#----------------------------------------# +#### BTT SKR Pico v1.0 mmu definition ######## +#----------------------------------------# + +[include config/mcu_definitions/mmu/BTT_SKR_Pico_v1.0.cfg] # Do not remove this line +[board_pins mmu_mcu] +mcu: mmu +aliases: + MMU_GEAR_STEP=MCU_Y_STEP , MMU_GEAR_DIR=MCU_Y_DIR , MMU_GEAR_ENABLE=MCU_Y_EN , MMU_GEAR_UART=MCU_TMCUART , + MMU_SEL_STEP=MCU_X_STEP , MMU_SEL_DIR=MCU_X_DIR , MMU_SEL_ENABLE=MCU_X_EN , MMU_SEL_UART=MCU_TMCUART , + + MMU_GEAR_ENDSTOP=MCU_Z-STOP , MMU_SEL_ENDSTOP=MCU_Y-STOP , + + MMU_SERVO=MCU_SERVOS , + MMU_ENCODER=MCU_X-STOP , + MMU_NEOPIXEL=MCU_RGB , + MMU_GATE_SENSOR=MCU_E0-STOP , + + EXTRA_PINS1=MCU_UART0_TX , EXTRA_PINS2=MCU_UART0_RX , + EXTRA_PINS3=MCU_SPI0_SCK , EXTRA_PINS4=MCU_SPI0_MISO , + EXTRA_PINS5=MCU_SPI0_MOSI , EXTRA_PINS6=MCU_SPI0_CS , + EXTRA_PINS7=MCU_I2C1_SDA , EXTRA_PINS8=MCU_I2C1_SCL , + EXTRA_PINS9=MCU_ADC0 , EXTRA_PINS10=MCU_ADC1 , + EXTRA_PINS11=MCU_ADC2 , EXTRA_PINS12=MCU_ADC3 , + EXTRA_PINS13= , EXTRA_PINS14=<5V> , + diff --git a/user_templates/mcu_defaults/mmu/Fysetc_ERCF_ERB.cfg b/user_templates/mcu_defaults/mmu/Fysetc_ERCF_ERB.cfg new file mode 100644 index 000000000..592b77464 --- /dev/null +++ b/user_templates/mcu_defaults/mmu/Fysetc_ERCF_ERB.cfg @@ -0,0 +1,37 @@ + +#---------------------------------------------# +#### Fysetc ERCF ERB MCU definition ########### +#---------------------------------------------# + +[mcu mmu] +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +# If you want to override the wiring of the Fysetc ERCF ERB board, keep in mind that this +# board is defined using the "mmu" name. So you should use "pin: mmu:PIN_NAME" +# in your own overrides.cfg files. + +[include config/mcu_definitions/mmu/Fysetc_ERCF_ERB.cfg] # Do not remove this line +[board_pins mmu_mcu] +mcu: mmu +aliases: + MMU_GEAR_STEP=MCU_GEAR_MOTOR_STEP , MMU_GEAR_DIR=MCU_GEAR_MOTOR_DIR , MMU_GEAR_ENABLE=MCU_GEAR_MOTOR_EN , MMU_GEAR_UART=MCU_GEAR_MOTOR_UART , + MMU_GEAR_DIAG=MCU_GEAR_MOTOR_DIAG , + MMU_SEL_STEP=MCU_SELECTOR_MOTOR_STEP , MMU_SEL_DIR=MCU_SELECTOR_MOTOR_DIR , MMU_SEL_ENABLE=MCU_SELECTOR_MOTOR_EN , MMU_SEL_UART=MCU_SELECTOR_MOTOR_UART , + MMU_SEL_DIAG=MCU_SELECTOR_MOTOR_DIAG , + + MMU_SEL_ENDSTOP=MCU_ENDSTOP , + MMU_SERVO=MCU_SERVO , + MMU_ENCODER=MCU_ENCODER , + MMU_GATE_SENSOR=MCU_HALL_SENSOR , + MMU_NEOPIXEL=MCU_RGB , + + MMU_PRE_GATE_0=MCU_0 , MMU_PRE_GATE_1=MCU_1 , + MMU_PRE_GATE_2=MCU_2 , MMU_PRE_GATE_3=MCU_3 , + MMU_PRE_GATE_4=MCU_4 , MMU_PRE_GATE_5=MCU_5 , + MMU_PRE_GATE_6=MMCU_6 , MMU_PRE_GATE_7=MCU_7 , + MMU_PRE_GATE_8=MCU_26 , MMU_PRE_GATE_9=MCU_27 , + MMU_PRE_GATE_10=MCU_28 , MMU_PRE_GATE_11=MCU_29 , + diff --git a/user_templates/mcu_defaults/mmu/Mellow_fly_ERCF.cfg b/user_templates/mcu_defaults/mmu/Mellow_fly_ERCF.cfg new file mode 100644 index 000000000..172b7c06f --- /dev/null +++ b/user_templates/mcu_defaults/mmu/Mellow_fly_ERCF.cfg @@ -0,0 +1,37 @@ + +#---------------------------------------------# +#### Mellow Fly ERCF MCU definition ########### +#---------------------------------------------# + +[mcu mmu] +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +# If you want to override the wiring of the Mellow Fly ERCF board, keep in mind that this +# board is defined using the "mmu" name. So you should use "pin: mmu:PIN_NAME" +# in your own overrides.cfg files. + +[include config/mcu_definitions/mmu/Mellow_fly_ERCF.cfg] # Do not remove this line +[board_pins mmu_mcu] +mcu: mmu +aliases: + MMU_GEAR_STEP=MCU_GEAR_STEP , MMU_GEAR_DIR=MCU_GEAR_DIR , MMU_GEAR_ENABLE=MCU_GEAR_EN , MMU_GEAR_UART=MCU_GEAR_UART , + MMU_GEAR_DIAG=MCU_GEAR_DIAG , + MMU_SEL_STEP=MCU_SELECTOR_STEP , MMU_SEL_DIR=MCU_SELECTOR_DIR , MMU_SEL_ENABLE=MCU_SELECTOR_EN , MMU_SEL_UART=MCU_SELECTOR_UART , + MMU_SEL_DIAG=MCU_SELECTOR_DIAG , + + MMU_SEL_ENDSTOP=MCU_ENDSTOP , + MMU_SERVO=MCU_SERVO , + MMU_ENCODER=MCU_ENCODER , + MMU_GATE_SENSOR=MCU_EXTRA , + + SPI_SCLK=MCU_SCK , SPI_MOSI=MCU_MOSI , SPI_MISO=MCU_MISO , + + MMU_PRE_GATE_0=MCU_IO10 , MMU_PRE_GATE_1=MCU_IO26 , + MMU_PRE_GATE_2=MCU_IO11 , MMU_PRE_GATE_3=MCU_IO27 , + MMU_PRE_GATE_4=MCU_IO12 , MMU_PRE_GATE_5=MCU_IO28 , + MMU_PRE_GATE_6=MCU_IO24 , MMU_PRE_GATE_7=MCU_IO29 , + MMU_PRE_GATE_8=MCU_IO13 , MMU_PRE_GATE_9=MCU_IO25 , + diff --git a/user_templates/mcu_defaults/mmu/Tircown_ERCF_easy_brd.cfg b/user_templates/mcu_defaults/mmu/Tircown_ERCF_easy_brd.cfg new file mode 100644 index 000000000..861f0336a --- /dev/null +++ b/user_templates/mcu_defaults/mmu/Tircown_ERCF_easy_brd.cfg @@ -0,0 +1,29 @@ + +#--------------------------------------------------# +#### Tircown ERCF easybrd MCU definition ########### +#--------------------------------------------------# + +[mcu mmu] +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +##-------------------------------------------------------------------- + +# If you want to override the wiring of the ERCF easy brd, keep in mind that this +# board is defined using the "mmu" name. So you should use "pin: mmu:PIN_NAME" +# in your own overrides.cfg files. + +[include config/mcu_definitions/mmu/Tircown_ERCF_easy_brd.cfg] # Do not remove this line +[board_pins mmu_mcu] +mcu: mmu +aliases: + MMU_GEAR_STEP=MCU_GEAR_STEP , MMU_GEAR_DIR=MCU_GEAR_DIR , MMU_GEAR_ENABLE=MCU_GEAR_ENABLE , + MMU_SEL_STEP=MCU_SELECTOR_STEP , MMU_SEL_DIR=MCU_SELECTOR_DIR , MMU_SEL_ENABLE=MCU_SELECTOR_ENABLE , + + MMU_GEAR_UART=MCU_TMCUART , # used for [tmc2209 stepper_mmu_gear] AND [tmc2209 stepper_mmu_selector] uart_pin in Happy_Hare + MMU_SEL_DIAG=MCU_SELECTOR_DIAG , + + MMU_SEL_ENDSTOP=MCU_SELECTOR_STOP , + MMU_SERVO=MCU_SERVO , + MMU_ENCODER=MCU_ENCODER , # (if not GATE_SENSOR!) + # MMU_GATE_SENSOR=MCU_ENCODER , # (if not ENCODER!) + diff --git a/user_templates/mcu_defaults/toolhead/BTT_SB2209_RP2040_v1.0.cfg b/user_templates/mcu_defaults/toolhead/BTT_SB2209_RP2040_v1.0.cfg index 05dedc0e1..44748bd9f 100644 --- a/user_templates/mcu_defaults/toolhead/BTT_SB2209_RP2040_v1.0.cfg +++ b/user_templates/mcu_defaults/toolhead/BTT_SB2209_RP2040_v1.0.cfg @@ -19,8 +19,8 @@ aliases: E_STEP=MCU_E0_STEP , E_DIR=MCU_E0_DIR , E_ENABLE=MCU_E0_EN , E_TMCUART=MCU_E0_UART , X_STOP=MCU_ENDSTOP , - PROBE_INPUT=MCU_IND_FAN , - TOOLHEAD_SENSOR=MCU_PROBE2 , + PROBE_INPUT=MCU_PROBE2 , + TOOLHEAD_SENSOR=MCU_PROBE1 , E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_TH0 , CHAMBER_TEMPERATURE=MCU_ONBOARD_NTCK100K , 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 672961559..37985e486 100644 --- a/user_templates/mcu_defaults/toolhead/BTT_SB2240_v1.0.cfg +++ b/user_templates/mcu_defaults/toolhead/BTT_SB2240_v1.0.cfg @@ -65,7 +65,7 @@ pin: toolhead:E_FAN [neopixel status_leds] pin: toolhead:STATUS_NEOPIXEL -# Since ADXL shares pins with the SPI interface of the TMC, it must be set up here, since different pin aliases must not resolve to the same pin +# Don't be surprised with the name of the pin. This is because the SPI bus is shared between motors and ADXL on this CANBoard. [tmc2240 extruder] cs_pin: toolhead:MCU_MOTOR_SPI_NSS spi_software_sclk_pin: toolhead:ADXL_SCLK diff --git a/user_templates/mcu_defaults/toolhead/Fysetc_SB_Can_TH_v1.x.cfg b/user_templates/mcu_defaults/toolhead/Fysetc_SB_Can_TH_v1.x.cfg new file mode 100644 index 000000000..8a1b7d612 --- /dev/null +++ b/user_templates/mcu_defaults/toolhead/Fysetc_SB_Can_TH_v1.x.cfg @@ -0,0 +1,85 @@ +#--------------------------------------------# +#### Fysetc SB Can TH v1.3 MCU definition #### +#--------------------------------------------# + +[mcu toolhead] +##-------------------------------------------------------------------- +canbus_uuid=change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +# If you want to override the wiring of the Fysetc SB Can TH, keep in mind that this +# board is defined using the "toolhead" name. So you should use "pin: toolhead:PIN_NAME" +# in your own overrides.cfg files. + +[include config/mcu_definitions/toolhead/Fysetc_SB_Can_TH_v1.x.cfg] # Do not remove this line + +[board_pins fysetc_mcu] +mcu: toolhead +aliases: + E_STEP=MCU_TMCDRIVER_STEP , E_DIR=MCU_TMCDRIVER_DIR , E_ENABLE=MCU_TMCDRIVER_ENABLE , E_TMCUART=MCU_TMCDRIVER_UART , + E_TXPIN=MCU_TMCDRIVER_TX , + + X_STOP=MCU_IO1 , Y_STOP=MCU_IO2 , + PROBE_INPUT=MCU_PROBE , + + E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_TE0 , + + PART_FAN=MCU_FAN0_PWM , E_FAN=MCU_FAN1_PWM , + + STATUS_NEOPIXEL=MCU_RGB , + + ADXL_CS=MCU_ADXL345_CSPIN , ADXL_SCLK=MCU_ADXL345_CLK , ADXL_MISO=MCU_ADXL345_MISO , ADXL_MOSI=MCU_ADXL345_MOSI , + +#----------------------------------------# +# Fysetc SB Can TH v1.3 pins remapping # +#----------------------------------------# + +# These pins overrides are automatically added when you select a CANbus +# toolhead MCU during the installation process. They should provide a +# good base to work with. Feel free to adapt to your board if needed! + +[extruder] +step_pin: toolhead:E_STEP +dir_pin: !toolhead:E_DIR +enable_pin: !toolhead:E_ENABLE +heater_pin: toolhead:E_HEATER +sensor_pin: toolhead:E_TEMPERATURE + +[tmc2209 extruder] +uart_pin: toolhead:E_TMCUART +tx_pin: toolhead:E_TXPIN + +## Uncomment the following line if using a prove for bed mesh +#[probe] +#pin: ^toolhead:PROBE_INPUT + +[fan] +pin: toolhead:PART_FAN + +[heater_fan hotend_fan] +pin: toolhead:E_FAN + +## Uncomment the following line if not using sensorless homing +## and having the X endstop plugged to the toolhead MCU. Make sure +## X endstop is plugged in to IO.1 on the board. +# [stepper_x] +# endstop_pin: ^toolhead:X_STOP + +## Uncomment the following line if not using sensorless homing +## and having the Y endstop plugged to the toolhead MCU. Make sure +## Yendstop is plugged in to IO.2 on the board. +# [stepper_y] +# endstop_pin: ^toolhead:Y_STOP + +[neopixel status_leds] +pin: toolhead:STATUS_NEOPIXEL + +[tmc2209 extruder] +uart_pin: toolhead:E_TMCUART + +[temperature_sensor toolhead_mcu] +sensor_type: temperature_mcu +sensor_mcu: toolhead + +[output_pin activity_led] +pin: toolhead:MCU_STATUS diff --git a/user_templates/mcu_defaults/toolhead/LDO_Nitehawk-SB_v1.0.cfg b/user_templates/mcu_defaults/toolhead/LDO_Nitehawk-SB_v1.0.cfg new file mode 100644 index 000000000..4fd4d99b0 --- /dev/null +++ b/user_templates/mcu_defaults/toolhead/LDO_Nitehawk-SB_v1.0.cfg @@ -0,0 +1,84 @@ + +#-------------------------------------------------------# +#### LDO Nighthawk SB toolhead v1 MCU definition ######## +#-------------------------------------------------------# + +[mcu toolhead] +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 ##### <--- change-me-to-the-correct-serial hint: ls /dev/serial/by-id/* # +##-------------------------------------------------------------------- + +# If you want to override the wiring of the LDO Nighthawk, keep in mind that this +# board is defined using the "toolhead" name. So you should use "pin: toolhead:PIN_NAME" +# in your own overrides.cfg files. + +[include config/mcu_definitions/toolhead/LDO_Nitehawk-SB_v1.0.cfg] # Do not remove this line +[board_pins nitehawk_mcu] +mcu: toolhead +aliases: + E_STEP=MCU_EMOT_STEP , E_DIR=MCU_EMOT_DIR , E_ENABLE=MCU_EMOT_EN , E_TMCUART=MCU_EMOT_UART , + + X_STOP=MCU_ENDSTOP_X , + PROBE_INPUT=MCU_HV_ENDSTOP , + + E_HEATER=MCU_HEAT , E_TEMPERATURE=MCU_TEMP , CHAMBER_TEMPERATURE=MCU_HEAT_CHAMBER , + NH_MCU_TEMP=MCU_NH_TEMP , + + PART_FAN=MCU_FAN1 , E_FAN=MCU_FAN0 , + PART_FAN_TACHO=MCU_PWM0 , E_FAN_TACHO=MCU_PWM1 , + + STATUS_NEOPIXEL=MCU_RGB , STATUS_BOARD=MCU_ACTIVITY_LED , + + ADXL_CS=MCU_ADXL_CS , ADXL_SCLK=MCU_ADXL_SCK , ADXL_MOSI=MCU_ADXL_MOSI , ADXL_MISO=MCU_ADXL_MISO , + + TX_PIN=MCU_ST_UART_TX , + + +#----------------------------------------# +# LDO Nighthawk-SB v1 pins remapping # +#----------------------------------------# + +# These pins overrides are automatically added when you select the LDO +# toolhead MCU during the installation process. They should provide a +# good base to work with. Feel free to adapt to your board if needed! + +[extruder] +step_pin: toolhead:E_STEP +dir_pin: toolhead:E_DIR +enable_pin: !toolhead:E_ENABLE +heater_pin: toolhead:E_HEATER +sensor_pin: toolhead:E_TEMPERATURE +pullup_resistor: 2200 + +[tmc2209 extruder] +uart_pin: toolhead:E_TMCUART +tx_pin: toolhead:TX_PIN +sense_resistor: 0.100 + +[probe] +pin: ^toolhead:PROBE_INPUT + +[fan] +pin: toolhead:PART_FAN +#tachometer_pin: toolhead:PART_FAN_TACHO + +[heater_fan hotend_fan] +pin: toolhead:E_FAN +# tachometer_pin: toolhead:E_FAN_TACHO + +## Uncomment the following line if not using sensorless homing +## and having the X endstop plugged to the toolhead MCU +# [stepper_x] +# endstop_pin: ^toolhead:X_STOP + +[neopixel status_leds] +pin: toolhead:STATUS_NEOPIXEL + +## Nitehawk PCB temperature sensor +[temperature_sensor nh_temp] +sensor_type: CMFB103F3950FANT +sensor_pin: toolhead:NH_MCU_TEMP +pullup_resistor: 2200 +min_temp: 0 +max_temp: 100 + diff --git a/user_templates/mcu_defaults/toolhead/Mellow_SB2040_Pro.cfg b/user_templates/mcu_defaults/toolhead/Mellow_SB2040_Pro.cfg new file mode 100644 index 000000000..3f7e35c6d --- /dev/null +++ b/user_templates/mcu_defaults/toolhead/Mellow_SB2040_Pro.cfg @@ -0,0 +1,77 @@ + +#-------------------------------------------# +#### Mellow SB2040 Pro MCU definition ######## +#-------------------------------------------# + +[mcu toolhead] +##-------------------------------------------------------------------- +canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +# If you want to override the wiring of the Mellow SB2040, keep in mind that this +# board is defined using the "toolhead" name. So you should use "pin: toolhead:PIN_NAME" +# in your own overrides.cfg files. + +[include config/mcu_definitions/toolhead/Mellow_SB2040_Pro.cfg] # Do not remove this line +[board_pins sb2040_mcu] +mcu: toolhead +aliases: + E_STEP=MCU_EMOT_STEP , E_DIR=MCU_EMOT_DIR , E_ENABLE=MCU_EMOT_EN , E_TMCUART=MCU_EMOT_CS , + + X_STOP=MCU_ENDSTOP , + PROBE_INPUT=MCU_HV_ENDSTOP , + TOOLHEAD_SENSOR=MCU_5V_ENDSTOP , + EXTRUDER_SENSOR=MCU_FAN2 , + + E_HEATER=MCU_HEAT , E_TEMPERATURE=MCU_TEMP , CHAMBER_TEMPERATURE=MCU_ONBOARD_NTCK100K , + + PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN1 , + + STATUS_NEOPIXEL=MCU_RGB , + + ADXL_CS=MCU_ADXL_CS , ADXL_SCLK=MCU_ADXL_SCK , ADXL_MOSI=MCU_ADXL_MOSI , ADXL_MISO=MCU_ADXL_MISO , + + +#----------------------------------------# +# Mellow SB2040 Pro pins remapping # +#----------------------------------------# + +# These pins overrides are automatically added when you select a CANbus +# toolhead MCU during the installation process. They should provide a +# good base to work with. Feel free to adapt to your board if needed! + +[extruder] +step_pin: toolhead:E_STEP +dir_pin: toolhead:E_DIR +enable_pin: !toolhead:E_ENABLE +heater_pin: toolhead:E_HEATER +sensor_pin: toolhead:E_TEMPERATURE +#pullup_resistor: 1000 # (1000 for PT1000 with jumper conn,4700-default without jumper) +## for PT100: +#sensor_type: MAX31865 +#sensor_pin: toolhead:MCU_MAX31865_CS +# spi_software_sclk_pin: toolhead:MCU_MAX31865_SCK +# spi_software_mosi_pin: toolhead:MCU_MAX31865_MOSI +# spi_software_miso_pin: toolhead:MCU_MAX31865_MISO +#rtd_reference_r: 430 + +[probe] +pin: ^toolhead:PROBE_INPUT + +[fan] +pin: toolhead:PART_FAN + +[heater_fan hotend_fan] +pin: toolhead:E_FAN + +## Uncomment the following line if not using sensorless homing +## and having the X endstop plugged to the toolhead MCU +# [stepper_x] +# endstop_pin: ^toolhead:X_STOP + +[neopixel status_leds] +pin: toolhead:STATUS_NEOPIXEL + +[tmc2240 extruder] +uart_pin: toolhead:E_TMCUART + diff --git a/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v1.cfg b/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v1.cfg index a5b92ea37..4021b4d75 100644 --- a/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v1.cfg +++ b/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v1.cfg @@ -18,9 +18,10 @@ mcu: toolhead aliases: E_STEP=MCU_EMOT_STEP , E_DIR=MCU_EMOT_DIR , E_ENABLE=MCU_EMOT_EN , E_TMCUART=MCU_EMOT_UART , - X_STOP=MCU_ENDSTOP , - PROBE_INPUT=MCU_HV_ENDSTOP , + X_STOP=MCU_ENDSTOP , + PROBE_INPUT=MCU_HV_ENDSTOP , TOOLHEAD_SENSOR=MCU_5V_ENDSTOP , + EXTRUDER_SENSOR=MCU_FAN2 , E_HEATER=MCU_HEAT , E_TEMPERATURE=MCU_TEMP , CHAMBER_TEMPERATURE=MCU_ONBOARD_NTCK100K , diff --git a/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v2.cfg b/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v2.cfg new file mode 100644 index 000000000..265086e82 --- /dev/null +++ b/user_templates/mcu_defaults/toolhead/Mellow_SB2040_v2.cfg @@ -0,0 +1,77 @@ + +#-------------------------------------------# +#### Mellow SB2040 v2 MCU definition ######## +#-------------------------------------------# + +[mcu toolhead] +##-------------------------------------------------------------------- +canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +# If you want to override the wiring of the Mellow SB2040, keep in mind that this +# board is defined using the "toolhead" name. So you should use "pin: toolhead:PIN_NAME" +# in your own overrides.cfg files. + +[include config/mcu_definitions/toolhead/Mellow_SB2040_v2.cfg] # Do not remove this line +[board_pins sb2040_mcu] +mcu: toolhead +aliases: + E_STEP=MCU_EMOT_STEP , E_DIR=MCU_EMOT_DIR , E_ENABLE=MCU_EMOT_EN , E_TMCUART=MCU_EMOT_UART , + + X_STOP=MCU_ENDSTOP , + PROBE_INPUT=MCU_HV_ENDSTOP , + TOOLHEAD_SENSOR=MCU_5V_ENDSTOP , + EXTRUDER_SENSOR=MCU_FAN2 , + + E_HEATER=MCU_HEAT , E_TEMPERATURE=MCU_TEMP , CHAMBER_TEMPERATURE=MCU_ONBOARD_NTCK100K , + + PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN1 , + + STATUS_NEOPIXEL=MCU_RGB , + + ADXL_CS=MCU_ADXL_CS , ADXL_SCLK=MCU_ADXL_SCK , ADXL_MOSI=MCU_ADXL_MOSI , ADXL_MISO=MCU_ADXL_MISO , + + +#----------------------------------------# +# Mellow SB2040 v2 pins remapping # +#----------------------------------------# + +# These pins overrides are automatically added when you select a CANbus +# toolhead MCU during the installation process. They should provide a +# good base to work with. Feel free to adapt to your board if needed! + +[extruder] +step_pin: toolhead:E_STEP +dir_pin: toolhead:E_DIR +enable_pin: !toolhead:E_ENABLE +heater_pin: toolhead:E_HEATER +sensor_pin: toolhead:E_TEMPERATURE +#pullup_resistor: 1000 # (1000 for PT1000 with jumper conn,4700-default without jumper) +## for PT100: +#sensor_type: MAX31865 +#sensor_pin: toolhead:MCU_MAX31865_CS +# spi_software_sclk_pin: toolhead:MCU_MAX31865_SCK +# spi_software_mosi_pin: toolhead:MCU_MAX31865_MOSI +# spi_software_miso_pin: toolhead:MCU_MAX31865_MISO +#rtd_reference_r: 430 + +[probe] +pin: ^toolhead:PROBE_INPUT + +[fan] +pin: toolhead:PART_FAN + +[heater_fan hotend_fan] +pin: toolhead:E_FAN + +## Uncomment the following line if not using sensorless homing +## and having the X endstop plugged to the toolhead MCU +# [stepper_x] +# endstop_pin: ^toolhead:X_STOP + +[neopixel status_leds] +pin: toolhead:STATUS_NEOPIXEL + +[tmc2209 extruder] +uart_pin: toolhead:E_TMCUART + diff --git a/user_templates/moonraker.conf b/user_templates/moonraker.conf index b86bd6202..bd96e978c 100644 --- a/user_templates/moonraker.conf +++ b/user_templates/moonraker.conf @@ -31,6 +31,21 @@ # [include moonraker/z_calibration.conf] # ----------------------------------------------------------------- +##### Spoolman plugin update management and server config --------- +# [include moonraker/spoolman.conf] +## If you want to change the default "localhost" IP, uncomment the two lines below to manually specify your Spoolman server IP +# [spoolman] +# server: http://YourSpoolmanIP:7912 +# ----------------------------------------------------------------- + +##### led_effect plugin update management ------------------------ +# [include moonraker/led_effect.conf] +# ----------------------------------------------------------------- + +##### TMC Autotune plugin update management ---------------------- +# [include moonraker/tmc_autotune.conf] +# ----------------------------------------------------------------- + ##### Add your custom moonraker config customizations and overrides below this line... # ------------------------------------------------------------------------------------ diff --git a/user_templates/overrides.cfg b/user_templates/overrides.cfg index 2b540fffe..cfb16a0a2 100644 --- a/user_templates/overrides.cfg +++ b/user_templates/overrides.cfg @@ -14,7 +14,7 @@ #> Main control MCUs are called "mcu" (and "secondary" when using a double MCU configuration) #> Toolhead CANboard MCUs are called "toolhead" -#> ERCF MCUs are called "ercf" +#> MMU/ERCF MCUs are called "mmu" # ------------------------------------------------------------------------------------------ diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index e790e3cc0..738bafea8 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -37,6 +37,7 @@ # [include config/hardware/axis/Z/Trident_TR8x8_1.8deg.cfg] # [include config/hardware/axis/Z/Trident_TR8x4_1.8deg.cfg] +# [include config/hardware/axis/Z/Trident_TR8x2_1.8deg.cfg] # [include config/hardware/axis/Z/V0_TR8x8_1.8deg.cfg] # [include config/hardware/axis/Z/V0_TR8x4_1.8deg.cfg] @@ -72,6 +73,7 @@ # [include config/hardware/extruder/lgx_heavy.cfg] # [include config/hardware/extruder/lgx_lite.cfg] # [include config/hardware/extruder/orbiter2.0.cfg] +# [include config/hardware/extruder/sherpa_mini.cfg] # [include config/hardware/extruder/vz_hextrudort.cfg] # ---------------------------------------------------------------------------------------- @@ -99,6 +101,9 @@ ## Voron TAP, also used naturally as a virtual Z endstop # [include config/hardware/probes/voron_tap.cfg] +## BLTouch probe also used as virtual Z endstop +# [include config/hardware/probes/bltouch_virtual.cfg] + ## 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] # ---------------------------------------------------------------------------------------- @@ -108,6 +113,10 @@ ### -------------------------------------------------------------------------------------- # [include config/hardware/fans/hotend_fan.cfg] # [include config/hardware/fans/part_fan.cfg] + +# [include config/hardware/fans/hotend_fan_tachometer.cfg] # When having a tachometer monitoring hotend fan speed +# [include config/hardware/fans/part_fan_tachometer.cfg] # When having a tachometer monitoring part fan speed + # [include config/hardware/fans/controller_fan.cfg] # [include config/hardware/fans/rpi_fan.cfg] # ---------------------------------------------------------------------------------------- @@ -128,6 +137,7 @@ ### that correspond to your display brand in the following lines: # [include config/hardware/displays/BTT_mini12864.cfg] # [include config/hardware/displays/Fysetc_mini12864.cfg] +# [include config/hardware/displays/Fysetc_mini12864_v1.2_v2.0.cfg] ### As BTT and Fysetc have done the wiring exactly the opposite on their boards, if you are mixing ### the brands (ie. a BTT display on a Fysetc board, or the opposite), please use the file @@ -135,6 +145,10 @@ ### rotate connectors 180 degree according to this documentation: https://docs.vorondesign.com/build/electrical/mini12864_klipper_guide.html # [include config/hardware/displays/BTT_mini12864_inversed.cfg] # [include config/hardware/displays/Fysetc_mini12864_inversed.cfg] +# [include config/hardware/displays/Fysetc_mini12864_v1.2_v2.0_inversed.cfg] + +### For a V0 display with an integrated MCU, don't forget to override the MCU serial port in your overrides.cfg file +# [include config/hardware/displays/V0_display.cfg] # ---------------------------------------------------------------------------------------- @@ -146,7 +160,7 @@ # [include config/hardware/temperature_sensors/cabinet_temp.cfg] # [include config/hardware/temperature_sensors/chamber_temp.cfg] # [include config/hardware/temperature_sensors/chamber_temp_ds18b20.cfg] # Specific for DS18B20 directly connected to the Pi -# [include config/hardware/temperature_sensors/chamber_temp_toolhead.cfg] # This is not recommended as toolhead board temperature sensors are not accurate +# [include config/hardware/temperature_sensors/chamber_temp_toolhead.cfg] # This is to use a toolhead integrated temperature sensor (or an external one as it's done on the LDO Nitehawk) # ---------------------------------------------------------------------------------------- @@ -154,7 +168,13 @@ ### -------------------------------------------------------------------------------------- # [include config/hardware/lights/fcob_white.cfg] # [include config/hardware/lights/neopixel_caselight.cfg] -# [include config/hardware/lights/status_leds.cfg] +# [include config/hardware/lights/status_leds.cfg] # Standard StealthBurner style LEDs +# [include config/hardware/lights/status_leds_rainbow_barf.cfg] # Rainbow Barf StealthBurner style LEDs + +# The following files are to be used with the LED effect plugin: https://github.com/julianschill/klipper-led_effect +# [include config/hardware/lights/neopixel_caselight_effects.cfg] +# [include config/hardware/lights/status_leds_effects.cfg] # Standard StealthBurner style LEDs +# [include config/hardware/lights/status_leds_rainbow_barf_effects.cfg] # Rainbow Barf StealthBurner style LEDs # ---------------------------------------------------------------------------------------- @@ -177,6 +197,9 @@ # [include config/hardware/accelerometers/adxl345_ebb.cfg] # For ADXL plugged in BTT EBB36 or EBB42 boards # [include config/hardware/accelerometers/adxl345_sht.cfg] # For ADXL plugged in Mellow SHT36 or SHT42 boards # [include config/hardware/accelerometers/adxl345_BTT_SB22xx.cfg] # For ADXL plugged in BTT SB2209 or SB2240 boards +# [include config/hardware/accelerometers/adxl345_Fysetc_SB_Can_TH.cfg] # For ADXL plugged in Fysetc SB Can TH boards + +# [include config/hardware/accelerometers/lis2dw_usb_rp2040_spi1.cfg] # For BTT S2DW V1.0, ... # ---------------------------------------------------------------------------------------- @@ -187,16 +210,15 @@ # ---------------------------------------------------------------------------------------- -# ------------------------------------------------------------------------------ ERCF ----> Select either all lines or none +# --------------------------------------------------------------------------- MMU/ERCF ----> You need to select both lines or none ### -------------------------------------------------------------------------------------- -### Klippain is designed to be used with the ERCF Happy Hare software: https://github.com/moggieuk/ERCF-Software-V3 -### Please run its own install script to get Happy Hare ready to be used -### Then, include all of the following files that are created during the installation of Happy Hare to enable ERCF in Klippain -# [include ercf_hardware.cfg] -# [include ercf_parameters.cfg] -# [include ercf_software.cfg] -# [include ercf_menu.cfg] # Optional: use it if you also have a Mini12864 display to add the ERCF menu entries -# [include config/hardware/ercf.cfg] +### Klippain is designed to be used with the MMU/ERCF HappyHare software backend: https://github.com/moggieuk/Happy-Hare +### Please refer to the corresponding Klippain documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md +# [include mmu/base/mmu_*.cfg] +# [include config/hardware/mmu.cfg] + +# [include mmu/optional/mmu_menu.cfg] # Optional: use it if you also have a Mini12864 display and want to add the MMU/ERCF menu entries +# [include mmu/addons/mmu_erec_cutter.cfg] # Optional: only for EREC Filament Cutter Support # ---------------------------------------------------------------------------------------- @@ -270,11 +292,17 @@ # ---------------------------------------------------------------------------------------- +# -------------------------------------------------------------------------- SPOOLMAN ---- +### -------------------------------------------------------------------------------------- +### You must have the Spoolman plugin installed... from here: https://github.com/Donkie/Spoolman +# [include config/software/spoolman.cfg] +# ---------------------------------------------------------------------------------------- + + ################################### ### DO NOT EDIT BELOW THIS LINE ### ################################### -[include config/machine.cfg] [include variables.cfg] [include mcu.cfg] [include overrides.cfg] diff --git a/user_templates/save_variables.cfg b/user_templates/save_variables.cfg index 21009a950..133b160ad 100644 --- a/user_templates/save_variables.cfg +++ b/user_templates/save_variables.cfg @@ -1,15 +1,2 @@ [Variables] -ercf_calib_0 = 1.0 -ercf_calib_1 = 1.0 -ercf_calib_2 = 1.0 -ercf_calib_3 = 1.0 -ercf_calib_4 = 1.0 -ercf_calib_5 = 1.0 -ercf_calib_6 = 1.0 -ercf_calib_7 = 1.0 -ercf_calib_8 = 1.0 -ercf_calib_9 = 1.0 -ercf_calib_10 = 1.0 -ercf_calib_11 = 1.0 -ercf_calib_ref = 500.0 -ercf_calib_clog_length = 8.0 +mmu_calibration_0 = 1.0 diff --git a/user_templates/variables.cfg b/user_templates/variables.cfg index c6f0468ed..f2e62f2e9 100644 --- a/user_templates/variables.cfg +++ b/user_templates/variables.cfg @@ -20,9 +20,6 @@ variable_tilting_travel_accel: 3000 variable_brush_clean_accel: 1500 variable_probe_dock_accel: 2000 -## Accel to decel scale factor (default is 75% of the accel) -variable_accel_to_decel_factor: 0.75 - ################################################# # Homing, start_print and end_print variables @@ -60,6 +57,8 @@ variable_prime_line_direction: "X" # can also be set to "Y" variable_prime_line_length: 40 # length of the prime line on the bed (in mm) variable_prime_line_purge_distance: 30 # length of filament to purge (in mm) variable_prime_line_flowrate: 10 # mm3/s used for the prime line +variable_prime_line_height: 0.6 # mm, used for actual cross section computation +variable_prime_line_margin: 5 # distance of purge line from fl_size rectangle ## Park position used when pause, end_print, etc... variable_park_position_xy: -1, -1 @@ -84,6 +83,11 @@ variable_max_bed_xy: 9999, 9999 ## Minimum safe Z height to attach/detach probe variable_probe_min_z_travel: 20 +## Z height to move to when detaching probe +## Setting to 'None' or removing this variable will prevent any +## change in z position when detaching the probe +variable_probe_stow_z_height: None + ## Position of the probe dock variable_probe_dock_location_xy: -1, -1 @@ -140,7 +144,7 @@ variable_print_default_material: "XXX" ## Material configuration parameters applied during START_PRINT by using the slicer MATERIAL variable ## FYI, retract paramaters are used only if firmware retraction is enabled, filter speed (in %) is used if -## there is a filter installed on the machine, etc... +## there is a filter installed on the machine, filament sensor is on or off if installed, etc... ## If you are using another material, just extend the list bellow with a new material and everything should work :) variable_material_parameters: { 'PLA': { @@ -150,7 +154,8 @@ variable_material_parameters: { 'retract_speed': 40, 'unretract_speed': 30, 'filter_speed': 0, - 'additional_z_offset': 0 + 'additional_z_offset': 0, + 'filament_sensor': 1 }, 'PET': { 'pressure_advance': 0.0650, @@ -159,7 +164,8 @@ variable_material_parameters: { 'retract_speed': 30, 'unretract_speed': 20, 'filter_speed': 0, - 'additional_z_offset': 0.020 + 'additional_z_offset': 0.020, + 'filament_sensor': 1 }, 'ABS': { 'pressure_advance': 0.0480, @@ -168,19 +174,32 @@ variable_material_parameters: { 'retract_speed': 40, 'unretract_speed': 30, 'filter_speed': 80, - 'additional_z_offset': 0 + 'additional_z_offset': 0, + 'filament_sensor': 1 + }, + 'TPU': { + 'pressure_advance': 0.0500, + 'retract_length': 0.2, + 'unretract_extra_length': 0, + 'retract_speed': 5, + 'unretract_speed': 5, + 'filter_speed': 0, + 'additional_z_offset': 0.040, + 'filament_sensor': 0 } } ################################################ -## ERCF specific variables +## MMU/ERCF specific variables ################################################ -## This section is only considered if an ERCF is installed and configured +## This section is only considered if an MMU/ERCF is installed and configured -variable_ercf_unload_on_cancel_print: False -variable_ercf_unload_on_end_print: True -variable_ercf_reset_stats_on_start_print: False +variable_mmu_force_homing_in_start_print: False +variable_mmu_unload_on_cancel_print: False +variable_mmu_unload_on_end_print: True +variable_mmu_check_gates_on_start_print: False # True is recommended but you must have TOOLS_USED=!referenced_tools! in your slicer START_PRINT parameters. Otherwise it will only check the INITIAL TOOL... +variable_mmu_check_errors_on_start_print: False # Set to True if you want an early check of MMU errors during the START_PRINT sequence. ################################################ ## Filter specific variables @@ -210,73 +229,26 @@ variable_purge_ooze_time: 10 # Time (in seconds) to wait after the purge to let variable_purgeclean_servo_angle_retracted: 0 variable_purgeclean_servo_angle_deployed: 90 - ## White light parameters (if installed in the machine) variable_light_intensity_start_print: 100 variable_light_intensity_printing: 30 variable_light_intensity_end_print: 0 +## Caselight LEDs ON at startup (caselight need to be installed in the machine) +variable_caselight_on_at_startup: False ## Patch the M190/M109 commands to avoid some wait time while the temperature ## settle on very low thermal latency devices (such as the BambuLabs hotend) variable_fix_heaters_temperature_settle: False - ## Resonnance testing position (if an accelerometer is installed in the machine) ## If test point is let to -1,-1, it default to the center of the bed at 50mm high variable_resonnance_test_point_xy: -1, -1 variable_resonnance_test_z_clearance: 50 -## SteathBurner minidisplay and case leds colors (if installed in the machine) -variable_status_leds_colors: { - 'logo': { - 'busy': {'r': 0.4, 'g': 0.0, 'b': 0.0, 'w': 0.0}, - 'cleaning': {'r': 0.0, 'g': 0.02, 'b': 0.5, 'w': 0.0}, - 'calibrating_z': {'r': 0.8, 'g': 0., 'b': 0.35, 'w': 0.0}, - 'heating': {'r': 0.3, 'g': 0.18, 'b': 0.0, 'w': 0.0}, - 'homing': {'r': 0.0, 'g': 0.6, 'b': 0.2, 'w': 0.0}, - 'leveling': {'r': 0.5, 'g': 0.1, 'b': 0.4, 'w': 0.0}, - 'meshing': {'r': 0.2, 'g': 1.0, 'b': 0.0, 'w': 0.0}, - 'on': {'r': 0.8, 'g': 0.8, 'b': 0.8, 'w':1.0}, - 'off': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, - 'printing': {'r': 1.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, - 'standby': {'r': 0.01, 'g': 0.01, 'b': 0.01, 'w': 0.1}, - 'error': {'r': 0.6, 'g': 0.0, 'b': 0.0, 'w':0.0}, - }, - 'nozzle': { - 'heating': {'r': 0.8, 'g': 0.35, 'b': 0.0, 'w':0.0}, - 'off': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, - 'on': {'r': 0.8, 'g': 0.8, 'b': 0.8, 'w':1.0}, - 'standby': {'r': 0.6, 'g': 0.0, 'b': 0.0, 'w':0.0}, - 'error': {'r': 0.6, 'g': 0.0, 'b': 0.0, 'w':0.0}, - }, - 'caselight': { - 'busy': {'r': 0.4, 'g': 0.0, 'b': 0.0, 'w': 0.0}, - 'cleaning': {'r': 0.0, 'g': 0.02, 'b': 0.5, 'w': 0.0}, - 'calibrating_z': {'r': 0.8, 'g': 0., 'b': 0.35, 'w': 0.0}, - 'heating': {'r': 0.3, 'g': 0.18, 'b': 0.0, 'w': 0.0}, - 'homing': {'r': 0.0, 'g': 0.6, 'b': 0.2, 'w': 0.0}, - 'leveling': {'r': 0.5, 'g': 0.1, 'b': 0.4, 'w': 0.0}, - 'meshing': {'r': 0.2, 'g': 1.0, 'b': 0.0, 'w': 0.0}, - 'on': {'r': 0.8, 'g': 0.8, 'b': 0.8, 'w':1.0}, - 'off': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, - 'printing': {'r': 1.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, - 'standby': {'r': 0.01, 'g': 0.01, 'b': 0.01, 'w': 0.1}, - 'error': {'r': 0.6, 'g': 0.0, 'b': 0.0, 'w':0.0}, - }, - 'minidisplay': { - 'on': {'r': 0.0, 'g': 0.2, 'b': 0.4, 'w':1.0}, - 'off': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, - 'error': {'r': 0.4, 'g': 0.0, 'b': 0.0, 'w':0.0}, - }, - 'thermal': { - 'hot': {'r': 1.0, 'g': 0.0, 'b': 0.0, 'w': 0.0}, - 'cold': {'r': 0.3, 'g': 0.0, 'b': 0.3, 'w': 0.0} - } - } - - +## ----------------------------------------------------------------------------------- +## ----------------------------------------------------------------------------------- ## Do not remove the next lines gcode: