Kaynağa Gözat

Minor tweaks for usb printing

leptun 4 yıl önce
ebeveyn
işleme
2363f19a62
3 değiştirilmiş dosya ile 10 ekleme ve 6 silme
  1. 4 5
      Firmware/Marlin.h
  2. 5 1
      Firmware/Marlin_main.cpp
  3. 1 0
      Firmware/ultralcd.cpp

+ 4 - 5
Firmware/Marlin.h

@@ -240,11 +240,6 @@ void prepare_move();
 void kill(const char *full_screen_message = NULL, unsigned char id = 0);
 void Stop();
 
-#define PRINTING_TYPE_SD 0
-#define PRINTING_TYPE_USB 1
-#define PRINTING_TYPE_NONE 2
-extern uint8_t saved_printing_type;
-
 bool IsStopped();
 
 //put an ASCII command at the end of the current buffer.
@@ -381,6 +376,10 @@ extern char dir_names[3][9];
 extern int8_t lcd_change_fil_state;
 // save/restore printing
 extern bool saved_printing;
+extern uint8_t saved_printing_type;
+#define PRINTING_TYPE_SD 0
+#define PRINTING_TYPE_USB 1
+#define PRINTING_TYPE_NONE 2
 
 //save/restore printing in case that mmu is not responding
 extern bool mmu_print_saved;

+ 5 - 1
Firmware/Marlin_main.cpp

@@ -1747,6 +1747,10 @@ void loop()
 	{
 		is_usb_printing = false;
 	}
+    if (isPrintPaused && saved_printing_type == PRINTING_TYPE_USB) //keep believing that usb is being printed. Prevents accessing dangerous menus while pausing.
+	{
+		is_usb_printing = true;
+	}
     
 #ifdef FANCHECK
     if ((saved_printing_type == PRINTING_TYPE_USB) && fan_check_error)
@@ -3463,7 +3467,7 @@ void process_commands()
             // SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED);
             lcd_pause_print();
         } // otherwise it has already been reported, so just ignore further processing
-        if(saved_printing_type == PRINTING_TYPE_USB) return; //ignore usb stream.
+        return; //ignore usb stream. It is reenabled by selecting resume from the lcd.
     }
 #endif
 

+ 1 - 0
Firmware/ultralcd.cpp

@@ -6847,6 +6847,7 @@ void lcd_print_stop()
           SERIAL_ECHOLNPGM("// action:cancel");   // for Octoprint
           }
 	saved_printing = false;
+    saved_printing_type = PRINTING_TYPE_NONE;
 	cancel_heatup = true;
 #ifdef MESH_BED_LEVELING
 	mbl.active = false;