Selaa lähdekoodia

Merge pull request #396 from XPila/MK3

Mk3
PavelSindler 6 vuotta sitten
vanhempi
commit
8bd84ba4fd

+ 14 - 7
Firmware/Marlin_main.cpp

@@ -593,7 +593,7 @@ extern int8_t CrashDetectMenu;
 
 void crashdet_enable()
 {
-	MYSERIAL.println("crashdet_enable"); 
+//	MYSERIAL.println("crashdet_enable"); 
 	tmc2130_sg_stop_on_crash = true;
 	eeprom_update_byte((uint8_t*)EEPROM_CRASH_DET, 0xFF); 
 	CrashDetectMenu = 1;
@@ -602,7 +602,7 @@ void crashdet_enable()
 
 void crashdet_disable()
 {
-	MYSERIAL.println("crashdet_disable"); 
+//	MYSERIAL.println("crashdet_disable"); 
 	tmc2130_sg_stop_on_crash = false;
 	tmc2130_sg_crash = false;
 	eeprom_update_byte((uint8_t*)EEPROM_CRASH_DET, 0x00); 
@@ -657,7 +657,7 @@ void crashdet_detected()
 #endif
 	lcd_update_enable(true);
 	lcd_update(2);
-	lcd_setstatuspgm(PSTR("Crash detected!"));
+	lcd_setstatuspgm(MSG_CRASH_DETECTED);
 	if (yesno)
 	{
 		enquecommand_P(PSTR("G28 X"));
@@ -2167,6 +2167,10 @@ void gcode_M701()
 	plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence
 	st_synchronize();
 
+	tone(BEEPER, 500);
+	delay_keep_alive(50);
+	noTone(BEEPER);
+
 	if (!farm_mode && loading_flag) {
 		bool clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true);
 
@@ -2189,6 +2193,7 @@ void gcode_M701()
 	custom_message = false;
 	custom_message_type = 0;
 #endif
+
 }
 
 void process_commands()
@@ -5701,13 +5706,15 @@ case 404:  //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
         target[E_AXIS]+= FILAMENTCHANGE_FINALFEED ;
         plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EXFEED, active_extruder); 
         
- 
-
-        
         //Wait for user to check the state
         lcd_change_fil_state = 0;
         lcd_loading_filament();
-        while ((lcd_change_fil_state == 0)||(lcd_change_fil_state != 1)){
+
+		tone(BEEPER, 500);
+		delay_keep_alive(50);
+		noTone(BEEPER);
+
+		while ((lcd_change_fil_state == 0)||(lcd_change_fil_state != 1)){
           lcd_change_fil_state = 0;
 		  KEEPALIVE_STATE(PAUSED_FOR_USER);
           lcd_alright();

+ 13 - 6
Firmware/language_all.cpp

@@ -429,22 +429,29 @@ const char * const MSG_CRASHDETECT_ON_LANG_TABLE[LANG_NUM] PROGMEM = {
 	MSG_CRASHDETECT_ON_CZ
 };
 
-const char MSG_CRASH_DETECTED_EN[] PROGMEM = "Crash detected. Continue printing?";
-const char MSG_CRASH_DETECTED_CZ[] PROGMEM = "Naraz detekovan, pokracovat v tisku?";
+const char MSG_CRASH_DETECTED_EN[] PROGMEM = "Crash detected.";
+const char MSG_CRASH_DETECTED_CZ[] PROGMEM = "Detekovan naraz.";
 const char * const MSG_CRASH_DETECTED_LANG_TABLE[LANG_NUM] PROGMEM = {
 	MSG_CRASH_DETECTED_EN,
 	MSG_CRASH_DETECTED_CZ
 };
 
-const char MSG_CRASH_DET_ONLY_IN_NORMAL_EN[] PROGMEM = "Crash detection can be turned on only in Normal mode.";
-const char MSG_CRASH_DET_ONLY_IN_NORMAL_CZ[] PROGMEM = "Crash detekce muze byt zapnuta pouze v Normal modu";
+const char MSG_CRASH_DETECTED2_EN[] PROGMEM = "Crash detected. Continue printing?";
+const char MSG_CRASH_DETECTED2_CZ[] PROGMEM = "Naraz detekovan, pokracovat v tisku?";
+const char * const MSG_CRASH_DETECTED2_LANG_TABLE[LANG_NUM] PROGMEM = {
+	MSG_CRASH_DETECTED2_EN,
+	MSG_CRASH_DETECTED2_CZ
+};
+
+const char MSG_CRASH_DET_ONLY_IN_NORMAL_EN[] PROGMEM = "\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode";
+const char MSG_CRASH_DET_ONLY_IN_NORMAL_CZ[] PROGMEM = "\x1b[2JCrash detekce muze\x1b[1;0Hbyt zapnuta pouze v\x1b[2;0HNormal modu";
 const char * const MSG_CRASH_DET_ONLY_IN_NORMAL_LANG_TABLE[LANG_NUM] PROGMEM = {
 	MSG_CRASH_DET_ONLY_IN_NORMAL_EN,
 	MSG_CRASH_DET_ONLY_IN_NORMAL_CZ
 };
 
-const char MSG_CRASH_DET_STEALTH_FORCE_OFF_EN[] PROGMEM = "WARNING: Crash detection disabled in Stealth mode";
-const char MSG_CRASH_DET_STEALTH_FORCE_OFF_CZ[] PROGMEM = "POZOR: Crash detekce deaktivovana ve Stealth modu";
+const char MSG_CRASH_DET_STEALTH_FORCE_OFF_EN[] PROGMEM = "\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode";
+const char MSG_CRASH_DET_STEALTH_FORCE_OFF_CZ[] PROGMEM = "\x1b[2JPOZOR:\x1b[1;0HCrash detekce\x1b[2;0Hdeaktivovana ve\x1b[3;0HStealth modu";
 const char * const MSG_CRASH_DET_STEALTH_FORCE_OFF_LANG_TABLE[LANG_NUM] PROGMEM = {
 	MSG_CRASH_DET_STEALTH_FORCE_OFF_EN,
 	MSG_CRASH_DET_STEALTH_FORCE_OFF_CZ

+ 2 - 0
Firmware/language_all.h

@@ -156,6 +156,8 @@ extern const char* const MSG_CRASHDETECT_ON_LANG_TABLE[LANG_NUM];
 #define MSG_CRASHDETECT_ON LANG_TABLE_SELECT(MSG_CRASHDETECT_ON_LANG_TABLE)
 extern const char* const MSG_CRASH_DETECTED_LANG_TABLE[LANG_NUM];
 #define MSG_CRASH_DETECTED LANG_TABLE_SELECT(MSG_CRASH_DETECTED_LANG_TABLE)
+extern const char* const MSG_CRASH_DETECTED2_LANG_TABLE[LANG_NUM];
+#define MSG_CRASH_DETECTED2 LANG_TABLE_SELECT(MSG_CRASH_DETECTED2_LANG_TABLE)
 extern const char* const MSG_CRASH_DET_ONLY_IN_NORMAL_LANG_TABLE[LANG_NUM];
 #define MSG_CRASH_DET_ONLY_IN_NORMAL LANG_TABLE_SELECT(MSG_CRASH_DET_ONLY_IN_NORMAL_LANG_TABLE)
 extern const char* const MSG_CRASH_DET_STEALTH_FORCE_OFF_LANG_TABLE[LANG_NUM];

+ 4 - 3
Firmware/language_cz.h

@@ -359,7 +359,8 @@ ve
 #define(length=17, lines=1) MSG_FSENS_AUTOLOAD_OFF  "F. autozav. [vyp]"
 #define(length=17, lines=1) MSG_FSENS_AUTOLOAD_NA  "F. autozav. [N/A]"
 #define MSG_RECOVERING_PRINT				"Obnovovani tisku    "
-#define(length=20, lines=2) MSG_CRASH_DETECTED   "Naraz detekovan, pokracovat v tisku?"
+#define(length=20, lines=1) MSG_CRASH_DETECTED   "Detekovan naraz."
+#define(length=20, lines=2) MSG_CRASH_DETECTED2   "Naraz detekovan, pokracovat v tisku?"
 
 #define MSG_SELFTEST_AXIS					"Osa"
 #define MSG_SELFTEST_AXIS_LENGTH			"Delka osy"
@@ -389,8 +390,8 @@ ve
 #define(length=15, lines=1) MSG_MENU_TEMPERATURES           "Teploty"
 #define(length=15, lines=1) MSG_MENU_BELT_STATUS            "Stav remenu"
 
-#define(length=20, lines=4) MSG_CRASH_DET_ONLY_IN_NORMAL        "Crash detekce muze byt zapnuta pouze v Normal modu"
-#define(length=20, lines=4) MSG_CRASH_DET_STEALTH_FORCE_OFF     "POZOR: Crash detekce deaktivovana ve Stealth modu"
+#define(length=20, lines=4) MSG_CRASH_DET_ONLY_IN_NORMAL        "\x1b[2JCrash detekce muze\x1b[1;0Hbyt zapnuta pouze v\x1b[2;0HNormal modu"
+#define(length=20, lines=4) MSG_CRASH_DET_STEALTH_FORCE_OFF     "\x1b[2JPOZOR:\x1b[1;0HCrash detekce\x1b[2;0Hdeaktivovana ve\x1b[3;0HStealth modu"
 
 #define(length=20, lines=4) MSG_AUTOLOADING_ENABLED             "Automaticke zavadeni filamentu aktivni, stisknete tlacitko a vlozte filament..."
 #define(length=20, lines=4) MSG_AUTOLOADING_ONLY_IF_FSENS_ON    "Automaticke zavadeni filamentu dostupne pouze pri zapnutem filament senzoru..."

+ 4 - 3
Firmware/language_en.h

@@ -367,7 +367,8 @@
 
 #define(length=20, lines=2) MSG_RECOVER_PRINT					"Blackout occurred. Recover print?"
 #define(length=20, lines=1) MSG_RECOVERING_PRINT				"Recovering print    "
-#define(length=20, lines=2) MSG_CRASH_DETECTED					"Crash detected. Continue printing?"
+#define(length=20, lines=1) MSG_CRASH_DETECTED				"Crash detected."
+#define(length=20, lines=2) MSG_CRASH_DETECTED2				"Crash detected. Continue printing?"
 
 #define(length=15, lines=1) MSG_INFO_EXTRUDER				"Extruder info"
 #define(length=15, lines=1) MSG_MENU_VOLTAGES               "Voltages"
@@ -396,8 +397,8 @@
 #define(length=17, lines=1) MSG_SECOND_SERIAL_ON				"RPi port     [on]"
 #define(length=17, lines=1) MSG_SECOND_SERIAL_OFF				"RPi port    [off]"
 
-#define(length=20, lines=4) MSG_CRASH_DET_ONLY_IN_NORMAL        "Crash detection can be turned on only in Normal mode."
-#define(length=20, lines=4) MSG_CRASH_DET_STEALTH_FORCE_OFF     "WARNING: Crash detection disabled in Stealth mode"
+#define(length=20, lines=4) MSG_CRASH_DET_ONLY_IN_NORMAL        "\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode"
+#define(length=20, lines=4) MSG_CRASH_DET_STEALTH_FORCE_OFF     "\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode"
 
 #define(length=20, lines=4) MSG_AUTOLOADING_ENABLED              "Autoloading filament is active, just press the knob and insert filament..."
 #define(length=20, lines=4) MSG_AUTOLOADING_ONLY_IF_FSENS_ON     "Autoloading filament available only when filament sensor is turned on..."

+ 35 - 13
Firmware/ultralcd.cpp

@@ -388,6 +388,7 @@ static void lcd_status_screen()
      
       if(lcd_status_message_level == 0){
           strncpy_P(lcd_status_message, WELCOME_MSG, LCD_WIDTH);
+		lcd_finishstatus();
       }
 	if (eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME) == 255 && eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME + 1) == 255 && eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME + 2) == 255 && eeprom_read_byte((uint8_t *)EEPROM_TOTALTIME + 3) == 255)
 	{
@@ -3293,9 +3294,36 @@ static void lcd_sort_type_set() {
 }
 #endif //SDCARD_SORT_ALPHA
 
+static void lcd_crash_mode_info()
+{
+	lcd_update_enable(true);
+	static uint32_t tim = 0;
+	if ((tim + 1000) < millis())
+	{
+		fputs_P(MSG_CRASH_DET_ONLY_IN_NORMAL, lcdout);
+		tim = millis();
+	}
+	if (lcd_clicked())
+	{
+		if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) lcd_goto_menu(lcd_tune_menu, 18);
+		else lcd_goto_menu(lcd_settings_menu, 16, true, true);
+	}
+}
+
 static void lcd_crash_mode_info2()
 {
-	lcd_show_fullscreen_message_and_wait_P(MSG_CRASH_DET_STEALTH_FORCE_OFF);
+	lcd_update_enable(true);
+	static uint32_t tim = 0;
+	if ((tim + 1000) < millis())
+	{
+		fputs_P(MSG_CRASH_DET_STEALTH_FORCE_OFF, lcdout);
+		tim = millis();
+	}
+	if (lcd_clicked())
+	{
+		if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) lcd_goto_menu(lcd_tune_menu, 16);
+		else lcd_goto_menu(lcd_settings_menu, 14, true, true);
+	}
 }
 
 static void lcd_filament_autoload_info()
