Single Z raise value for all tool-changing / parking (#12090)

* Universal tool-change Z lift
* Add TOOLCHANGE_ZRAISE to example configs
* Park/unpark changes to example configs
* Implement DEBUG_DXC_MODE
This commit is contained in:
InsanityAutomation
2018-10-17 12:11:41 -04:00
committed by Scott Lahteine
parent 6bdbe3299e
commit 3ec3872730
144 changed files with 395 additions and 580 deletions

View File

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(SINGLENOZZLE)
#if EXTRUDERS > 1
#include "../gcode.h"
#include "../../module/tool_change.h"
@ -32,18 +32,25 @@
#endif
void M217_report(const bool eeprom=false) {
#if NUM_SERIAL > 1
const int16_t port = command_queue_port[cmd_queue_index_r];
#endif
serialprintPGM_P(port, eeprom ? PSTR(" M217") : PSTR("Singlenozzle:"));
SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(sn_settings.swap_length));
SERIAL_ECHOPAIR_P(port, " P", LINEAR_UNIT(sn_settings.prime_speed));
SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(sn_settings.retract_speed));
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(sn_settings.change_point.x));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(sn_settings.change_point.y));
#if ENABLED(SINGLENOZZLE)
serialprintPGM_P(port, eeprom ? PSTR(" M217") : PSTR("Singlenozzle:"));
SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(toolchange_settings.swap_length));
SERIAL_ECHOPAIR_P(port, " P", LINEAR_UNIT(toolchange_settings.prime_speed));
SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(toolchange_settings.retract_speed));
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(toolchange_settings.change_point.x));
SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(toolchange_settings.change_point.y));
#endif
#endif
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(sn_settings.z_raise));
SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(toolchange_settings.z_raise));
SERIAL_EOL();
}
@ -61,19 +68,23 @@ void GcodeSuite::M217() {
bool report = true;
if (parser.seenval('S')) { report = false; const float v = parser.value_linear_units(); sn_settings.swap_length = constrain(v, 0, 500); }
if (parser.seenval('P')) { report = false; const int16_t v = parser.value_linear_units(); sn_settings.prime_speed = constrain(v, 10, 5400); }
if (parser.seenval('R')) { report = false; const int16_t v = parser.value_linear_units(); sn_settings.retract_speed = constrain(v, 10, 5400); }
#if ENABLED(SINGLENOZZLE)
if (parser.seenval('S')) { report = false; const float v = parser.value_linear_units(); toolchange_settings.swap_length = constrain(v, 0, 500); }
if (parser.seenval('P')) { report = false; const int16_t v = parser.value_linear_units(); toolchange_settings.prime_speed = constrain(v, 10, 5400); }
if (parser.seenval('R')) { report = false; const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); }
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
if (parser.seenval('X')) { report = false; toolchange_settings.change_point.x = parser.value_linear_units(); }
if (parser.seenval('Y')) { report = false; toolchange_settings.change_point.y = parser.value_linear_units(); }
#endif
#if ENABLED(SINGLENOZZLE_SWAP_PARK)
if (parser.seenval('X')) { report = false; sn_settings.change_point.x = parser.value_linear_units(); }
if (parser.seenval('Y')) { report = false; sn_settings.change_point.y = parser.value_linear_units(); }
#endif
if (parser.seenval('Z')) { report = false; sn_settings.z_raise = parser.value_linear_units(); }
if (parser.seenval('Z')) { report = false; toolchange_settings.z_raise = parser.value_linear_units(); }
if (report) M217_report();
}
#endif // SINGLENOZZLE
#endif // EXTRUDERS > 1

View File

