Browse Source

Merge pull request #312 from PavelSindler/wizard

Wizard: force high power mode during xyz cal. and selftest; wizard for assembled printer
PavelSindler 7 years ago
parent
commit
c1416cbb33
3 changed files with 43 additions and 2 deletions
  1. 9 0
      Firmware/Marlin.h
  2. 26 2
      Firmware/Marlin_main.cpp
  3. 8 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();

+ 26 - 2
Firmware/Marlin_main.cpp

@@ -727,6 +727,7 @@ void factory_reset(char level, bool quiet)
             lcd_force_language_selection();
             // Force the "Follow calibration flow" message at the next boot up.
             calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION);
+			eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard
             farm_no = 0;
 			farm_mode == false;
 			eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode);
@@ -1916,11 +1917,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);
@@ -1999,6 +2019,7 @@ bool gcode_M45(bool onlyZ) {
 				if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION)
 					// Shipped, the nozzle height has been set already. The user can start printing now.
 					calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
+					final_result = true;
 				// babystep_apply();
 			}
 		}
@@ -2047,6 +2068,9 @@ bool gcode_M45(bool onlyZ) {
 		// Timeouted.
 	}
 	lcd_update_enable(true);
+#ifdef TMC2130
+	FORCE_HIGH_POWER_END;
+#endif // TMC2130
 	return final_result;
 	}
 

+ 8 - 0
Firmware/ultralcd.cpp

@@ -3569,6 +3569,8 @@ void lcd_wizard(int state) {
 			break;
 		case 4: //z cal.
 			lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_Z_CAL);
+			wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_STEEL_SHEET_CHECK, false, false);
+			if (!wizard_event) lcd_show_fullscreen_message_and_wait_P(MSG_PLACE_STEEL_SHEET);
 			wizard_event = gcode_M45(true);
 			if (wizard_event) state = 11; //shipped, no need to set first layer, go to final message directly
 			else end = true;
@@ -5445,6 +5447,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);
@@ -5557,6 +5562,9 @@ static bool lcd_selftest()
 	{
 		LCD_ALERTMESSAGERPGM(MSG_SELFTEST_FAILED);
 	}
+	#ifdef TMC2130
+	  FORCE_HIGH_POWER_END;
+	#endif // TMC2130
 	return(_result);
 }