@@ -3311,8 +3339,6 @@ static void lcd_fsensor_fail()
 static void lcd_silent_mode_set() {
   SilentModeMenu = !SilentModeMenu;
   eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
-  if (CrashDetectMenu && SilentModeMenu)
-	  lcd_crash_mode_info2();
 #ifdef TMC2130
   st_synchronize();
   if (tmc2130_wait_standstill_xy(1000)) {}
@@ -3325,16 +3351,10 @@ static void lcd_silent_mode_set() {
   sei();
 #endif //TMC2130
   digipot_init();
-  if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL)) lcd_goto_menu(lcd_tune_menu, 8);
-  else lcd_goto_menu(lcd_settings_menu, 7);
-}
-
-static void lcd_crash_mode_info()
-{
-	lcd_show_fullscreen_message_and_wait_P(MSG_CRASH_DET_ONLY_IN_NORMAL);
+  if (CrashDetectMenu && SilentModeMenu)
+	  lcd_goto_menu(lcd_crash_mode_info2);
 }
 
-
 static void lcd_crash_mode_set()
 {
 	CrashDetectMenu = !CrashDetectMenu; //set also from crashdet_enable() and crashdet_disable()
@@ -3822,7 +3842,7 @@ static void lcd_settings_menu()
     if (CrashDetectMenu == 0) MENU_ITEM(function, MSG_CRASHDETECT_OFF, lcd_crash_mode_set);
     else MENU_ITEM(function, MSG_CRASHDETECT_ON, lcd_crash_mode_set);
   }
