Catch Tx G-Code, trigger a GCode script and set pin outputs

The can be possible to catch a Tx Gcode command asking for change extruder, so Octoprint trigger an Gcode script to retract then send outputs in binary I guest so I can takea multiplexer for change the extruder withoout a MMU unit, something like this:

inside the GCODE

  • T5
  • Octoprint trigger a Retract GCode command for n mm
  • Output GPIO27,17,22 101
  • External multiplexer circuit take the raspberry output and select the extruder cabling coming from the printer and change to another extruder
  • Octorpint trigger a Extrude (for advance filament into nozzle)

so the result is a filament change having a marlin config for a single extruder and single nozzle. (without MMU unit)
with 3 outputs we can use up to 8 extruders.

It is possible.