Browse Source

Merge pull request #1302 from PavelSindler/wizard_improvements

Wizard improvements
PavelSindler 6 years ago
parent
commit
78775e2f87
2 changed files with 81 additions and 65 deletions
  1. 16 1
      Firmware/Marlin_main.cpp
  2. 65 64
      Firmware/ultralcd.cpp

+ 16 - 1
Firmware/Marlin_main.cpp

@@ -2752,6 +2752,21 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
 	if (lcd_calibrate_z_end_stop_manual(onlyZ))
 	{
 #endif //TMC2130
+		
+		lcd_show_fullscreen_message_and_wait_P(_T(MSG_CONFIRM_NOZZLE_CLEAN));
+		if(onlyZ){
+			lcd_display_message_fullscreen_P(_T(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1));
+			lcd_set_cursor(0, 3);
+			lcd_print(1);
+			lcd_puts_P(_T(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2));
+		}else{
+			//lcd_show_fullscreen_message_and_wait_P(_T(MSG_PAPER));
+			lcd_display_message_fullscreen_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1));
+			lcd_set_cursor(0, 2);
+			lcd_print(1);
+			lcd_puts_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2));
+		}
+
 		refresh_cmd_timeout();
 		#ifndef STEEL_SHEET
 		if (((degHotend(0) > MAX_HOTEND_TEMP_CALIBRATION) || (degBed() > MAX_BED_TEMP_CALIBRATION)) && (!onlyZ))
@@ -2766,7 +2781,6 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
 			bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_STEEL_SHEET_CHECK), false, false);
 			if(result) lcd_show_fullscreen_message_and_wait_P(_T(MSG_REMOVE_STEEL_SHEET));
 			#endif //STEEL_SHEET
-			lcd_show_fullscreen_message_and_wait_P(_T(MSG_CONFIRM_NOZZLE_CLEAN));
 		    lcd_show_fullscreen_message_and_wait_P(_T(MSG_PAPER));
 			KEEPALIVE_STATE(IN_HANDLER);
 			lcd_display_message_fullscreen_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1));
@@ -2774,6 +2788,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
 			lcd_print(1);
 			lcd_puts_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2));
 		}
+			
 		// Move the print head close to the bed.
 		current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
 

+ 65 - 64
Firmware/ultralcd.cpp

@@ -3072,8 +3072,6 @@ void lcd_wait_for_cool_down() {
 #ifndef TMC2130
 bool lcd_calibrate_z_end_stop_manual(bool only_z)
 {
-    bool clean_nozzle_asked = false;
-
     // Don't know where we are. Let's claim we are Z=0, so the soft end stops will not be triggered when moving up.
     current_position[Z_AXIS] = 0;
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
@@ -3120,13 +3118,6 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z)
                 previous_millis_msg = millis();
             }
         }
-
-        if (! clean_nozzle_asked) {
-            lcd_show_fullscreen_message_and_wait_P(_T(MSG_CONFIRM_NOZZLE_CLEAN));
-            clean_nozzle_asked = true;
-        }
-		
-
         // Let the user confirm, that the Z carriage is at the top end stoppers.
         int8_t result = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Are left and right Z~carriages all up?"), false);////MSG_CONFIRM_CARRIAGE_AT_THE_TOP c=20 r=2
         if (result == -1)
@@ -3141,22 +3132,6 @@ calibrated:
     // during the search for the induction points.
     current_position[Z_AXIS] = Z_MAX_POS-3.f;
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
-    
-    
-    if(only_z){
-        lcd_display_message_fullscreen_P(_T(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1));
-        lcd_set_cursor(0, 3);
-        lcd_print(1);
-        lcd_puts_P(_T(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2));
-    }else{
-		//lcd_show_fullscreen_message_and_wait_P(_T(MSG_PAPER));
-        lcd_display_message_fullscreen_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1));
-        lcd_set_cursor(0, 2);
-        lcd_print(1);
-        lcd_puts_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2));
-    }
-    
-    
     return true;
 
 canceled:
@@ -4394,18 +4369,58 @@ static void wait_preheat()
     plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 60, active_extruder);
     delay_keep_alive(2000);
     lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING));
-    while (abs(degHotend(0) - degTargetHotend(0)) > 3) {
+	lcd_set_custom_characters();
+	while (abs(degHotend(0) - degTargetHotend(0)) > 3) {
         lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING));
 
         lcd_set_cursor(0, 4);
-        lcd_print(LCD_STR_THERMOMETER[0]);
-        lcd_print(ftostr3(degHotend(0)));
-        lcd_print("/");
-        lcd_print(degTargetHotend(0));
-        lcd_print(LCD_STR_DEGREE);
-        lcd_set_custom_characters();
+	    //Print the hotend temperature (9 chars total)
+		lcdui_print_temp(LCD_STR_THERMOMETER[0], (int)(degHotend(0) + 0.5), (int)(degTargetHotend(0) + 0.5));
         delay_keep_alive(1000);
     }