-  else MENU_ITEM(function, MSG_CRASHDETECT_NA, lcd_crash_mode_info);
+  else MENU_ITEM(submenu, MSG_CRASHDETECT_NA, lcd_crash_mode_info);
 
   if (temp_cal_active == false) {
 	  MENU_ITEM(function, MSG_TEMP_CALIBRATION_OFF, lcd_temp_calibration_set);
@@ -5179,7 +5199,7 @@ static void lcd_tune_menu()
     if (CrashDetectMenu == 0) MENU_ITEM(function, MSG_CRASHDETECT_OFF, lcd_crash_mode_set);
     else MENU_ITEM(function, MSG_CRASHDETECT_ON, lcd_crash_mode_set);
   }
-  else MENU_ITEM(function, MSG_CRASHDETECT_NA, lcd_crash_mode_info);
+  else MENU_ITEM(submenu, MSG_CRASHDETECT_NA, lcd_crash_mode_info);
 
   END_MENU();
 }
@@ -6512,6 +6532,7 @@ static bool check_file(const char* filename) {
 	}
 	card.printingHasFinished();
 	strncpy_P(lcd_status_message, WELCOME_MSG, LCD_WIDTH);
+	lcd_finishstatus();
 	return result;
 	
 }
@@ -6855,6 +6876,7 @@ void lcd_setstatuspgm(const char* message)
   if (lcd_status_message_level > 0)
     return;
   strncpy_P(lcd_status_message, message, LCD_WIDTH);
+  lcd_status_message[LCD_WIDTH] = 0;
   lcd_finishstatus();
 }
 void lcd_setalertstatuspgm(const char* message)