| 
					
				 | 
			
			
				@@ -202,8 +202,6 @@ int bowden_length[4] = {385, 385, 385, 385}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 bool is_usb_printing = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 bool homing_flag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-bool temp_cal_active = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 unsigned long kicktime = _millis()+100000; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 unsigned int  usb_printing_counter; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -650,6 +648,12 @@ void failstats_reset_print() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void softReset() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    cli(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    wdt_enable(WDTO_15MS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    while(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef MESH_BED_LEVELING 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -764,6 +768,7 @@ static void factory_reset(char level) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			softReset(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			break; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1014,11 +1019,19 @@ void setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	lcd_splash(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     Sound_Init();                                // also guarantee "SET_OUTPUT(BEEPER)" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	selectedSerialPort = eeprom_read_byte((uint8_t *)EEPROM_SECOND_SERIAL_ACTIVE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if (selectedSerialPort == 0xFF) selectedSerialPort = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	eeprom_update_byte((uint8_t *)EEPROM_SECOND_SERIAL_ACTIVE, selectedSerialPort); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	MYSERIAL.begin(BAUDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	stdout = uartout; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef W25X20CL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     bool w25x20cl_success = w25x20cl_init(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint8_t optiboot_status = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if (w25x20cl_success) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	    optiboot_w25x20cl_enter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		optiboot_status = optiboot_w25x20cl_enter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #if (LANG_MODE != 0) //secondary language support 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         update_sec_lang_from_external_flash(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //(LANG_MODE != 0) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1040,15 +1053,13 @@ void setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if ((farm_mode == 0xFF && farm_no == 0) || ((uint16_t)farm_no == 0xFFFF))  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if ((uint16_t)farm_no == 0xFFFF) farm_no = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	selectedSerialPort = eeprom_read_byte((uint8_t*)EEPROM_SECOND_SERIAL_ACTIVE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if (selectedSerialPort == 0xFF) selectedSerialPort = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if (farm_mode) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		no_response = true; //we need confirmation by recieving PRUSA thx 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		important_status = 8; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		prusa_statistics(8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		selectedSerialPort = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		MYSERIAL.begin(BAUDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//increased extruder current (PFW363) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		tmc2130_current_h[E_AXIS] = 36; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1062,12 +1073,12 @@ void setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if(!(eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED,true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	MYSERIAL.begin(BAUDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifndef W25X20CL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	SERIAL_PROTOCOLLNPGM("start"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#endif //W25X20CL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	stdout = uartout; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if ((optiboot_status != 0) || (selectedSerialPort != 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SERIAL_PROTOCOLLNPGM("start"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	SERIAL_ECHO_START; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	printf_P(PSTR(" " FW_VERSION_FULL "\n")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1246,6 +1257,13 @@ void setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	    w25x20cl_err_msg(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	    printf_P(_n("W25X20CL not responding.\n")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#ifdef EXTRUDER_ALTFAN_DETECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	SERIAL_ECHORPGM(_n("Extruder fan type: ")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if (extruder_altfan_detect()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SERIAL_ECHOLNRPGM(PSTR("ALTFAN")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SERIAL_ECHOLNRPGM(PSTR("NOCTUA")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#endif //EXTRUDER_ALTFAN_DETECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	plan_init();  // Initialize planner; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1332,8 +1350,7 @@ void setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // Initialize current_position accounting for software endstops to 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // avoid unexpected initial shifts on the first move 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     clamp_to_software_endstops(current_position); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                      current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef FILAMENT_SENSOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	fsensor_init(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1453,8 +1470,7 @@ void setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if (eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE) == 255) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		temp_cal_active = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	} else temp_cal_active = eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if (eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA) == 255) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1462,7 +1478,6 @@ void setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		int16_t z_shift = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		for (uint8_t i = 0; i < 5; i++) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		temp_cal_active = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 255) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		eeprom_write_byte((uint8_t*)EEPROM_UVLO, 0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1535,7 +1550,7 @@ void setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  lcd_show_fullscreen_message_and_wait_P(_T(MSG_BABYSTEP_Z_NOT_SET)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  lcd_update_enable(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	  else if (calibration_status() == CALIBRATION_STATUS_CALIBRATED && temp_cal_active == true && calibration_status_pinda() == false) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	  else if (calibration_status() == CALIBRATION_STATUS_CALIBRATED && eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE) && calibration_status_pinda() == false) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  //lcd_show_fullscreen_message_and_wait_P(_i("Temperature calibration has not been run yet"));////MSG_PINDA_NOT_CALIBRATED c=20 r=4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  lcd_update_enable(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	  } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1948,7 +1963,7 @@ static void set_bed_level_equation_lsq(double *plane_equation_coefficients) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // put the bed at 0 so we don't go below it. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[Z_AXIS] = cs.zprobe_zoffset; // in the lsq we reach here after raising the extruder due to the loop structure 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else // not AUTO_BED_LEVELING_GRID 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1976,7 +1991,7 @@ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // put the bed at 0 so we don't go below it. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[Z_AXIS] = cs.zprobe_zoffset; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2008,7 +2023,7 @@ static void run_z_probe() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[Z_AXIS] = st_get_position_mm(Z_AXIS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // make sure the planner knows where we are as it may be a bit different than we last said to move to 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 static void do_blocking_move_to(float x, float y, float z) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2129,7 +2144,7 @@ void raise_z_above(float target, bool plan) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (axis_known_position[Z_AXIS] || z_min_endstop) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // current position is known or very low, it's safe to raise Z 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(plan) plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS], active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(plan) plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2142,15 +2157,14 @@ void raise_z_above(float target, bool plan) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     tmc2130_home_enter(Z_AXIS_MASK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (endstop_z_hit_on_purpose()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // not necessarily exact, but will avoid further vertical moves 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[Z_AXIS] = max_pos[Z_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                          current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     tmc2130_home_exit(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //TMC2130 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2168,22 +2182,22 @@ bool calibrate_z_auto() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	int axis_up_dir = -home_dir(Z_AXIS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	tmc2130_home_enter(Z_AXIS_MASK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	current_position[Z_AXIS] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	set_destination_to_current(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	destination[Z_AXIS] += (1.1 * max_length(Z_AXIS) * axis_up_dir); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	feedrate = homing_feedrate[Z_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_buffer_line_destinationXYZE(feedrate / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//	current_position[axis] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	//	plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//	plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	tmc2130_home_exit(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	enable_endstops(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	current_position[Z_AXIS] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	set_destination_to_current(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	destination[Z_AXIS] += 10 * axis_up_dir; //10mm up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	feedrate = homing_feedrate[Z_AXIS] / 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_buffer_line_destinationXYZE(feedrate / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	enable_endstops(endstops_enabled); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if (PRINTER_TYPE == PRINTER_MK3) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2192,7 +2206,7 @@ bool calibrate_z_auto() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[Z_AXIS] = Z_MAX_POS + 9.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //TMC2130 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2203,9 +2217,9 @@ static void check_Z_crash(void) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if (READ(Z_TMC2130_DIAG) != 0) { //Z crash 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		FORCE_HIGH_POWER_END; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[Z_AXIS] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[Z_AXIS] += MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS], active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2235,24 +2249,24 @@ void homeaxis(int axis, uint8_t cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // and the following movement to endstop has a chance to achieve the required velocity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // for the stall guard to work. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[axis] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		set_destination_to_current(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        destination[axis] = 11.f; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[axis] = -3.f * axis_home_dir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // Move away from the possible collision with opposite endstop with the collision detection disabled. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         endstops_hit_on_purpose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         enable_endstops(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[axis] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[axis] = 1. * axis_home_dir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // Now continue to move up to the left end stop with the collision detection enabled. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         enable_endstops(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[axis] = 1.1 * axis_home_dir * max_length(axis); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		for (uint8_t i = 0; i < cnt; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2260,9 +2274,9 @@ void homeaxis(int axis, uint8_t cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			endstops_hit_on_purpose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			enable_endstops(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[axis] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			destination[axis] = -10.f * axis_home_dir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			endstops_hit_on_purpose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// Now move left up to the collision, this time with a repeatable velocity. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2273,7 +2287,7 @@ void homeaxis(int axis, uint8_t cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else //TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			feedrate = homing_feedrate[axis] / 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			uint16_t mscnt = tmc2130_rd_MSCNT(axis); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2307,10 +2321,10 @@ void homeaxis(int axis, uint8_t cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         float dist = - axis_home_dir * 0.01f * 64; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[axis] -= dist; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[axis] += dist; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[axis] = current_position[axis]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], 0.5f*feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_destinationXYZE(0.5f*feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    		feedrate = 0.0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2322,22 +2336,22 @@ void homeaxis(int axis, uint8_t cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int axis_home_dir = home_dir(axis); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[axis] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[axis] = 1.5 * max_length(axis) * axis_home_dir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         feedrate = homing_feedrate[axis]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         check_Z_crash(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[axis] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[axis] = -home_retract_mm(axis) * axis_home_dir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[axis] = 2*home_retract_mm(axis) * axis_home_dir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         feedrate = homing_feedrate[axis]/2 ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         check_Z_crash(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2360,7 +2374,7 @@ void home_xy() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     set_destination_to_current(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     homeaxis(X_AXIS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     homeaxis(Y_AXIS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     endstops_hit_on_purpose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2383,7 +2397,7 @@ void refresh_cmd_timeout(void) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       retracted[active_extruder]=true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       prepare_move(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       current_position[Z_AXIS]-=cs.retract_zlift; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       prepare_move(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       feedrate = oldFeedrate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else if(!retracting && retracted[active_extruder]) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2392,7 +2406,7 @@ void refresh_cmd_timeout(void) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       destination[Z_AXIS]=current_position[Z_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       destination[E_AXIS]=current_position[E_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       current_position[Z_AXIS]+=cs.retract_zlift; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       current_position[E_AXIS]-=(swapretract?(retract_length_swap+retract_recover_length_swap):(cs.retract_length+cs.retract_recover_length))*float(extrudemultiply)*0.01f; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       plan_set_e_position(current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       float oldFeedrate = feedrate; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2595,7 +2609,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int x_axis_home_dir = home_dir(X_AXIS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         feedrate = homing_feedrate[X_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(homing_feedrate[Y_AXIS]<feedrate) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2605,15 +2619,15 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           feedrate *= sqrt(pow(max_length(X_AXIS) / max_length(Y_AXIS), 2) + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         axis_is_at_home(X_AXIS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         axis_is_at_home(Y_AXIS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[X_AXIS] = current_position[X_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         destination[Y_AXIS] = current_position[Y_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         feedrate = 0.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         endstops_hit_on_purpose(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2677,14 +2691,14 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               MYSERIAL.println(current_position[X_AXIS]);MYSERIAL.println(current_position[Y_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               MYSERIAL.println(current_position[Z_AXIS]);MYSERIAL.println(current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef DEBUG_BUILD 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               SERIAL_ECHOLNPGM("plan_buffer_line()"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               MYSERIAL.println(destination[X_AXIS]);MYSERIAL.println(destination[Y_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               MYSERIAL.println(destination[Z_AXIS]);MYSERIAL.println(destination[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               MYSERIAL.println(feedrate);MYSERIAL.println(active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              plan_buffer_line_destinationXYZE(feedrate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               current_position[X_AXIS] = destination[X_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               current_position[Y_AXIS] = destination[Y_AXIS]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2703,8 +2717,8 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             feedrate = XY_TRAVEL_SPEED/60; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             current_position[Z_AXIS] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_destinationXYZE(feedrate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             current_position[X_AXIS] = destination[X_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             current_position[Y_AXIS] = destination[Y_AXIS]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2720,10 +2734,10 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               && (current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER <= Y_MAX_POS)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               current_position[Z_AXIS] = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1);    // Set destination away from bed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               feedrate = max_feedrate[Z_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              plan_buffer_line_destinationXYZE(feedrate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               homeaxis(Z_AXIS); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2750,7 +2764,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // Set the planner and stepper routine positions. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // At this point the mesh bed leveling and world2machine corrections are disabled and current_position 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // contains the machine coordinates. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       #ifdef ENDSTOPS_ONLY_FOR_HOMING 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         enable_endstops(false); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2862,7 +2876,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	enable_endstops(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	current_position[X_AXIS] += 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	current_position[Y_AXIS] += 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// Let the user move the Z axes up to the end stoppers. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2912,7 +2926,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		bool endstops_enabled  = enable_endstops(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[Z_AXIS] -= 1; //move 1mm down with disabled endstop 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// Move the print head close to the bed. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2923,7 +2937,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		tmc2130_home_enter(Z_AXIS_MASK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef TMC2130 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2964,7 +2978,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				clean_up_after_endstop_move(l_feedmultiply); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				// Print head up. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //#ifndef NEW_XYZCAL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if (result >= 0) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2984,7 +2998,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					clean_up_after_endstop_move(l_feedmultiply); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					// Print head up. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					// if (result >= 0) babystep_apply();					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					#endif //HEATBED_V2 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3097,18 +3111,18 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //Retract E 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[E_AXIS] += e_shift; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_buffer_line_curposXYZE(FILAMENTCHANGE_RFEED, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_buffer_line_curposXYZE(FILAMENTCHANGE_RFEED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //Lift Z 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[Z_AXIS] += z_shift; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_buffer_line_curposXYZE(FILAMENTCHANGE_ZFEED, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_buffer_line_curposXYZE(FILAMENTCHANGE_ZFEED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //Move XY to side 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[X_AXIS] = x_position; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[Y_AXIS] = y_position; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //Beep, manage nozzle heater and wait for user to start unload filament 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3133,7 +3147,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			lcd_set_cursor(0, 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			lcd_puts_P(_T(MSG_PLEASE_WAIT)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[X_AXIS] -= 100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			lcd_show_fullscreen_message_and_wait_P(_i("Please open idler and remove filament manually."));////MSG_CHECK_IDLER c=20 r=4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3170,7 +3184,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (!automatic) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[E_AXIS] += FILAMENTCHANGE_RECFEED; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line_curposXYZE(FILAMENTCHANGE_EXFEED, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_curposXYZE(FILAMENTCHANGE_EXFEED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //Move XY back 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3228,12 +3242,12 @@ void gcode_M701() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[E_AXIS] += 40; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(400 / 60, active_extruder); //fast sequence 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(400 / 60); //fast sequence 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         raise_z_above(MIN_Z_FOR_LOAD, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[E_AXIS] += 30; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(400 / 60, active_extruder); //fast sequence 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(400 / 60); //fast sequence 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		load_filament_final_feed(); //slow sequence 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		st_synchronize(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3399,8 +3413,7 @@ static void gcode_G92() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             current_position[E_AXIS] = values[E_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // Set all at once 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                          current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3807,9 +3820,7 @@ void process_commands() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #if (defined(WATCHDOG) && (MOTHERBOARD == BOARD_EINSY_1_0a)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 boot_app_magic = BOOT_APP_MAGIC; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 boot_app_flags = BOOT_APP_FLG_RUN; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				wdt_enable(WDTO_15MS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				cli(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				while(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                softReset(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else //WATCHDOG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 asm volatile("jmp 0x3E000"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //WATCHDOG 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4353,7 +4364,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             current_position[X_AXIS] = uncorrected_position.x; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             current_position[Y_AXIS] = uncorrected_position.y; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             current_position[Z_AXIS] = uncorrected_position.z; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int l_feedmultiply = setup_for_endstop_move(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             feedrate = homing_feedrate[Z_AXIS]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4467,7 +4478,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp);         //Apply the correction sending the probe offset 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS];   //The difference is added to current position and sent to planner. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifndef Z_PROBE_SLED 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4555,11 +4566,15 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /*! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ### G76 - PINDA probe temperature calibration <a href="https://reprap.org/wiki/G-code#G76:_PINDA_probe_temperature_calibration">G76: PINDA probe temperature calibration</a> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   This G-code is used to calibrate the temperature drift of the PINDA (inductive Sensor). 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   The PINDAv2 sensor has a built-in thermistor which has the advantage that the calibration can be done once for all materials. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   The Original i3 Prusa MK2/s uses PINDAv1 and this calibration improves the temperature drift, but not as good as the PINDAv2. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  superPINDA sensor has internal temperature compensation and no thermistor output. There is no point of doing temperature calibration in such case. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  If PINDA_THERMISTOR and DETECT_SUPERPINDA is defined during compilation, calibration is skipped with serial message "No PINDA thermistor". 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  This can be caused also if PINDA thermistor connection is broken or PINDA temperature is lower than PINDA_MINTEMP. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   #### Example 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ``` 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4574,154 +4589,155 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   case 76:  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef PINDA_THERMISTOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if (true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!has_temperature_compensation()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SERIAL_ECHOLNPGM("No PINDA thermistor"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if (calibration_status() >= CALIBRATION_STATUS_XYZ_CALIBRATION) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				//we need to know accurate position of first calibration point 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				//if xyz calibration was not performed yet, interrupt temperature calibration and inform user that xyz cal. is needed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				lcd_show_fullscreen_message_and_wait_P(_i("Please run XYZ calibration first.")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// We don't know where we are! HOME! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// Push the commands to the front of the message queue in the reverse order! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// There shall be always enough space reserved for these commands. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				repeatcommand_front(); // repeat G76 with all its parameters 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				enquecommand_front_P((PSTR("G28 W0"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			lcd_show_fullscreen_message_and_wait_P(_i("Stable ambient temperature 21-26C is needed a rigid stand is required."));////MSG_TEMP_CAL_WARNING c=20 r=4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_STEEL_SHEET_CHECK), false, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if (result) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Z_AXIS] = 50; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Y_AXIS] = 180; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				lcd_show_fullscreen_message_and_wait_P(_T(MSG_REMOVE_STEEL_SHEET)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[X_AXIS] = pgm_read_float(bed_ref_points_4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				gcode_G28(false, false, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (calibration_status() >= CALIBRATION_STATUS_XYZ_CALIBRATION) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //we need to know accurate position of first calibration point 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //if xyz calibration was not performed yet, interrupt temperature calibration and inform user that xyz cal. is needed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lcd_show_fullscreen_message_and_wait_P(_i("Please run XYZ calibration first.")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if ((current_temperature_pinda > 35) && (farm_mode == false)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				//waiting for PIDNA probe to cool down in case that we are not in farm mode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Z_AXIS] = 100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				if (lcd_wait_for_pinda(35) == false) { //waiting for PINDA probe to cool, if this takes more then time expected, temp. cal. fails 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					lcd_temp_cal_show_result(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			lcd_update_enable(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			SERIAL_ECHOLNPGM("PINDA probe calibration start"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // We don't know where we are! HOME! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // Push the commands to the front of the message queue in the reverse order! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // There shall be always enough space reserved for these commands. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            repeatcommand_front(); // repeat G76 with all its parameters 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            enquecommand_front_P((PSTR("G28 W0"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        lcd_show_fullscreen_message_and_wait_P(_i("Stable ambient temperature 21-26C is needed a rigid stand is required."));////MSG_TEMP_CAL_WARNING c=20 r=4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_STEEL_SHEET_CHECK), false, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (result) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Z_AXIS] = 50; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Y_AXIS] = 180; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lcd_show_fullscreen_message_and_wait_P(_T(MSG_REMOVE_STEEL_SHEET)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[X_AXIS] = pgm_read_float(bed_ref_points_4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            gcode_G28(false, false, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ((current_temperature_pinda > 35) && (farm_mode == false)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //waiting for PIDNA probe to cool down in case that we are not in farm mode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Z_AXIS] = 100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (lcd_wait_for_pinda(35) == false) { //waiting for PINDA probe to cool, if this takes more then time expected, temp. cal. fails 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lcd_temp_cal_show_result(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        lcd_update_enable(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SERIAL_ECHOLNPGM("PINDA probe calibration start"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			float zero_z; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			int z_shift = 0; //unit: steps 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			float start_temp = 5 * (int)(current_temperature_pinda / 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if (start_temp < 35) start_temp = 35; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if (start_temp < current_temperature_pinda) start_temp += 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			printf_P(_N("start temperature: %.1f\n"), start_temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        float zero_z; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int z_shift = 0; //unit: steps 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        float start_temp = 5 * (int)(current_temperature_pinda / 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (start_temp < 35) start_temp = 35; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (start_temp < current_temperature_pinda) start_temp += 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        printf_P(_N("start temperature: %.1f\n"), start_temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //			setTargetHotend(200, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			setTargetBed(70 + (start_temp - 30)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        setTargetBed(70 + (start_temp - 30)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			custom_message_type = CustomMsg::TempCal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			custom_message_state = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			current_position[X_AXIS] = PINDA_PREHEAT_X; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			current_position[Y_AXIS] = PINDA_PREHEAT_Y; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			current_position[Z_AXIS] = PINDA_PREHEAT_Z; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        custom_message_type = CustomMsg::TempCal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        custom_message_state = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        current_position[X_AXIS] = PINDA_PREHEAT_X; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        current_position[Y_AXIS] = PINDA_PREHEAT_Y; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        current_position[Z_AXIS] = PINDA_PREHEAT_Z; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			while (current_temperature_pinda < start_temp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				delay_keep_alive(1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				serialecho_temperatures(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        while (current_temperature_pinda < start_temp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            delay_keep_alive(1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            serialecho_temperatures(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0); //invalidate temp. calibration in case that in will be aborted during the calibration process  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0); //invalidate temp. calibration in case that in will be aborted during the calibration process 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			current_position[X_AXIS] = pgm_read_float(bed_ref_points_4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        current_position[X_AXIS] = pgm_read_float(bed_ref_points_4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			bool find_z_result = find_bed_induction_sensor_point_z(-1.f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if (find_z_result == false) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				lcd_temp_cal_show_result(find_z_result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			zero_z = current_position[Z_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        bool find_z_result = find_bed_induction_sensor_point_z(-1.f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (find_z_result == false) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lcd_temp_cal_show_result(find_z_result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        zero_z = current_position[Z_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			printf_P(_N("\nZERO: %.3f\n"), current_position[Z_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        printf_P(_N("\nZERO: %.3f\n"), current_position[Z_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			int i = -1; for (; i < 5; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				float temp = (40 + i * 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				printf_P(_N("\nStep: %d/6 (skipped)\nPINDA temperature: %d Z shift (mm):0\n"), i + 2, (40 + i*5)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				if (i >= 0) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				if (start_temp <= temp) break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int i = -1; for (; i < 5; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            float temp = (40 + i * 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            printf_P(_N("\nStep: %d/6 (skipped)\nPINDA temperature: %d Z shift (mm):0\n"), i + 2, (40 + i*5)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (i >= 0) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (start_temp <= temp) break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			for (i++; i < 5; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				float temp = (40 + i * 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				printf_P(_N("\nStep: %d/6\n"), i + 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				custom_message_state = i + 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				setTargetBed(50 + 10 * (temp - 30) / 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (i++; i < 5; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            float temp = (40 + i * 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            printf_P(_N("\nStep: %d/6\n"), i + 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            custom_message_state = i + 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setTargetBed(50 + 10 * (temp - 30) / 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //				setTargetHotend(255, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[X_AXIS] = PINDA_PREHEAT_X; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Y_AXIS] = PINDA_PREHEAT_Y; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Z_AXIS] = PINDA_PREHEAT_Z; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				while (current_temperature_pinda < temp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					delay_keep_alive(1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					serialecho_temperatures(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[X_AXIS] = pgm_read_float(bed_ref_points_4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				find_z_result = find_bed_induction_sensor_point_z(-1.f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				if (find_z_result == false) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					lcd_temp_cal_show_result(find_z_result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_unit[Z_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[X_AXIS] = PINDA_PREHEAT_X; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Y_AXIS] = PINDA_PREHEAT_Y; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Z_AXIS] = PINDA_PREHEAT_Z; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            while (current_temperature_pinda < temp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                delay_keep_alive(1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                serialecho_temperatures(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[X_AXIS] = pgm_read_float(bed_ref_points_4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            find_z_result = find_bed_induction_sensor_point_z(-1.f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (find_z_result == false) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lcd_temp_cal_show_result(find_z_result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_unit[Z_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				printf_P(_N("\nPINDA temperature: %.1f Z shift (mm): %.3f"), current_temperature_pinda, current_position[Z_AXIS] - zero_z); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            printf_P(_N("\nPINDA temperature: %.1f Z shift (mm): %.3f"), current_temperature_pinda, current_position[Z_AXIS] - zero_z); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			lcd_temp_cal_show_result(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        lcd_temp_cal_show_result(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#endif //PINDA_THERMISTOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#else //PINDA_THERMISTOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		setTargetBed(PINDA_MIN_T); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		float zero_z; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4743,7 +4759,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[X_AXIS] = PINDA_PREHEAT_X; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[Y_AXIS] = PINDA_PREHEAT_Y; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[Z_AXIS] = PINDA_PREHEAT_Z; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		while (abs(degBed() - PINDA_MIN_T) > 1) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4759,11 +4775,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0); //invalidate temp. calibration in case that in will be aborted during the calibration process  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[Z_AXIS] = 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[X_AXIS] = BED_X0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[Y_AXIS] = BED_Y0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		find_bed_induction_sensor_point_z(-1.f); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4780,7 +4796,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[X_AXIS] = PINDA_PREHEAT_X; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[Y_AXIS] = PINDA_PREHEAT_Y; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[Z_AXIS] = PINDA_PREHEAT_Z; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			while (degBed() < t_c) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				delay_keep_alive(1000); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4791,10 +4807,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				serialecho_temperatures(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[Z_AXIS] = 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[X_AXIS] = BED_X0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[Y_AXIS] = BED_Y0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(3000 / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_buffer_line_curposXYZE(3000 / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			find_bed_induction_sensor_point_z(-1.f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			z_shift = (int)((current_position[Z_AXIS] - zero_z)*cs.axis_steps_per_unit[Z_AXIS]); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4817,13 +4833,12 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			disable_e2(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			setTargetBed(0); //set bed target temperature back to 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		lcd_show_fullscreen_message_and_wait_P(_T(MSG_TEMP_CALIBRATION_DONE)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		temp_cal_active = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		lcd_update_enable(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		lcd_update(2);		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#endif //PINDA_THERMISTOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4937,7 +4952,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// Cycle through all points and probe them 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// First move up. During this first movement, the babystepping will be reverted. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// The move to the first calibration point. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[X_AXIS] = BED_X0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[Y_AXIS] = BED_Y0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4952,7 +4967,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		#endif //SUPPORT_VERBOSITY 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(homing_feedrate[X_AXIS] / 30, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(homing_feedrate[X_AXIS] / 30); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// Wait until the move is finished. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4967,7 +4982,6 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		#endif // SUPPORT_VERBOSITY 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		int l_feedmultiply = setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		const char *kill_message = NULL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		while (mesh_point != nMeasPoints * nMeasPoints) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// Get coords of a measuring point. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			uint8_t ix = mesh_point % nMeasPoints; // from 0 to MESH_NUM_X_POINTS - 1 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5004,7 +5018,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if((ix == 0) && (iy == 0)) current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			else current_position[Z_AXIS] += 2.f / nMeasPoints; //use relative movement from Z coordinate where PINDa triggered on previous point. This makes calibration faster. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			float init_z_bckp = current_position[Z_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// Move to XY position of the sensor point. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5025,7 +5039,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			#endif // SUPPORT_VERBOSITY 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//printf_P(PSTR("after clamping: [%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(XY_AXIS_FEEDRATE, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_buffer_line_curposXYZE(XY_AXIS_FEEDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// Go down until endstop is hit 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5037,7 +5051,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if (init_z_bckp - current_position[Z_AXIS] < 0.1f) { //broken cable or initial Z coordinate too low. Go to MESH_HOME_Z_SEARCH and repeat last step (z-probe) again to distinguish between these two cases. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				//printf_P(PSTR("Another attempt! Current Z position: %f\n"), current_position[Z_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point   
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5092,7 +5106,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			MYSERIAL.print(current_position[Z_AXIS], 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		#endif // SUPPORT_VERBOSITY 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (mesh_point != nMeasPoints * nMeasPoints) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Sound_MakeSound(e_SOUND_TYPE_StandardAlert); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5109,14 +5123,14 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // ~ Z-homing (can not be used "G28", because X & Y-homing would have been done before (Z-homing)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     bState=enable_z_endstop(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     current_position[Z_AXIS] -= 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     enable_z_endstop(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     tmc2130_home_enter(Z_AXIS_MASK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif // TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 40); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     tmc2130_home_exit(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5244,9 +5258,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		go_home_with_z_lift(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //		SERIAL_ECHOLNPGM("Go home finished"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//unretract (after PINDA preheat retraction) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if (degHotend(active_extruder) > EXTRUDE_MINTEMP && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ((degHotend(active_extruder) > EXTRUDE_MINTEMP) && eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE) && calibration_status_pinda() && (target_temperature_bed >= 50)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[E_AXIS] += default_retraction; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			plan_buffer_line_curposXYZE(400, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			plan_buffer_line_curposXYZE(400); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		KEEPALIVE_STATE(NOT_BUSY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// Restore custom message state 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5268,7 +5282,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (mbl.active) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 SERIAL_PROTOCOLPGM("Num X,Y: "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 SERIAL_PROTOCOL(MESH_NUM_X_POINTS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                SERIAL_PROTOCOLPGM(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SERIAL_PROTOCOL(','); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 SERIAL_PROTOCOL(MESH_NUM_Y_POINTS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 SERIAL_PROTOCOLPGM("\nZ search height: "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 SERIAL_PROTOCOL(MESH_HOME_Z_SEARCH); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5278,7 +5292,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         SERIAL_PROTOCOLPGM("  "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         SERIAL_PROTOCOL_F(mbl.z_values[y][x], 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    SERIAL_PROTOCOLPGM("\n"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    SERIAL_PROTOCOLLN(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             else 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6288,7 +6302,7 @@ Sigma_Exit: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           SERIAL_PROTOCOLPGM(" T"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           SERIAL_PROTOCOL(cur_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          SERIAL_PROTOCOLPGM(":"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          SERIAL_PROTOCOL(':'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           SERIAL_PROTOCOL_F(degHotend(cur_extruder),1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           SERIAL_PROTOCOLPGM(" /"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           SERIAL_PROTOCOL_F(degTargetHotend(cur_extruder),1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -7973,9 +7987,8 @@ Sigma_Exit: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				SERIAL_PROTOCOLPGM("P:"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				SERIAL_PROTOCOL_F(current_temperature_pinda, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				SERIAL_PROTOCOLPGM("/"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				SERIAL_PROTOCOL(set_target_pinda); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				SERIAL_PROTOCOLLN(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				SERIAL_PROTOCOL('/'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				SERIAL_PROTOCOLLN(set_target_pinda); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				codenum = _millis(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			manage_heater(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -8564,7 +8577,7 @@ Sigma_Exit: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /*! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	### M999 - Restart after being stopped <a href="https://reprap.org/wiki/G-code#M999:_Restart_after_being_stopped_by_error">M999: Restart after being stopped by error</a> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ### M999 - Restart after being stopped <a href="https://reprap.org/wiki/G-code#M999:_Restart_after_being_stopped_by_error">M999: Restart after being stopped by error</a> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @todo Usually doesn't work. Should be fixed or removed. Most of the time, if `Stopped` it set, the print fails and is unrecoverable. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     case 999: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -8724,7 +8737,7 @@ Sigma_Exit: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else //SNMM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               if (tmp_extruder >= EXTRUDERS) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   SERIAL_ECHO_START; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  SERIAL_ECHOPGM("T"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  SERIAL_ECHO('T'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   SERIAL_PROTOCOLLN((int)tmp_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   SERIAL_ECHOLNRPGM(_n("Invalid extruder"));////MSG_INVALID_EXTRUDER 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -8754,7 +8767,7 @@ Sigma_Exit: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       // Set the new active extruder and position 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       active_extruder = tmp_extruder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       // Move to the old position if 'F' was in the parameters 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       if (make_move && Stopped == false) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                           prepare_move(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9304,13 +9317,13 @@ void prepare_move() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // Do not use feedmultiply for E or Z only moves 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      plan_buffer_line_destinationXYZE(feedrate/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef MESH_BED_LEVELING 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply*(1./(60.f*100.f)), active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply*(1./(60.f*100.f)), active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     plan_buffer_line_destinationXYZE(feedrate*feedmultiply*(1./(60.f*100.f))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9444,7 +9457,32 @@ static void handleSafetyTimer() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif //SAFETYTIMER 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#define FS_CHECK_COUNT 250 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#ifdef IR_SENSOR_ANALOG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define FS_CHECK_COUNT 16 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// Switching mechanism of the fsensor type. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// Called from 2 spots which have a very similar behavior 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// 1: ClFsensorPCB::_Old -> ClFsensorPCB::_Rev04 and print _i("FS v0.4 or newer") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/// 2: ClFsensorPCB::_Rev04 -> oFsensorPCB=ClFsensorPCB::_Old and print _i("FS v0.3 or older") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void manage_inactivity_IR_ANALOG_Check(uint16_t &nFSCheckCount, ClFsensorPCB isVersion, ClFsensorPCB switchTo, const char *statusLineTxt_P) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    bool bTemp = (!CHECK_ALL_HEATERS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    bTemp = bTemp && (menu_menu == lcd_status_screen); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    bTemp = bTemp && ((oFsensorPCB == isVersion) || (oFsensorPCB == ClFsensorPCB::_Undef)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    bTemp = bTemp && fsensor_enabled; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (bTemp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        nFSCheckCount++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (nFSCheckCount > FS_CHECK_COUNT) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            nFSCheckCount = 0; // not necessary 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            oFsensorPCB = switchTo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            eeprom_update_byte((uint8_t *)EEPROM_FSENSOR_PCB, (uint8_t)oFsensorPCB); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            printf_IRSensorAnalogBoardChange(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lcd_setstatuspgm(statusLineTxt_P); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        nFSCheckCount = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef FILAMENT_SENSOR 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9457,15 +9495,15 @@ static uint16_t nFSCheckCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //-//		if (mcode_in_progress != 600) //M600 not in progress 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef PAT9125 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          bInhibitFlag=(menu_menu==lcd_menu_extruder_info); // Support::ExtruderInfo menu active 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		bInhibitFlag=(menu_menu==lcd_menu_extruder_info); // Support::ExtruderInfo menu active 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif // PAT9125 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef IR_SENSOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef IR_SENSOR_ANALOG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Settings::HWsetup::FSdetect menu active 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Settings::HWsetup::FSdetect menu active 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif // IR_SENSOR_ANALOG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif // IR_SENSOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && ! eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9476,7 +9514,7 @@ static uint16_t nFSCheckCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if( current_voltage_raw_IR > maxVolt )maxVolt = current_voltage_raw_IR; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if( current_voltage_raw_IR < minVolt )minVolt = current_voltage_raw_IR; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#if 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#if 0 // Start: IR Sensor debug info 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				{ // debug print 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					static uint16_t lastVolt = ~0U; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					if( current_voltage_raw_IR != lastVolt ){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9484,38 +9522,29 @@ static uint16_t nFSCheckCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						lastVolt = current_voltage_raw_IR; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// the trouble is, I can hold the filament in the hole in such a way, that it creates the exact voltage 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// to be detected as the new fsensor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// We can either fake it by extending the detection window to a looooong time 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// or do some other countermeasures 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#endif // End: IR Sensor debug info 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! The trouble is, I can hold the filament in the hole in such a way, that it creates the exact voltage 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! to be detected as the new fsensor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! We can either fake it by extending the detection window to a looooong time 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! or do some other countermeasures 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// what we want to detect: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// if minvolt gets below ~0.6V, it means there is an old fsensor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// if maxvolt gets above 4.6V, it means we either have an old fsensor or broken cables/fsensor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// So I'm waiting for a situation, when minVolt gets to range <0, 0.7> and maxVolt gets into range <4.4, 5> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// If and only if minVolt is in range <0.6, 0.7> and maxVolt is in range <4.4, 4.5>, I'm considering a situation with the new fsensor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				// otherwise, I don't care 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				if( minVolt >= Voltage2Raw(0.3F) && minVolt <= Voltage2Raw(0.5F)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				 && maxVolt >= Voltage2Raw(4.2F) && maxVolt <= Voltage2Raw(4.6F) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! what we want to detect: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! if minvolt gets below ~0.3V, it means there is an old fsensor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! if maxvolt gets above 4.6V, it means we either have an old fsensor or broken cables/fsensor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! So I'm waiting for a situation, when minVolt gets to range <0, 1.5> and maxVolt gets into range <3.0, 5> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! If and only if minVolt is in range <0.3, 1.5> and maxVolt is in range <3.0, 4.6>, I'm considering a situation with the new fsensor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if( minVolt >= IRsensor_Ldiode_TRESHOLD && minVolt <= IRsensor_Lmax_TRESHOLD  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 && maxVolt >= IRsensor_Hmin_TRESHOLD && maxVolt <= IRsensor_Hopen_TRESHOLD 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    bool bTemp = (!CHECK_ALL_HEATERS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    bTemp = bTemp && (menu_menu==lcd_status_screen); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    bTemp = bTemp && ((oFsensorPCB==ClFsensorPCB::_Old)||(oFsensorPCB==ClFsensorPCB::_Undef)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    bTemp = bTemp && fsensor_enabled; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if(bTemp){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                         nFSCheckCount++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                         if(nFSCheckCount>FS_CHECK_COUNT){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              nFSCheckCount=0;    // not necessary 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              oFsensorPCB=ClFsensorPCB::_Rev04; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              printf_IRSensorAnalogBoardChange(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              lcd_setstatuspgm(_i("FS v0.4 or newer"));////c=18 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						nFSCheckCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					manage_inactivity_IR_ANALOG_Check(nFSCheckCount, ClFsensorPCB::_Old, ClFsensorPCB::_Rev04, _i("FS v0.4 or newer") ); ////c=18 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! If and only if minVolt is in range <0.0, 0.3> and maxVolt is in range  <4.6, 5.0V>, I'm considering a situation with the old fsensor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! Note, we are not relying on one voltage here - getting just +5V can mean an old fsensor or a broken new sensor - that's why 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//! we need to have both voltages detected correctly to allow switching back to the old fsensor. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				else if( minVolt < IRsensor_Ldiode_TRESHOLD  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 && maxVolt > IRsensor_Hopen_TRESHOLD && maxVolt <= IRsensor_VMax_TRESHOLD 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					manage_inactivity_IR_ANALOG_Check(nFSCheckCount, ClFsensorPCB::_Rev04, oFsensorPCB=ClFsensorPCB::_Old, _i("FS v0.3 or older")); ////c=18 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif // IR_SENSOR_ANALOG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if (fsensor_check_autoload()) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9526,7 +9555,7 @@ static uint16_t nFSCheckCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //-//					if (degHotend0() > EXTRUDE_MINTEMP) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Sound_MakeCustom(50,1000,false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						Sound_MakeCustom(50,1000,false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						loading_flag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						enquecommand_front_P((PSTR("M701"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9537,20 +9566,17 @@ if(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						show_preheat_nozzle_warning(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						lcd_update_enable(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              eFilamentAction=FilamentAction::AutoLoad; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              bFilamentFirstRun=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              if(target_temperature[0]>=EXTRUDE_MINTEMP) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   bFilamentPreheatState=true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                                   mFilamentItem(target_temperature[0],target_temperature_bed); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   menu_submenu(mFilamentItemForce); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   menu_submenu(lcd_generic_preheat_menu); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   lcd_timeoutToStatus.start(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						eFilamentAction=FilamentAction::AutoLoad; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						bFilamentFirstRun=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						if(target_temperature[0]>=EXTRUDE_MINTEMP){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							bFilamentPreheatState=true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//							mFilamentItem(target_temperature[0],target_temperature_bed); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							menu_submenu(mFilamentItemForce); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							menu_submenu(lcd_generic_preheat_menu); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							lcd_timeoutToStatus.start(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			else 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9942,7 +9968,7 @@ static void wait_for_heater(long codenum, uint8_t extruder) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					SERIAL_PROTOCOLLN("?"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					SERIAL_PROTOCOLLN('?'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10073,16 +10099,16 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	card.openFile(filename_wldsd, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	/*destination[Z_AXIS] = mesh_home_z_search; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	//plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_buffer_line_destinationXYZE(Z_LIFT_FEEDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	for(int8_t i=0; i < NUM_AXIS; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		current_position[i] = destination[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		destination[Z_AXIS] = measure_z_height; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_destinationXYZE(Z_LIFT_FEEDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		for(int8_t i=0; i < NUM_AXIS; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[i] = destination[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10107,9 +10133,9 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (iy & 1) ix = (x_points_num - 1) - ix; // Zig zag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		float z0 = 0.f; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		/*destination[Z_AXIS] = mesh_home_z_search; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		//plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		plan_buffer_line_destinationXYZE(Z_LIFT_FEEDRATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		for(int8_t i=0; i < NUM_AXIS; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			current_position[i] = destination[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10122,8 +10148,8 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		destination[X_AXIS] = ix * (x_dimension / (x_points_num - 1)) + shift_x; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		destination[Y_AXIS] = iy * (y_dimension / (y_points_num - 1)) + shift_y; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], XY_AXIS_FEEDRATE/6, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        set_current_to_destination(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		mesh_plan_buffer_line_destinationXYZE(XY_AXIS_FEEDRATE/6); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		set_current_to_destination(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//	printf_P(PSTR("X = %f; Y= %f \n"), current_position[X_AXIS], current_position[Y_AXIS]); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10476,7 +10502,11 @@ float temp_comp_interpolation(float inp_temperature) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (i>0) EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + (i-1) * 2, &shift[i]); //read shift in steps from EEPROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		temp_C[i] = 50 + i * 10; //temperature in C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef PINDA_THERMISTOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		temp_C[i] = 35 + i * 5; //temperature in C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		constexpr int start_compensating_temp = 35; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		temp_C[i] = start_compensating_temp + i * 5; //temperature in degrees C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#ifdef DETECT_SUPERPINDA 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		static_assert(start_compensating_temp >= PINDA_MINTEMP, "Temperature compensation start point is lower than PINDA_MINTEMP."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#endif //DETECT_SUPERPINDA 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		temp_C[i] = 50 + i * 10; //temperature in C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10529,7 +10559,7 @@ float temp_comp_interpolation(float inp_temperature) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef PINDA_THERMISTOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 float temp_compensation_pinda_thermistor_offset(float temperature_pinda) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if (!temp_cal_active) return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if (!eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE)) return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if (!calibration_status_pinda()) return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return temp_comp_interpolation(temperature_pinda) / cs.axis_steps_per_unit[Z_AXIS]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10546,12 +10576,12 @@ void long_pause() //long pause print 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//lift z 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	current_position[Z_AXIS] += Z_PAUSE_LIFT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_buffer_line_curposXYZE(15, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_buffer_line_curposXYZE(15); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//Move XY to side 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	current_position[X_AXIS] = X_PAUSE_POS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	current_position[Y_AXIS] = Y_PAUSE_POS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_buffer_line_curposXYZE(50, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_buffer_line_curposXYZE(50); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// Turn off the print fan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	fanSpeed = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10661,7 +10691,7 @@ void uvlo_() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // Retract 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[E_AXIS] -= default_retraction; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_buffer_line_curposXYZE(95, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_buffer_line_curposXYZE(95); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     disable_e0(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10674,7 +10704,7 @@ void uvlo_() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[Z_AXIS] += float(1024 - z_microsteps) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 / (z_res * cs.axis_steps_per_unit[Z_AXIS]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 + UVLO_Z_AXIS_SHIFT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     poweroff_z(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10737,7 +10767,7 @@ void uvlo_() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // All is set: with all the juice left, try to move extruder away to detach the nozzle completely from the print 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     poweron_z(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     current_position[X_AXIS] = (current_position[X_AXIS] < 0.5f * (X_MIN_POS + X_MAX_POS)) ? X_MIN_POS : X_MAX_POS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plan_buffer_line_curposXYZE(500, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plan_buffer_line_curposXYZE(500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     wdt_enable(WDTO_1S); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10788,7 +10818,7 @@ void uvlo_tiny() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         current_position[Z_AXIS] += float(1024 - z_microsteps) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     / (z_res * cs.axis_steps_per_unit[Z_AXIS]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     + UVLO_TINY_Z_AXIS_SHIFT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         st_synchronize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         poweroff_z(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -10967,7 +10997,7 @@ bool recover_machine_state_after_power_panic() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // 5) Set the physical positions from the logical positions using the world2machine transformation 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // This is only done to inizialize Z/E axes with physical locations, since X/Y are unknown. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  plan_set_position_curposXYZE(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // 6) Power up the Z motors, mark their positions as known. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   axis_known_position[Z_AXIS] = true; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11391,9 +11421,9 @@ void print_mesh_bed_leveling_table() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   for (int8_t y = 0; y < MESH_NUM_Y_POINTS; ++ y) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for (int8_t x = 0; x < MESH_NUM_Y_POINTS; ++ x) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       MYSERIAL.print(mbl.z_values[y][x], 3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      SERIAL_ECHOPGM(" "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      SERIAL_ECHO(' '); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  SERIAL_ECHOLNPGM(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SERIAL_ECHOLN(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 uint16_t print_time_remaining() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11441,7 +11471,7 @@ static void print_time_remaining_init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void load_filament_final_feed() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	current_position[E_AXIS]+= FILAMENTCHANGE_FINALFEED; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FINAL, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FINAL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //! @brief Wait for user to check the state 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11586,7 +11616,7 @@ void M600_load_filament_movements() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	plan_buffer_line_curposXYZE(50, active_extruder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	current_position[E_AXIS]+= FILAMENTCHANGE_FIRSTFEED ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FIRST, active_extruder);  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FIRST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	load_filament_final_feed(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	lcd_loading_filament(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11693,7 +11723,6 @@ void disable_force_z() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif // TMC2130 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void enable_force_z() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if(bEnableForce_z) 
			 |