I created a solution for this, which I wanted to share. The solution is made to upload a gcode to klipper and “print” it. I use a ender 3 s1 pro - f103 chip - laser module. As far as I know the 401 Chip should be fine with this too.
The printer.cfg needs to be changed massivly. So make a backup for you printer settings and start anew for laser.
First of all: remove everything which does interact with the [extruder]. Also something like bed_mesh or btouch needs to be removed.
add
[pwm_tool laser]
pin: PC0
shutdown_value: 0
and at least those two macros. Watch out: A lot of M3 is for debbuging settings. I use the cura printer software for creating my gcodes for the laser. It does Scale from 0 up to 1000. If your software has other steps, you should scale M3.
[gcode_macro M3]
description: Laser an mit vereinfachtem Power-Handling
gcode:
{% set power = params.S|default(0)|int %}
{% if power < 0 %}
{% set power = 0 %}
{% elif power > 1000 %}
{% set power = 1000 %}
{% endif %}
RESPOND MSG=“Laser Power: {power}”
SET_PIN PIN=laser VALUE={ power / 1000.0 }
[gcode_macro M5]
description: Laser off
gcode:
SET_PIN PIN=laser VALUE=0
I also added another macro, since you dont have BTouch anymore.
Change stepper_z so you can move your head a little downwards after “homing”
[stepper_z]
endstop_pin: !PA7
position_endstop: 0
position_max: 270
position_min: -30
for simulating the home process use the following. This just accepts the current z position as z=0, which lets you move your laser through klipper. Without homing klipper does not allow anything:
[gcode_macro HOME_ALL]
description: Home all axes
gcode:
G28 X Y
SET_KINEMATIC_POSITION Z=0
[gcode_macro HOME_Z]
description: Home Z axis
gcode:
SET_KINEMATIC_POSITION Z=0
Alright. This was the setup. Now to the laser process. I use the Cura Software to create a gcode. I tried other softwares, but I am not using the laser much, so I am fine with the custom software.
The gcode is created as follows:
G0X101.750 S499
G1X117.250
The S499 is the laser for 50% power. Klipper does not take that input. I use a chatbot to transform my whole code to:
G0X101.750
M3 S499
G1X117.250
M3 S0
With this transformation the code and klipper is fine to laser my gcode. I know that’s a lot of changes, but I still wanted to share a functioning workaround, since I did not find anything.