浏览代码

snmm: M702 (unload filament) extended, snmm stop print: user is asked which filaments to unload

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

+ 5 - 2
Firmware/Marlin_main.cpp

@@ -5444,10 +5444,13 @@ case 404:  //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
 	{
 #ifdef SNMM
 		if (code_seen('U')) {
-			extr_unload_used();
+			extr_unload_used(); //unload all filaments which were used in current print
+		}
+		else if (code_seen('C')) {
+			extr_unload(); //unload just current filament 
 		}
 		else {
-			extr_unload_all();
+			extr_unload_all(); //unload all filaments
 		}
 #else
 		custom_message = true;

+ 15 - 0
Firmware/language_all.cpp

@@ -25,6 +25,11 @@ const char * const MSG_ADJUSTZ_LANG_TABLE[LANG_NUM] PROGMEM = {
 	MSG_ADJUSTZ_DE
 };
 
+const char MSG_ALL_EN[] PROGMEM = "All";
+const char * const MSG_ALL_LANG_TABLE[1] PROGMEM = {
+	MSG_ALL_EN
+};
+
 const char MSG_AMAX_EN[] PROGMEM = "Amax ";
 const char * const MSG_AMAX_LANG_TABLE[1] PROGMEM = {
 	MSG_AMAX_EN
@@ -700,6 +705,11 @@ const char * const MSG_COUNT_X_LANG_TABLE[1] PROGMEM = {
 	MSG_COUNT_X_EN
 };
 
+const char MSG_CURRENT_EN[] PROGMEM = "Current";
+const char * const MSG_CURRENT_LANG_TABLE[1] PROGMEM = {
+	MSG_CURRENT_EN
+};
+
 const char MSG_DISABLE_STEPPERS_EN[] PROGMEM = "Disable steppers";
 const char MSG_DISABLE_STEPPERS_CZ[] PROGMEM = "Vypnout motory";
 const char MSG_DISABLE_STEPPERS_IT[] PROGMEM = "Disabilit motori";
@@ -3154,6 +3164,11 @@ const char * const MSG_USB_PRINTING_LANG_TABLE[LANG_NUM] PROGMEM = {
 	MSG_USB_PRINTING_DE
 };
 
+const char MSG_USED_EN[] PROGMEM = "Used";
+const char * const MSG_USED_LANG_TABLE[1] PROGMEM = {
+	MSG_USED_EN
+};
+
 const char MSG_USERWAIT_EN[] PROGMEM = "Wait for user...";
 const char MSG_USERWAIT_IT[] PROGMEM = "Attendendo utente";
 const char MSG_USERWAIT_ES[] PROGMEM = "Esperando ordenes";

+ 7 - 1
Firmware/language_all.h

@@ -29,7 +29,9 @@ extern unsigned char lang_selected;
 extern const char* const MSG_ACTIVE_EXTRUDER_LANG_TABLE[1];
 #define MSG_ACTIVE_EXTRUDER LANG_TABLE_SELECT_EXPLICIT(MSG_ACTIVE_EXTRUDER_LANG_TABLE, 0)
 extern const char* const MSG_ADJUSTZ_LANG_TABLE[LANG_NUM];
-#define MSG_ADJUSTZ LANG_TABLE_SELECT(MSG_ADJUSTZ_LANG_TABLE) 
+#define MSG_ADJUSTZ LANG_TABLE_SELECT(MSG_ADJUSTZ_LANG_TABLE)
+extern const char* const MSG_ALL_LANG_TABLE[1];
+#define MSG_ALL LANG_TABLE_SELECT_EXPLICIT(MSG_ALL_LANG_TABLE, 0)
 extern const char* const MSG_AMAX_LANG_TABLE[1];
 #define MSG_AMAX LANG_TABLE_SELECT_EXPLICIT(MSG_AMAX_LANG_TABLE, 0)
 extern const char* const MSG_AUTHOR_LANG_TABLE[1];
@@ -140,6 +142,8 @@ extern const char* const MSG_CORRECTLY_LANG_TABLE[LANG_NUM];
 #define MSG_CORRECTLY LANG_TABLE_SELECT(MSG_CORRECTLY_LANG_TABLE)
 extern const char* const MSG_COUNT_X_LANG_TABLE[1];
 #define MSG_COUNT_X LANG_TABLE_SELECT_EXPLICIT(MSG_COUNT_X_LANG_TABLE, 0)
+extern const char* const MSG_CURRENT_LANG_TABLE[1];
+#define MSG_CURRENT LANG_TABLE_SELECT_EXPLICIT(MSG_CURRENT_LANG_TABLE, 0)
 extern const char* const MSG_DISABLE_STEPPERS_LANG_TABLE[LANG_NUM];
 #define MSG_DISABLE_STEPPERS LANG_TABLE_SELECT(MSG_DISABLE_STEPPERS_LANG_TABLE)
 extern const char* const MSG_DWELL_LANG_TABLE[LANG_NUM];
@@ -582,6 +586,8 @@ extern const char* const MSG_UNLOAD_FILAMENT_4_LANG_TABLE[LANG_NUM];
 #define MSG_UNLOAD_FILAMENT_4 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_4_LANG_TABLE)
 extern const char* const MSG_USB_PRINTING_LANG_TABLE[LANG_NUM];
 #define MSG_USB_PRINTING LANG_TABLE_SELECT(MSG_USB_PRINTING_LANG_TABLE)
+extern const char* const MSG_USED_LANG_TABLE[1];
+#define MSG_USED LANG_TABLE_SELECT_EXPLICIT(MSG_USED_LANG_TABLE, 0)
 extern const char* const MSG_USERWAIT_LANG_TABLE[LANG_NUM];
 #define MSG_USERWAIT LANG_TABLE_SELECT(MSG_USERWAIT_LANG_TABLE)
 extern const char* const MSG_VMIN_LANG_TABLE[1];

+ 3 - 0
Firmware/language_en.h

@@ -293,5 +293,8 @@
 #define(length=20, lines=1) MSG_TEMP_CALIBRATION_ON				"Temp. cal. [ON]"
 #define(length=20, lines=1) MSG_TEMP_CALIBRATION_OFF			"Temp. cal. [OFF]"
 #define(length=20, lines=1) MSG_PREPARE_FILAMENT				"Prepare new filament"
+#define(length=19, lines=1) MSG_ALL								"All"
+#define(length=19, lines=1) MSG_USED							"Used"
+#define(length=19, lines=1) MSG_CURRENT							"Current"
 
 

+ 55 - 4
Firmware/ultralcd.cpp

@@ -640,7 +640,7 @@ void lcd_commands()
 			#endif
 			lcd_ignore_click(false);
 			#ifdef SNMM
-			lcd_commands_step = 7;
+			lcd_commands_step = 8;
 			#else
 			lcd_commands_step = 3;
 			#endif
@@ -671,9 +671,17 @@ void lcd_commands()
 			lcd_commands_step = 5;
 		}
 		if (lcd_commands_step == 7 && !blocks_queued()) {
-			enquecommand_P(PSTR("M702 U"));
+			switch(snmm_stop_print_menu()) {
+				case 0: enquecommand_P(PSTR("M702")); break;//all 
+				case 1: enquecommand_P(PSTR("M702 U")); break; //used
+				case 2: enquecommand_P(PSTR("M702 C")); break; //current
+				default: enquecommand_P(PSTR("M702")); break;
+			}
 			lcd_commands_step = 3;
 		}
+		if (lcd_commands_step == 8 && !blocks_queued()) { //step 8 is here for delay (going to next step after execution of all gcodes from step 4)
+			lcd_commands_step = 7; 
+		}
 	}
 
 	if (lcd_commands_type == 3)
