General Goal:
I’m currently creating a python script to easily add auto z adjustment between my BLTouch probe and nozzle so that I can switch my nozzles easier on my Ender 3 S1 PRO.
Implementation idea:
Although implementations for this kind of thing exists already, they require a lot of changes to the main printer config file and thus conflict with other setups. Such as not being able to use the virtual z bl touch endstop for stepper Z, having to rewrite the homing macro etc.
To avoid this I want to use a general endstop which I’ve added to my PA15 pin and use homing.probing_move(endstop, position, speed), ‘endstop’ being my PA15 endstop and ‘position’ being the nozzle over the PA15 endstop.
Issue:
This currently works fine if I set the PA15 endstop as my stepper Z default endstop (Which I don’t want to do) and pass that to the probing move function. But if I try to grab the PA15 endstop and pass that to the probe move function without setting it that way, I get an error of:
"{'error': 'WebRequestError', 'message': "initializer for ctype 'struct trdispatch_mcu *' must be a cdata pointer, not NoneType"}" from the probing_move function
The code I’m using to get my general PA15 endstop is this
> def get_endstop(self, endstop_pin, gcmd):
> printer = self.config.get_printer()
> ppins = printer.lookup_object('pins')
> endstop = ppins.setup_pin('endstop', endstop_pin)
> stepper = self.get_z_stepper(gcmd)
> name = stepper.get_name(short=True)
> self.query_endstops.register_endstop(endstop, name)
> endstop.add_stepper(stepper)
>
> return endstop
‘endstop_pin’ being a string which contains “PA15”. It seems to retrieve the endstop fine and assign it to the stepper (Which I think is correct, I’m not too sure) but then I seem to be receiving the aforementioned error which I don’t entirely understand.
I’m a bit new to python, but I’m familiar with C#/C/C++ and some other langauges, mainly C# and C++. If I get this issue resolved, I’ll upload the entire code to a github and my personal CAD files to easily attach an autoz endstop to the Ender 3 S1 Pro.
Thanks for any help in advance.