Marlin Firmware - independant Stepper Control


I’m working on a project that uses Marlin firmware. My main problem at the moment is I need to control the extruder stepper separate from the XYZ steppers, as in I need to control it using my own logic in the firmware. Overall the printer would be executing the G0/G1 XYZ movements without any E parameters, and what I set elsewhere in the firmware will control the E movement.

Ive tried a number of things including messing with the queue, motion, planner, and position, current_position and destination but with limited success. My understanding is limited in those components at the moment.

An example of how to say toggle the extruder 1mm forward and back to 0mm/origin regardless of what gcodes are in the queue at any moment is ideal. At the very least, if someone can explain in detail how the motion and positioning works to be modified dynamically would be helpful.

Any help with this matter is greatly appreciated and please let me know if more info is needed.



G0 X90.6 Y13.8
G1 E22.4 F3000 



For sequential, synchronous moves that of course works. I am looking, however, to be able to instruct the extruder stepper to move certain points at any point in time, regardless of the queue, i.e. asynchronously in relation to the XYZ steppers. Say you have a long list of XYZ moves, the E stepper would alternate to 1mm and 0mm every second while the XYZ moves are executed in the planner.

The documentation also states the synchronicity:

Blockquote The G0 and G1 commands add a linear move to the queue to be performed after all previous moves are completed. These commands yield control back to the command parser as soon as the move is queued, but they may delay the command parser while awaiting a slot in the queue