Please see Klipper-Toolchanger
Feel free to adapt my CPAP config. That is based on a dedicated toolbard. You will need to change the pin assignment if you are using something else..
Please file a bug if you are interested in detailed build instructions for the CPAP box.