Browse Source

T? code initial version

PavelSindler 7 years ago
parent
commit
db11abf5e5

+ 7 - 2
Firmware/Marlin_main.cpp

@@ -5484,11 +5484,16 @@ case 404:  //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
 	  int index;
 	  for (index = 1; *(strchr_pointer + index) == ' ' || *(strchr_pointer + index) == '\t'; index++);
 	   
-	  if (*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '9') {
+	  if ((*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '9') && *(strchr_pointer + index) != '?') {
 		  SERIAL_ECHOLNPGM("Invalid T code.");
 	  }
 	  else {
-		  tmp_extruder = code_value();
+		  if (*(strchr_pointer + index) == '?') {
+			  tmp_extruder = choose_extruder_menu();
+		  }
+		  else {
+			  tmp_extruder = code_value();
+		  }
 		  snmm_filaments_used |= (1 << tmp_extruder); //for stop print
 #ifdef SNMM
 		  snmm_extruder = tmp_extruder;

+ 5 - 0
Firmware/language_all.cpp

@@ -605,6 +605,11 @@ const char * const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM] PROGMEM = {
 	MSG_CHANGING_FILAMENT_DE
 };
 
+const char MSG_CHOOSE_EXTRUDER_EN[] PROGMEM = "Choose extruder:";
+const char * const MSG_CHOOSE_EXTRUDER_LANG_TABLE[1] PROGMEM = {
+	MSG_CHOOSE_EXTRUDER_EN
+};
+
 const char MSG_CLEAN_NOZZLE_E_EN[] PROGMEM = "E calibration finished. Please clean the nozzle. Click when done.";
 const char MSG_CLEAN_NOZZLE_E_CZ[] PROGMEM = "E kalibrace ukoncena. Prosim ocistete trysku. Po te potvrdte tlacitkem.";
 const char MSG_CLEAN_NOZZLE_E_IT[] PROGMEM = "Calibrazione E terminata. Si prega di pulire l'ugello. Click per continuare.";

+ 2 - 0
Firmware/language_all.h

@@ -122,6 +122,8 @@ extern const char* const MSG_CHANGE_SUCCESS_LANG_TABLE[LANG_NUM];
 #define MSG_CHANGE_SUCCESS LANG_TABLE_SELECT(MSG_CHANGE_SUCCESS_LANG_TABLE)
 extern const char* const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM];
 #define MSG_CHANGING_FILAMENT LANG_TABLE_SELECT(MSG_CHANGING_FILAMENT_LANG_TABLE)
+extern const char* const MSG_CHOOSE_EXTRUDER_LANG_TABLE[1];
+#define MSG_CHOOSE_EXTRUDER LANG_TABLE_SELECT_EXPLICIT(MSG_CHOOSE_EXTRUDER_LANG_TABLE, 0)
 extern const char* const MSG_CLEAN_NOZZLE_E_LANG_TABLE[LANG_NUM];
 #define MSG_CLEAN_NOZZLE_E LANG_TABLE_SELECT(MSG_CLEAN_NOZZLE_E_LANG_TABLE)
 extern const char* const MSG_CNG_SDCARD_LANG_TABLE[1];

+ 1 - 0
Firmware/language_en.h

@@ -296,5 +296,6 @@
 #define(length=19, lines=1) MSG_ALL								"All"
 #define(length=19, lines=1) MSG_USED							"Used during print"
 #define(length=19, lines=1) MSG_CURRENT							"Current"
+#define(length=20, lines=1)	MSG_CHOOSE_EXTRUDER					"Choose extruder:"
 
 

+ 88 - 0
Firmware/ultralcd.cpp

@@ -2941,6 +2941,94 @@ static char snmm_stop_print_menu() { //menu for choosing which filaments will be
 	
 }
 
+char choose_extruder_menu() {
+
+	int items_no = 4;
+	int first = 0;
+	int enc_dif = 0;
+	char cursor_pos = 1;
+	
+	enc_dif = encoderDiff;
+	lcd_implementation_clear();
+	
+	lcd_printPGM(MSG_CHOOSE_EXTRUDER);
+	lcd.setCursor(0, 1);
+	lcd.print(">");
+	for (int i = 0; i < 3; i++) {
+		lcd_print_at_PGM(1, i + 1, PSTR("Extruder"));
+	}
+
+	while (1) {
+
+		for (int i = 0; i < 3; i++) {
+			lcd.setCursor(10, i+1);
+			lcd.print(first + i + 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 (first < items_no - 3) {
+						first++;
+						lcd_implementation_clear();
+						lcd_printPGM(MSG_CHOOSE_EXTRUDER);
+						for (int i = 0; i < 3; i++) {
+							lcd_print_at_PGM(1, i + 1, PSTR("Extruder"));
+						}
+					}
+				}
+
+				if (cursor_pos < 1) {
+					cursor_pos = 1;
+					if (first > 0) {
+						first--;
+						lcd_implementation_clear();
+						lcd_printPGM(MSG_CHOOSE_EXTRUDER);
+						for (int i = 0; i < 3; i++) {
+							lcd_print_at_PGM(1, i + 1, PSTR("Extruder"));
+						}
+					}
+				}
+				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()) {
+			lcd_update(2);
+			while (lcd_clicked());
+			delay(10);
+			while (lcd_clicked());
+			return(cursor_pos + first - 1);
+			
+		}
+
+	}
+
+}
+
 
 char reset_menu() {
 #ifdef SNMM

+ 1 - 0
Firmware/ultralcd.h

@@ -248,6 +248,7 @@ union MenuData;
 
 void bowden_menu();
 char reset_menu();
+char choose_extruder_menu();
 
 void lcd_pinda_calibration_menu();
 void lcd_calibrate_pinda();