Basic Information:
Printer Model: ratrig style
MCU / Printerboard: Octopus pro
DumpVariables.cfg (32.6 KB)
printer.cfg.zip (22.5 KB)
Hello,
I have built a printer with a toolchanger. All the 6 tools are mounted on a lifting unit. That lifting unit can move between 0mm (upper position) down 200mm to the toolchanging position.
On the upper position (liftet up completely to 0mm), there is a endstop sensor mountet that recognizes that the lifting unit is at 0mm.
Herefore I would like to create 3 macros:
- macro 1: gcode_macro HOME_LIFTING_UNIT
But here I don`t know how to write this ā {% if( Endstopsensor is triggered) %}
[gcode_macro HOME_LIFTING_UNIT]
variable_lifting_unit_homed:0
gcode:
brake_open
G4 P1000
{% if( Endstopsensor is triggered) %} ( <- I don't know how to write this)
MANUAL_STEPPER STEPPER=lifting_unit SET_POSITION=0 # Set assumed possition as rotated to min
MANUAL_STEPPER STEPPER=lifting_unit SPEED=5 ACCEL=5 Move=10 STOP_ON_ENDSTOP=-1 SYNC=1 # Move down until no longer endstop is triggered, max 10mm. If Endstop is not untriggered then raise an error. Wait for the movement before continuing.
MANUAL_STEPPER STEPPER=lifting_unit SET_POSITION=0 # Set assumed possition as rotated to min
MANUAL_STEPPER STEPPER=lifting_unit SPEED=5 ACCEL=5 Move=-5 STOP_ON_ENDSTOP=1 SYNC=1 # Move again a little up to min and stop on endstop. If Endstop is not triggered then raise an error. Wait for the movement before continuing.
MANUAL_STEPPER STEPPER=lifting_unit SET_POSITION=0 # Set possition to min
SET_GCODE_VARIABLE MACRO=HOME_LIFTING_UNIT VARIABLE=lifting_unit_homed VALUE={1}
{% else %}
MANUAL_STEPPER STEPPER=lifting_unit SPEED=5 ACCEL=5 Move=-200 STOP_ON_ENDSTOP=1 SYNC=1
SET_GCODE_VARIABLE MACRO=HOME_LIFTING_UNIT VARIABLE=lifting_unit_homed VALUE={1}
{% endif %}
Some ideas how to write this macro better would be great.