Browse Source

Live adjust Z - display zero in case of invalid calibration status (same logic in babystep_load and _lcd_babystep)

Robert Pelnar 5 years ago
parent
commit
8409a26594

+ 2 - 1
Firmware/Marlin_main.cpp

@@ -7699,7 +7699,8 @@ void wait_for_heater(long codenum) {
 	}
 }
 
-void check_babystep() {
+void check_babystep()
+{
 	int babystep_z;
 	EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystep_z);
 	if ((babystep_z < Z_BABYSTEP_MIN) || (babystep_z > Z_BABYSTEP_MAX)) {

+ 4 - 3
Firmware/mesh_bed_calibration.cpp

@@ -2984,13 +2984,14 @@ static int babystepLoadZ = 0;
 
 void babystep_load()
 {
+	babystepLoadZ = 0;
     // Apply Z height correction aka baby stepping before mesh bed leveling gets activated.
-    if(calibration_status() < CALIBRATION_STATUS_LIVE_ADJUST)
+    if (calibration_status() < CALIBRATION_STATUS_LIVE_ADJUST)
     {
         check_babystep(); //checking if babystep is in allowed range, otherwise setting babystep to 0
         
         // End of G80: Apply the baby stepping value.
-        EEPROM_read_B(EEPROM_BABYSTEP_Z,&babystepLoadZ);
+        EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystepLoadZ);
                             
     #if 0
         SERIAL_ECHO("Z baby step: ");
@@ -3026,7 +3027,7 @@ void babystep_undo()
 
 void babystep_reset()
 {
-      babystepLoadZ = 0;    
+	babystepLoadZ = 0;    
 }
 
 void count_xyz_details(float (&distanceMin)[2]) {

+ 1 - 0
Firmware/mesh_bed_calibration.h

@@ -176,6 +176,7 @@ extern void babystep_undo();
 // Reset the current babystep counter without moving the axes.
 extern void babystep_reset();
 
+
 extern void count_xyz_details(float (&distanceMin)[2]);
 extern bool sample_z();
 

+ 1 - 1
Firmware/mmu.cpp

@@ -26,7 +26,7 @@ extern char choose_extruder_menu();
 
 bool mmu_enabled = false;
 
-int8_t mmu_state = -1;
+int8_t mmu_state = 0;
 
 uint8_t mmu_extruder = 0;
 

+ 2 - 1
Firmware/tmc2130.cpp

@@ -77,7 +77,8 @@ bool tmc2130_sg_change = false;
 
 bool skip_debug_msg = false;
 
-#define DBG(args...) printf_P(args)
+#define DBG(args...)
+//printf_P(args)
 #ifndef _n
 #define _n PSTR
 #endif //_n

+ 9 - 4
Firmware/ultralcd.cpp

@@ -120,7 +120,7 @@ static void lcd_control_temperature_preheat_pla_settings_menu();
 static void lcd_control_temperature_preheat_abs_settings_menu();
 static void lcd_control_motion_menu();
 static void lcd_control_volumetric_menu();
-static void lcd_settings_menu_back();
+//static void lcd_settings_menu_back();
 
 static void prusa_stat_printerstatus(int _status);
 static void prusa_stat_farm_number();
@@ -2846,6 +2846,10 @@ static void _lcd_babystep(int axis, const char *msg)
 		EEPROM_read_B(EEPROM_BABYSTEP_Y, &_md->babystepMem[1]);
 		EEPROM_read_B(EEPROM_BABYSTEP_Z, &_md->babystepMem[2]);
 
+		// same logic as in babystep_load
+	    if (calibration_status() >= CALIBRATION_STATUS_LIVE_ADJUST)
+			_md->babystepMem[2] = 0;
+
 		_md->babystepMemMM[0] = _md->babystepMem[0]/axis_steps_per_unit[X_AXIS];
 		_md->babystepMemMM[1] = _md->babystepMem[1]/axis_steps_per_unit[Y_AXIS];
 		_md->babystepMemMM[2] = _md->babystepMem[2]/axis_steps_per_unit[Z_AXIS];
@@ -3014,7 +3018,7 @@ void pid_extruder() {
 	}
 
 }
-
+/*
 void lcd_adjust_z() {
   int enc_dif = 0;
   int cursor_pos = 1;
@@ -3097,7 +3101,7 @@ void lcd_adjust_z() {
   lcd_clear();
   lcd_return_to_status();
 
-}
+}*/
 
 bool lcd_wait_for_pinda(float temp) {
 	lcd_set_custom_characters_degree();
@@ -4781,6 +4785,7 @@ static void lcd_ustep_linearity_menu_save()
 }
 #endif //TMC2130
 
+/*
 static void lcd_settings_menu_back()
 {
 #ifdef TMC2130
@@ -4799,7 +4804,7 @@ static void lcd_settings_menu_back()
     menu_menu = lcd_main_menu;
 //    lcd_main_menu();
 }
-
+*/
 
 static void lcd_calibration_menu()
 {