浏览代码

wizard :checking if PLA is loaded, user can repeat v2 cal., M117 and M1 hotfix

PavelSindler 7 年之前
父节点
当前提交
77937ab4bb
共有 5 个文件被更改,包括 104 次插入11 次删除
  1. 12 4
      Firmware/Marlin_main.cpp
  2. 30 0
      Firmware/language_all.cpp
  3. 12 0
      Firmware/language_all.h
  4. 7 1
      Firmware/language_en.h
  5. 43 6
      Firmware/ultralcd.cpp

+ 12 - 4
Firmware/Marlin_main.cpp

@@ -2318,10 +2318,14 @@ void process_commands()
   KEEPALIVE_STATE(IN_HANDLER);
 
   if (code_seen("M117")) { //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^"
+	  custom_message = true;
+	  custom_message_type = 2;
 	  starpos = (strchr(strchr_pointer + 5, '*'));
 	  if (starpos != NULL)
 		  *(starpos) = '\0';
 	  lcd_setstatus(strchr_pointer + 5);
+	  custom_message = false;
+	  custom_message_type = 0;
   }
   else if(code_seen("PRUSA")){
 		if (code_seen("Ping")) {  //PRUSA Ping
@@ -3716,9 +3720,11 @@ void process_commands()
     case 0: // M0 - Unconditional stop - Wait for user button press on LCD
     case 1: // M1 - Conditional stop - Wait for user button press on LCD
     {
-      char *src = strchr_pointer + 2;
+	  custom_message = true;
+	  custom_message_type = 2;
 
-      codenum = 0;
+      char *src = strchr_pointer + 2;
+	  codenum = 0;
 
       bool hasP = false, hasS = false;
       if (code_seen('P')) {
@@ -3744,7 +3750,7 @@ void process_commands()
       if (codenum > 0){
         codenum += millis();  // keep track of when we started waiting
 		KEEPALIVE_STATE(PAUSED_FOR_USER);
-        while(millis() < codenum && !lcd_clicked()){
+		while(millis() < codenum && !lcd_clicked()){
           manage_heater();
           manage_inactivity(true);
           lcd_update();
@@ -3766,7 +3772,9 @@ void process_commands()
         LCD_MESSAGERPGM(MSG_RESUMING);
       else
         LCD_MESSAGERPGM(WELCOME_MSG);
-    }
+	  custom_message = false;
+	  custom_message_type = 0;
+	}
     break;
 #endif
     case 17:

+ 30 - 0
Firmware/language_all.cpp

@@ -2097,6 +2097,16 @@ const char * const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1] PROGMEM = {
 	MSG_PLANNER_BUFFER_BYTES_EN
 };
 
+const char MSG_PLA_FILAMENT_LOADED_EN[] PROGMEM = "Is PLA filament loaded?";
+const char * const MSG_PLA_FILAMENT_LOADED_LANG_TABLE[1] PROGMEM = {
+	MSG_PLA_FILAMENT_LOADED_EN
+};
+
+const char MSG_PLEASE_LOAD_PLA_EN[] PROGMEM = "Please load PLA filament first.";
+const char * const MSG_PLEASE_LOAD_PLA_LANG_TABLE[1] PROGMEM = {
+	MSG_PLEASE_LOAD_PLA_EN
+};
+
 const char MSG_PLEASE_WAIT_EN[] PROGMEM = "Please wait";
 const char MSG_PLEASE_WAIT_CZ[] PROGMEM = "Prosim cekejte";
 const char MSG_PLEASE_WAIT_IT[] PROGMEM = "Aspetta";
@@ -3492,6 +3502,11 @@ const char * const MSG_WIZARD_CALIBRATION_FAILED_LANG_TABLE[1] PROGMEM = {
 	MSG_WIZARD_CALIBRATION_FAILED_EN
 };
 
+const char MSG_WIZARD_CLEAN_HEATBED_EN[] PROGMEM = "Please clean heatbed and then press the knob.";
+const char * const MSG_WIZARD_CLEAN_HEATBED_LANG_TABLE[1] PROGMEM = {
+	MSG_WIZARD_CLEAN_HEATBED_EN
+};
+
 const char MSG_WIZARD_DONE_EN[] PROGMEM = "All is done. Happy printing!";
 const char * const MSG_WIZARD_DONE_LANG_TABLE[1] PROGMEM = {
 	MSG_WIZARD_DONE_EN
@@ -3507,6 +3522,11 @@ const char * const MSG_WIZARD_HEATING_LANG_TABLE[1] PROGMEM = {
 	MSG_WIZARD_HEATING_EN
 };
 
+const char MSG_WIZARD_INSERT_CORRECT_FILAMENT_EN[] PROGMEM = "Please load PLA filament and then resume Wizard by rebooting the printer.";
+const char * const MSG_WIZARD_INSERT_CORRECT_FILAMENT_LANG_TABLE[1] PROGMEM = {
+	MSG_WIZARD_INSERT_CORRECT_FILAMENT_EN
+};
+
 const char MSG_WIZARD_LANGUAGE_EN[] PROGMEM = "Please choose your language";
 const char * const MSG_WIZARD_LANGUAGE_LANG_TABLE[1] PROGMEM = {
 	MSG_WIZARD_LANGUAGE_EN
@@ -3517,11 +3537,21 @@ const char * const MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE[1] PROGMEM = {
 	MSG_WIZARD_LOAD_FILAMENT_EN
 };
 
+const char MSG_WIZARD_PLA_FILAMENT_EN[] PROGMEM = "Is it PLA filament?";
+const char * const MSG_WIZARD_PLA_FILAMENT_LANG_TABLE[1] PROGMEM = {
+	MSG_WIZARD_PLA_FILAMENT_EN
+};
+
 const char MSG_WIZARD_QUIT_EN[] PROGMEM = "You can always resume the Wizard from Calibration -> Wizard.";
 const char * const MSG_WIZARD_QUIT_LANG_TABLE[1] PROGMEM = {
 	MSG_WIZARD_QUIT_EN
 };
 
+const char MSG_WIZARD_REPEAT_V2_CAL_EN[] PROGMEM = "Do you want to repeat last step to readjust distance between nozzle and heatbed?";
+const char * const MSG_WIZARD_REPEAT_V2_CAL_LANG_TABLE[1] PROGMEM = {
+	MSG_WIZARD_REPEAT_V2_CAL_EN
+};
+
 const char MSG_WIZARD_RERUN_EN[] PROGMEM = "Running Wizard will delete current calibration results and start from the beginning. Continue?";
 const char * const MSG_WIZARD_RERUN_LANG_TABLE[1] PROGMEM = {
 	MSG_WIZARD_RERUN_EN

+ 12 - 0
Firmware/language_all.h

@@ -396,6 +396,10 @@ extern const char* const MSG_PINDA_PREHEAT_LANG_TABLE[LANG_NUM];
 #define MSG_PINDA_PREHEAT LANG_TABLE_SELECT(MSG_PINDA_PREHEAT_LANG_TABLE)
 extern const char* const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1];
 #define MSG_PLANNER_BUFFER_BYTES LANG_TABLE_SELECT_EXPLICIT(MSG_PLANNER_BUFFER_BYTES_LANG_TABLE, 0)
+extern const char* const MSG_PLA_FILAMENT_LOADED_LANG_TABLE[1];
+#define MSG_PLA_FILAMENT_LOADED LANG_TABLE_SELECT_EXPLICIT(MSG_PLA_FILAMENT_LOADED_LANG_TABLE, 0)
+extern const char* const MSG_PLEASE_LOAD_PLA_LANG_TABLE[1];
+#define MSG_PLEASE_LOAD_PLA LANG_TABLE_SELECT_EXPLICIT(MSG_PLEASE_LOAD_PLA_LANG_TABLE, 0)
 extern const char* const MSG_PLEASE_WAIT_LANG_TABLE[LANG_NUM];
 #define MSG_PLEASE_WAIT LANG_TABLE_SELECT(MSG_PLEASE_WAIT_LANG_TABLE)
 extern const char* const MSG_POSITION_UNKNOWN_LANG_TABLE[1];
@@ -646,18 +650,26 @@ extern const char* const MSG_WIZARD_LANG_TABLE[1];
 #define MSG_WIZARD LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LANG_TABLE, 0)
 extern const char* const MSG_WIZARD_CALIBRATION_FAILED_LANG_TABLE[1];
 #define MSG_WIZARD_CALIBRATION_FAILED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_CALIBRATION_FAILED_LANG_TABLE, 0)
+extern const char* const MSG_WIZARD_CLEAN_HEATBED_LANG_TABLE[1];
+#define MSG_WIZARD_CLEAN_HEATBED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_CLEAN_HEATBED_LANG_TABLE, 0)
 extern const char* const MSG_WIZARD_DONE_LANG_TABLE[1];
 #define MSG_WIZARD_DONE LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_DONE_LANG_TABLE, 0)
 extern const char* const MSG_WIZARD_FILAMENT_LOADED_LANG_TABLE[1];
 #define MSG_WIZARD_FILAMENT_LOADED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_FILAMENT_LOADED_LANG_TABLE, 0)
 extern const char* const MSG_WIZARD_HEATING_LANG_TABLE[1];
 #define MSG_WIZARD_HEATING LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_HEATING_LANG_TABLE, 0)
+extern const char* const MSG_WIZARD_INSERT_CORRECT_FILAMENT_LANG_TABLE[1];
+#define MSG_WIZARD_INSERT_CORRECT_FILAMENT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_INSERT_CORRECT_FILAMENT_LANG_TABLE, 0)
 extern const char* const MSG_WIZARD_LANGUAGE_LANG_TABLE[1];
 #define MSG_WIZARD_LANGUAGE LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LANGUAGE_LANG_TABLE, 0)
 extern const char* const MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE[1];
 #define MSG_WIZARD_LOAD_FILAMENT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE, 0)
+extern const char* const MSG_WIZARD_PLA_FILAMENT_LANG_TABLE[1];
+#define MSG_WIZARD_PLA_FILAMENT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_PLA_FILAMENT_LANG_TABLE, 0)
 extern const char* const MSG_WIZARD_QUIT_LANG_TABLE[1];
 #define MSG_WIZARD_QUIT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_QUIT_LANG_TABLE, 0)
+extern const char* const MSG_WIZARD_REPEAT_V2_CAL_LANG_TABLE[1];
+#define MSG_WIZARD_REPEAT_V2_CAL LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_REPEAT_V2_CAL_LANG_TABLE, 0)
 extern const char* const MSG_WIZARD_RERUN_LANG_TABLE[1];
 #define MSG_WIZARD_RERUN LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_RERUN_LANG_TABLE, 0)
 extern const char* const MSG_WIZARD_SELFTEST_LANG_TABLE[1];

+ 7 - 1
Firmware/language_en.h

@@ -323,7 +323,7 @@
 #define MSG_WIZARD_SELFTEST					"First, I will run the selftest to check most common assembly problems."
 #define MSG_WIZARD_CALIBRATION_FAILED		"Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer."
 #define MSG_WIZARD_XYZ_CAL					"I will run xyz calibration now. It will take approx. 12 mins."
-#define MSG_WIZARD_FILAMENT_LOADED			"Is filament loaded?"
+#define MSG_WIZARD_FILAMENT_LOADED		"Is filament loaded?"
 #define MSG_WIZARD_Z_CAL					"I will run z calibration now."
 #define MSG_WIZARD_WILL_PREHEAT				"Now I will preheat nozzle for PLA."
 #define MSG_WIZARD_HEATING					"Preheating nozzle. Please wait."
@@ -333,3 +333,9 @@
 #define MSG_WIZARD_DONE						"All is done. Happy printing!"
 #define MSG_WIZARD_LOAD_FILAMENT			"Please insert PLA filament to the extruder, then press knob to load it."
 #define MSG_WIZARD_RERUN					"Running Wizard will delete current calibration results and start from the beginning. Continue?"
+#define MSG_WIZARD_REPEAT_V2_CAL					"Do you want to repeat last step to readjust distance between nozzle and heatbed?"
+#define MSG_WIZARD_CLEAN_HEATBED					"Please clean heatbed and then press the knob."
+#define MSG_WIZARD_PLA_FILAMENT					"Is it PLA filament?"
+#define MSG_WIZARD_INSERT_CORRECT_FILAMENT			"Please load PLA filament and then resume Wizard by rebooting the printer."
+#define MSG_PLA_FILAMENT_LOADED				"Is PLA filament loaded?"
+#define MSG_PLEASE_LOAD_PLA					"Please load PLA filament first."

+ 43 - 6
Firmware/ultralcd.cpp

@@ -687,7 +687,7 @@ void lcd_commands()
 			lcd_commands_step = 0;
 			lcd_commands_type = 0;
 			if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {
-				lcd_wizard(9);
+				lcd_wizard(10);
 			}
 		}
 
@@ -2789,7 +2789,21 @@ void lcd_toshiba_flash_air_compatibility_toggle()
 }
 
 void lcd_v2_calibration() {
-	    lcd_commands_type = LCD_COMMAND_V2_CAL;
+		bool loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_PLA_FILAMENT_LOADED, true, false);
+		if (loaded) lcd_commands_type = LCD_COMMAND_V2_CAL;
+		else {
+			lcd_display_message_fullscreen_P(MSG_PLEASE_LOAD_PLA);
+			for (int i = 0; i < 20; i++) { //wait max. 2s
+				delay_keep_alive(100);
+				if (lcd_clicked()) {
+					while (lcd_clicked());
+					delay(10);
+					while (lcd_clicked());
+					break;
+				}
+			}
+		}
+		lcd_update_enable(true);
 		lcd_return_to_status();
 }
 
@@ -2891,15 +2905,33 @@ void lcd_wizard(int state) {
 			lcd_print_at_PGM(0,2,MSG_LOADING_FILAMENT);
 			loading_flag = true;
 			gcode_M701();
-			state = 8;
+			state = 9;
 			break;
 		case 8:
+			wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_WIZARD_PLA_FILAMENT, false, true);
+			if (wizard_event) state = 9;
+			else end = true;
+			break;
+		case 9:
 			lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_V2_CAL);
 			lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_V2_CAL_2);
 			lcd_commands_type = LCD_COMMAND_V2_CAL;
 			end = true;
 			break;
-		case 9: //we are finished
+		case 10: //repeat firt layer cal.?
+			wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_REPEAT_V2_CAL, false);
+			if (wizard_event) {
+				current_position[Z_AXIS] += 100;
+				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);
+				current_position[Y_AXIS] = 205;
+				plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Y_AXIS]/60, active_extruder);
+				lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_CLEAN_HEATBED);
+				state = 9;
+			}
+			else {
+				state = 11;
+			}
+		case 11: //we are finished
 			eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0);
 			end = true;
 			break;
@@ -2923,10 +2955,15 @@ void lcd_wizard(int state) {
 		break;
 	case 3: //xyz cal.
 		msg = MSG_WIZARD_CALIBRATION_FAILED;
+		break;
 	case 4: //z cal.
 		msg = MSG_WIZARD_CALIBRATION_FAILED;
-	case 8: break; //exit wizard for v2 calibration, which is implemted in lcd_commands (we need lcd_update running)
-	case 9: //we are finished
+		break;
+	case 8: 
+		msg = MSG_WIZARD_INSERT_CORRECT_FILAMENT;
+		break;
+	case 9: break; //exit wizard for v2 calibration, which is implemted in lcd_commands (we need lcd_update running)
+	case 11: //we are finished
 
 		msg = MSG_WIZARD_DONE;
 		lcd_reset_alert_level();