On the original of this request (G28 E for homing syringe extruders):
changed #define EXT0_JAM_PIN -1 to 42 in configuration.h
added #define JAM_METHOD 2 in the manual part of configuration.h
connected an opto endstop, signal to pin 42
As long as the signal is high, the PRINTER_INTERRUPT_EVENT_JAM_DETECTED gets raised. So I added a flag in and Printer.cpp to prevent repeated execution of myJam_action:
static bool JamActing; (Printer.h, Class Printer)
bool Printer::JamActing = false; (Printer.cpp )
For testing I added the next for JAM_ACTION == 10 in Printer::handleInterruptEvent (I'll move this to a custom events part in the final version)and changed #define JAM_ACTION from 0 to 10 in configuration.h.
#elif JAM_ACTION == 10
if (!Printer::JamActing) {
Printer::JamActing = true;
Extruder::pauseExtruders();
Extruder::markAllUnjammed();
Extruder::unpauseExtruders();
PrintLine::moveRelativeDistanceInSteps(0, 0, 0, 2 * Printer::axisStepsPerMM[E_AXIS], Printer::maxFeedrate[E_AXIS] / 8, false, false); // Move back a bit to unstop the endstop
Commands::waitUntilEndOfAllMoves();
Printer::currentPositionSteps[E_AXIS] = 0; //Set extruder start position
Printer::JamActing = false;
}
In the Gcode I start all prints with setting my syringe valve to stock inlet and then move the extruder (syringe piston motor) towards the endstop (out).
Test look good. The extruder stops at once. Then the printer waits some 30 seconds (don't know why ? adding Com::printFLN(PSTR("some comments") increases the delay), moves the extruder back a bit (piston in) and starts printing.