|
@@ -0,0 +1,396 @@
|
|
1
|
+/**
|
|
2
|
+ * Marlin 3D Printer Firmware
|
|
3
|
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
4
|
+ *
|
|
5
|
+ * Based on Sprinter and grbl.
|
|
6
|
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
|
7
|
+ *
|
|
8
|
+ * This program is free software: you can redistribute it and/or modify
|
|
9
|
+ * it under the terms of the GNU General Public License as published by
|
|
10
|
+ * the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+ * (at your option) any later version.
|
|
12
|
+ *
|
|
13
|
+ * This program is distributed in the hope that it will be useful,
|
|
14
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+ * GNU General Public License for more details.
|
|
17
|
+ *
|
|
18
|
+ * You should have received a copy of the GNU General Public License
|
|
19
|
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+ *
|
|
21
|
+ */
|
|
22
|
+#pragma once
|
|
23
|
+
|
|
24
|
+#include "../ultralcd.h"
|
|
25
|
+#include "../../inc/MarlinConfig.h"
|
|
26
|
+
|
|
27
|
+extern uint32_t encoderPosition;
|
|
28
|
+extern int8_t encoderLine, encoderTopLine, screen_items;
|
|
29
|
+extern millis_t lastEncoderMovementMillis;
|
|
30
|
+extern bool screen_changed;
|
|
31
|
+
|
|
32
|
+constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
|
|
33
|
+
|
|
34
|
+void scroll_screen(const uint8_t limit, const bool is_menu);
|
|
35
|
+bool use_click();
|
|
36
|
+bool printer_busy();
|
|
37
|
+void lcd_completion_feedback(const bool good=true);
|
|
38
|
+void lcd_goto_previous_menu();
|
|
39
|
+void lcd_goto_previous_menu_no_defer();
|
|
40
|
+
|
|
41
|
+////////////////////////////////////////////
|
|
42
|
+///////// Menu Item Draw Functions /////////
|
|
43
|
+////////////////////////////////////////////
|
|
44
|
+
|
|
45
|
+#if ENABLED(SDSUPPORT)
|
|
46
|
+ class CardReader;
|
|
47
|
+#endif
|
|
48
|
+
|
|
49
|
+void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, const char* pstr, const char pre_char, const char post_char);
|
|
50
|
+void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL);
|
|
51
|
+void lcd_implementation_drawedit(const char* const pstr, const char* const value=NULL);
|
|
52
|
+#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
53
|
+ void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder);
|
|
54
|
+#endif
|
|
55
|
+#if HAS_GRAPHICAL_LCD
|
|
56
|
+ void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, const char* pstr, const char* const data, const bool pgm);
|
|
57
|
+ #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
|
|
58
|
+ #define lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, false)
|
|
59
|
+ #define lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, true)
|
|
60
|
+ #define DRAWMENU_SETTING_EDIT_GENERIC(SRC) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, SRC)
|
|
61
|
+ #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
|
|
62
|
+ #if ENABLED(SDSUPPORT)
|
|
63
|
+ void _drawmenu_sd(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir);
|
|
64
|
+ #define lcd_implementation_drawmenu_sdfile(sel, row, pstr, theCard) _drawmenu_sd(sel, row, pstr, theCard, false)
|
|
65
|
+ #define lcd_implementation_drawmenu_sddirectory(sel, row, pstr, theCard) _drawmenu_sd(sel, row, pstr, theCard, true)
|
|
66
|
+ #endif
|
|
67
|
+ #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY)
|
|
68
|
+ void _lcd_zoffset_overlay_gfx(const float zvalue);
|
|
69
|
+ #endif
|
|
70
|
+#else
|
|
71
|
+ #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_UPLEVEL_CHAR, LCD_UPLEVEL_CHAR)
|
|
72
|
+ void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data);
|
|
73
|
+ void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data);
|
|
74
|
+ #define DRAWMENU_SETTING_EDIT_GENERIC(SRC) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', SRC)
|
|
75
|
+ #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
|
|
76
|
+ #if ENABLED(SDSUPPORT)
|
|
77
|
+ void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard);
|
|
78
|
+ void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard);
|
|
79
|
+ #endif
|
|
80
|
+#endif
|
|
81
|
+#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
|
|
82
|
+#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
|
|
83
|
+#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
|
|
84
|
+
|
|
85
|
+#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
86
|
+ void lcd_implementation_ubl_plot(const uint8_t x, const uint8_t inverted_y);
|
|
87
|
+#endif
|
|
88
|
+
|
|
89
|
+////////////////////////////////////////////
|
|
90
|
+/////// Edit Setting Draw Functions ////////
|
|
91
|
+////////////////////////////////////////////
|
|
92
|
+
|
|
93
|
+#define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(TYPE, NAME, STRFUNC) \
|
|
94
|
+ FORCE_INLINE void lcd_implementation_drawmenu_setting_edit_ ## NAME (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, TYPE * const data, ...) { \
|
|
95
|
+ UNUSED(pstr2); \
|
|
96
|
+ DRAWMENU_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \
|
|
97
|
+ } \
|
|
98
|
+ FORCE_INLINE void lcd_implementation_drawmenu_setting_edit_callback_ ## NAME (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, TYPE * const data, ...) { \
|
|
99
|
+ UNUSED(pstr2); \
|
|
100
|
+ DRAWMENU_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \
|
|
101
|
+ } \
|
|
102
|
+ FORCE_INLINE void lcd_implementation_drawmenu_setting_edit_accessor_ ## NAME (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, TYPE (*pget)(), void (*pset)(TYPE), ...) { \
|
|
103
|
+ UNUSED(pstr2); UNUSED(pset); \
|
|
104
|
+ DRAWMENU_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
|
|
105
|
+ } \
|
|
106
|
+ typedef void NAME##_void
|
|
107
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int16_t, int3, itostr3);
|
|
108
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int16_t, int4, itostr4sign);
|
|
109
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(uint8_t, int8, i8tostr3);
|
|
110
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float3, ftostr3);
|
|
111
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52, ftostr52);
|
|
112
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float43, ftostr43sign);
|
|
113
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float5, ftostr5rj);
|
|
114
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float51, ftostr51sign);
|
|
115
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52sign, ftostr52sign);
|
|
116
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float62, ftostr62rj);
|
|
117
|
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(uint32_t, long5, ftostr5rj);
|
|
118
|
+
|
|
119
|
+#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) DRAW_BOOL_SETTING(sel, row, pstr, data)
|
|
120
|
+#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) DRAW_BOOL_SETTING(sel, row, pstr, data)
|
|
121
|
+#define lcd_implementation_drawmenu_setting_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset) DRAW_BOOL_SETTING(sel, row, pstr, data)
|
|
122
|
+
|
|
123
|
+////////////////////////////////////////////
|
|
124
|
+/////////////// Menu Actions ///////////////
|
|
125
|
+////////////////////////////////////////////
|
|
126
|
+
|
|
127
|
+#define menu_action_back(dummy) _menu_action_back()
|
|
128
|
+void _menu_action_back();
|
|
129
|
+void menu_action_submenu(screenFunc_t data);
|
|
130
|
+void menu_action_function(menuAction_t data);
|
|
131
|
+void menu_action_gcode(const char* pgcode);
|
|
132
|
+
|
|
133
|
+#if ENABLED(SDSUPPORT)
|
|
134
|
+ void menu_action_sdfile(CardReader &theCard);
|
|
135
|
+ void menu_action_sddirectory(CardReader &theCard);
|
|
136
|
+#endif
|
|
137
|
+
|
|
138
|
+////////////////////////////////////////////
|
|
139
|
+/////////// Menu Editing Actions ///////////
|
|
140
|
+////////////////////////////////////////////
|
|
141
|
+
|
|
142
|
+#define DECLARE_MENU_EDIT_TYPE(TYPE, NAME) \
|
|
143
|
+ bool _menu_edit_ ## NAME(); \
|
|
144
|
+ void menu_edit_ ## NAME(); \
|
|
145
|
+ void menu_edit_callback_ ## NAME(); \
|
|
146
|
+ void _menu_action_setting_edit_ ## NAME(PGM_P const pstr, TYPE* const ptr, const TYPE minValue, const TYPE maxValue); \
|
|
147
|
+ void menu_action_setting_edit_callback_ ## NAME(PGM_P const pstr, TYPE * const ptr, const TYPE minValue, const TYPE maxValue, const screenFunc_t callback=NULL, const bool live=false); \
|
|
148
|
+ FORCE_INLINE void menu_action_setting_edit_ ## NAME(PGM_P const pstr, TYPE * const ptr, const TYPE minValue, const TYPE maxValue) { \
|
|
149
|
+ menu_action_setting_edit_callback_ ## NAME(pstr, ptr, minValue, maxValue); \
|
|
150
|
+ } \
|
|
151
|
+ typedef void NAME##_void
|
|
152
|
+
|
|
153
|
+DECLARE_MENU_EDIT_TYPE(int16_t, int3);
|
|
154
|
+DECLARE_MENU_EDIT_TYPE(int16_t, int4);
|
|
155
|
+DECLARE_MENU_EDIT_TYPE(uint8_t, int8);
|
|
156
|
+DECLARE_MENU_EDIT_TYPE(float, float3);
|
|
157
|
+DECLARE_MENU_EDIT_TYPE(float, float52);
|
|
158
|
+DECLARE_MENU_EDIT_TYPE(float, float43);
|
|
159
|
+DECLARE_MENU_EDIT_TYPE(float, float5);
|
|
160
|
+DECLARE_MENU_EDIT_TYPE(float, float51);
|
|
161
|
+DECLARE_MENU_EDIT_TYPE(float, float52sign);
|
|
162
|
+DECLARE_MENU_EDIT_TYPE(float, float62);
|
|
163
|
+DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
|
|
164
|
+
|
|
165
|
+void menu_action_setting_edit_bool(PGM_P pstr, bool* ptr);
|
|
166
|
+void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t callbackFunc);
|
|
167
|
+
|
|
168
|
+////////////////////////////////////////////
|
|
169
|
+//////////// Menu System Macros ////////////
|
|
170
|
+////////////////////////////////////////////
|
|
171
|
+
|
|
172
|
+/**
|
|
173
|
+ * SCREEN_OR_MENU_LOOP generates init code for a screen or menu
|
|
174
|
+ *
|
|
175
|
+ * encoderTopLine is the top menu line to display
|
|
176
|
+ * _lcdLineNr is the index of the LCD line (e.g., 0-3)
|
|
177
|
+ * _menuLineNr is the menu item to draw and process
|
|
178
|
+ * _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
|
|
179
|
+ */
|
|
180
|
+#define SCREEN_OR_MENU_LOOP() \
|
|
181
|
+ int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
|
|
182
|
+ for (int8_t _lcdLineNr = 0; _lcdLineNr < menu_bottom; _lcdLineNr++, _menuLineNr++) { \
|
|
183
|
+ _thisItemNr = 0
|
|
184
|
+
|
|
185
|
+/**
|
|
186
|
+ * START_SCREEN Opening code for a screen having only static items.
|
|
187
|
+ * Do simplified scrolling of the entire screen.
|
|
188
|
+ *
|
|
189
|
+ * START_MENU Opening code for a screen with menu items.
|
|
190
|
+ * Scroll as-needed to keep the selected line in view.
|
|
191
|
+ */
|
|
192
|
+#define START_SCREEN() \
|
|
193
|
+ scroll_screen(menu_bottom, false); \
|
|
194
|
+ bool _skipStatic = false; \
|
|
195
|
+ SCREEN_OR_MENU_LOOP()
|
|
196
|
+
|
|
197
|
+#define START_MENU() \
|
|
198
|
+ scroll_screen(1, true); \
|
|
199
|
+ bool _skipStatic = true; \
|
|
200
|
+ SCREEN_OR_MENU_LOOP()
|
|
201
|
+
|
|
202
|
+#define END_SCREEN() \
|
|
203
|
+ } \
|
|
204
|
+ screen_items = _thisItemNr
|
|
205
|
+
|
|
206
|
+#define END_MENU() \
|
|
207
|
+ } \
|
|
208
|
+ screen_items = _thisItemNr; \
|
|
209
|
+ UNUSED(_skipStatic)
|
|
210
|
+
|
|
211
|
+/**
|
|
212
|
+ * REVERSE_MENU_DIRECTION
|
|
213
|
+ *
|
|
214
|
+ * To reverse the menu direction we need a general way to reverse
|
|
215
|
+ * the direction of the encoder everywhere. So encoderDirection is
|
|
216
|
+ * added to allow the encoder to go the other way.
|
|
217
|
+ *
|
|
218
|
+ * This behavior is limited to scrolling Menus and SD card listings,
|
|
219
|
+ * and is disabled in other contexts.
|
|
220
|
+ */
|
|
221
|
+#if ENABLED(REVERSE_MENU_DIRECTION)
|
|
222
|
+ extern int8_t encoderDirection;
|
|
223
|
+ #define ENCODER_DIRECTION_NORMAL() (encoderDirection = 1)
|
|
224
|
+ #define ENCODER_DIRECTION_MENUS() (encoderDirection = -1)
|
|
225
|
+#else
|
|
226
|
+ #define ENCODER_DIRECTION_NORMAL() NOOP
|
|
227
|
+ #define ENCODER_DIRECTION_MENUS() NOOP
|
|
228
|
+#endif
|
|
229
|
+
|
|
230
|
+#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
|
231
|
+
|
|
232
|
+ extern bool encoderRateMultiplierEnabled;
|
|
233
|
+ #define ENCODER_RATE_MULTIPLY(F) (encoderRateMultiplierEnabled = F)
|
|
234
|
+
|
|
235
|
+ //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value
|
|
236
|
+
|
|
237
|
+ /**
|
|
238
|
+ * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
|
|
239
|
+ */
|
|
240
|
+ #define MENU_MULTIPLIER_ITEM(TYPE, LABEL, ...) do { \
|
|
241
|
+ _MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \
|
|
242
|
+ encoderRateMultiplierEnabled = true; \
|
|
243
|
+ lastEncoderMovementMillis = 0; \
|
|
244
|
+ _MENU_ITEM_PART_2(TYPE, PSTR(LABEL), ## __VA_ARGS__); \
|
|
245
|
+ }while(0)
|
|
246
|
+
|
|
247
|
+#else // !ENCODER_RATE_MULTIPLIER
|
|
248
|
+ #define ENCODER_RATE_MULTIPLY(F) NOOP
|
|
249
|
+#endif // !ENCODER_RATE_MULTIPLIER
|
|
250
|
+
|
|
251
|
+/**
|
|
252
|
+ * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
|
|
253
|
+ *
|
|
254
|
+ * lcd_implementation_drawmenu_[type](sel, row, label, arg3...)
|
|
255
|
+ * menu_action_[type](arg3...)
|
|
256
|
+ *
|
|
257
|
+ * Examples:
|
|
258
|
+ * MENU_ITEM(back, MSG_WATCH, 0 [dummy parameter] )
|
|
259
|
+ * or
|
|
260
|
+ * MENU_BACK(MSG_WATCH)
|
|
261
|
+ * lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH))
|
|
262
|
+ * menu_action_back()
|
|
263
|
+ *
|
|
264
|
+ * MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
|
|
265
|
+ * lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
|
|
266
|
+ * menu_action_function(lcd_sdcard_pause)
|
|
267
|
+ *
|
|
268
|
+ * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
|
|
269
|
+ * MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
|
270
|
+ * lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
|
271
|
+ * menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
|
272
|
+ *
|
|
273
|
+ */
|
|
274
|
+#define _MENU_ITEM_PART_1(TYPE, ...) \
|
|
275
|
+ if (_menuLineNr == _thisItemNr) { \
|
|
276
|
+ if (encoderLine == _thisItemNr && lcd_clicked) { \
|
|
277
|
+ lcd_clicked = false
|
|
278
|
+
|
|
279
|
+#define _MENU_ITEM_PART_2(TYPE, PLABEL, ...) \
|
|
280
|
+ menu_action_ ## TYPE(__VA_ARGS__); \
|
|
281
|
+ if (screen_changed) return; \
|
|
282
|
+ } \
|
|
283
|
+ if (lcdDrawUpdate) \
|
|
284
|
+ lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PLABEL, ## __VA_ARGS__); \
|
|
285
|
+ } \
|
|
286
|
+ ++_thisItemNr
|
|
287
|
+
|
|
288
|
+#define MENU_ITEM_P(TYPE, PLABEL, ...) do { \
|
|
289
|
+ _skipStatic = false; \
|
|
290
|
+ _MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \
|
|
291
|
+ _MENU_ITEM_PART_2(TYPE, PLABEL, ## __VA_ARGS__); \
|
|
292
|
+ }while(0)
|
|
293
|
+
|
|
294
|
+#define MENU_ITEM(TYPE, LABEL, ...) MENU_ITEM_P(TYPE, PSTR(LABEL), ## __VA_ARGS__)
|
|
295
|
+
|
|
296
|
+#define MENU_ITEM_ADDON_START(X) \
|
|
297
|
+ if (lcdDrawUpdate && _menuLineNr == _thisItemNr - 1) { \
|
|
298
|
+ SETCURSOR(X, _lcdLineNr)
|
|
299
|
+
|
|
300
|
+#define MENU_ITEM_ADDON_END() } (0)
|
|
301
|
+
|
|
302
|
+#define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0)
|
|
303
|
+
|
|
304
|
+// Used to print static text with no visible cursor.
|
|
305
|
+// Parameters: label [, bool center [, bool invert [, char *value] ] ]
|
|
306
|
+#define STATIC_ITEM_P(LABEL, ...) do{ \
|
|
307
|
+ if (_menuLineNr == _thisItemNr) { \
|
|
308
|
+ if (_skipStatic && encoderLine <= _thisItemNr) { \
|
|
309
|
+ encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
|
|
310
|
+ ++encoderLine; \
|
|
311
|
+ } \
|
|
312
|
+ if (lcdDrawUpdate) \
|
|
313
|
+ lcd_implementation_drawmenu_static(_lcdLineNr, LABEL, ## __VA_ARGS__); \
|
|
314
|
+ } \
|
|
315
|
+ ++_thisItemNr; } while(0)
|
|
316
|
+
|
|
317
|
+#define STATIC_ITEM(LABEL, ...) STATIC_ITEM_P(PSTR(LABEL), ## __VA_ARGS__)
|
|
318
|
+
|
|
319
|
+#define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
|
|
320
|
+#define MENU_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
321
|
+#define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
322
|
+#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
|
323
|
+ #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(_CAT(setting_edit_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
324
|
+ #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
325
|
+#else // !ENCODER_RATE_MULTIPLIER
|
|
326
|
+ #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
327
|
+ #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
328
|
+#endif // !ENCODER_RATE_MULTIPLIER
|
|
329
|
+
|
|
330
|
+////////////////////////////////////////////
|
|
331
|
+/////////////// Menu Screens ///////////////
|
|
332
|
+////////////////////////////////////////////
|
|
333
|
+
|
|
334
|
+void menu_main();
|
|
335
|
+void menu_move();
|
|
336
|
+
|
|
337
|
+#if ENABLED(SDSUPPORT)
|
|
338
|
+ void menu_sdcard();
|
|
339
|
+#endif
|
|
340
|
+
|
|
341
|
+// First Fan Speed title in "Tune" and "Control>Temperature" menus
|
|
342
|
+#if FAN_COUNT > 0 && HAS_FAN0
|
|
343
|
+ #if FAN_COUNT > 1
|
|
344
|
+ #define FAN_SPEED_1_SUFFIX " 1"
|
|
345
|
+ #else
|
|
346
|
+ #define FAN_SPEED_1_SUFFIX ""
|
|
347
|
+ #endif
|
|
348
|
+#endif
|
|
349
|
+
|
|
350
|
+////////////////////////////////////////////
|
|
351
|
+//////// Menu Item Helper Functions ////////
|
|
352
|
+////////////////////////////////////////////
|
|
353
|
+
|
|
354
|
+void lcd_move_z();
|
|
355
|
+void lcd_synchronize(PGM_P const msg=NULL);
|
|
356
|
+void line_to_z(const float &z);
|
|
357
|
+void _lcd_draw_homing();
|
|
358
|
+
|
|
359
|
+void watch_temp_callback_E0();
|
|
360
|
+void watch_temp_callback_E1();
|
|
361
|
+void watch_temp_callback_E2();
|
|
362
|
+void watch_temp_callback_E3();
|
|
363
|
+void watch_temp_callback_E4();
|
|
364
|
+void watch_temp_callback_E5();
|
|
365
|
+void watch_temp_callback_bed();
|
|
366
|
+
|
|
367
|
+#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
368
|
+ void lcd_enqueue_command(const char * const cmd);
|
|
369
|
+ void lcd_enqueue_commands_P(PGM_P const cmd);
|
|
370
|
+#endif
|
|
371
|
+
|
|
372
|
+#if ENABLED(LEVEL_BED_CORNERS)
|
|
373
|
+ void _lcd_level_bed_corners();
|
|
374
|
+#endif
|
|
375
|
+
|
|
376
|
+#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
377
|
+ extern float lcd_z_fade_height;
|
|
378
|
+ void _lcd_set_z_fade_height();
|
|
379
|
+#endif
|
|
380
|
+
|
|
381
|
+#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS))
|
|
382
|
+ void _lcd_toggle_bed_leveling();
|
|
383
|
+#endif
|
|
384
|
+
|
|
385
|
+#if ENABLED(BABYSTEPPING)
|
|
386
|
+ #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
387
|
+ void lcd_babystep_zoffset();
|
|
388
|
+ #else
|
|
389
|
+ void lcd_babystep_z();
|
|
390
|
+ #endif
|
|
391
|
+#endif
|
|
392
|
+
|
|
393
|
+#if ENABLED(EEPROM_SETTINGS)
|
|
394
|
+ void lcd_store_settings();
|
|
395
|
+ void lcd_load_settings();
|
|
396
|
+#endif
|