|
@@ -121,6 +121,26 @@
|
121
|
121
|
#define MIN_BED_TEMP 0
|
122
|
122
|
#endif
|
123
|
123
|
|
|
124
|
+/**
|
|
125
|
+ * Custom menu items with jyersLCD
|
|
126
|
+ */
|
|
127
|
+#if ENABLED(CUSTOM_MENU_CONFIG)
|
|
128
|
+ #ifdef CONFIG_MENU_ITEM_5_DESC
|
|
129
|
+ #define CUSTOM_MENU_COUNT 5
|
|
130
|
+ #elif defined(CONFIG_MENU_ITEM_4_DESC)
|
|
131
|
+ #define CUSTOM_MENU_COUNT 4
|
|
132
|
+ #elif defined(CONFIG_MENU_ITEM_3_DESC)
|
|
133
|
+ #define CUSTOM_MENU_COUNT 3
|
|
134
|
+ #elif defined(CONFIG_MENU_ITEM_2_DESC)
|
|
135
|
+ #define CUSTOM_MENU_COUNT 2
|
|
136
|
+ #elif defined(CONFIG_MENU_ITEM_1_DESC)
|
|
137
|
+ #define CUSTOM_MENU_COUNT 1
|
|
138
|
+ #endif
|
|
139
|
+ #if CUSTOM_MENU_COUNT
|
|
140
|
+ #define HAS_CUSTOM_MENU 1
|
|
141
|
+ #endif
|
|
142
|
+#endif
|
|
143
|
+
|
124
|
144
|
constexpr uint16_t TROWS = 6, MROWS = TROWS - 1,
|
125
|
145
|
TITLE_HEIGHT = 30,
|
126
|
146
|
MLINE = 53,
|
|
@@ -1078,7 +1098,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
|
1078
|
1098
|
#define PREPARE_PREHEAT (PREPARE_ZOFFSET + ENABLED(HAS_PREHEAT))
|
1079
|
1099
|
#define PREPARE_COOLDOWN (PREPARE_PREHEAT + EITHER(HAS_HOTEND, HAS_HEATED_BED))
|
1080
|
1100
|
#define PREPARE_CHANGEFIL (PREPARE_COOLDOWN + ENABLED(ADVANCED_PAUSE_FEATURE))
|
1081
|
|
- #define PREPARE_TOTAL PREPARE_CHANGEFIL
|
|
1101
|
+ #define PREPARE_CUSTOM_MENU (PREPARE_CHANGEFIL + ENABLED(HAS_CUSTOM_MENU))
|
|
1102
|
+ #define PREPARE_TOTAL PREPARE_CUSTOM_MENU
|
1082
|
1103
|
|
1083
|
1104
|
switch (item) {
|
1084
|
1105
|
case PREPARE_BACK:
|
|
@@ -1153,6 +1174,18 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
|
1153
|
1174
|
break;
|
1154
|
1175
|
#endif
|
1155
|
1176
|
|
|
1177
|
+ #if HAS_CUSTOM_MENU
|
|
1178
|
+ case PREPARE_CUSTOM_MENU:
|
|
1179
|
+ #ifndef CUSTOM_MENU_CONFIG_TITLE
|
|
1180
|
+ #define CUSTOM_MENU_CONFIG_TITLE "Custom Commands"
|
|
1181
|
+ #endif
|
|
1182
|
+ if (draw)
|
|
1183
|
+ Draw_Menu_Item(row, ICON_Version, F(CUSTOM_MENU_CONFIG_TITLE));
|
|
1184
|
+ else
|
|
1185
|
+ Draw_Menu(MenuCustom);
|
|
1186
|
+ break;
|
|
1187
|
+ #endif
|
|
1188
|
+
|
1156
|
1189
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
1157
|
1190
|
case PREPARE_CHANGEFIL:
|
1158
|
1191
|
if (draw) {
|
|
@@ -1750,6 +1783,126 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
|
1750
|
1783
|
break;
|
1751
|
1784
|
#endif // FILAMENT_LOAD_UNLOAD_GCODES
|
1752
|
1785
|
|
|
1786
|
+ #if HAS_CUSTOM_MENU
|
|
1787
|
+
|
|
1788
|
+ case MenuCustom:
|
|
1789
|
+
|
|
1790
|
+ #define CUSTOM_MENU_BACK 0
|
|
1791
|
+ #define CUSTOM_MENU_1 1
|
|
1792
|
+ #define CUSTOM_MENU_2 2
|
|
1793
|
+ #define CUSTOM_MENU_3 3
|
|
1794
|
+ #define CUSTOM_MENU_4 4
|
|
1795
|
+ #define CUSTOM_MENU_5 5
|
|
1796
|
+ #define CUSTOM_MENU_TOTAL CUSTOM_MENU_COUNT
|
|
1797
|
+
|
|
1798
|
+ switch (item) {
|
|
1799
|
+ case CUSTOM_MENU_BACK:
|
|
1800
|
+ if (draw)
|
|
1801
|
+ Draw_Menu_Item(row, ICON_Back, F("Back"));
|
|
1802
|
+ else
|
|
1803
|
+ Draw_Menu(Prepare, PREPARE_CUSTOM_MENU);
|
|
1804
|
+ break;
|
|
1805
|
+
|
|
1806
|
+ #if CUSTOM_MENU_COUNT >= 1
|
|
1807
|
+ case CUSTOM_MENU_1:
|
|
1808
|
+ if (draw)
|
|
1809
|
+ Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_1_DESC));
|
|
1810
|
+ else {
|
|
1811
|
+ Popup_Handler(Custom);
|
|
1812
|
+ //queue.inject(F(CONFIG_MENU_ITEM_1_GCODE)); // Old code
|
|
1813
|
+ gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_1_GCODE));
|
|
1814
|
+ planner.synchronize();
|
|
1815
|
+ Redraw_Menu();
|
|
1816
|
+ #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
|
1817
|
+ AudioFeedback();
|
|
1818
|
+ #endif
|
|
1819
|
+ #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
|
1820
|
+ queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
|
1821
|
+ #endif
|
|
1822
|
+ }
|
|
1823
|
+ break;
|
|
1824
|
+ #endif
|
|
1825
|
+
|
|
1826
|
+ #if CUSTOM_MENU_COUNT >= 2
|
|
1827
|
+ case CUSTOM_MENU_2:
|
|
1828
|
+ if (draw)
|
|
1829
|
+ Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_2_DESC));
|
|
1830
|
+ else {
|
|
1831
|
+ Popup_Handler(Custom);
|
|
1832
|
+ gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_2_GCODE));
|
|
1833
|
+ planner.synchronize();
|
|
1834
|
+ Redraw_Menu();
|
|
1835
|
+ #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
|
1836
|
+ AudioFeedback();
|
|
1837
|
+ #endif
|
|
1838
|
+ #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
|
1839
|
+ queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
|
1840
|
+ #endif
|
|
1841
|
+ }
|
|
1842
|
+ break;
|
|
1843
|
+ #endif
|
|
1844
|
+
|
|
1845
|
+ #if CUSTOM_MENU_COUNT >= 3
|
|
1846
|
+ case CUSTOM_MENU_3:
|
|
1847
|
+ if (draw)
|
|
1848
|
+ Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_3_DESC));
|
|
1849
|
+ else {
|
|
1850
|
+ Popup_Handler(Custom);
|
|
1851
|
+ gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_3_GCODE));
|
|
1852
|
+ planner.synchronize();
|
|
1853
|
+ Redraw_Menu();
|
|
1854
|
+ #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
|
1855
|
+ AudioFeedback();
|
|
1856
|
+ #endif
|
|
1857
|
+ #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
|
1858
|
+ queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
|
1859
|
+ #endif
|
|
1860
|
+ }
|
|
1861
|
+ break;
|
|
1862
|
+ #endif
|
|
1863
|
+
|
|
1864
|
+ #if CUSTOM_MENU_COUNT >= 4
|
|
1865
|
+ case CUSTOM_MENU_4:
|
|
1866
|
+ if (draw)
|
|
1867
|
+ Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_4_DESC));
|
|
1868
|
+ else {
|
|
1869
|
+ Popup_Handler(Custom);
|
|
1870
|
+ gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_4_GCODE));
|
|
1871
|
+ planner.synchronize();
|
|
1872
|
+ Redraw_Menu();
|
|
1873
|
+ #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
|
1874
|
+ AudioFeedback();
|
|
1875
|
+ #endif
|
|
1876
|
+ #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
|
1877
|
+ queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
|
1878
|
+ #endif
|
|
1879
|
+ }
|
|
1880
|
+ break;
|
|
1881
|
+ #endif
|
|
1882
|
+
|
|
1883
|
+ #if CUSTOM_MENU_COUNT >= 5
|
|
1884
|
+ case CUSTOM_MENU_5:
|
|
1885
|
+ if (draw)
|
|
1886
|
+ Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_5_DESC));
|
|
1887
|
+ else {
|
|
1888
|
+ Popup_Handler(Custom);
|
|
1889
|
+ gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_5_GCODE));
|
|
1890
|
+ planner.synchronize();
|
|
1891
|
+ Redraw_Menu();
|
|
1892
|
+ #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK)
|
|
1893
|
+ AudioFeedback();
|
|
1894
|
+ #endif
|
|
1895
|
+ #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN
|
|
1896
|
+ queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE));
|
|
1897
|
+ #endif
|
|
1898
|
+ }
|
|
1899
|
+ break;
|
|
1900
|
+ #endif // Custom Menu
|
|
1901
|
+ }
|
|
1902
|
+ break;
|
|
1903
|
+
|
|
1904
|
+ #endif // HAS_CUSTOM_MENU
|
|
1905
|
+
|
1753
|
1906
|
case Control:
|
1754
|
1907
|
|
1755
|
1908
|
#define CONTROL_BACK 0
|
|
@@ -3688,6 +3841,14 @@ FSTR_P CrealityDWINClass::Get_Menu_Title(uint8_t menu) {
|
3688
|
3841
|
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
3689
|
3842
|
case ChangeFilament: return F("Change Filament");
|
3690
|
3843
|
#endif
|
|
3844
|
+ #if HAS_CUSTOM_MENU
|
|
3845
|
+ case MenuCustom:
|
|
3846
|
+ #ifdef CUSTOM_MENU_CONFIG_TITLE
|
|
3847
|
+ return F(CUSTOM_MENU_CONFIG_TITLE);
|
|
3848
|
+ #else
|
|
3849
|
+ return F("Custom Commands");
|
|
3850
|
+ #endif
|
|
3851
|
+ #endif
|
3691
|
3852
|
case Control: return F("Control");
|
3692
|
3853
|
case TempMenu: return F("Temperature");
|
3693
|
3854
|
#if HAS_HOTEND || HAS_HEATED_BED
|
|
@@ -3753,6 +3914,9 @@ uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) {
|
3753
|
3914
|
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
3754
|
3915
|
case ChangeFilament: return CHANGEFIL_TOTAL;
|
3755
|
3916
|
#endif
|
|
3917
|
+ #if HAS_CUSTOM_MENU
|
|
3918
|
+ case MenuCustom: return CUSTOM_MENU_TOTAL;
|
|
3919
|
+ #endif
|
3756
|
3920
|
case Control: return CONTROL_TOTAL;
|
3757
|
3921
|
case TempMenu: return TEMP_TOTAL;
|
3758
|
3922
|
#if HAS_HOTEND || HAS_HEATED_BED
|
|
@@ -3831,6 +3995,7 @@ void CrealityDWINClass::Popup_Handler(PopupID popupid, bool option/*=false*/) {
|
3831
|
3995
|
case Runout: Draw_Popup(F("Filament Runout"), F(""), F(""), Wait, ICON_BLTouch); break;
|
3832
|
3996
|
case PIDWait: Draw_Popup(F("PID Autotune"), F("in process"), F("Please wait until done."), Wait, ICON_BLTouch); break;
|
3833
|
3997
|
case Resuming: Draw_Popup(F("Resuming Print"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break;
|
|
3998
|
+ case Custom: Draw_Popup(F("Running Custom GCode"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break;
|
3834
|
3999
|
default: break;
|
3835
|
4000
|
}
|
3836
|
4001
|
}
|