Selaa lähdekoodia

force high power mode during xyz cal. and selftest

PavelSindler 7 vuotta sitten
vanhempi
commit
82dffb688a
3 muutettua tiedostoa jossa 39 lisäystä ja 2 poistoa
  1. 9 0
      Firmware/Marlin.h
  2. 24 2
      Firmware/Marlin_main.cpp
  3. 6 0
      Firmware/ultralcd.cpp

+ 9 - 0
Firmware/Marlin.h

@@ -420,6 +420,15 @@ extern int busy_state;
 
 #endif //HOST_KEEPALIVE_FEATURE
 
+#ifdef TMC2130
+
+#define FORCE_HIGH_POWER_START	force_high_power_mode(true)
+#define FORCE_HIGH_POWER_END	force_high_power_mode(false)
+
+void force_high_power_mode(bool start_high_power_section);
+
+#endif //TMC2130
+
 // G-codes
 bool gcode_M45(bool onlyZ);
 void gcode_M701();

+ 24 - 2
Firmware/Marlin_main.cpp

@@ -1916,11 +1916,30 @@ void ramming() {
   }
 */
 
+#ifdef TMC2130
+void force_high_power_mode(bool start_high_power_section) {
+	uint8_t silent;
+	silent = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
+	if (silent == 1) {
+		//we are in silent mode, set to normal mode to enable crash detection
+
+
+		st_synchronize();
+		cli();
+		tmc2130_mode = (start_high_power_section == true) ? TMC2130_MODE_NORMAL : TMC2130_MODE_SILENT;
+		tmc2130_init();
+		sei();
+		digipot_init();
+	}
+}
+#endif //TMC2130
+
 bool gcode_M45(bool onlyZ) {
 	bool final_result = false;
+	#ifdef TMC2130
+	FORCE_HIGH_POWER_START;
+	#endif // TMC2130
 	// Only Z calibration?
-
-
 	if (!onlyZ) {
 		setTargetBed(0);
 		setTargetHotend(0, 0);
@@ -2048,6 +2067,9 @@ bool gcode_M45(bool onlyZ) {
 		// Timeouted.
 	}
 	lcd_update_enable(true);
+#ifdef TMC2130
+	FORCE_HIGH_POWER_END;
+#endif // TMC2130
 	return final_result;
 	}
 

+ 6 - 0
Firmware/ultralcd.cpp

@@ -5433,6 +5433,9 @@ static bool lcd_selftest()
 
 	lcd_implementation_clear();
 	lcd.setCursor(0, 0); lcd_printPGM(MSG_SELFTEST_START);
+	#ifdef TMC2130
+	  FORCE_HIGH_POWER_START;
+	#endif // TMC2130
 	delay(2000);
 
 	_progress = lcd_selftest_screen(-1, _progress, 3, true, 2000);
@@ -5545,6 +5548,9 @@ static bool lcd_selftest()
 	{
 		LCD_ALERTMESSAGERPGM(MSG_SELFTEST_FAILED);
 	}
+	#ifdef TMC2130
+	  FORCE_HIGH_POWER_END;
+	#endif // TMC2130
 	return(_result);
 }