3dprint: split config

This commit is contained in:
makefu 2024-01-18 21:59:51 +01:00
parent 9ccf7a2d43
commit 23b33633c2
No known key found for this signature in database
GPG key ID: 36F7711F3FC0F225
6 changed files with 293 additions and 51 deletions

View file

@ -0,0 +1,80 @@
# 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=y
# CONFIG_MACH_HC32F460 is not set
# CONFIG_MACH_RP2040 is not set
# 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="stm32"
CONFIG_MCU="stm32f401xc"
CONFIG_CLOCK_FREQ=84000000
CONFIG_USBSERIAL=y
CONFIG_FLASH_SIZE=0x40000
CONFIG_FLASH_BOOT_ADDRESS=0x8000000
CONFIG_RAM_START=0x20000000
CONFIG_RAM_SIZE=0x10000
CONFIG_STACK_SIZE=512
CONFIG_FLASH_APPLICATION_ADDRESS=0x8000000
CONFIG_STM32_SELECT=y
# CONFIG_MACH_STM32F103 is not set
# CONFIG_MACH_STM32F207 is not set
CONFIG_MACH_STM32F401=y
# CONFIG_MACH_STM32F405 is not set
# CONFIG_MACH_STM32F407 is not set
# CONFIG_MACH_STM32F429 is not set
# CONFIG_MACH_STM32F446 is not set
# CONFIG_MACH_STM32F765 is not set
# CONFIG_MACH_STM32F031 is not set
# CONFIG_MACH_STM32F042 is not set
# CONFIG_MACH_STM32F070 is not set
# CONFIG_MACH_STM32F072 is not set
# CONFIG_MACH_STM32G070 is not set
# CONFIG_MACH_STM32G071 is not set
# CONFIG_MACH_STM32G0B0 is not set
# CONFIG_MACH_STM32G0B1 is not set
# CONFIG_MACH_STM32G431 is not set
# CONFIG_MACH_STM32H723 is not set
# CONFIG_MACH_STM32H743 is not set
# CONFIG_MACH_STM32H750 is not set
# CONFIG_MACH_STM32L412 is not set
# CONFIG_MACH_N32G452 is not set
# CONFIG_MACH_N32G455 is not set
CONFIG_MACH_STM32F4=y
CONFIG_HAVE_STM32_USBOTG=y
CONFIG_STM32_DFU_ROM_ADDRESS=0x1fff0000
# CONFIG_STM32_FLASH_START_8000 is not set
# CONFIG_STM32_FLASH_START_10000 is not set
# CONFIG_STM32_FLASH_START_4000 is not set
CONFIG_STM32_FLASH_START_0000=y
CONFIG_CLOCK_REF_FREQ=8000000
CONFIG_STM32F0_TRIM=16
CONFIG_STM32_USB_PA11_PA12=y
# CONFIG_STM32_SERIAL_USART1 is not set
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_SDIO=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

View file

@ -1,57 +1,12 @@
{ pkgs, ... }:
let
dev = "/dev/web_cam";
in
{
imports = [
./klipper.nix
./webcam.nix
./octoprint.nix
];
services.mjpg-streamer = {
enable = true;
# new camera
#inputPlugin = "input_uvc.so -d ${dev} -r 1280x960";
# ps eye came
inputPlugin = "input_uvc.so -y -d ${dev} -r 640x480 -f 5";
# outputPlugin = "output_http.so -w @www@ -n -p 18088";
};
users.users.octoprint.extraGroups = [ "video" ];
users.users.mjpg-streamer.extraGroups = [ "video" ];
# allow octoprint to access /dev/vchiq
# also ensure that the webcam always comes up under the same name
services.udev.extraRules = ''
SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1415", ATTRS{idProduct}=="2000", SYMLINK+="web_cam"
'';
systemd.services.octoprint = {
path = [ pkgs.libraspberrypi ];
};
services.octoprint = {
enable = true;
plugins = plugins: with plugins;[
costestimation
displayprogress
mqtt
stlviewer
themeify
# octolapse
(buildPlugin rec {
pname = "OctoPrint-HomeAssistant";
version = "3.7.0";
src = pkgs.fetchFromGitHub {
owner = "cmroche";
repo = pname;
rev = version;
hash = "sha256-R6ayI8KHpBSR2Cnp6B2mKdJGHaxTENkOKvbvILLte2E=";
};
})
];
extraConfig.plugins.mqtt.broker = {
url = "192.168.111.11";
username = "hass";
password = "lksue43jrf";
};
};
}

View file

