Add Shutdown host to LCD Menu

Add "Shutdown host" entry to LCD menu if printer is not active and host is connected.
This commit is contained in:
sarusani 2023-12-02 12:06:24 +01:00
parent ba027dd41e
commit 49f9d7abdc
3 changed files with 15 additions and 1 deletions

View File

@ -104,6 +104,7 @@ const char MSG_SELFTEST_WIRINGERROR[] PROGMEM_I1 = ISTR("Wiring error"); ////MSG
const char MSG_SETTINGS[] PROGMEM_I1 = ISTR("Settings"); ////MSG_SETTINGS c=18
const char MSG_SET_READY[] PROGMEM_I1 = ISTR("Set Ready"); ////MSG_SET_READY c=18
const char MSG_SET_NOT_READY[] PROGMEM_I1 = ISTR("Set not Ready"); ////MSG_SET_NOT_READY c=18
const char MSG_SHUTDOWN_HOST[] PROGMEM_I1 = ISTR("Shutdown host"); ////MSG_SHUTDOWN_HOST c=18
const char MSG_SELECT_LANGUAGE[] PROGMEM_I1 = ISTR("Select language"); ////MSG_SELECT_LANGUAGE c=18
const char MSG_SORTING_FILES[] PROGMEM_I1 = ISTR("Sorting files"); ////MSG_SORTING_FILES c=20
const char MSG_TOTAL[] PROGMEM_I1 = ISTR("Total"); ////MSG_TOTAL c=6
@ -234,6 +235,7 @@ const char MSG_OCTOPRINT_READY[] PROGMEM_N1 = "// action:ready"; ////
const char MSG_OCTOPRINT_NOT_READY[] PROGMEM_N1 = "// action:not_ready"; ////
const char MSG_OCTOPRINT_START[] PROGMEM_N1 = "// action:start"; ////
const char MSG_OCTOPRINT_UVLO_RECOVERY_READY[] PROGMEM_N1 = "// action:uvlo_recovery_ready"; ////
const char MSG_HOST_ACTION_SHUTDOWN[] PROGMEM_N1 = "//action:shutdown"; ////
const char MSG_FANCHECK_HOTEND[] PROGMEM_N1 = "Err:HOTEND FAN ERROR"; ////c=20
const char MSG_FANCHECK_PRINT[] PROGMEM_N1 = "Err:PRINT FAN ERROR"; ////c=20
const char MSG_M112_KILL[] PROGMEM_N1 = "M112 called. Emergency Stop."; ////c=20

View File

@ -106,6 +106,7 @@ extern const char MSG_SELFTEST_WIRINGERROR[];
extern const char MSG_SETTINGS[];
extern const char MSG_SET_READY[];
extern const char MSG_SET_NOT_READY[];
extern const char MSG_SHUTDOWN_HOST[];
extern const char MSG_SELECT_LANGUAGE[];
extern const char MSG_SORTING_FILES[];
extern const char MSG_TOTAL[];
@ -238,6 +239,7 @@ extern const char MSG_OCTOPRINT_READY[];
extern const char MSG_OCTOPRINT_NOT_READY[];
extern const char MSG_OCTOPRINT_START[];
extern const char MSG_OCTOPRINT_UVLO_RECOVERY_READY[];
extern const char MSG_HOST_ACTION_SHUTDOWN[];
extern const char MSG_FANCHECK_HOTEND[];
extern const char MSG_FANCHECK_PRINT[];
extern const char MSG_M112_KILL[];

View File

@ -5137,6 +5137,12 @@ static void lcd_printer_ready_state_toggle()
}
}
static void lcd_shutdown_menu()
{
SERIAL_ECHOLNRPGM(MSG_HOST_ACTION_SHUTDOWN);
lcd_return_to_status();
}
//! @brief Show Main Menu
//!
//! @code{.unparsed}
@ -5331,10 +5337,14 @@ static void lcd_main_menu()
if (MMU2::mmu2.Enabled()) {
MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu);////MSG_MMU_FAIL_STATS c=18
}
if (!printer_active() && M79_timer_get_status()) {
MENU_ITEM_FUNCTION_P(_T(MSG_SHUTDOWN_HOST), lcd_shutdown_menu);
}
MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT c=18
MENU_END();
}