From 2363f19a626bc3d9921c13044dec7c375fe4e39a Mon Sep 17 00:00:00 2001 From: leptun Date: Fri, 20 Sep 2019 21:07:20 +0300 Subject: [PATCH] Minor tweaks for usb printing --- Firmware/Marlin.h | 9 ++++----- Firmware/Marlin_main.cpp | 6 +++++- Firmware/ultralcd.cpp | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 3c96cfc0..ee7f15d8 100755 --- a/Firmware/Marlin.h +++ b/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; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b73ef594..3e1372ed 100755 --- a/Firmware/Marlin_main.cpp +++ b/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 diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 87a64e72..0fb1d3de 100755 --- a/Firmware/ultralcd.cpp +++ b/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;