@ -1,23 +1,41 @@
{
security.polkit.enable = true;
services.moonraker = {
enable = true;
address = "0";
allowSystemControl = true;
settings = {
octoprint_compat = {};
history = {};
announcements.subscriptions = [ "fluidd" ];
authorization = {
trusted_clients = [ "192.168.111.0/24" "127.0.0.1" ];
force_logins = false;
cors_domains = [ "http://fluidd.lan" "http://localhost" ];
};
};
};
#services.mainsail.enable = true;
services.fluidd.enable = true;
services.fluidd.hostName = "fluidd.lan";
services.fluidd.nginx.locations."/webcam".proxyPass = "http://127.0.0.1:8080/stream";
services.nginx.clientMaxBodySize = "1000m";
services.klipper = {
enable = true;
user = "moonraker";
group = "moonraker";
# octoprintIntegration = true;
# https://github.com/Klipper3d/klipper/blob/master/config/printer-artillery-sidewinder-x2-2022.cfg
configFile = ./printer-artillery-sidewinder-x2-2022.cfg; # file used to control the klipper-flashed printer
firmwares = {
artillery = {
enable = true;
enableKlipperFlash = true;
configFile = ./artillery-flashconfig; # file used to flash a printer with new klipper firmware
serial = "/dev/ttyAMA0"; #when in DFU mode
};
};
};

View file

@ -0,0 +1,32 @@
{
services.octoprint = {
enable = true;
plugins = plugins: with plugins;[
costestimation
displayprogress
mqtt
stlviewer
themeify
# octolapse
(buildPlugin rec {
pname = "OctoPrint-HomeAssistant";
version = "3.7.0";
src = pkgs.fetchFromGitHub {
owner = "cmroche";
repo = pname;
rev = version;
hash = "sha256-R6ayI8KHpBSR2Cnp6B2mKdJGHaxTENkOKvbvILLte2E=";
};
})
];
extraConfig.plugins.mqtt.broker = {
url = "192.168.111.11";
username = "hass";
password = "lksue43jrf";
};
};
users.users.octoprint.extraGroups = [ "video" ];
systemd.services.octoprint = {
path = [ pkgs.libraspberrypi ];
};
}

View file

@ -8,7 +8,8 @@
# make flash FLASH_DEVICE=/dev/serial/by-id/usb-Klipper_stm32f401xc_*-if00
# See docs/Config_Reference.md for a description of parameters.
#
# also do https://3dprintbeginner.com/fix-octoprint-always-on-printer-display/
[stepper_x]
step_pin: !PB14
dir_pin: PB13
@ -97,7 +98,7 @@ sensor_pin: PC2
control_pin: PC3
x_offset:27.25
y_offset:-12.8
z_offset: 1.0
z_offset: 0.679
samples: 3
samples_tolerance: 0.050
samples_tolerance_retries: 3
@ -154,3 +155,139 @@ max_accel: 1500
max_z_velocity: 50
max_z_accel: 400
square_corner_velocity: 5.0
# for fluidd
[display_status]
[pause_resume]
[virtual_sdcard]
path: /var/lib/moonraker/gcodes
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
# change this if you need more or less extrusion
variable_extrude: 1.0
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 2.0) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
[gcode_macro UNLOAD_FILAMENT]
gcode:
M83
G92 E0.0
G1 E-100 F500
G92 E0.0
M82
[gcode_macro LOAD_FILAMENT]
gcode:
M83
G92 E0.0
G1 E125 F150
G1 E-35 F2400
G92 E0.0
M82
[gcode_macro PID_EXTRUDER]
gcode:
M106 S255
{% set TARGET_TEMP = params.TARGET_TEMP|default(210)|float %}
PID_CALIBRATE HEATER=extruder TARGET={TARGET_TEMP}
[gcode_macro PID_BED]
gcode:
{%set TARGET_TEMP = params.TARGET_TEMP|default(70)|float %}
PID_CALIBRATE HEATER=heater_bed TARGET={TARGET_TEMP}
[gcode_macro MATERIAL_PA]
gcode:
{% set MATERIAL = params.MATERIAL|default("PLA")|string %}
{% set TEXT ="Setting PA for " + MATERIAL %}
{% if MATERIAL == "PLA" %}
SET_PRESSURE_ADVANCE ADVANCE=0.068
{% elif MATERIAL == "PETG" %}
SET_PRESSURE_ADVANCE ADVANCE=0.075
{% elif MATERIAL == "TPU" %}
SET_PRESSURE_ADVANCE ADVANCE=0.0460
{% else %}
{% set TEXT ="No PA value for " + MATERIAL %}
{% endif %}
_DISPLAYTEXT TEXT="{TEXT}">
[gcode_macro LOCK_Z_STEPPERS]
gcode:
SET_STEPPER_ENABLE STEPPER=stepper_z ENABLE=1
[gcode_macro UN_LOCK_Z_STEPPERS]
gcode:
SET_STEPPER_ENABLE STEPPER=stepper_z ENABLE=0
[gcode_macro MOVE_TO_NEUTRAL_POSITION]
gcode:
g28; home all axis
g90; set to absolute positioning
g1 x150 y150 f9000
g1 z100 f3000
[gocde_macro PROBE_CALIBRATE]
gcode:
g28 ; home all axis
PROBE_CALIBRATE
[gocde_macro SCREWS_TILT_CALCULATE]
gcode:
SCREWS_TILT_CALCULATE

View file

@ -0,0 +1,20 @@
let
dev = "/dev/web_cam";
in
{
services.mjpg-streamer = {
enable = true;
# new camera
#inputPlugin = "input_uvc.so -d ${dev} -r 1280x960";
inputPlugin = "input_uvc.so -y -d ${dev} -r 640x480 -f 5"; # ps eyecam
# outputPlugin = "output_http.so -w @www@ -n -p 18088";
};
services.udev.extraRules = ''
SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1415", ATTRS{idProduct}=="2000", SYMLINK+="web_cam"
'';
users.users.mjpg-streamer.extraGroups = [ "video" ];
}