@@ -1222,33 +1222,55 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
12221222
12231223#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
12241224
1225- void extruder_migration () {
1225+ bool extruder_migration () {
12261226
12271227 #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+ }
12291234 #endif
12301235
12311236 // No auto-migration or specified target?
12321237 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
12331244 migration.automode = false ;
1234- return ;
1245+ return false ;
12351246 }
12361247
12371248 // Migrate to a target or the next extruder
12381249
12391250 uint8_t migration_extruder = active_extruder;
12401251
12411252 if (migration.target ) {
1253+ #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
1254+ SERIAL_ECHOLN (" Migration using fixed target" );
1255+ #endif
12421256 // Specified target ok?
12431257 const int16_t t = migration.target - 1 ;
12441258 if (t != active_extruder) migration_extruder = t;
12451259 }
12461260 else if (migration.automode && migration_extruder < migration.last && migration_extruder < EXTRUDERS - 1 )
12471261 migration_extruder++;
12481262
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+ }
12501269
12511270 // Migration begins
1271+ #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE)
1272+ SERIAL_ECHOLN (" Beginning migration" );
1273+ #endif
12521274
12531275 migration.in_progress = true ; // Prevent runout script
12541276 planner.synchronize ();
@@ -1294,6 +1316,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
12941316
12951317 planner.synchronize ();
12961318 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 ;
12971323 }
12981324
12991325#endif // TOOLCHANGE_MIGRATION_FEATURE
0 commit comments