+	
+}
+
+static void lcd_wizard_unload()
+{
+	if(mmu_enabled)
+	{
+		int8_t unload = lcd_show_multiscreen_message_two_choices_and_wait_P(
+		_i("Use unload to remove filament 1 if it protrudes outside of the rear MMU tube. Use eject if it is hidden in tube.")
+		,false, true, _i("Unload"), _i("Eject"));
+		if (unload)
+		{
+			extr_unload_0();
+		} 
+		else
+		{
+			mmu_eject_fil_0();
+		}
+	} 
+	else
+	{
+			unload_filament();
+	}
+}
+
+static void lcd_wizard_load()
+{
+	if (mmu_enabled)
+	{
+		lcd_show_fullscreen_message_and_wait_P(_i("Please insert PLA filament to the first tube of MMU, then press the knob to load it."));////c=20 r=8
+	} 
+	else
+	{
+		lcd_show_fullscreen_message_and_wait_P(_i("Please insert PLA filament to the extruder, then press knob to load it."));////MSG_WIZARD_LOAD_FILAMENT c=20 r=8
+	}	
+	lcd_update_enable(false);
+	lcd_clear();
+	lcd_puts_at_P(0, 2, _T(MSG_LOADING_FILAMENT));
+#ifdef SNMM
+	change_extr(0);
+#endif
+	loading_flag = true;
+	gcode_M701();
 }
 
 //! @brief Printer first run wizard (Selftest and calibration)
@@ -4482,11 +4497,25 @@ void lcd_wizard(WizState state)
 			else end = true;
 			break;
 		case S::Z: //z calibration
+			lcd_show_fullscreen_message_and_wait_P(_i("Please remove shipping helpers first."));
+			lcd_show_fullscreen_message_and_wait_P(_i("Now remove the test print from steel sheet."));
 			lcd_show_fullscreen_message_and_wait_P(_i("I will run z calibration now."));////MSG_WIZARD_Z_CAL c=20 r=8
 			wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_STEEL_SHEET_CHECK), false, false);
 			if (!wizard_event) lcd_show_fullscreen_message_and_wait_P(_T(MSG_PLACE_STEEL_SHEET));
 			wizard_event = gcode_M45(true, 0);
-			if (wizard_event) state = S::Finish; //shipped, no need to set first layer, go to final message directly
+			if (wizard_event) {
+				//current filament needs to be unloaded and then new filament should be loaded
+				//start to preheat nozzle for unloading remaining PLA filament
+				setTargetHotend(PLA_PREHEAT_HOTEND_TEMP, 0);
+				lcd_display_message_fullscreen_P(_i("Now I will preheat nozzle for PLA."));
+				wait_preheat();
+				//unload current filament
+				lcd_wizard_unload();
+				//load filament
+				lcd_wizard_load();
+				setTargetHotend(0, 0); //we are finished, cooldown nozzle
+				state = S::Finish; //shipped, no need to set first layer, go to final message directly
+			}
 			else end = true;
 			break;
 		case S::IsFil: //is filament loaded?
@@ -4521,40 +4550,11 @@ void lcd_wizard(WizState state)
 		    break;
 		case S::Unload:
 		    wait_preheat();
-            if(mmu_enabled)
-            {
-                int8_t unload = lcd_show_multiscreen_message_two_choices_and_wait_P(
-                        _i("Use unload to remove filament 1 if it protrudes outside of the rear MMU tube. Use eject if it is hidden in tube.")
-                        ,false, true, _i("Unload"), _i("Eject"));
-                if (unload)
-                {
-                    extr_unload_0();
-                } else
-                {
-                    mmu_eject_fil_0();
-                }
-            } else
-            {
-                unload_filament();
-            }
+			lcd_wizard_unload();
             state = S::LoadFil;
             break;
 		case S::LoadFil: //load filament
-		    if (mmu_enabled)
-		    {
-		        lcd_show_fullscreen_message_and_wait_P(_i("Please insert PLA filament to the first tube of MMU, then press the knob to load it."));////c=20 r=8
-		    } else
-		    {
-			    lcd_show_fullscreen_message_and_wait_P(_i("Please insert PLA filament to the extruder, then press knob to load it."));////MSG_WIZARD_LOAD_FILAMENT c=20 r=8
-		    }
-			lcd_update_enable(false);
-			lcd_clear();
-			lcd_puts_at_P(0, 2, _T(MSG_LOADING_FILAMENT));
-#ifdef SNMM
-			change_extr(0);
-#endif
-            loading_flag = true;
-			gcode_M701();
+			lcd_wizard_load();
 			state = S::Lay1Cal;
 			break;
 		case S::IsPla:
@@ -4603,6 +4603,7 @@ void lcd_wizard(WizState state)
 		msg = _T(MSG_WIZARD_DONE);
 		lcd_reset_alert_level();
 		lcd_setstatuspgm(_T(WELCOME_MSG));
+		lcd_return_to_status(); 
 		break;
 
 	default: