I’m building a toolchanger and i have mounted switches on the toolhead and on the magazin.
So the planned movements are:
- Move with toolhead to tool park position
- grap tool
- move 10mm back
- check if button from toolhead is closed and button from magazin is open → if not stop
- toolchange successfully
Its my first time i write python and my first time inside a klipper module
the main part of my scripts look like:
park_x = self.start_x + self.parkpositions[targetTool][0]
park_y = self.start_y + self.parkpositions[targetTool][1]
toolhead.manual_move([ park_x - self.secure_x, park_y], self.speed_move_fast)
toolhead.manual_move([park_x], self.speed_move_load)
self.lock_tool()
self.tool_current = targetTool
self.save_current_tool()
toolhead.manual_move([park_x - self.check_tool_distance], self.speed_move_load)
if not self.get_button_status(1, 0):
raise self.printer.command_error("Tool load failed")
toolhead.manual_move([ park_x - self.secure_x, park_y], self.speed_move_load)
But my problem is the function “self.get_button_status”.
I don’t know how i can check the button status at this moment.
i have tried it with
buttons = self.printer.load_object(config, "buttons")
buttons.register_buttons([magazinpin], self.magazin_button_callback)
but the callbacks are always to late
is this possible?
thanks