@@ -2890,6 +2898,50 @@ void bowden_menu() {
 	}
 }
 
+static char snmm_stop_print_menu() { //menu for choosing which filaments will be unloaded in stop print
+	lcd_implementation_clear();
+	lcd_print_at_PGM(0,0,MSG_UNLOAD_FILAMENT); lcd.print(":");
+	lcd.setCursor(0, 1); lcd.print(">");
+	lcd_print_at_PGM(1,1,MSG_ALL);
+	lcd_print_at_PGM(1,2,MSG_USED);
+	lcd_print_at_PGM(1,3,MSG_CURRENT);
+	char cursor_pos = 1;
+	int enc_dif = 0;
+
+	while (1) {
+		manage_heater();
+		manage_inactivity(true);
+		if (abs((enc_dif - encoderDiff)) > 4) {
+
+			if ((abs(enc_dif - encoderDiff)) > 1) {
+				if (enc_dif > encoderDiff) cursor_pos--;
+				if (enc_dif < encoderDiff) cursor_pos++;
+				if (cursor_pos > 3) cursor_pos = 3;
+				if (cursor_pos < 1) cursor_pos = 1;
+
+				lcd.setCursor(0, 1);
+				lcd.print(" ");
+				lcd.setCursor(0, 2);
+				lcd.print(" ");
+				lcd.setCursor(0, 3);
+				lcd.print(" ");
+				lcd.setCursor(0, cursor_pos);
+				lcd.print(">");
+				enc_dif = encoderDiff;
+				delay(100);
+			}
+		}
+		if (lcd_clicked()) {
+			while (lcd_clicked());
+			delay(10);
+			while (lcd_clicked());
+			return(cursor_pos - 1);
+		}
+	}
+	
+}
+
+
 char reset_menu() {
 #ifdef SNMM
 	int items_no = 5;
@@ -3116,7 +3168,7 @@ static void extr_adj(int extruder) //loading filament for SNMM
 }
 
 
-static void extr_unload() { //unloads filament
+void extr_unload() { //unloads filament
 	float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT;
 	float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
 	int8_t SilentMode;
@@ -3311,7 +3363,6 @@ static void fil_load_menu()
 	END_MENU();
 }
 
-
 static void fil_unload_menu()
 {
 	START_MENU();

+ 2 - 2
Firmware/ultralcd.h

@@ -224,8 +224,8 @@ static void extr_unload_3();
 static void lcd_disable_farm_mode();
 void extr_unload_all(); 
 void extr_unload_used();
-static void extr_unload();
-
+void extr_unload();
+static char snmm_stop_print_menu();
 
 void stack_error();
 static void lcd_ping_allert();