Single X Duplication Extension (#13373)

* Multi-nozzle selective duplication
* Use a bit-mask, reduce stepper_indirection.h size
* Tweak the multi-nozzle duplication description
* Use 'S' as a bool in M605
* Add HAS_DUPLICATION_MODE conditional
* Remove '_MODE' from the option name
* M605 in the style of Stacker M280
* Also include direct mask style (P)
This commit is contained in:
InsanityAutomation
2019-03-13 01:42:50 -04:00
committed by Scott Lahteine
parent ad91476d26
commit 050eac03af
86 changed files with 289 additions and 220 deletions

View File

@ -258,7 +258,7 @@ void GcodeSuite::G28(const bool always_home_all) {
tool_change(0, 0, true);
#endif
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#if HAS_DUPLICATION_MODE
extruder_duplication_enabled = false;
#endif

View File

@ -119,7 +119,7 @@ void GcodeSuite::G34() {
tool_change(0, 0, true);
#endif
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#if HAS_DUPLICATION_MODE
extruder_duplication_enabled = false;
#endif

View File

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#if HAS_DUPLICATION_MODE
//#define DEBUG_DXC_MODE
@ -38,8 +38,8 @@
* M605: Set dual x-carriage movement mode
*
* M605 : Restore user specified DEFAULT_DUAL_X_CARRIAGE_MODE
* M605 S0: Full control mode. The slicer has full control over x-carriage movement
* M605 S1: Auto-park mode. The inactive head will auto park/unpark without slicer involvement
* M605 S0 : Full control mode. The slicer has full control over x-carriage movement
* M605 S1 : Auto-park mode. The inactive head will auto park/unpark without slicer involvement
* M605 S2 [Xnnn] [Rmmm]: Duplication mode. The second extruder will duplicate the first with nnn
* units x-offset and an optional differential hotend temperature of
* mmm degrees. E.g., with "M605 S2 X100 R2" the second extruder will duplicate
@ -59,6 +59,8 @@
const DualXMode previous_mode = dual_x_carriage_mode;
dual_x_carriage_mode = (DualXMode)parser.value_byte();
#if 0
scaled_duplication_mode = false;
if (dual_x_carriage_mode == DXC_SCALED_DUPLICATION_MODE) {
@ -77,6 +79,7 @@
}
return;
}
#endif
switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE:
@ -147,16 +150,36 @@
#endif // DEBUG_DXC_MODE
}
#elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#elif ENABLED(MULTI_NOZZLE_DUPLICATION)
/**
* M605: Set multi-nozzle duplication mode
*
* S2 - Enable duplication mode
* P[mask] - Bit-mask of nozzles to include in the duplication set.
* A value of 0 disables duplication.
* E[index] - Last nozzle index to include in the duplication set.
* A value of 0 disables duplication.
*/
void GcodeSuite::M605() {
planner.synchronize();
extruder_duplication_enabled = parser.intval('S') == (int)DXC_DUPLICATION_MODE;
if (parser.seen("EPS")) {
planner.synchronize();
if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly
else if (parser.seenval('E')) duplication_e_mask = pow(2, e + 1) - 1; // Set the mask by E index
const bool ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0));
extruder_duplication_enabled = ena && (duplication_e_mask >= 3);
}
SERIAL_ECHO_START();
SERIAL_ECHOPGM(MSG_DUPLICATION_MODE);
serialprintln_onoff(extruder_duplication_enabled);
serialprint_onoff(extruder_duplication_enabled);
if (ena) {
SERIAL_ECHOPGM(" ( ");
HOTEND_LOOP() if (TEST(duplication_e_mask, e)) { SERIAL_ECHO(e); SERIAL_CHAR(' '); }
SERIAL_CHAR(')');
}
SERIAL_EOL();
}
#endif // DUAL_NOZZLE_DUPLICATION_MODE
#endif // MULTI_NOZZLE_DUPLICATION
#endif // DUAL_X_CARRIAGE || DUAL_NOZZLE_DUPLICATION_MODE
#endif // HAS_DUPICATION_MODE

View File

@ -650,7 +650,7 @@ void GcodeSuite::process_parsed_command(
case 603: M603(); break; // M603: Configure Filament Change
#endif
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#if HAS_DUPLICATION_MODE
case 605: M605(); break; // M605: Set Dual X Carriage movement mode
#endif

View File

@ -769,7 +769,7 @@ private:
static void M603();
#endif
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
#if HAS_DUPLICATION_MODE
static void M605();
#endif