I think the parts in green can be done directly via gcode only, and can be standardised/hardwired:
- Optical sensor detects filament has finished.
- Continues print untill filament is pulled half way into the hotend. (This to give room for the new filament to be fed in)
- Pauses print, raises extruder 20mm.
- Sets hotend temp to 0
- Sounds buzzer.
- New filament is fed in
- Sets hotend temp to 220
- It extrudes 30mm of filament (which you have to manually clean away)
- Extruder drops 20mm, and resumes printing.
But yes, the crucial part would be the detection, which would cause the gcode to run.
About the DaVinci using the sensor during a print, when I was on firmware A, I tested it, by snipping the filament off during a print. It just kept on printing after the filament ran through. I havent tested it on current firmwares, though
if it isn't broken, you haven't modded it enough