akamanto: import current klipper config

main
Robert Gerus 2023-10-28 18:22:02 +02:00 committed by Ari Gato
parent e5ea1eadaa
commit 440b871426
10 changed files with 232 additions and 134 deletions

View File

@ -91,14 +91,14 @@ in {
hardware.opengl.enable = true;
# strictly printer stuff below
# temporary until configs are finalized
systemd.services.klipper.serviceConfig = {
ExecStart = lib.mkForce [
""
"${pkgs.klipper}/bin/klippy --input-tty=/run/klipper/tty --api-server=/run/klipper/api /var/lib/moonraker/config/klipper.cfg"
];
ReadWritePaths = "/var/lib/moonraker/config/";
};
## uncomment if you need manual config changes
#systemd.services.klipper.serviceConfig = {
# ExecStart = lib.mkForce [
# ""
# "${pkgs.klipper}/bin/klippy --input-tty=/run/klipper/tty --api-server=/run/klipper/api /var/lib/moonraker/config/klipper.cfg"
# ];
# ReadWritePaths = "/var/lib/moonraker/config/";
#};
services.klipper = {
enable = true;
mutableConfig = false;
@ -113,164 +113,171 @@ in {
};
};
};
# lies; not actually in use for now
# imported using:
# sed -r -e 's/^([^:]*):/\1=/' -e 's/=(.{1,})$/="\1"/' -e '/^\[.*[ ]/s/\[(.*)\]/["\1"]/' klipper-printer.cfg > klipper-printer.toml
# + some small fixes
# + nix repl :p fromTOML (builtins.readFile ( ./. + "/klipper-printer.toml"))
settings = {
mcu.serial = "/dev/ttyACM0";
pause_resume = { };
display_status = { };
virtual_sdcard = { path = "/var/lib/moonraker/gcodes"; };
force_move = { enable_force_move = true; };
printer = {
kinematics = "corexy";
max_velocity = 300;
max_accel = 2000;
max_z_velocity = 5;
max_z_accel = 100;
max_accel = "2000";
max_velocity = "300";
max_z_accel = "100";
max_z_velocity = "5";
};
mcu = { serial = "/dev/ttyACM0"; };
virtual_sdcard = { path = "/var/lib/moonraker/gcodes"; };
pause_resume = { };
display_status = { };
exclude_object = { };
force_move = { enable_force_move = "true"; };
bed_mesh = {
horizontal_move_z = "5";
mesh_max = "210, 200";
mesh_min = "5, 5";
probe_count = "5, 5";
speed = "120";
};
fan = { pin = "P2.4"; };
"fan_generic exhaust" = { pin = "P2.6"; };
"bed_mesh default" = {
version = 1;
x_count = 5;
y_count = 5;
mesh_x_pps = 2;
mesh_y_pps = 2;
algo = "lagrange";
tension = 0.2;
min_x = 5.0;
max_x = 210.0;
min_y = 5.0;
max_y = 200.0;
# divided into sublists for formatting purposes
points = lib.flatten [
[ "-0.747500" "-0.752500" "-0.776250" "-0.851250" "-0.990625" ]
[ "-0.590000" "-0.582500" "-0.588750" "-0.688750" "-0.839375" ]
[ "-0.376875" "-0.362500" "-0.388750" "-0.464375" "-0.623750" ]
[ "-0.184375" "-0.220000" "-0.208750" "-0.221250" "-0.361875" ]
[ "0.128125" "0.078750" "0.065000" "0.038750" "-0.075625" ]
];
};
probe = {
pin = "P1.25";
z_offset = "3.36";
z_offset = "-0.300";
};
"temperature_sensor ambient" = {
sensor_pin = "P0.26";
sensor_type = "ATC Semitec 104GT-2";
};
stepper_x = {
step_pin = "P2.3";
dir_pin = "!P0.22";
enable_pin = "!P0.21";
microsteps = "32";
rotation_distance = "40";
endstop_pin = "^P1.24";
position_endstop = "220";
position_min = "-15";
position_max = "220";
homing_speed = "80";
homing_positive_dir = true;
};
stepper_y = {
step_pin = "P2.2";
dir_pin = "!P0.20";
enable_pin = "!P0.19";
microsteps = "32";
rotation_distance = "40";
endstop_pin = "^P1.26";
position_endstop = "215";
position_max = "215";
homing_speed = "80";
homing_positive_dir = true;
};
stepper_z = {
step_pin = "P2.8";
dir_pin = "P2.13";
enable_pin = "!P4.29";
microsteps = "32";
rotation_distance = "4";
endstop_pin = "^P1.29";
position_endstop = "235";
position_min = "-5";
position_max = "240";
homing_speed = "50";
homing_positive_dir = true;
fan = { pin = "P2.4"; };
"fan_generic exhaust" = { pin = "P2.6"; };
heater_bed = {
control = "watermark";
heater_pin = "P2.5";
max_temp = "130";
min_temp = "0";
sensor_pin = "P0.25";
sensor_type = "Honeywell 100K 135-104LAG-J01";
};
extruder = {
step_pin = "P2.0";
dir_pin = "P0.5";
control = "pid";
dir_pin = "!P0.5";
enable_pin = "!P0.4";
microsteps = "32";
rotation_distance = "8.07";
nozzle_diameter = "0.400";
filament_diameter = "1.750";
heater_pin = "P2.7";
sensor_type = "ATC Semitec 104GT-2";
sensor_pin = "P0.23";
control = "pid";
pid_Kp = "38.5";
pid_Ki = "2.318";
pid_Kd = "160";
min_temp = "0";
max_temp = "295";
microsteps = "32";
min_temp = "0";
nozzle_diameter = "0.400";
pid_Kd = "160";
pid_Ki = "2.318";
pid_Kp = "38.5";
rotation_distance = "8.07";
sensor_pin = "P0.23";
sensor_type = "ATC Semitec 104GT-2";
step_pin = "P2.0";
};
extruder1 = {
step_pin = "P2.1";
dir_pin = "!P0.11";
control = "pid";
dir_pin = "P0.11";
enable_pin = "!P0.10";
microsteps = "32";
rotation_distance = "8.07";
nozzle_diameter = "0.400";
filament_diameter = "1.750";
heater_pin = "P1.23";
sensor_type = "ATC Semitec 104GT-2";
sensor_pin = "P0.24";
control = "pid";
pid_Kp = "38.5";
pid_Ki = "2.318";
pid_Kd = "160";
min_temp = "0";
max_temp = "265";
};
heater_bed = {
heater_pin = "P2.5";
sensor_type = "Honeywell 100K 135-104LAG-J01";
sensor_pin = "P0.25";
control = "watermark";
microsteps = "32";
min_temp = "0";
max_temp = "130";
nozzle_diameter = "0.400";
pid_Kd = "160";
pid_Ki = "2.318";
pid_Kp = "38.5";
rotation_distance = "8.07";
sensor_pin = "P0.24";
sensor_type = "ATC Semitec 104GT-2";
step_pin = "P2.1";
};
stepper_x = {
dir_pin = "!P0.22";
enable_pin = "!P0.21";
endstop_pin = "^P1.24";
homing_positive_dir = "true";
homing_speed = "80";
microsteps = "32";
position_endstop = "220";
position_max = "220";
position_min = "-15";
rotation_distance = "40";
step_pin = "P2.3";
};
stepper_y = {
dir_pin = "!P0.20";
enable_pin = "!P0.19";
endstop_pin = "^P1.26";
homing_positive_dir = "true";
homing_speed = "80";
microsteps = "32";
position_endstop = "215";
position_max = "215";
rotation_distance = "40";
step_pin = "P2.2";
};
stepper_z = {
dir_pin = "P2.13";
enable_pin = "!P4.29";
endstop_pin = "^P1.29";
homing_positive_dir = "true";
homing_speed = "50";
microsteps = "32";
position_endstop = "235";
position_max = "240";
position_min = "-5";
rotation_distance = "4";
step_pin = "P2.8";
};
"gcode_macro CANCEL_PRINT" = {
description = "Cancel the actual running print";
rename_existing = "CANCEL_PRINT_BASE";
gcode = [ "TURN_OFF_HEATERS" "CANCEL_PRINT_BASE" ];
rename_existing = "CANCEL_PRINT_BASE";
};
"gcode_macro T0" = {
description = "change to tool 0 (high-temp)";
gcode = [
"SET_GCODE_OFFSET X=0 Y=0 Z=0 MOVE=1"
"SAVE_GCODE_STATE"
"G91"
"G1 Z5"
"G90"
"G1 X220 Y15 F10000"
"RESTORE_GCODE_STATE MOVE=1 MOVE_SPEED=100"
"SET_GCODE_OFFSET X=0 Y=0 Z=0"
];
"delayed_gcode bed_mesh_init" = {
gcode = [ "BED_MESH_PROFILE LOAD=default" ];
initial_duration = ".01";
};
"gcode_macro T1" = {
description = "change to tool 1 (normal)";
gcode = [
"SET_GCODE_OFFSET X=27.45 Y=-0.15 Z=1.6 MOVE=1"
"SAVE_GCODE_STATE"
"G91"
"G1 Z5"
"G90"
"# X-10 - X27.45"
"G1 X-37.45 Y15 F10000"
"RESTORE_GCODE_STATE MOVE=1 MOVE_SPEED=100"
];
"delayed_gcode t0_offset" = {
gcode = [ "SET_GCODE_OFFSET X=0 Y=0 Z=-0.1" ];
initial_duration = ".02";
};
"gcode_macro TC_DEMO" = {
gcode = [
"G90"
"G1 X100 Y100 Z20 F6000"
"T1"
"T0"
"T1"
"T0"
"T1"
"T0"
"T1"
"T0"
"T1"
"T0"
"T1"
"T0"
];
};
};
} // lib.mapAttrs' (name: value:
lib.nameValuePair ("gcode_macro " + name) {
gcode = lib.remove "" (lib.splitString "\n"
(builtins.readFile (./klipper-macros/. + "/${name}")));
}) (builtins.readDir ./klipper-macros/.);
};
services.moonraker = {

View File

@ -0,0 +1,13 @@
M83 # Put the extruder into relative mode
G92 E0.0 # Reset the extruder so that it thinks it is at position zero
# G1 E400 F350 # Move the extruder forward 120mm at a speed of 350mm/minute
# faster
{% for n in range(5) %}
G1 E50 F1000
{% endfor %}
# slower
{% for n in range(1) %}
G1 E50 F350
{% endfor %}
G92 E0.0 # Reset the extruder again
M82 # Put the extruder back into absolute mode.

View File

@ -0,0 +1,15 @@
G92 E0
{% if (printer.toolhead.extruder) == "extruder" %}
{% set prime_x = 3 %}
{% else %}
{% set prime_x = 4 %}
{% endif %}
M117 priming first line
G1 X{ prime_x } Y3 Z0.3 F5000.0
G1 E3 F3000
G1 X{ prime_x } Y143.0 Z0.3 F3000.0 E20
M117 priming second line
G1 X{ prime_x + 2 } Y143.0 Z0.3 F5000.0
G1 X{ prime_x + 2 } Y3 Z0.3 F3000 E40
G92 E0
G1 Z2.0 F3000

View File

@ -0,0 +1,5 @@
{% if (printer.toolhead.extruder) == "extruder" %}
T1
{% else %}
T0
{% endif %}

View File

@ -0,0 +1,12 @@
SET_GCODE_OFFSET X=0 Y=0 Z=0
SAVE_GCODE_STATE
{% if printer.toolhead.position.z + 6 < printer.toolhead.axis_minimum.z %}
G91
G1 Z5
G90
{% endif %}
G1 X220 Y15 F10000
RESTORE_GCODE_STATE MOVE=1 MOVE_SPEED=100
SET_GCODE_OFFSET X=0 Y=0 Z=-0.1
ACTIVATE_EXTRUDER EXTRUDER=extruder
M117 T0 active

View File

@ -0,0 +1,12 @@
SET_GCODE_OFFSET X=27.45 Y=-0.15 Z=1.6
SAVE_GCODE_STATE
{% if printer.toolhead.position.z + 6 < printer.toolhead.axis_minimum.z %}
G91
G1 Z5
G90
{% endif %}
G1 X-37.45 Y15 F10000
RESTORE_GCODE_STATE MOVE=1 MOVE_SPEED=100
SET_GCODE_OFFSET X=27.45 Y=-0.15 Z=1.6
ACTIVATE_EXTRUDER EXTRUDER=extruder1
M117 T1 active

View File

@ -0,0 +1,14 @@
G90
G1 X100 Y100 Z20 F6000
T1
T0
T1
T0
T1
T0
T1
T0
T1
T0
T1
T0

View File

@ -0,0 +1,13 @@
M83 # Put the extruder into relative mode
G92 E0.0 # Reset the extruder so that it thinks it is at position zero
# G1 E-400 F350 # Move the extruder forward 120mm at a speed of 350mm/minute
# slower
{% for n in range(1) %}
G1 E-50 F350
{% endfor %}
# faster
{% for n in range(5) %}
G1 E-50 F1000
{% endfor %}
G92 E0.0 # Reset the extruder again
M82 # Put the extruder back into absolute mode.

View File

@ -0,0 +1,4 @@
G91
G1 Z5
G90
G1 X220 Y15 F10000

View File

@ -0,0 +1,3 @@
G91
G1 Z5
G90