I just started using Octoprint (and the RasPi) for the first time last week, so please forgive me if this question can not be done, or if it was asked before.
Could it be possible for Octoprint do run a kind of "IF" and "THEN" while printing? I'll give an idea I had that would use the GPIO inputs, and determine what Octoprint needs to do. Lets use E3D's tool-changing 3D printer as an example. Lets run a print that uses all 4 tools. And about half way through, there is a power outage. so now the printer is stopped, and it has a random tool locked in to the carriage. If the print is restarted, the printer will assume there is no tool locked in the carriage and try to pick up the first tool to start printing. But since there is a tool in the carriage from the power outage, the printer will crash.
My thinking to stop this is to use "IF" and "THEN" commands that are controlled using the GPIO inputs. First Octoprint would home X and Y, then using the GPIO inputs, notice what tool storage location is empty, then run the tool docking gcode.
Something like; (please excuse the format, I dont know the code for the RasPi yet)
docked = high not_docked = low IF tool_0 = not_docked RUN TOOL NUMBER 0 DOCKING GCODE IF tool_1 = not_docked RUN TOOL NUMBER 1 DOCKING GCODE IF tool_2 = not_docked RUN TOOL NUMBER 2 DOCKING GCODE IF tool_3 = not_docked RUN TOOL NUMBER 3 DOCKING GCODE
The IF and THEN could also be used to confirm the tool is locked to the carriage before it starts (or continues) printing.
IF carriage_locked = not_docked STOP PRINT SHOW WARNING
Thanks for any input. And i'm looking forward to learning more