| 
															
																@@ -1483,6 +1483,7 @@ static void lcd_menu_extruder_info() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      
															 | 
															
															 | 
															
																      
															 | 
														
													
												
													
														
															| 
															 | 
															
																     // Display Nozzle fan RPM 
															 | 
															
															 | 
															
																     // Display Nozzle fan RPM 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      
															 | 
															
															 | 
															
																      
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+#if (defined(TACH_1)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     lcd.setCursor(0, 1); 
															 | 
															
															 | 
															
																     lcd.setCursor(0, 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     lcd_printPGM(MSG_INFO_PRINT_FAN); 
															 | 
															
															 | 
															
																     lcd_printPGM(MSG_INFO_PRINT_FAN); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      
															 | 
															
															 | 
															
																      
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -1491,7 +1492,7 @@ static void lcd_menu_extruder_info() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     lcd.setCursor(12, 1); 
															 | 
															
															 | 
															
																     lcd.setCursor(12, 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     lcd.print(itostr4(fan_speed_RPM[1])); 
															 | 
															
															 | 
															
																     lcd.print(itostr4(fan_speed_RPM[1])); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     lcd.print(" RPM"); 
															 | 
															
															 | 
															
																     lcd.print(" RPM"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+#endif 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      
															 | 
															
															 | 
															
																      
															 | 
														
													
												
													
														
															| 
															 | 
															
																     // Display X and Y difference from Filament sensor 
															 | 
															
															 | 
															
																     // Display X and Y difference from Filament sensor 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      
															 | 
															
															 | 
															
																      
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -3707,7 +3708,7 @@ void lcd_wizard(int state) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			case CALIBRATION_STATUS_CALIBRATED: end = true; eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); break; 
															 | 
															
															 | 
															
																 			case CALIBRATION_STATUS_CALIBRATED: end = true; eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); break; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			default: state = 2; break; //if calibration status is unknown, run wizard from the beginning 
															 | 
															
															 | 
															
																 			default: state = 2; break; //if calibration status is unknown, run wizard from the beginning 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			} 
															 | 
															
															 | 
															
																 			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			break; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			break;  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		case 2: //selftest 
															 | 
															
															 | 
															
																 		case 2: //selftest 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_SELFTEST); 
															 | 
															
															 | 
															
																 			lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_SELFTEST); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			wizard_event = lcd_selftest(); 
															 | 
															
															 | 
															
																 			wizard_event = lcd_selftest(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -5629,7 +5630,11 @@ static bool lcd_selftest() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	if (_result) 
															 | 
															
															 | 
															
																 	if (_result) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	{ 
															 | 
															
															 | 
															
																 	{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		_progress = lcd_selftest_screen(0, _progress, 3, true, 2000); 
															 | 
															
															 | 
															
																 		_progress = lcd_selftest_screen(0, _progress, 3, true, 2000); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+#if (defined(TACH_1)) 		 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		_result = lcd_selftest_fan_dialog(1); 
															 | 
															
															 | 
															
																 		_result = lcd_selftest_fan_dialog(1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+#else //defined(TACH_1) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		_result = lcd_selftest_manual_fan_check(1, false); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+#endif //defined(TACH_1) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	if (_result) 
															 | 
															
															 | 
															
																 	if (_result) 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -5888,13 +5893,11 @@ static bool lcd_selfcheck_axis_sg(char axis) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		return true; 
															 | 
															
															 | 
															
																 		return true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 #endif //TMC2130 
															 | 
															
															 | 
															
																 #endif //TMC2130 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+#ifndef TMC2130 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 static bool lcd_selfcheck_axis(int _axis, int _travel) 
															 | 
															
															 | 
															
																 static bool lcd_selfcheck_axis(int _axis, int _travel) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 { 
															 | 
															
															 | 
															
																 { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	bool _stepdone = false; 
															 | 
															
															 | 
															
																 	bool _stepdone = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	bool _stepresult = false; 
															 | 
															
															 | 
															
																 	bool _stepresult = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	int _progress = 0; 
															 | 
															
															 | 
															
																 	int _progress = 0; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -5902,41 +5905,39 @@ static bool lcd_selfcheck_axis(int _axis, int _travel) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	int _err_endstop = 0; 
															 | 
															
															 | 
															
																 	int _err_endstop = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	int _lcd_refresh = 0; 
															 | 
															
															 | 
															
																 	int _lcd_refresh = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	_travel = _travel + (_travel / 10); 
															 | 
															
															 | 
															
																 	_travel = _travel + (_travel / 10); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	do { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	do { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		current_position[_axis] = current_position[_axis] - 1; 
															 | 
															
															 | 
															
																 		current_position[_axis] = current_position[_axis] - 1; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); 
															 | 
															
															 | 
															
																 		plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		st_synchronize(); 
															 | 
															
															 | 
															
																 		st_synchronize(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		if (/*x_min_endstop || y_min_endstop || */(READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1)) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) || 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		{ 
															 | 
															
															 | 
															
																 		{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			if (_axis == 0) 
															 | 
															
															 | 
															
																 			if (_axis == 0) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			{ 
															 | 
															
															 | 
															
																 			{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				_stepresult = (x_min_endstop) ? true : false; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				_err_endstop = (y_min_endstop) ? 1 : 2; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				_stepresult = ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ? true : false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				_err_endstop = ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ? 1 : 2; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			} 
															 | 
															
															 | 
															
																 			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			if (_axis == 1) 
															 | 
															
															 | 
															
																 			if (_axis == 1) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			{ 
															 | 
															
															 | 
															
																 			{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				_stepresult = (y_min_endstop) ? true : false; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				_err_endstop = (x_min_endstop) ? 0 : 2; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				_stepresult = ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ? true : false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				_err_endstop = ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ? 0 : 2; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			} 
															 | 
															
															 | 
															
																 			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			if (_axis == 2) 
															 | 
															
															 | 
															
																 			if (_axis == 2) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			{ 
															 | 
															
															 | 
															
																 			{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				_stepresult = (READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) ? true : false; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				_err_endstop = (x_min_endstop) ? 0 : 1; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				_stepresult = ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) ? true : false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				_err_endstop = ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ? 0 : 1; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 				/*disable_x(); 
															 | 
															
															 | 
															
																 				/*disable_x(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 				disable_y(); 
															 | 
															
															 | 
															
																 				disable_y(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 				disable_z();*/ 
															 | 
															
															 | 
															
																 				disable_z();*/ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			} 
															 | 
															
															 | 
															
																 			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			_stepdone = true; 
															 | 
															
															 | 
															
																 			_stepdone = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#ifdef TMC2130 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		tmc2130_home_exit(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#endif 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		if (_lcd_refresh < 6) 
															 | 
															
															 | 
															
																 		if (_lcd_refresh < 6) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		{ 
															 | 
															
															 | 
															
																 		{ 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -5944,7 +5945,7 @@ static bool lcd_selfcheck_axis(int _axis, int _travel) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		else 
															 | 
															
															 | 
															
																 		else 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		{ 
															 | 
															
															 | 
															
																 		{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			_progress = lcd_selftest_screen(4 + _axis, _progress, 3, false, 0); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			_progress = lcd_selftest_screen(2 + _axis, _progress, 3, false, 0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			_lcd_refresh = 0; 
															 | 
															
															 | 
															
																 			_lcd_refresh = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -5953,7 +5954,7 @@ static bool lcd_selfcheck_axis(int _axis, int _travel) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		//delay(100); 
															 | 
															
															 | 
															
																 		//delay(100); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		(_travel_done <= _travel) ? _travel_done++ : _stepdone = true; 
															 | 
															
															 | 
															
																 		(_travel_done <= _travel) ? _travel_done++ : _stepdone = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} while (!_stepdone); 
															 | 
															
															 | 
															
																 	} while (!_stepdone); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -5983,7 +5984,6 @@ static bool lcd_selfcheck_axis(int _axis, int _travel) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	return _stepresult; 
															 | 
															
															 | 
															
																 	return _stepresult; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -5991,124 +5991,100 @@ static bool lcd_selfcheck_pulleys(int axis) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 { 
															 | 
															
															 | 
															
																 { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; 
															 | 
															
															 | 
															
																 	float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT; 
															 | 
															
															 | 
															
																 	float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	float current_position_init, current_position_final; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	float current_position_init; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	float move; 
															 | 
															
															 | 
															
																 	float move; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	bool endstop_triggered = false; 
															 | 
															
															 | 
															
																 	bool endstop_triggered = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	bool result = true; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	int i; 
															 | 
															
															 | 
															
																 	int i; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	unsigned long timeout_counter; 
															 | 
															
															 | 
															
																 	unsigned long timeout_counter; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	refresh_cmd_timeout(); 
															 | 
															
															 | 
															
																 	refresh_cmd_timeout(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	manage_inactivity(true); 
															 | 
															
															 | 
															
																 	manage_inactivity(true); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	if (axis == 0) move = 50; //X_AXIS  
															 | 
															
															 | 
															
																 	if (axis == 0) move = 50; //X_AXIS  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		else move = 50; //Y_AXIS 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	else move = 50; //Y_AXIS 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		//current_position_init = current_position[axis]; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		current_position_init = st_get_position_mm(axis); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		current_position[axis] += 5; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		for (i = 0; i < 5; i++) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			refresh_cmd_timeout(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			current_position[axis] = current_position[axis] + move; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			//digipot_current(0, 850); //set motor current higher 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], 200, active_extruder); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			st_synchronize(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			//if (SilentModeMenu == 1) digipot_current(0, tmp_motor[0]); //set back to normal operation currents 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			//else digipot_current(0, tmp_motor_loud[0]); //set motor current back			 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			current_position[axis] = current_position[axis] - move; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#ifdef TMC2130 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			tmc2130_home_enter(X_AXIS_MASK << axis); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#endif 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], 50, active_extruder); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			st_synchronize(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			if ((x_min_endstop) || (y_min_endstop)) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	current_position_init = current_position[axis]; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	current_position[axis] += 2; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	for (i = 0; i < 5; i++) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		refresh_cmd_timeout(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		current_position[axis] = current_position[axis] + move; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		digipot_current(0, 850); //set motor current higher 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], 200, active_extruder); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		st_synchronize(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if (SilentModeMenu == 1) digipot_current(0, tmp_motor[0]); //set back to normal operation currents 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		else digipot_current(0, tmp_motor_loud[0]); //set motor current back			 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		current_position[axis] = current_position[axis] - move; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], 50, active_extruder); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		st_synchronize(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			return(false); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	timeout_counter = millis() + 2500; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	endstop_triggered = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	manage_inactivity(true); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	while (!endstop_triggered) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			endstop_triggered = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			if (current_position_init - 1 <= current_position[axis] && current_position_init + 1 >= current_position[axis]) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				current_position[axis] += 15; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				st_synchronize(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				return(true); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 				lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); 
															 | 
															
															 | 
															
																 				lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 				return(false); 
															 | 
															
															 | 
															
																 				return(false); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			} 
															 | 
															
															 | 
															
																 			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#ifdef TMC2130 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			tmc2130_home_exit(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#endif 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		timeout_counter = millis() + 2500; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		endstop_triggered = false; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		manage_inactivity(true); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		while (!endstop_triggered) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			if ((x_min_endstop) || (y_min_endstop)) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#ifdef TMC2130 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				tmc2130_home_exit(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#endif 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				endstop_triggered = true; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				current_position_final = st_get_position_mm(axis); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				SERIAL_ECHOPGM("current_pos_init:"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				MYSERIAL.println(current_position_init); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				SERIAL_ECHOPGM("current_pos:"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				MYSERIAL.println(current_position_final); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			current_position[axis] -= 1; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			st_synchronize(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			if (millis() > timeout_counter) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 				lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); 
															 | 
															
															 | 
															
																 				lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				if (current_position_init - 1 <= current_position_final && current_position_init + 1 >= current_position_final) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-					current_position[axis] += 15; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-					plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-					st_synchronize(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-					return(true); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				} 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-					return(false); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				} 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			} 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#ifdef TMC2130 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				tmc2130_home_exit(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#endif 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				//current_position[axis] -= 1; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				current_position[axis] += 50; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				current_position[axis] -= 100; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#ifdef TMC2130 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				tmc2130_home_enter(X_AXIS_MASK << axis); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#endif 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				st_synchronize(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				if (millis() > timeout_counter) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-					lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-					return(false); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				} 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				return(false); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			} 
															 | 
															
															 | 
															
																 			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		}		 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	return(true); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 static bool lcd_selfcheck_endstops() 
															 | 
															
															 | 
															
																 static bool lcd_selfcheck_endstops() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-{/* 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	bool _result = true; 
															 | 
															
															 | 
															
																 	bool _result = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	if (x_min_endstop || y_min_endstop || READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) || 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	{ 
															 | 
															
															 | 
															
																 	{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		current_position[0] = (x_min_endstop) ? current_position[0] = current_position[0] + 10 : current_position[0]; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		current_position[1] = (y_min_endstop) ? current_position[1] = current_position[1] + 10 : current_position[1]; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		current_position[2] = (READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) ? current_position[2] = current_position[2] + 10 : current_position[2]; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) current_position[0] += 10; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) current_position[1] += 10; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) current_position[2] += 10; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[0] / 60, active_extruder); 
															 | 
															
															 | 
															
																 	plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[0] / 60, active_extruder); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	delay(500); 
															 | 
															
															 | 
															
																 	delay(500); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	if (x_min_endstop || y_min_endstop || READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) || 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	{ 
															 | 
															
															 | 
															
																 	{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		_result = false; 
															 | 
															
															 | 
															
																 		_result = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		char _error[4] = ""; 
															 | 
															
															 | 
															
																 		char _error[4] = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		if (x_min_endstop) strcat(_error, "X"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		if (y_min_endstop) strcat(_error, "Y"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		if (READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "Z"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "X"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Y"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Z"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		lcd_selftest_error(3, _error, ""); 
															 | 
															
															 | 
															
																 		lcd_selftest_error(3, _error, ""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	manage_heater(); 
															 | 
															
															 | 
															
																 	manage_heater(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	manage_inactivity(true); 
															 | 
															
															 | 
															
																 	manage_inactivity(true); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	return _result; 
															 | 
															
															 | 
															
																 	return _result; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	*/ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+#endif //not defined TMC2130 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 static bool lcd_selfcheck_check_heater(bool _isbed) 
															 | 
															
															 | 
															
																 static bool lcd_selfcheck_check_heater(bool _isbed) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 { 
															 | 
															
															 | 
															
																 { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -6321,7 +6297,7 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	 
															 | 
															
															 | 
															
																 	 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	switch (_fan) 
															 | 
															
															 | 
															
																 	switch (_fan) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	{ 
															 | 
															
															 | 
															
																 	{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	case 1: 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	case 0: 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		// extruder cooling fan 
															 | 
															
															 | 
															
																 		// extruder cooling fan 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		lcd.setCursor(0, 1);  
															 | 
															
															 | 
															
																 		lcd.setCursor(0, 1);  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		if(check_opposite == true) lcd_printPGM(MSG_SELFTEST_COOLING_FAN);  
															 | 
															
															 | 
															
																 		if(check_opposite == true) lcd_printPGM(MSG_SELFTEST_COOLING_FAN);  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -6329,7 +6305,7 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN); 
															 | 
															
															 | 
															
																 		SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		WRITE(EXTRUDER_0_AUTO_FAN_PIN, 1); 
															 | 
															
															 | 
															
																 		WRITE(EXTRUDER_0_AUTO_FAN_PIN, 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		break; 
															 | 
															
															 | 
															
																 		break; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	case 2: 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	case 1: 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		// object cooling fan 
															 | 
															
															 | 
															
																 		// object cooling fan 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		lcd.setCursor(0, 1); 
															 | 
															
															 | 
															
																 		lcd.setCursor(0, 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		if (check_opposite == true) lcd_printPGM(MSG_SELFTEST_EXTRUDER_FAN); 
															 | 
															
															 | 
															
																 		if (check_opposite == true) lcd_printPGM(MSG_SELFTEST_EXTRUDER_FAN); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -6350,12 +6326,12 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	{ 
															 | 
															
															 | 
															
																 	{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		switch (_fan) 
															 | 
															
															 | 
															
																 		switch (_fan) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		{ 
															 | 
															
															 | 
															
																 		{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		case 1: 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		case 0: 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			// extruder cooling fan 
															 | 
															
															 | 
															
																 			// extruder cooling fan 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN); 
															 | 
															
															 | 
															
																 			SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			WRITE(EXTRUDER_0_AUTO_FAN_PIN, 1); 
															 | 
															
															 | 
															
																 			WRITE(EXTRUDER_0_AUTO_FAN_PIN, 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			break; 
															 | 
															
															 | 
															
																 			break; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		case 2: 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		case 1: 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			// object cooling fan 
															 | 
															
															 | 
															
																 			// object cooling fan 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			SET_OUTPUT(FAN_PIN); 
															 | 
															
															 | 
															
																 			SET_OUTPUT(FAN_PIN); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			analogWrite(FAN_PIN, 255); 
															 | 
															
															 | 
															
																 			analogWrite(FAN_PIN, 255); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -6440,9 +6416,9 @@ static bool lcd_selftest_fan_dialog(int _fan) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		else if (fan_speed[1] < 34) { //fan is spinning, but measured RPM are too low for print fan, it must be left extruder fan 
															 | 
															
															 | 
															
																 		else if (fan_speed[1] < 34) { //fan is spinning, but measured RPM are too low for print fan, it must be left extruder fan 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			//check fans manually 
															 | 
															
															 | 
															
																 			//check fans manually 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			_result = lcd_selftest_manual_fan_check(2, true); //turn on print fan and check that left extruder fan is not spinning 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			_result = lcd_selftest_manual_fan_check(1, true); //turn on print fan and check that left extruder fan is not spinning 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			if (_result) { 
															 | 
															
															 | 
															
																 			if (_result) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-				_result = lcd_selftest_manual_fan_check(2, false); //print fan is stil turned on; check that it is spinning 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				_result = lcd_selftest_manual_fan_check(1, false); //print fan is stil turned on; check that it is spinning 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 				if (!_result) _errno = 6; //print fan not spinning 
															 | 
															
															 | 
															
																 				if (!_result) _errno = 6; //print fan not spinning 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			} 
															 | 
															
															 | 
															
																 			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			else { 
															 | 
															
															 | 
															
																 			else { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -6466,8 +6442,6 @@ static bool lcd_selftest_fan_dialog(int _fan) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bool _clear, int _delay) 
															 | 
															
															 | 
															
																 static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bool _clear, int _delay) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 { 
															 | 
															
															 | 
															
																 { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	//SERIAL_ECHOPGM("Step:"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	//MYSERIAL.println(_step); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	lcd_next_update_millis = millis() + (LCD_UPDATE_INTERVAL * 10000); 
															 | 
															
															 | 
															
																 	lcd_next_update_millis = millis() + (LCD_UPDATE_INTERVAL * 10000); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 |