@ -22,10 +22,10 @@
#include "../../inc/MarlinConfig.h"
#define DEBUG_DXC_MODE
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
//#define DEBUG_DXC_MODE
#include "../gcode.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
@ -99,50 +99,52 @@
else if (!parser.seen('W')) // if no S or W parameter, the DXC mode gets reset to the user's default
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
if (parser.seen('W')) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("IDEX mode: ");
switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE: SERIAL_ECHOPGM("DXC_FULL_CONTROL_MODE"); break;
case DXC_AUTO_PARK_MODE: SERIAL_ECHOPGM("DXC_AUTO_PARK_MODE"); break;
case DXC_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_DUPLICATION_MODE"); break;
case DXC_SCALED_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_SCALED_DUPLICATION_MODE"); break;
}
SERIAL_ECHOPAIR("\nActive Ext: ", int(active_extruder));
if (!active_extruder_parked) SERIAL_ECHOPGM(" NOT ");
SERIAL_ECHOPGM(" parked.");
SERIAL_ECHOPAIR("\nactive_extruder_x_pos: ", current_position[X_AXIS]);
SERIAL_ECHOPAIR("\ninactive_extruder_x_pos: ", inactive_extruder_x_pos);
SERIAL_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled));
SERIAL_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset);
SERIAL_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset);
SERIAL_ECHOPAIR("\ndelayed_move_time: ", delayed_move_time);
SERIAL_ECHOPAIR("\nX1 Home X: ", x_home_pos(0));
SERIAL_ECHOPAIR("\nX1_MIN_POS=", int(X1_MIN_POS));
SERIAL_ECHOPAIR("\nX1_MAX_POS=", int(X1_MAX_POS));
SERIAL_ECHOPAIR("\nX2 Home X: ", x_home_pos(1));
SERIAL_ECHOPAIR("\nX2_MIN_POS=", int(X2_MIN_POS));
SERIAL_ECHOPAIR("\nX2_MAX_POS=", int(X2_MAX_POS));
SERIAL_ECHOPAIR("\nX2_HOME_DIR=", int(X2_HOME_DIR));
SERIAL_ECHOPAIR("\nX2_HOME_POS=", int(X2_HOME_POS));
SERIAL_ECHOPAIR("\nDEFAULT_DUAL_X_CARRIAGE_MODE=", STRINGIFY(DEFAULT_DUAL_X_CARRIAGE_MODE));
SERIAL_ECHOPAIR("\nTOOLCHANGE_PARK_ZLIFT=", float(TOOLCHANGE_PARK_ZLIFT));
SERIAL_ECHOPAIR("\nTOOLCHANGE_UNPARK_ZLIFT=", float(TOOLCHANGE_UNPARK_ZLIFT));
SERIAL_ECHOPAIR("\nDEFAULT_DUPLICATION_X_OFFSET=", int(DEFAULT_DUPLICATION_X_OFFSET));
#ifdef DEBUG_DXC_MODE
SERIAL_EOL();
for (uint8_t i = 0; i < 2; i++) {
SERIAL_ECHOPAIR(" nozzle:", int(i));
LOOP_XYZ(j) {
SERIAL_ECHOPGM(" hotend_offset[");
SERIAL_CHAR(axis_codes[j]);
SERIAL_ECHOPAIR("_AXIS][", int(i));
SERIAL_ECHOPAIR("]=", hotend_offset[j][i]);
if (parser.seen('W')) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("IDEX mode: ");
switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE: SERIAL_ECHOPGM("DXC_FULL_CONTROL_MODE"); break;
case DXC_AUTO_PARK_MODE: SERIAL_ECHOPGM("DXC_AUTO_PARK_MODE"); break;
case DXC_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_DUPLICATION_MODE"); break;
case DXC_SCALED_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_SCALED_DUPLICATION_MODE"); break;
}
SERIAL_ECHOPAIR("\nActive Ext: ", int(active_extruder));
if (!active_extruder_parked) SERIAL_ECHOPGM(" NOT ");
SERIAL_ECHOPGM(" parked.");
SERIAL_ECHOPAIR("\nactive_extruder_x_pos: ", current_position[X_AXIS]);
SERIAL_ECHOPAIR("\ninactive_extruder_x_pos: ", inactive_extruder_x_pos);
SERIAL_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled));
SERIAL_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset);
SERIAL_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset);
SERIAL_ECHOPAIR("\ndelayed_move_time: ", delayed_move_time);
SERIAL_ECHOPAIR("\nX1 Home X: ", x_home_pos(0));
SERIAL_ECHOPAIR("\nX1_MIN_POS=", int(X1_MIN_POS));
SERIAL_ECHOPAIR("\nX1_MAX_POS=", int(X1_MAX_POS));
SERIAL_ECHOPAIR("\nX2 Home X: ", x_home_pos(1));
SERIAL_ECHOPAIR("\nX2_MIN_POS=", int(X2_MIN_POS));
SERIAL_ECHOPAIR("\nX2_MAX_POS=", int(X2_MAX_POS));
SERIAL_ECHOPAIR("\nX2_HOME_DIR=", int(X2_HOME_DIR));
SERIAL_ECHOPAIR("\nX2_HOME_POS=", int(X2_HOME_POS));
SERIAL_ECHOPAIR("\nDEFAULT_DUAL_X_CARRIAGE_MODE=", STRINGIFY(DEFAULT_DUAL_X_CARRIAGE_MODE));
SERIAL_ECHOPAIR("\nTOOLCHANGE_ZRAISE=", float(TOOLCHANGE_ZRAISE));
SERIAL_ECHOPAIR("\nDEFAULT_DUPLICATION_X_OFFSET=", int(DEFAULT_DUPLICATION_X_OFFSET));
SERIAL_EOL();
for (uint8_t i = 0; i < 2; i++) {
SERIAL_ECHOPAIR(" nozzle:", int(i));
LOOP_XYZ(j) {
SERIAL_ECHOPGM(" hotend_offset[");
SERIAL_CHAR(axis_codes[j]);
SERIAL_ECHOPAIR("_AXIS][", int(i));
SERIAL_ECHOPAIR("]=", hotend_offset[j][i]);
}
SERIAL_EOL();
}
SERIAL_EOL();
}
SERIAL_EOL();
}
#endif // DEBUG_DXC_MODE
}
#elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)

View File

@ -481,7 +481,7 @@ void GcodeSuite::process_parsed_command(
case 211: M211(); break; // M211: Enable, Disable, and/or Report software endstops
#if ENABLED(SINGLENOZZLE)
#if EXTRUDERS > 1
case 217: M217(); break; // M217: Set filament swap parameters
#endif

View File

@ -612,7 +612,7 @@ private:
static void M211();
#if ENABLED(SINGLENOZZLE)
#if EXTRUDERS > 1
static void M217();
#endif