Add pause/resume to USB/host prints via LCD menu

Depending if SD or USB/host print the firmware sends
- SD print: `// action:paused` or `// action:resumed` are send to inform USB/Host
- USB/host print: `// action:pause` or `// action:resume` are send to trigger the USB/host to handle it

- USB/host must handle `// action:pause` and `// action:resume` correctly to work
  - Tested with Octoprint
    - It handles every thing correctly
    - Any combination of Octoprint and/or LCD `pause` and `resume` working correctly
  - Tested with Pronterface
    - It pauses BUT doesn't send the printer in pause position, and so it is not possible to `resume` from LCD menu
    - I guess some Macros can fix that.
  - Repetier Host/Server documentation shows that it should work. Not tested.

Could save 56 bytes in first step and additional 38 bytes adding `MSG_PAUSE_PRINT` to messages.c/.h

Updated `lang_en*.txt`
@todo Polish translation is 19 characters long (it still fits) BUT should be corrected to 18 chars.
This commit is contained in:
3d-gussner 2021-02-03 10:42:25 +01:00
parent 0bda4504c1
commit 2ba24fe0d4
10 changed files with 68 additions and 44 deletions

View File

@ -70,6 +70,7 @@ const char MSG_MMU_LOAD_FAILS[] PROGMEM_I1 = ISTR("MMU load fails"); ////c=14
const char MSG_NO[] PROGMEM_I1 = ISTR("No"); ////
const char MSG_NOZZLE[] PROGMEM_I1 = ISTR("Nozzle"); ////
const char MSG_PAPER[] PROGMEM_I1 = ISTR("Place a sheet of paper under the nozzle during the calibration of first 4 points. If the nozzle catches the paper, power off the printer immediately."); ////c=20 r=10
const char MSG_PAUSE_PRINT[] PROGMEM_I1 = ISTR("Pause print");////c=18
const char MSG_PLACE_STEEL_SHEET[] PROGMEM_I1 = ISTR("Please place steel sheet on heatbed."); ////c=20 r=4
const char MSG_PLEASE_WAIT[] PROGMEM_I1 = ISTR("Please wait"); ////c=20
const char MSG_POWER_FAILURES[] PROGMEM_I1 = ISTR("Power failures"); ////c=14
@ -188,7 +189,9 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; ////
const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; ////
const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; ////
const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; ////
const char MSG_OCTOPRINT_PAUSE[] PROGMEM_N1 = "// action:pause"; ////
const char MSG_OCTOPRINT_PAUSED[] PROGMEM_N1 = "// action:paused"; ////
const char MSG_OCTOPRINT_RESUME[] PROGMEM_N1 = "// action:resume"; ////
const char MSG_OCTOPRINT_RESUMED[] PROGMEM_N1 = "// action:resumed"; ////
const char MSG_OCTOPRINT_CANCEL[] PROGMEM_N1 = "// action:cancel"; ////
const char MSG_FANCHECK_EXTRUDER[] PROGMEM_N1 = "Err: EXTR. FAN ERROR"; ////c=20

View File

@ -69,6 +69,7 @@ extern const char MSG_MMU_LOAD_FAILS[];
extern const char MSG_NO[];
extern const char MSG_NOZZLE[];
extern const char MSG_PAPER[];
extern const char MSG_PAUSE_PRINT[];
extern const char MSG_PLACE_STEEL_SHEET[];
extern const char MSG_PLEASE_WAIT[];
extern const char MSG_POWER_FAILURES[];
@ -188,7 +189,9 @@ extern const char MSG_ERR_STOPPED[];
extern const char MSG_ENDSTOP_HIT[];
extern const char MSG_EJECT_FILAMENT[];
extern const char MSG_CUT_FILAMENT[];
extern const char MSG_OCTOPRINT_PAUSE[];
extern const char MSG_OCTOPRINT_PAUSED[];
extern const char MSG_OCTOPRINT_RESUME[];
extern const char MSG_OCTOPRINT_RESUMED[];
extern const char MSG_OCTOPRINT_CANCEL[];
extern const char MSG_FANCHECK_EXTRUDER[];

View File

