mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(logistics): working klipper
This commit is contained in:
parent
17524cc5b8
commit
6153aabafe
5 changed files with 277 additions and 1 deletions
|
|
@ -4,6 +4,195 @@ _: {
|
||||||
enable = true;
|
enable = true;
|
||||||
octoprintIntegration = true;
|
octoprintIntegration = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
filter = {};
|
||||||
|
|
||||||
|
print_stats = {};
|
||||||
|
|
||||||
|
virtual_sdcard = {
|
||||||
|
path = "/printersd/";
|
||||||
|
};
|
||||||
|
|
||||||
|
dirzctl = {};
|
||||||
|
|
||||||
|
hx711s = {
|
||||||
|
sensor0_clk_pin = "PA4";
|
||||||
|
sensor0_sdo_pin = "PC6";
|
||||||
|
};
|
||||||
|
|
||||||
|
prtouch = {
|
||||||
|
sensor_x = 32;
|
||||||
|
sensor_y = 30;
|
||||||
|
clr_noz_start_x = 15;
|
||||||
|
clr_noz_start_y = 25;
|
||||||
|
clr_noz_len_y = 15;
|
||||||
|
s_hot_min_temp = 160;
|
||||||
|
s_hot_max_temp = 200;
|
||||||
|
s_bed_max_temp = 60;
|
||||||
|
show_msg = true;
|
||||||
|
wipe_retract_distance = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
stepper_x = {
|
||||||
|
step_pin = "PC2";
|
||||||
|
dir_pin = "!PB9";
|
||||||
|
enable_pin = "!PC3";
|
||||||
|
microsteps = 16;
|
||||||
|
rotation_distance = 40;
|
||||||
|
endstop_pin = "~!PA5";
|
||||||
|
position_endstop = -6;
|
||||||
|
position_min = -6;
|
||||||
|
position_max = 230;
|
||||||
|
homing_speed = 80;
|
||||||
|
};
|
||||||
|
|
||||||
|
"tmc2208 stepper_x" = {
|
||||||
|
uart_pin = "PB12";
|
||||||
|
run_current = 0.60;
|
||||||
|
sense_resistor = 0.150;
|
||||||
|
interpolate = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
stepper_y = {
|
||||||
|
step_pin = "PB8";
|
||||||
|
dir_pin = "PB7";
|
||||||
|
enable_pin = "!PC3";
|
||||||
|
microsteps = 16;
|
||||||
|
rotation_distance = 40;
|
||||||
|
endstop_pin = "~!PA6";
|
||||||
|
position_endstop = -14;
|
||||||
|
position_min = -14;
|
||||||
|
position_max = 230;
|
||||||
|
homing_speed = 80;
|
||||||
|
};
|
||||||
|
|
||||||
|
"tmc2208 stepper_y" = {
|
||||||
|
uart_pin = "PB13";
|
||||||
|
run_current = 0.60;
|
||||||
|
sense_resistor = 0.150;
|
||||||
|
interpolate = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
stepper_z = {
|
||||||
|
step_pin = "PB6";
|
||||||
|
dir_pin = "!PB5";
|
||||||
|
enable_pin = "!PC3";
|
||||||
|
microsteps = 16;
|
||||||
|
rotation_distance = 8;
|
||||||
|
endstop_pin = "probe:z_virtual_endstop";
|
||||||
|
position_min = -3;
|
||||||
|
position_max = 250;
|
||||||
|
homing_speed = 4;
|
||||||
|
second_homing_speed = 1;
|
||||||
|
homing_retract_dist = 2.0;
|
||||||
|
};
|
||||||
|
|
||||||
|
"tmc2208 stepper_z" = {
|
||||||
|
uart_pin = "PB14";
|
||||||
|
run_current = 0.8;
|
||||||
|
sense_resistor = 0.150;
|
||||||
|
interpolate = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
extruder = {
|
||||||
|
max_extrude_only_distance = 100.0;
|
||||||
|
step_pin = "PB4";
|
||||||
|
dir_pin = "PB3";
|
||||||
|
enable_pin = "!PC3";
|
||||||
|
microsteps = 16;
|
||||||
|
rotation_distance = 7.44;
|
||||||
|
nozzle_diameter = 0.400;
|
||||||
|
filament_diameter = 1.750;
|
||||||
|
heater_pin = "PA1";
|
||||||
|
sensor_type = "EPCOS 100K B57560G104F";
|
||||||
|
sensor_pin = "PC5";
|
||||||
|
control = "pid";
|
||||||
|
pid_Kp = 27.142;
|
||||||
|
pid_Ki = 1.371;
|
||||||
|
pid_Kd = 134.351;
|
||||||
|
min_temp = 0;
|
||||||
|
max_temp = 260;
|
||||||
|
};
|
||||||
|
|
||||||
|
heater_bed = {
|
||||||
|
heater_pin = "PB2";
|
||||||
|
sensor_type = "EPCOS 100K B57560G104F";
|
||||||
|
sensor_pin = "PC4";
|
||||||
|
control = "pid";
|
||||||
|
pid_kp = 66.371;
|
||||||
|
pid_ki = 0.846;
|
||||||
|
pid_kd = 1301.702;
|
||||||
|
min_temp = 0;
|
||||||
|
max_temp = 100;
|
||||||
|
};
|
||||||
|
|
||||||
|
"heater_fan hotend_fan" = {
|
||||||
|
pin = "PC1";
|
||||||
|
};
|
||||||
|
|
||||||
|
fan = {
|
||||||
|
pin = "PA0";
|
||||||
|
};
|
||||||
|
|
||||||
|
mcu = {
|
||||||
|
serial = "/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0";
|
||||||
|
restart_method = "command";
|
||||||
|
};
|
||||||
|
|
||||||
|
printer = {
|
||||||
|
kinematics = "cartesian";
|
||||||
|
max_velocity = 250;
|
||||||
|
max_accel = 2500;
|
||||||
|
max_z_velocity = 5;
|
||||||
|
square_corner_velocity = 5.0;
|
||||||
|
max_z_accel = 100;
|
||||||
|
};
|
||||||
|
|
||||||
|
bltouch = {
|
||||||
|
sensor_pin = "^PC14";
|
||||||
|
control_pin = "PC13";
|
||||||
|
x_offset = -23.0;
|
||||||
|
y_offset = -14.5;
|
||||||
|
z_offset = 2.65;
|
||||||
|
speed = 20;
|
||||||
|
pin_move_time = 0.4;
|
||||||
|
stow_on_each_sample = false;
|
||||||
|
probe_with_touch_mode = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
safe_z_home = {
|
||||||
|
home_xy_position = "134,123";
|
||||||
|
speed = 150;
|
||||||
|
z_hop = 10;
|
||||||
|
z_hop_speed = 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
bed_mesh = {
|
||||||
|
speed = 120;
|
||||||
|
horizontal_move_z = 5;
|
||||||
|
mesh_min = "30,30";
|
||||||
|
mesh_max = "207,215.5";
|
||||||
|
probe_count = "5,5";
|
||||||
|
algorithm = "bicubic";
|
||||||
|
};
|
||||||
|
|
||||||
|
screws_tilt_adjust = {
|
||||||
|
screw1 = "54.5,45.5";
|
||||||
|
screw1_name = "front left screw";
|
||||||
|
screw2 = "224.5,45.5";
|
||||||
|
screw2_name = "front right screw";
|
||||||
|
screw3 = "224.5,215.5";
|
||||||
|
screw3_name = "rear right screw";
|
||||||
|
screw4 = "54.5,215.5";
|
||||||
|
screw4_name = "rear left screw";
|
||||||
|
horizontal_move_z = 10.;
|
||||||
|
speed = 50.;
|
||||||
|
screw_thread = "CCW-M4";
|
||||||
|
};
|
||||||
|
|
||||||
|
e3v3se_display = {
|
||||||
|
language = "english";
|
||||||
|
logging = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ _: {
|
||||||
moonraker = {
|
moonraker = {
|
||||||
enable = true;
|
enable = true;
|
||||||
address = "0.0.0.0";
|
address = "0.0.0.0";
|
||||||
|
user = "octoprint";
|
||||||
port = 7125; # it's the default but i'm specifying it anyway
|
port = 7125; # it's the default but i'm specifying it anyway
|
||||||
settings = {
|
settings = {
|
||||||
octoprint_compat = { };
|
octoprint_compat = { };
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ in {
|
||||||
serial = {
|
serial = {
|
||||||
port = "/dev/ttyUSB0";
|
port = "/dev/ttyUSB0";
|
||||||
baudrate = 115200;
|
baudrate = 115200;
|
||||||
autoconnect = true;
|
autoconnect = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ in {
|
||||||
plugins = [final.curaPlugins.octoprint];
|
plugins = [final.curaPlugins.octoprint];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
klipper = prev.callPackage ../packages/klipper.nix {};
|
||||||
|
|
||||||
octoprint = let
|
octoprint = let
|
||||||
mapPlugin = python3Packages: _: plugin:
|
mapPlugin = python3Packages: _: plugin:
|
||||||
plugin.override {
|
plugin.override {
|
||||||
|
|
|
||||||
84
packages/klipper.nix
Normal file
84
packages/klipper.nix
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, fetchFromGitHub
|
||||||
|
, python3
|
||||||
|
, unstableGitUpdater
|
||||||
|
, makeWrapper
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "klipper";
|
||||||
|
version = "0.12.0-unstable-2024-07-05";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "kittywitch";
|
||||||
|
repo = "ender3-v3-se-klipper-with-display";
|
||||||
|
rev = "c2fb1cf76812b974152ecc90cb696c302384adbd";
|
||||||
|
hash = "sha256-Rx5+ECHlCG1trJnF/Xs4cSUTrIcAry/4RrZRMaPoPeg=";
|
||||||
|
};
|
||||||
|
|
||||||
|
sourceRoot = "${src.name}/klippy";
|
||||||
|
|
||||||
|
# NB: This is needed for the postBuild step
|
||||||
|
nativeBuildInputs = [
|
||||||
|
(python3.withPackages ( p: with p; [ cffi ] ))
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [ (python3.withPackages (p: with p; [ can cffi pyserial greenlet jinja2 markupsafe numpy ])) ];
|
||||||
|
|
||||||
|
# we need to run this to prebuild the chelper.
|
||||||
|
postBuild = ''
|
||||||
|
python ./chelper/__init__.py
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Python 3 is already supported but shebangs aren't updated yet
|
||||||
|
postPatch = ''
|
||||||
|
for file in klippy.py console.py parsedump.py; do
|
||||||
|
substituteInPlace $file \
|
||||||
|
--replace '/usr/bin/env python2' '/usr/bin/env python'
|
||||||
|
done
|
||||||
|
|
||||||
|
# needed for cross compilation
|
||||||
|
substituteInPlace ./chelper/__init__.py \
|
||||||
|
--replace 'GCC_CMD = "gcc"' 'GCC_CMD = "${stdenv.cc.targetPrefix}cc"'
|
||||||
|
'';
|
||||||
|
|
||||||
|
# NB: We don't move the main entry point into `/bin`, or even symlink it,
|
||||||
|
# because it uses relative paths to find necessary modules. We could wrap but
|
||||||
|
# this is used 99% of the time as a service, so it's not worth the effort.
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
mkdir -p $out/lib/klipper
|
||||||
|
cp -r ./* $out/lib/klipper
|
||||||
|
|
||||||
|
# Moonraker expects `config_examples` and `docs` to be available
|
||||||
|
# under `klipper_path`
|
||||||
|
cp -r $src/docs $out/lib/docs
|
||||||
|
cp -r $src/config $out/lib/config
|
||||||
|
|
||||||
|
# Add version information. For the normal procedure see https://www.klipper3d.org/Packaging.html#versioning
|
||||||
|
# This is done like this because scripts/make_version.py is not available when sourceRoot is set to "${src.name}/klippy"
|
||||||
|
echo "${version}-NixOS" > $out/lib/klipper/.version
|
||||||
|
|
||||||
|
mkdir -p $out/bin
|
||||||
|
chmod 755 $out/lib/klipper/klippy.py
|
||||||
|
makeWrapper $out/lib/klipper/klippy.py $out/bin/klippy --chdir $out/lib/klipper
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.updateScript = unstableGitUpdater {
|
||||||
|
url = meta.homepage;
|
||||||
|
tagPrefix = "v";
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Klipper 3D printer firmware";
|
||||||
|
mainProgram = "klippy";
|
||||||
|
homepage = "https://github.com/KevinOConnor/klipper";
|
||||||
|
maintainers = with maintainers; [ lovesegfault zhaofengli cab404 ];
|
||||||
|
platforms = platforms.linux;
|
||||||
|
license = licenses.gpl3Only;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue