Browse Source

PFW658 - disable extruder motor while changing filament with mmu2 (prevents extruder motor overheating)

Robert Pelnar 5 years ago
parent
commit
bfc343c7c5
2 changed files with 19 additions and 0 deletions
  1. 1 0
      Firmware/Marlin_main.cpp
  2. 18 0
      Firmware/mmu.cpp

+ 1 - 0
Firmware/Marlin_main.cpp

@@ -6636,6 +6636,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
 				uint8_t val = tmc2130_cur2val(cur_mA);
 				tmc2130_set_current_h(i, val);
 				tmc2130_set_current_r(i, val);
+				//if (i == E_AXIS) printf_P(PSTR("E-axis current=%ldmA\n"), cur_mA);
 			}
 
 #else //TMC2130

+ 18 - 0
Firmware/mmu.cpp

@@ -14,6 +14,10 @@
 #include "printers.h"
 #include <avr/pgmspace.h>
 
+#ifdef TMC2130
+#include "tmc2130.h"
+#endif //TMC2130
+
 #define CHECK_FINDA ((IS_SD_PRINTING || is_usb_printing) && (mcode_in_progress != 600) && !saved_printing && e_active())
 
 #define MMU_TODELAY 100
@@ -321,6 +325,15 @@ int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament)
 
 void mmu_command(uint8_t cmd)
 {
+#ifdef TMC2130
+	if ((cmd >= MMU_CMD_T0) && (cmd <= MMU_CMD_T4))
+	{
+		//disable extruder motor
+		tmc2130_set_pwr(E_AXIS, 0);
+		//printf_P(PSTR("E-axis disabled\n"));
+	}
+#endif //TMC2130
+
 	mmu_cmd = cmd;
 	mmu_ready = false;
 }
@@ -475,6 +488,11 @@ void manage_response(bool move_axes, bool turn_off_nozzle)
 		  }
 	}
 	if (lcd_update_was_enabled) lcd_update_enable(true);
+#ifdef TMC2130
+			//enable extruder motor (disabled in mmu_command, start of T-code processing)
+			tmc2130_set_pwr(E_AXIS, 1);
+			//printf_P(PSTR("E-axis enabled\n"));
+#endif //TMC2130
 }
 
 //! @brief load filament to nozzle of multimaterial printer