|
@@ -1222,16 +1222,27 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
1222
|
1222
|
|
1223
|
1223
|
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
|
1224
|
1224
|
|
1225
|
|
- void extruder_migration() {
|
|
1225
|
+ bool extruder_migration() {
|
1226
|
1226
|
|
1227
|
1227
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
1228
|
|
- if (thermalManager.targetTooColdToExtrude(active_extruder)) return;
|
|
1228
|
+ if (thermalManager.targetTooColdToExtrude(active_extruder)) {
|
|
1229
|
+ #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
|
|
1230
|
+ SERIAL_ECHOLN("Migration Source Too Cold");
|
|
1231
|
+ #endif
|
|
1232
|
+ return false;
|
|
1233
|
+ }
|
1229
|
1234
|
#endif
|
1230
|
1235
|
|
1231
|
1236
|
// No auto-migration or specified target?
|
1232
|
1237
|
if (!migration.target && active_extruder >= migration.last) {
|
|
1238
|
+ #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
|
|
1239
|
+ SERIAL_ECHO_MSG("No Migration Target");
|
|
1240
|
+ SERIAL_ECHO_MSG("Target: ", migration.target,
|
|
1241
|
+ " Last: ", migration.last,
|
|
1242
|
+ " Active: ", active_extruder);
|
|
1243
|
+ #endif
|
1233
|
1244
|
migration.automode = false;
|
1234
|
|
- return;
|
|
1245
|
+ return false;
|
1235
|
1246
|
}
|
1236
|
1247
|
|
1237
|
1248
|
// Migrate to a target or the next extruder
|
|
@@ -1239,6 +1250,9 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
1239
|
1250
|
uint8_t migration_extruder = active_extruder;
|
1240
|
1251
|
|
1241
|
1252
|
if (migration.target) {
|
|
1253
|
+ #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
|
|
1254
|
+ SERIAL_ECHOLN("Migration using fixed target");
|
|
1255
|
+ #endif
|
1242
|
1256
|
// Specified target ok?
|
1243
|
1257
|
const int16_t t = migration.target - 1;
|
1244
|
1258
|
if (t != active_extruder) migration_extruder = t;
|
|
@@ -1246,9 +1260,17 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
1246
|
1260
|
else if (migration.automode && migration_extruder < migration.last && migration_extruder < EXTRUDERS - 1)
|
1247
|
1261
|
migration_extruder++;
|
1248
|
1262
|
|
1249
|
|
- if (migration_extruder == active_extruder) return;
|
|
1263
|
+ if (migration_extruder == active_extruder) {
|
|
1264
|
+ #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
|
|
1265
|
+ SERIAL_ECHOLN("Migration source matches active");
|
|
1266
|
+ #endif
|
|
1267
|
+ return false;
|
|
1268
|
+ }
|
1250
|
1269
|
|
1251
|
1270
|
// Migration begins
|
|
1271
|
+ #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
|
|
1272
|
+ SERIAL_ECHOLN("Beginning migration");
|
|
1273
|
+ #endif
|
1252
|
1274
|
|
1253
|
1275
|
migration.in_progress = true; // Prevent runout script
|
1254
|
1276
|
planner.synchronize();
|
|
@@ -1294,6 +1316,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
1294
|
1316
|
|
1295
|
1317
|
planner.synchronize();
|
1296
|
1318
|
planner.set_e_position_mm(current_position.e); // New extruder primed and ready
|
|
1319
|
+ #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
|
|
1320
|
+ SERIAL_ECHOLN("Migration Complete");
|
|
1321
|
+ #endif
|
|
1322
|
+ return true;
|
1297
|
1323
|
}
|
1298
|
1324
|
|
1299
|
1325
|
#endif // TOOLCHANGE_MIGRATION_FEATURE
|