🚸 Custom Menu Items for JyersUI (#24270)
This commit is contained in:
parent
8b8b2a7ed3
commit
11d68e3127
@ -121,6 +121,26 @@
|
||||
#define MIN_BED_TEMP 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Custom menu items with jyersLCD
|
||||
*/
|
||||
#if ENABLED(CUSTOM_MENU_CONFIG)
|
||||
#ifdef CONFIG_MENU_ITEM_5_DESC
|
||||
#define CUSTOM_MENU_COUNT 5
|
||||
#elif defined(CONFIG_MENU_ITEM_4_DESC)
|
||||
#define CUSTOM_MENU_COUNT 4
|
||||
#elif defined(CONFIG_MENU_ITEM_3_DESC)
|
||||
#define CUSTOM_MENU_COUNT 3
|
||||
#elif defined(CONFIG_MENU_ITEM_2_DESC)
|
||||
#define CUSTOM_MENU_COUNT 2
|
||||
#elif defined(CONFIG_MENU_ITEM_1_DESC)
|
||||
#define CUSTOM_MENU_COUNT 1
|
||||
#endif
|
||||
#if CUSTOM_MENU_COUNT
|
||||
#define HAS_CUSTOM_MENU 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
constexpr uint16_t TROWS = 6, MROWS = TROWS - 1,
|
||||
TITLE_HEIGHT = 30,
|
||||
MLINE = 53,
|
||||
@ -1078,7 +1098,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
|
||||
#define PREPARE_PREHEAT (PREPARE_ZOFFSET + ENABLED(HAS_PREHEAT))
|
||||
#define PREPARE_COOLDOWN (PREPARE_PREHEAT + EITHER(HAS_HOTEND, HAS_HEATED_BED))
|
||||
#define PREPARE_CHANGEFIL (PREPARE_COOLDOWN + ENABLED(ADVANCED_PAUSE_FEATURE))
|
||||
#define PREPARE_TOTAL PREPARE_CHANGEFIL
|
||||
#define PREPARE_CUSTOM_MENU (PREPARE_CHANGEFIL + ENABLED(HAS_CUSTOM_MENU))
|
||||
#define PREPARE_TOTAL PREPARE_CUSTOM_MENU
|
||||
|
||||
switch (item) {
|
||||
case PREPARE_BACK:
|
||||
@ -1153,6 +1174,18 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if HAS_CUSTOM_MENU
|
||||
case PREPARE_CUSTOM_MENU:
|
||||
#ifndef CUSTOM_MENU_CONFIG_TITLE
|
||||
#define CUSTOM_MENU_CONFIG_TITLE "Custom Commands"
|
||||
#endif
|
||||
if (draw)
|
||||
Draw_Menu_Item(row, ICON_Version, F(CUSTOM_MENU_CONFIG_TITLE));
|
||||
else
|
||||
Draw_Menu(MenuCustom);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
case PREPARE_CHANGEFIL:
|
||||
if (draw) {
|
||||
@ -1750,6 +1783,126 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
|
||||
break;
|
||||
#endif // FILAMENT_LOAD_UNLOAD_GCODES
|
||||
|
||||
#if HAS_CUSTOM_MENU
|
||||
|
||||
case MenuCustom:
|
||||
|
||||
#define CUSTOM_MENU_BACK 0
|
||||
#define CUSTOM_MENU_1 1
|
||||
#define CUSTOM_MENU_2 2
|
||||
#define CUSTOM_MENU_3 3
|
||||
#define CUSTOM_MENU_4 4
|
||||
#define CUSTOM_MENU_5 5
|
||||
#define CUSTOM_MENU_TOTAL CUSTOM_MENU_COUNT
|
||||
|
||||
switch (item) {
|
||||
case CUSTOM_MENU_BACK:
|
||||
if (draw)
|
||||
Draw_Menu_Item(row, ICON_Back, F("Back"));
|
||||
else
|
||||
Draw_Menu(Prepare, PREPARE_CUSTOM_MENU);
|
||||
break;
|
||||
|
||||
#if CUSTOM_MENU_COUNT >= 1
|
||||
case CUSTOM_MENU_1:
|
||||
if (draw)
|
||||
Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_1_DESC));
|
||||
else {
|
||||
Popup_Handler(Custom);
|
||||
//queue.inject(F(CONFIG_MENU_ITEM_1_GCODE)); // Old code
|
||||
gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_1_GCODE));
|
||||
planner.synchronize();
|
||||
Redraw_Menu();
|
||||
#if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
||||
AudioFeedback();
|
||||
#endif
|
||||
#ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
||||
queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if CUSTOM_MENU_COUNT >= 2
|
||||
case CUSTOM_MENU_2:
|
||||
if (draw)
|
||||
Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_2_DESC));
|
||||
else {
|
||||
Popup_Handler(Custom);
|
||||
gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_2_GCODE));
|
||||
planner.synchronize();
|
||||
Redraw_Menu();
|
||||
#if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
||||
AudioFeedback();
|
||||
#endif
|
||||
#ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
||||
queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if CUSTOM_MENU_COUNT >= 3
|
||||
case CUSTOM_MENU_3:
|
||||
if (draw)
|
||||
Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_3_DESC));
|
||||
else {
|
||||
Popup_Handler(Custom);
|
||||
gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_3_GCODE));
|
||||
planner.synchronize();
|
||||
Redraw_Menu();
|
||||
#if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
||||
AudioFeedback();
|
||||
#endif
|
||||
#ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
||||
queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if CUSTOM_MENU_COUNT >= 4
|
||||
case CUSTOM_MENU_4:
|
||||
if (draw)
|
||||
Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_4_DESC));
|
||||
else {
|
||||
Popup_Handler(Custom);
|
||||
gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_4_GCODE));
|
||||
planner.synchronize();
|
||||
Redraw_Menu();
|
||||
#if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
||||
AudioFeedback();
|
||||
#endif
|
||||
#ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
||||
queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if CUSTOM_MENU_COUNT >= 5
|
||||
case CUSTOM_MENU_5:
|
||||
if (draw)
|
||||
Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_5_DESC));
|
||||
else {
|
||||
Popup_Handler(Custom);
|
||||
gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_5_GCODE));
|
||||
planner.synchronize();
|
||||
Redraw_Menu();
|
||||
#if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
||||
AudioFeedback();
|
||||
#endif
|
||||
#ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
||||
queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#endif // Custom Menu
|
||||
}
|
||||
break;
|
||||
|
||||
#endif // HAS_CUSTOM_MENU
|
||||
|
||||
case Control:
|
||||
|
||||
#define CONTROL_BACK 0
|
||||
@ -3688,6 +3841,14 @@ FSTR_P CrealityDWINClass::Get_Menu_Title(uint8_t menu) {
|
||||
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
||||
case ChangeFilament: return F("Change Filament");
|
||||
#endif
|
||||
#if HAS_CUSTOM_MENU
|
||||
case MenuCustom:
|
||||
#ifdef CUSTOM_MENU_CONFIG_TITLE
|
||||
return F(CUSTOM_MENU_CONFIG_TITLE);
|
||||
#else
|
||||
return F("Custom Commands");
|
||||
#endif
|
||||
#endif
|
||||
case Control: return F("Control");
|
||||
case TempMenu: return F("Temperature");
|
||||
#if HAS_HOTEND || HAS_HEATED_BED
|
||||
@ -3753,6 +3914,9 @@ uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) {
|
||||
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
||||
case ChangeFilament: return CHANGEFIL_TOTAL;
|
||||
#endif
|
||||
#if HAS_CUSTOM_MENU
|
||||
case MenuCustom: return CUSTOM_MENU_TOTAL;
|
||||
#endif
|
||||
case Control: return CONTROL_TOTAL;
|
||||
case TempMenu: return TEMP_TOTAL;
|
||||
#if HAS_HOTEND || HAS_HEATED_BED
|
||||
@ -3831,6 +3995,7 @@ void CrealityDWINClass::Popup_Handler(PopupID popupid, bool option/*=false*/) {
|
||||
case Runout: Draw_Popup(F("Filament Runout"), F(""), F(""), Wait, ICON_BLTouch); break;
|
||||
case PIDWait: Draw_Popup(F("PID Autotune"), F("in process"), F("Please wait until done."), Wait, ICON_BLTouch); break;
|
||||
case Resuming: Draw_Popup(F("Resuming Print"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break;
|
||||
case Custom: Draw_Popup(F("Running Custom GCode"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ enum processID : uint8_t {
|
||||
enum PopupID : uint8_t {
|
||||
Pause, Stop, Resume, SaveLevel, ETemp, ConfFilChange, PurgeMore, MeshSlot,
|
||||
Level, Home, MoveWait, Heating, FilLoad, FilChange, TempWarn, Runout, PIDWait, Resuming, ManualProbing,
|
||||
FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete
|
||||
FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom
|
||||
};
|
||||
|
||||
enum menuID : uint8_t {
|
||||
@ -55,6 +55,7 @@ enum menuID : uint8_t {
|
||||
ZOffset,
|
||||
Preheat,
|
||||
ChangeFilament,
|
||||
MenuCustom,
|
||||
Control,
|
||||
TempMenu,
|
||||
PID,
|
||||
|
Loading…
Reference in New Issue
Block a user