diff --git a/hosts/briah/klipper.cfg b/hosts/briah/klipper.cfg index 9ae1f79..617e7a3 100644 --- a/hosts/briah/klipper.cfg +++ b/hosts/briah/klipper.cfg @@ -143,7 +143,6 @@ position_max: 280 endstop_pin: probe:z_virtual_endstop # Use Z- as endstop homing_speed: 5.0 - [extruder] max_extrude_only_distance: 100.0 step_pin: PB10 @@ -208,13 +207,6 @@ fade_start: 1 fade_end: 10 fade_target: 0 -#[input_shaper] -# Calibrate IS: https://www.klipper3d.org/Resonance_Compensation.html -#shaper_type_y = mzv -#shaper_freq_y = 69.9300699 -#shaper_type_x = ei -#shaper_freq_x = 74.4878957 - [temperature_sensor raspberry_pi] sensor_type: temperature_host #min_temp: 10 @@ -239,6 +231,39 @@ gcode: BED_MESH_CALIBRATE SAVE_CONFIG +# -- # +# Uncomment lines below for KUSBA support. +# -- # +# +# [mcu adxl] +# serial: /dev/serial/by-id/usb-Klipper_rp2040_E6624C902762BE38-if00 +# Edit the above line with the correct serial address. Use "ls /dev/serial/by-id/*" to find the MCU serial address. +# +# [adxl345] +# cs_pin: adxl:gpio1 +# +# # Hardware SPI Option (Better results, "Invalid ID" Klipper bug with first query) +# spi_bus: spi0a +# +# # Software SPI Option (No "Invalid ID" Klipper bug with first query) +# # spi_software_sclk_pin: adxl:gpio2 +# # spi_software_mosi_pin: adxl:gpio3 +# # spi_software_miso_pin: adxl:gpio0 +# +# [resonance_tester] +# accel_chip: adxl345 +# probe_points: +# 112,112,20 +# # Edit the above line with the correct probe points location. I recommend the center of your bed for X & Y, 20 for Z. +# # For 350 mm printers: 175,175,20 +# # For 300 mm printers: 150,150,20 +# # For 250 mm printers: 125,125,20 +# # For 120 mm printers: 60,60,20 +# +# -- # +# More info: https://www.klipper3d.org/Config_Reference.html#adxl345 +# -- # + #*# <---------------------- SAVE_CONFIG ----------------------> #*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. #*# @@ -248,12 +273,12 @@ gcode: #*# [bed_mesh default] #*# version = 1 #*# points = -#*# 0.075000, 0.037500, -0.077500, -0.145000, -0.305000, -0.202500 -#*# 0.137500, 0.137500, 0.117500, 0.095000, 0.062500, -0.070000 -#*# 0.127500, 0.110000, 0.080000, 0.060000, 0.022500, -0.145000 -#*# 0.127500, 0.120000, 0.092500, 0.072500, 0.042500, -0.087500 -#*# 0.112500, 0.087500, 0.057500, 0.040000, 0.010000, -0.130000 -#*# -0.020000, -0.032500, -0.050000, -0.052500, -0.065000, -0.165000 +#*# 0.022500, -0.010000, -0.052500, -0.080000, -0.117500, -0.117500 +#*# 0.015000, 0.032500, 0.007500, -0.005000, -0.040000, -0.055000 +#*# 0.010000, 0.017500, -0.015000, -0.030000, -0.075000, -0.107500 +#*# 0.017500, 0.025000, -0.002500, -0.020000, -0.060000, -0.082500 +#*# -0.020000, -0.015000, -0.047500, -0.055000, -0.092500, -0.115000 +#*# -0.135000, -0.132500, -0.152500, -0.157500, -0.180000, -0.180000 #*# tension = 0.2 #*# min_x = 30.0 #*# algo = bicubic @@ -276,3 +301,9 @@ gcode: #*# pid_kp = 64.075 #*# pid_ki = 0.844 #*# pid_kd = 1215.827 +#*# +#*# [input_shaper] +#*# shaper_type_y = 2hump_ei +#*# shaper_freq_y = 57.2 +#*# shaper_type_x = ei +#*# shaper_freq_x = 62.4 diff --git a/overlays/gradientpkgs.nix b/overlays/gradientpkgs.nix index a3cfabb..762b482 100644 --- a/overlays/gradientpkgs.nix +++ b/overlays/gradientpkgs.nix @@ -13,9 +13,27 @@ final: prev: xwaylandvideobridge = prev.libsForQt5.callPackage ../pkgs/xwaylandvideobridge.nix { }; + # Klipper with accelerometer support. See: https://www.klipper3d.org/Measuring_Resonances.html#software-installation + klipper = prev.klipper.overrideAttrs (finalAttrs: prevAttrs: { + buildInputs = [ + prev.openblasCompat + (prev.python3.withPackages (p: with p; [can cffi pyserial greenlet jinja2 markupsafe numpy matplotlib ])) + ]; + }); + klipper-np3pro-firmware = prev.klipper-firmware.override { mcu = prev.lib.strings.sanitizeDerivationName "np3pro"; firmwareConfig = ../pkgs/klipper-np3pro-firmware/config; }; -} \ No newline at end of file + klipper-kusba-firmware = (prev.klipper-firmware.override { + mcu = prev.lib.strings.sanitizeDerivationName "kusba"; + firmwareConfig = ../pkgs/klipper-kusba-firmware/config; + }).overrideAttrs (finalAttrs: prevAttrs: { + # Regular firmware derivation does not copy uf2 file. + installPhase = prevAttrs.installPhase + '' + cp out/klipper.uf2 $out/ || true + ''; + }); + +} diff --git a/pkgs/klipper-kusba-firmware/config b/pkgs/klipper-kusba-firmware/config new file mode 100644 index 0000000..4114423 --- /dev/null +++ b/pkgs/klipper-kusba-firmware/config @@ -0,0 +1,56 @@ +# CONFIG_LOW_LEVEL_OPTIONS is not set +# CONFIG_MACH_AVR is not set +# CONFIG_MACH_ATSAM is not set +# CONFIG_MACH_ATSAMD is not set +# CONFIG_MACH_LPC176X is not set +# CONFIG_MACH_STM32 is not set +# CONFIG_MACH_HC32F460 is not set +CONFIG_MACH_RP2040=y +# CONFIG_MACH_PRU is not set +# CONFIG_MACH_AR100 is not set +# CONFIG_MACH_LINUX is not set +# CONFIG_MACH_SIMU is not set +CONFIG_BOARD_DIRECTORY="rp2040" +CONFIG_MCU="rp2040" +CONFIG_CLOCK_FREQ=12000000 +CONFIG_USBSERIAL=y +CONFIG_FLASH_SIZE=0x200000 +CONFIG_FLASH_BOOT_ADDRESS=0x10000100 +CONFIG_RAM_START=0x20000000 +CONFIG_RAM_SIZE=0x42000 +CONFIG_STACK_SIZE=512 +CONFIG_FLASH_APPLICATION_ADDRESS=0x10000100 +CONFIG_RP2040_SELECT=y +CONFIG_RP2040_HAVE_STAGE2=y +CONFIG_RP2040_FLASH_START_0100=y +# CONFIG_RP2040_FLASH_START_4000 is not set +CONFIG_RP2040_STAGE2_FILE="boot2_w25q080.S" +CONFIG_RP2040_STAGE2_CLKDIV=2 +CONFIG_RP2040_USB=y +# CONFIG_RP2040_SERIAL_UART0 is not set +# CONFIG_RP2040_CANBUS is not set +# CONFIG_RP2040_USBCANBUS is not set +CONFIG_RP2040_CANBUS_GPIO_RX=4 +CONFIG_RP2040_CANBUS_GPIO_TX=5 +CONFIG_USB=y +CONFIG_USB_VENDOR_ID=0x1d50 +CONFIG_USB_DEVICE_ID=0x614e +CONFIG_USB_SERIAL_NUMBER_CHIPID=y +CONFIG_USB_SERIAL_NUMBER="12345" +CONFIG_WANT_GPIO_BITBANGING=y +CONFIG_WANT_DISPLAYS=y +CONFIG_WANT_SENSORS=y +CONFIG_WANT_LIS2DW=y +CONFIG_WANT_SOFTWARE_I2C=y +CONFIG_WANT_SOFTWARE_SPI=y +CONFIG_CANBUS_FREQUENCY=1000000 +CONFIG_HAVE_GPIO=y +CONFIG_HAVE_GPIO_ADC=y +CONFIG_HAVE_GPIO_SPI=y +CONFIG_HAVE_GPIO_I2C=y +CONFIG_HAVE_GPIO_HARD_PWM=y +CONFIG_HAVE_STRICT_TIMING=y +CONFIG_HAVE_CHIPID=y +CONFIG_HAVE_STEPPER_BOTH_EDGE=y +CONFIG_HAVE_BOOTLOADER_REQUEST=y +CONFIG_INLINE_STEPPER_HACK=y