Introduce M221 aka flow-control.

Now it is possible to control the extruders flow.

  M221 S100 = 100% of the extruders steps
  M221 S90  = 90% of the extruders steps

M221 is also used in other firmwares for this. Also a lot of
hosts, like Octoprint and Pronterface using this M-Code for
this behaviour.
This commit is contained in:
wurstnase 2016-06-24 20:04:24 +02:00 committed by Markus Hitter
parent 280edf6dbc
commit 9b010e65ee
3 changed files with 15 additions and 0 deletions

7
dda.c
View File

@ -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;

1
dda.h
View File

@ -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;

View File

@ -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 ---