diff --git a/dda.c b/dda.c index ec16d12..0884263 100644 --- a/dda.c +++ b/dda.c @@ -110,6 +110,8 @@ void dda_init(void) { // set up default feedrate if (startpoint.F == 0) startpoint.F = next_target.target.F = SEARCH_FEEDRATE_Z; + if (startpoint.e_multiplier == 0) + startpoint.e_multiplier = next_target.target.e_multiplier = 100; } /*! Distribute a new startpoint to DDA's internal structures without any movement. @@ -216,6 +218,11 @@ void dda_create(DDA *dda, TARGET *target) { // type, but are subject to other special handling. steps[E] = um_to_steps(target->axis[E], E); + // Apply extrusion multiplier. + steps[E] *= target->e_multiplier; + steps[E] += 50; + steps[E] /= 100; + if ( ! target->e_relative) { int32_t delta_steps; diff --git a/dda.h b/dda.h index 10a5ea3..4eaef1a 100644 --- a/dda.h +++ b/dda.h @@ -41,6 +41,7 @@ typedef struct { axes_int32_t axis; uint32_t F; + uint8_t e_multiplier; uint8_t e_relative :1; ///< bool: e axis relative? Overrides all_relative } TARGET; diff --git a/gcode_process.c b/gcode_process.c index 79493e9..b87f2d5 100644 --- a/gcode_process.c +++ b/gcode_process.c @@ -793,6 +793,13 @@ void process_gcode_command() { #endif break; + case 221: + //? --- M221: Control the extruders flow --- + if ( ! next_target.seen_S) + break; + next_target.target.e_multiplier = next_target.S; + break; + #ifdef DEBUG case 240: //? --- M240: echo off ---