@ -1539,6 +1539,12 @@ void lcd_pause_print()
}
}
//! @brief Pause USB/host print, disable nozzle heater, move to park position
void lcd_pause_usb_print()
{
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint
}
float move_menu_scale;
static void lcd_move_menu_axis();
@ -6497,6 +6503,12 @@ void lcd_resume_print()
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint
}
//! @brief Resume paused USB/host print
void lcd_resume_usb_print()
{
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUME); //resume octoprint
}
static void change_sheet()
{
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), selected_sheet);
@ -6631,44 +6643,50 @@ static void lcd_main_menu()
MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT
}
if(isPrintPaused && saved_printing_type == PRINTING_TYPE_USB)
if (mesh_bed_leveling_flag == false && homing_flag == false && !isPrintPaused)
{
if (IS_SD_PRINTING)
{
MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);////MSG_PAUSE_PRINT c=18
}
else if (is_usb_printing)
{
MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);////MSG_PAUSE_PRINT c=18
}
}
if(isPrintPaused)
{
#ifdef FANCHECK
if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK))
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18
#else
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18
#endif
}
#ifdef SDSUPPORT
if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal)
{
if (card.isFileOpen())
if (is_usb_printing)
{
if (mesh_bed_leveling_flag == false && homing_flag == false) {
if (card.sdprinting)
{
MENU_ITEM_FUNCTION_P(_i("Pause print"), lcd_pause_print);////MSG_PAUSE_PRINT
}
else if(isPrintPaused)
{
#ifdef FANCHECK
if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK))
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18
#else
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18
#endif
}
MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
}
}
else if (lcd_commands_type == LcdCommands::Layer1Cal && mesh_bed_leveling_flag == false && homing_flag == false) {
//MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18
}
else
{
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18
}
}
#else
if (is_usb_printing)
{
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18
}
else
{
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18
}
#endif //FANCHECK
}
if(IS_SD_PRINTING || is_usb_printing || isPrintPaused)
{
MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
}
#ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code
if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal)
{
if (!card.isFileOpen())
{
if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal))
{
@ -6680,7 +6698,7 @@ static void lcd_main_menu()
}
#if SDCARDDETECT < 1
MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD
#endif
#endif //SDCARDDETECT
}
} else
@ -6689,9 +6707,9 @@ static void lcd_main_menu()
MENU_ITEM_SUBMENU_P(_i("No SD card"), lcd_sdcard_menu);////MSG_NO_CARD
#if SDCARDDETECT < 1
MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface////MSG_INIT_SDCARD
#endif
#endif //SDCARDDETECT
}
#endif
#endif //SDSUPPORT
if(!isPrintPaused && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal))
{

View File

@ -544,7 +544,7 @@
#
"Nozzle FAN"
#MSG_PAUSE_PRINT
#MSG_PAUSE_PRINT c=18
"Pause print"
#MSG_PID_RUNNING c=20 r=1

View File

@ -726,7 +726,7 @@
"Nozzle FAN"
"Vent. trysky"
#MSG_PAUSE_PRINT
#MSG_PAUSE_PRINT c=18
"Pause print"
"Pozastavit tisk"

View File

@ -726,7 +726,7 @@
"Nozzle FAN"
"Duesevent."
#MSG_PAUSE_PRINT
#MSG_PAUSE_PRINT c=18
"Pause print"
"Druck pausieren"

View File

@ -726,7 +726,7 @@
"Nozzle FAN"
"Vent. capa"
#MSG_PAUSE_PRINT
#MSG_PAUSE_PRINT c=18
"Pause print"
"Pausar impresion"

View File

@ -726,7 +726,7 @@
"Nozzle FAN"
"Vent. buse"
#MSG_PAUSE_PRINT
#MSG_PAUSE_PRINT c=18
"Pause print"
"Pause de l'impr."

View File

@ -726,7 +726,7 @@
"Nozzle FAN"
"Ventola estrusore"
#MSG_PAUSE_PRINT
#MSG_PAUSE_PRINT c=18
"Pause print"
"Metti in pausa"

View File

@ -726,7 +726,7 @@
"Nozzle FAN"
"WentHotend"
#MSG_PAUSE_PRINT
#MSG_PAUSE_PRINT c=18
"Pause print"
"Wstrzymanie wydruku"