Browse Source

Merge pull request #431 from PavelSindler/fan_error_resume

SD card long pause update
XPila 6 years ago
parent
commit
975ed14cb6
2 changed files with 12 additions and 8 deletions
  1. 1 2
      Firmware/Marlin_main.cpp
  2. 11 6
      Firmware/ultralcd.cpp

+ 1 - 2
Firmware/Marlin_main.cpp

@@ -662,8 +662,7 @@ void crashdet_detected()
 	lcd_setstatuspgm(MSG_CRASH_DETECTED);
 	if (yesno)
 	{
-		enquecommand_P(PSTR("G28 X"));
-		enquecommand_P(PSTR("G28 Y"));
+		enquecommand_P(PSTR("G28 X Y"));
 		enquecommand_P(PSTR("CRASH_RECOVER"));
 	}
 	else

+ 11 - 6
Firmware/ultralcd.cpp

@@ -576,12 +576,17 @@ void lcd_commands()
 	if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE)
 	{
 		if(lcd_commands_step == 0) {
-			card.pauseSDPrint();
-			lcd_setstatuspgm(MSG_FINISHING_MOVEMENTS);
-			lcdDrawUpdate = 3;
-			lcd_commands_step = 1;
+			if (card.sdprinting) {
+				card.pauseSDPrint();
+				lcd_setstatuspgm(MSG_FINISHING_MOVEMENTS);
+				lcdDrawUpdate = 3;
+				lcd_commands_step = 1;
+			}
+			else {
+				lcd_commands_type = 0;
+			}
 		}
-		if (lcd_commands_step == 1 && !blocks_queued()) {
+		if (lcd_commands_step == 1 && !blocks_queued() && !homing_flag) {
 			lcd_setstatuspgm(MSG_PRINT_PAUSED);
 			isPrintPaused = true;
 			long_pause();
@@ -598,7 +603,7 @@ void lcd_commands()
 			lcdDrawUpdate = 3;
 			lcd_commands_step = 4;
 		}
-		if (lcd_commands_step == 1 && !blocks_queued()) {	//recover feedmultiply
+		if (lcd_commands_step == 1 && !blocks_queued() && cmd_buffer_empty()) {	//recover feedmultiply; cmd_buffer_empty() ensures that card.sdprinting is synchronized with buffered commands and thus print cant be paused until resume is finished
 			
 			sprintf_P(cmd1, PSTR("M220 S%d"), saved_feedmultiply);
 			enquecommand(cmd1);