Browse Source

Preheat nozzle before loading filament in M600 (change filament) gcode.

This fixes problem of not heating the nozzle when retrying load after MMU load failed.
Marek Bel 6 years ago
parent
commit
b2255c8be9
4 changed files with 13 additions and 8 deletions
  1. 1 1
      Firmware/Marlin.h
  2. 5 4
      Firmware/Marlin_main.cpp
  3. 6 2
      Firmware/mmu.cpp
  4. 1 1
      Firmware/mmu.h

+ 1 - 1
Firmware/Marlin.h

@@ -493,5 +493,5 @@ void proc_commands();
 void M600_load_filament();
 void M600_load_filament_movements();
 void M600_wait_for_user(float HotendTempBckp);
-void M600_check_state();
+void M600_check_state(float nozzle_temp);
 void load_filament_final_feed();

+ 5 - 4
Firmware/Marlin_main.cpp

@@ -3040,12 +3040,12 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
                 manage_response(false, false);
             }
         }
-        mmu_M600_load_filament(automatic);
+        mmu_M600_load_filament(automatic, HotendTempBckp);
     }
     else
         M600_load_filament();
 
-    if (!automatic) M600_check_state();
+    if (!automatic) M600_check_state(HotendTempBckp);
 
 		lcd_update_enable(true);
 
@@ -9090,7 +9090,8 @@ void load_filament_final_feed()
 	plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EFEED_FINAL, active_extruder);
 }
 
-void M600_check_state()
+//! @par nozzle_temp nozzle temperature to load filament
+void M600_check_state(float nozzle_temp)
 {
 		//Wait for user to check the state
 		lcd_change_fil_state = 0;
@@ -9103,7 +9104,7 @@ void M600_check_state()
 				// Filament failed to load so load it again
 				case 2:
 					if (mmu_enabled)
-						mmu_M600_load_filament(false); //nonautomatic load; change to "wrong filament loaded" option?
+						mmu_M600_load_filament(false, nozzle_temp); //nonautomatic load; change to "wrong filament loaded" option?
 					else
 						M600_load_filament_movements();
 					break;

+ 6 - 2
Firmware/mmu.cpp

@@ -830,9 +830,10 @@ void mmu_M600_wait_and_beep() {
 		WRITE(BEEPER, LOW);
 }
 
-void mmu_M600_load_filament(bool automatic)
+//! @brief load filament for mmu v2
+//! @par nozzle_temp nozzle temperature to load filament
+void mmu_M600_load_filament(bool automatic, float nozzle_temp)
 { 
-	//load filament for mmu v2
 		  tmp_extruder = mmu_extruder;
 		  if (!automatic) {
 #ifdef MMU_M600_SWITCH_EXTRUDER
@@ -852,6 +853,9 @@ void mmu_M600_load_filament(bool automatic)
 
 //		  printf_P(PSTR("T code: %d \n"), tmp_extruder);
 //		  mmu_printf_P(PSTR("T%d\n"), tmp_extruder);
+		  setTargetHotend(nozzle_temp,active_extruder);
+		  mmu_wait_for_heater_blocking();
+
 		  mmu_command(MmuCmd::T0 + tmp_extruder);
 
 		  manage_response(false, true, MMU_LOAD_MOVE);

+ 1 - 1
Firmware/mmu.h

@@ -97,7 +97,7 @@ extern void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move =
 
 extern void mmu_load_to_nozzle();
 
-extern void mmu_M600_load_filament(bool automatic);
+extern void mmu_M600_load_filament(bool automatic, float nozzle_temp);
 extern void mmu_M600_wait_and_beep();
 
 extern void extr_mov(float shift, float feed_rate);