|
@@ -43,14 +43,6 @@ typedef void (*selectFunc_t)();
|
43
|
43
|
void _lcd_zoffset_overlay_gfx(const float zvalue);
|
44
|
44
|
#endif
|
45
|
45
|
|
46
|
|
-#if HAS_BED_PROBE
|
47
|
|
- #if Z_PROBE_OFFSET_RANGE_MIN >= -9 && Z_PROBE_OFFSET_RANGE_MAX <= 9
|
48
|
|
- #define LCD_Z_OFFSET_TYPE float43 // Values from -9.000 to +9.000
|
49
|
|
- #else
|
50
|
|
- #define LCD_Z_OFFSET_TYPE float42_52 // Values from -99.99 to 99.99
|
51
|
|
- #endif
|
52
|
|
-#endif
|
53
|
|
-
|
54
|
46
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) && Z_PROBE_OFFSET_RANGE_MIN >= -9 && Z_PROBE_OFFSET_RANGE_MAX <= 9
|
55
|
47
|
#define BABYSTEP_TO_STR(N) ftostr43sign(N)
|
56
|
48
|
#elif ENABLED(BABYSTEPPING)
|
|
@@ -81,13 +73,14 @@ class MenuItemBase {
|
81
|
73
|
}
|
82
|
74
|
};
|
83
|
75
|
|
|
76
|
+// STATIC_ITEM(LABEL,...)
|
84
|
77
|
class MenuItem_static : public MenuItemBase {
|
85
|
78
|
public:
|
86
|
79
|
static void draw(const uint8_t row, PGM_P const pstr, const uint8_t style=SS_DEFAULT, const char * const vstr=nullptr);
|
87
|
80
|
};
|
88
|
81
|
|
89
|
|
-// CONFIRM_ITEM(LABEL,Y,N,FY,FN,V...),
|
90
|
|
-// YESNO_ITEM(LABEL,FY,FN,V...)
|
|
82
|
+// CONFIRM_ITEM(LABEL,Y,N,FY,FN,...),
|
|
83
|
+// YESNO_ITEM(LABEL,FY,FN,...)
|
91
|
84
|
class MenuItem_confirm : public MenuItemBase {
|
92
|
85
|
public:
|
93
|
86
|
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
|
@@ -123,60 +116,6 @@ class MenuItem_confirm : public MenuItemBase {
|
123
|
116
|
}
|
124
|
117
|
};
|
125
|
118
|
|
126
|
|
-// BACK_ITEM(LABEL)
|
127
|
|
-class MenuItem_back : public MenuItemBase {
|
128
|
|
- public:
|
129
|
|
- FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr) {
|
130
|
|
- _draw(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]);
|
131
|
|
- }
|
132
|
|
- // Back Item action goes back one step in history
|
133
|
|
- FORCE_INLINE static void action(PGM_P const=nullptr) { ui.go_back(); }
|
134
|
|
-};
|
135
|
|
-
|
136
|
|
-// SUBMENU(LABEL, screen_handler)
|
137
|
|
-class MenuItem_submenu : public MenuItemBase {
|
138
|
|
- public:
|
139
|
|
- FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
140
|
|
- _draw(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]);
|
141
|
|
- }
|
142
|
|
- static inline void action(PGM_P const, const screenFunc_t func) { ui.save_previous_screen(); ui.goto_screen(func); }
|
143
|
|
-};
|
144
|
|
-
|
145
|
|
-// Any menu item that invokes an immediate action
|
146
|
|
-class MenuItem_button : public MenuItemBase {
|
147
|
|
- public:
|
148
|
|
- // Button-y Items are selectable lines with no other indicator
|
149
|
|
- static inline void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
150
|
|
- _draw(sel, row, pstr, '>', ' ');
|
151
|
|
- }
|
152
|
|
-};
|
153
|
|
-
|
154
|
|
-// GCODES_ITEM(LABEL, GCODES)
|
155
|
|
-class MenuItem_gcode : public MenuItem_button {
|
156
|
|
- public:
|
157
|
|
- FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
158
|
|
- _draw(sel, row, pstr, '>', ' ');
|
159
|
|
- }
|
160
|
|
- static void action(PGM_P const, const char * const pgcode);
|
161
|
|
- static inline void action(PGM_P const pstr, const uint8_t, const char * const pgcode) { action(pstr, pgcode); }
|
162
|
|
-};
|
163
|
|
-
|
164
|
|
-// ACTION_ITEM(LABEL, FUNC)
|
165
|
|
-class MenuItem_function : public MenuItem_button {
|
166
|
|
- public:
|
167
|
|
- //static inline void action(PGM_P const, const uint8_t, const menuAction_t func) { (*func)(); };
|
168
|
|
- static inline void action(PGM_P const, const menuAction_t func) { (*func)(); };
|
169
|
|
-};
|
170
|
|
-
|
171
|
|
-#if ENABLED(SDSUPPORT)
|
172
|
|
- class CardReader;
|
173
|
|
- class MenuItem_sdbase {
|
174
|
|
- public:
|
175
|
|
- // Implemented for HD44780 and DOGM
|
176
|
|
- static void draw(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir);
|
177
|
|
- };
|
178
|
|
-#endif
|
179
|
|
-
|
180
|
119
|
////////////////////////////////////////////
|
181
|
120
|
///////////// Edit Menu Items //////////////
|
182
|
121
|
////////////////////////////////////////////
|
|
@@ -233,361 +172,15 @@ class MenuEditItemBase : public MenuItemBase {
|
233
|
172
|
static inline void draw_edit_screen(const char* const value) { draw_edit_screen(editLabel, value); }
|
234
|
173
|
};
|
235
|
174
|
|
236
|
|
-// Template for specific Menu Edit Item Types
|
237
|
|
-template<typename NAME>
|
238
|
|
-class TMenuEditItem : MenuEditItemBase {
|
239
|
|
- private:
|
240
|
|
- typedef typename NAME::type_t type_t;
|
241
|
|
- static inline float scale(const float value) { return NAME::scale(value); }
|
242
|
|
- static inline float unscale(const float value) { return NAME::unscale(value); }
|
243
|
|
- static const char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); }
|
244
|
|
- static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
|
245
|
|
- public:
|
246
|
|
- FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, type_t * const data, ...) {
|
247
|
|
- MenuEditItemBase::draw(sel, row, pstr, NAME::strfunc(*(data)));
|
248
|
|
- }
|
249
|
|
- FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, type_t (*pget)(), ...) {
|
250
|
|
- MenuEditItemBase::draw(sel, row, pstr, NAME::strfunc(pget()));
|
251
|
|
- }
|
252
|
|
- // Edit screen for this type of item
|
253
|
|
- static void edit_screen() { MenuEditItemBase::edit_screen(to_string, load); }
|
254
|
|
- static void action(
|
255
|
|
- PGM_P const pstr, // Edit label
|
256
|
|
- type_t * const ptr, // Value pointer
|
257
|
|
- const type_t minValue, // Value range
|
258
|
|
- const type_t maxValue,
|
259
|
|
- const screenFunc_t callback=nullptr, // Value update callback
|
260
|
|
- const bool live=false // Callback during editing
|
261
|
|
- ) {
|
262
|
|
- // Make sure minv and maxv fit within int32_t
|
263
|
|
- const int32_t minv = _MAX(scale(minValue), INT32_MIN),
|
264
|
|
- maxv = _MIN(scale(maxValue), INT32_MAX);
|
265
|
|
- goto_edit_screen(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv,
|
266
|
|
- edit_screen, callback, live);
|
267
|
|
- }
|
268
|
|
-};
|
269
|
|
-
|
270
|
|
-// Provide a set of Edit Item Types which encompass a primitive
|
271
|
|
-// type, a string function, and a scale factor for edit and display.
|
272
|
|
-// These items call the Edit Item draw method passing the prepared string.
|
273
|
|
-#define __DOFIXfloat PROBE()
|
274
|
|
-#define _DOFIX(TYPE,V) TYPE(TERN(IS_PROBE(__DOFIX##TYPE),FIXFLOAT(V),(V)))
|
275
|
|
-#define DEFINE_MENU_EDIT_ITEM_TYPE(NAME, TYPE, STRFUNC, SCALE, V...) \
|
276
|
|
- struct MenuEditItemInfo_##NAME { \
|
277
|
|
- typedef TYPE type_t; \
|
278
|
|
- static inline float scale(const float value) { return value * (SCALE) + (V+0); } \
|
279
|
|
- static inline float unscale(const float value) { return value / (SCALE) + (V+0); } \
|
280
|
|
- static inline const char* strfunc(const float value) { return STRFUNC(_DOFIX(TYPE,value)); } \
|
281
|
|
- }; \
|
282
|
|
- typedef TMenuEditItem<MenuEditItemInfo_##NAME> MenuItem_##NAME
|
283
|
|
-
|
284
|
|
-// NAME TYPE STRFUNC SCALE +ROUND
|
285
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(percent ,uint8_t ,ui8tostr4pctrj , 100.f/255.f, 0.5f); // 100% right-justified
|
286
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(int3 ,int16_t ,i16tostr3rj , 1 ); // 123, -12 right-justified
|
287
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(int4 ,int16_t ,i16tostr4signrj , 1 ); // 1234, -123 right-justified
|
288
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(int8 ,int8_t ,i8tostr3rj , 1 ); // 123, -12 right-justified
|
289
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(uint8 ,uint8_t ,ui8tostr3rj , 1 ); // 123 right-justified
|
290
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(uint16_3 ,uint16_t ,ui16tostr3rj , 1 ); // 123 right-justified
|
291
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(uint16_4 ,uint16_t ,ui16tostr4rj , 0.1f ); // 1234 right-justified
|
292
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(uint16_5 ,uint16_t ,ui16tostr5rj , 0.01f ); // 12345 right-justified
|
293
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float3 ,float ,ftostr3 , 1 ); // 123 right-justified
|
294
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float42_52 ,float ,ftostr42_52 , 100 ); // _2.34, 12.34, -2.34 or 123.45, -23.45
|
295
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float43 ,float ,ftostr43sign ,1000 ); // -1.234, _1.234, +1.234
|
296
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float5 ,float ,ftostr5rj , 1 ); // 12345 right-justified
|
297
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float5_25 ,float ,ftostr5rj , 0.04f ); // 12345 right-justified (25 increment)
|
298
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float51 ,float ,ftostr51rj , 10 ); // 1234.5 right-justified
|
299
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float31sign ,float ,ftostr31sign , 10 ); // +12.3
|
300
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float41sign ,float ,ftostr41sign , 10 ); // +123.4
|
301
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float51sign ,float ,ftostr51sign , 10 ); // +1234.5
|
302
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(float52sign ,float ,ftostr52sign , 100 ); // +123.45
|
303
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(long5 ,uint32_t ,ftostr5rj , 0.01f ); // 12345 right-justified
|
304
|
|
-DEFINE_MENU_EDIT_ITEM_TYPE(long5_25 ,uint32_t ,ftostr5rj , 0.04f ); // 12345 right-justified (25 increment)
|
305
|
|
-
|
306
|
|
-class MenuItem_bool : public MenuEditItemBase {
|
307
|
|
- public:
|
308
|
|
- FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, const bool onoff) {
|
309
|
|
- MenuEditItemBase::draw(sel, row, pstr, onoff ? GET_TEXT(MSG_LCD_ON) : GET_TEXT(MSG_LCD_OFF), true);
|
310
|
|
- }
|
311
|
|
- FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, bool * const data, ...) {
|
312
|
|
- draw(sel, row, pstr, *data);
|
313
|
|
- }
|
314
|
|
- FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const, bool (*pget)(), ...) {
|
315
|
|
- draw(sel, row, pstr, pget());
|
316
|
|
- }
|
317
|
|
- static void action(PGM_P const pstr, bool * const ptr, const screenFunc_t callbackFunc=nullptr);
|
318
|
|
-};
|
319
|
|
-
|
320
|
|
-////////////////////////////////////////////
|
321
|
|
-//////////// Menu System Macros ////////////
|
322
|
|
-////////////////////////////////////////////
|
323
|
|
-
|
324
|
|
-/**
|
325
|
|
- * Marlin's native menu screens work by running a loop from the top visible line index
|
326
|
|
- * to the bottom visible line index (according to how much the screen has been scrolled).
|
327
|
|
- * This complete loop is done on every menu screen call.
|
328
|
|
- *
|
329
|
|
- * The menu system is highly dynamic, so it doesn't know ahead of any menu loop which
|
330
|
|
- * items will be visible or hidden, so menu items don't have a fixed index number.
|
331
|
|
- *
|
332
|
|
- * During the loop, each menu item checks to see if its line is the current one. If it is,
|
333
|
|
- * then it checks to see if a click has arrived so it can run its action. If the action
|
334
|
|
- * doesn't redirect to another screen then the menu item calls its draw method.
|
335
|
|
- *
|
336
|
|
- * Menu item add-ons can do whatever they like.
|
337
|
|
- *
|
338
|
|
- * This mixture of drawing and processing inside a loop has the advantage that a single
|
339
|
|
- * line can be used to represent a menu item, and that is the rationale for this design.
|
340
|
|
- *
|
341
|
|
- * One of the pitfalls of this method is that DOGM displays call the screen handler 2x,
|
342
|
|
- * 4x, or 8x per screen update to draw just one segment of the screen. As a result, any
|
343
|
|
- * menu item that exists in two screen segments is drawn and processed twice per screen
|
344
|
|
- * update. With each item processed 5, 10, 20, or 40 times the logic has to be simple.
|
345
|
|
- *
|
346
|
|
- * To avoid repetition and side-effects, function calls for testing menu item conditions
|
347
|
|
- * should be done before the menu loop (START_MENU / START_SCREEN).
|
348
|
|
- */
|
349
|
|
-
|
350
|
|
-/**
|
351
|
|
- * SCREEN_OR_MENU_LOOP generates header code for a screen or menu
|
352
|
|
- *
|
353
|
|
- * encoderTopLine is the top menu line to display
|
354
|
|
- * _lcdLineNr is the index of the LCD line (e.g., 0-3)
|
355
|
|
- * _menuLineNr is the menu item to draw and process
|
356
|
|
- * _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
|
357
|
|
- */
|
358
|
|
-#define SCREEN_OR_MENU_LOOP(IS_MENU) \
|
359
|
|
- scroll_screen(IS_MENU ? 1 : LCD_HEIGHT, IS_MENU); \
|
360
|
|
- int8_t _menuLineNr = encoderTopLine, _thisItemNr = 0; \
|
361
|
|
- bool _skipStatic = IS_MENU; UNUSED(_thisItemNr); \
|
362
|
|
- for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT; _lcdLineNr++, _menuLineNr++) { \
|
363
|
|
- _thisItemNr = 0
|
364
|
|
-
|
365
|
|
-/**
|
366
|
|
- * START_SCREEN Opening code for a screen having only static items.
|
367
|
|
- * Do simplified scrolling of the entire screen.
|
368
|
|
- *
|
369
|
|
- * START_MENU Opening code for a screen with menu items.
|
370
|
|
- * Scroll as-needed to keep the selected line in view.
|
371
|
|
- */
|
372
|
|
-#define START_SCREEN() SCREEN_OR_MENU_LOOP(false)
|
373
|
|
-#define START_MENU() SCREEN_OR_MENU_LOOP(true)
|
374
|
|
-#define NEXT_ITEM() (++_thisItemNr)
|
375
|
|
-#define SKIP_ITEM() NEXT_ITEM()
|
376
|
|
-#define END_SCREEN() } screen_items = _thisItemNr
|
377
|
|
-#define END_MENU() END_SCREEN(); UNUSED(_skipStatic)
|
378
|
|
-
|
379
|
|
-#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
380
|
|
- #define ENCODER_RATE_MULTIPLY(F) (ui.encoderRateMultiplierEnabled = F)
|
381
|
|
- #define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER) do{ if (USE_MULTIPLIER) ui.enable_encoder_multiplier(true); }while(0)
|
382
|
|
- //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value
|
383
|
|
-#else
|
384
|
|
- #define ENCODER_RATE_MULTIPLY(F) NOOP
|
385
|
|
- #define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER)
|
|
175
|
+#if ENABLED(SDSUPPORT)
|
|
176
|
+ class CardReader;
|
|
177
|
+ class MenuItem_sdbase {
|
|
178
|
+ public:
|
|
179
|
+ // Implemented for HD44780 and DOGM
|
|
180
|
+ static void draw(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir);
|
|
181
|
+ };
|
386
|
182
|
#endif
|
387
|
183
|
|
388
|
|
-/**
|
389
|
|
- * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
|
390
|
|
- *
|
391
|
|
- * MenuItem_<type>::draw(sel, row, label, arg3...)
|
392
|
|
- * MenuItem_<type>::action(arg3...)
|
393
|
|
- *
|
394
|
|
- * Examples:
|
395
|
|
- * BACK_ITEM(MSG_INFO_SCREEN)
|
396
|
|
- * MenuItem_back::action(plabel, ...)
|
397
|
|
- * MenuItem_back::draw(sel, row, plabel, ...)
|
398
|
|
- *
|
399
|
|
- * ACTION_ITEM(MSG_PAUSE_PRINT, lcd_sdcard_pause)
|
400
|
|
- * MenuItem_function::action(plabel, lcd_sdcard_pause)
|
401
|
|
- * MenuItem_function::draw(sel, row, plabel, lcd_sdcard_pause)
|
402
|
|
- *
|
403
|
|
- * EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
|
404
|
|
- * MenuItem_int3::action(plabel, &feedrate_percentage, 10, 999)
|
405
|
|
- * MenuItem_int3::draw(sel, row, plabel, &feedrate_percentage, 10, 999)
|
406
|
|
- */
|
407
|
|
-
|
408
|
|
-#define _MENU_INNER_P(TYPE, USE_MULTIPLIER, PLABEL, V...) do { \
|
409
|
|
- PGM_P const plabel = PLABEL; \
|
410
|
|
- if (encoderLine == _thisItemNr && ui.use_click()) { \
|
411
|
|
- _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \
|
412
|
|
- MenuItem_##TYPE::action(plabel, ##V); \
|
413
|
|
- if (ui.screen_changed) return; \
|
414
|
|
- } \
|
415
|
|
- if (ui.should_draw()) \
|
416
|
|
- MenuItem_##TYPE::draw \
|
417
|
|
- (encoderLine == _thisItemNr, _lcdLineNr, plabel, ##V); \
|
418
|
|
-}while(0)
|
419
|
|
-
|
420
|
|
-#define _MENU_ITEM_P(TYPE, V...) do { \
|
421
|
|
- if (_menuLineNr == _thisItemNr) { \
|
422
|
|
- _skipStatic = false; \
|
423
|
|
- _MENU_INNER_P(TYPE, ##V); \
|
424
|
|
- } \
|
425
|
|
- NEXT_ITEM(); \
|
426
|
|
-}while(0)
|
427
|
|
-
|
428
|
|
-// Indexed items set a global index value and optional data
|
429
|
|
-#define _MENU_ITEM_N_S_P(TYPE, N, S, V...) do{ \
|
430
|
|
- if (_menuLineNr == _thisItemNr) { \
|
431
|
|
- _skipStatic = false; \
|
432
|
|
- MenuItemBase::init(N, S); \
|
433
|
|
- _MENU_INNER_P(TYPE, ##V); \
|
434
|
|
- } \
|
435
|
|
- NEXT_ITEM(); \
|
436
|
|
-}while(0)
|
437
|
|
-
|
438
|
|
-// Indexed items set a global index value
|
439
|
|
-#define _MENU_ITEM_N_P(TYPE, N, V...) do{ \
|
440
|
|
- if (_menuLineNr == _thisItemNr) { \
|
441
|
|
- _skipStatic = false; \
|
442
|
|
- MenuItemBase::itemIndex = N; \
|
443
|
|
- _MENU_INNER_P(TYPE, ##V); \
|
444
|
|
- } \
|
445
|
|
- NEXT_ITEM(); \
|
446
|
|
-}while(0)
|
447
|
|
-
|
448
|
|
-// Items with a unique string
|
449
|
|
-#define _MENU_ITEM_S_P(TYPE, S, V...) do{ \
|
450
|
|
- if (_menuLineNr == _thisItemNr) { \
|
451
|
|
- _skipStatic = false; \
|
452
|
|
- MenuItemBase::itemString = S; \
|
453
|
|
- _MENU_INNER_P(TYPE, ##V); \
|
454
|
|
- } \
|
455
|
|
- NEXT_ITEM(); \
|
456
|
|
-}while(0)
|
457
|
|
-
|
458
|
|
-// STATIC_ITEM draws a styled string with no highlight.
|
459
|
|
-// Parameters: label [, style [, char *value] ]
|
460
|
|
-
|
461
|
|
-#define STATIC_ITEM_INNER_P(PLABEL, V...) do{ \
|
462
|
|
- if (_skipStatic && encoderLine <= _thisItemNr) { \
|
463
|
|
- ui.encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
|
464
|
|
- ++encoderLine; \
|
465
|
|
- } \
|
466
|
|
- if (ui.should_draw()) \
|
467
|
|
- MenuItem_static::draw(_lcdLineNr, PLABEL, ##V); \
|
468
|
|
-} while(0)
|
469
|
|
-
|
470
|
|
-#define STATIC_ITEM_P(PLABEL, V...) do{ \
|
471
|
|
- if (_menuLineNr == _thisItemNr) \
|
472
|
|
- STATIC_ITEM_INNER_P(PLABEL, ##V); \
|
473
|
|
- NEXT_ITEM(); \
|
474
|
|
-} while(0)
|
475
|
|
-
|
476
|
|
-#define STATIC_ITEM_N_P(PLABEL, N, V...) do{ \
|
477
|
|
- if (_menuLineNr == _thisItemNr) { \
|
478
|
|
- MenuItemBase::init(N); \
|
479
|
|
- STATIC_ITEM_INNER_P(PLABEL, ##V); \
|
480
|
|
- } \
|
481
|
|
- NEXT_ITEM(); \
|
482
|
|
-}while(0)
|
483
|
|
-
|
484
|
|
-#define STATIC_ITEM(LABEL, V...) STATIC_ITEM_P(GET_TEXT(LABEL), ##V)
|
485
|
|
-#define STATIC_ITEM_N(LABEL, N, V...) STATIC_ITEM_N_P(GET_TEXT(LABEL), ##V)
|
486
|
|
-
|
487
|
|
-#define MENU_ITEM_N_S_P(TYPE, N, S, PLABEL, V...) _MENU_ITEM_N_S_P(TYPE, N, S, false, PLABEL, ##V)
|
488
|
|
-#define MENU_ITEM_N_S(TYPE, N, S, LABEL, V...) MENU_ITEM_N_S_P(TYPE, N, S, GET_TEXT(LABEL), ##V)
|
489
|
|
-#define MENU_ITEM_S_P(TYPE, S, PLABEL, V...) _MENU_ITEM_S_P(TYPE, S, false, PLABEL, ##V)
|
490
|
|
-#define MENU_ITEM_S(TYPE, S, LABEL, V...) MENU_ITEM_S_P(TYPE, S, GET_TEXT(LABEL), ##V)
|
491
|
|
-#define MENU_ITEM_N_P(TYPE, N, PLABEL, V...) _MENU_ITEM_N_P(TYPE, N, false, PLABEL, ##V)
|
492
|
|
-#define MENU_ITEM_N(TYPE, N, LABEL, V...) MENU_ITEM_N_P(TYPE, N, GET_TEXT(LABEL), ##V)
|
493
|
|
-#define MENU_ITEM_P(TYPE, PLABEL, V...) _MENU_ITEM_P(TYPE, false, PLABEL, ##V)
|
494
|
|
-#define MENU_ITEM(TYPE, LABEL, V...) MENU_ITEM_P(TYPE, GET_TEXT(LABEL), ##V)
|
495
|
|
-
|
496
|
|
-#define BACK_ITEM(LABEL) MENU_ITEM(back, LABEL)
|
497
|
|
-
|
498
|
|
-#define ACTION_ITEM_N_S_P(N, S, PLABEL, ACTION) MENU_ITEM_N_S_P(function, N, S, PLABEL, ACTION)
|
499
|
|
-#define ACTION_ITEM_N_S(N, S, LABEL, ACTION) ACTION_ITEM_N_S_P(N, S, GET_TEXT(LABEL), ACTION)
|
500
|
|
-#define ACTION_ITEM_S_P(S, PLABEL, ACTION) MENU_ITEM_S_P(function, S, PLABEL, ACTION)
|
501
|
|
-#define ACTION_ITEM_S(S, LABEL, ACTION) ACTION_ITEM_S_P(S, GET_TEXT(LABEL), ACTION)
|
502
|
|
-#define ACTION_ITEM_N_P(N, PLABEL, ACTION) MENU_ITEM_N_P(function, N, PLABEL, ACTION)
|
503
|
|
-#define ACTION_ITEM_N(N, LABEL, ACTION) ACTION_ITEM_N_P(N, GET_TEXT(LABEL), ACTION)
|
504
|
|
-#define ACTION_ITEM_P(PLABEL, ACTION) MENU_ITEM_P(function, PLABEL, ACTION)
|
505
|
|
-#define ACTION_ITEM(LABEL, ACTION) ACTION_ITEM_P(GET_TEXT(LABEL), ACTION)
|
506
|
|
-
|
507
|
|
-#define GCODES_ITEM_N_S_P(N, S, PLABEL, GCODES) MENU_ITEM_N_S_P(gcode, N, S, PLABEL, GCODES)
|
508
|
|
-#define GCODES_ITEM_N_S(N, S, LABEL, GCODES) GCODES_ITEM_N_S_P(N, S, GET_TEXT(LABEL), GCODES)
|
509
|
|
-#define GCODES_ITEM_S_P(S, PLABEL, GCODES) MENU_ITEM_S_P(gcode, S, PLABEL, GCODES)
|
510
|
|
-#define GCODES_ITEM_S(S, LABEL, GCODES) GCODES_ITEM_S_P(S, GET_TEXT(LABEL), GCODES)
|
511
|
|
-#define GCODES_ITEM_N_P(N, PLABEL, GCODES) MENU_ITEM_N_P(gcode, N, PLABEL, GCODES)
|
512
|
|
-#define GCODES_ITEM_N(N, LABEL, GCODES) GCODES_ITEM_N_P(N, GET_TEXT(LABEL), GCODES)
|
513
|
|
-#define GCODES_ITEM_P(PLABEL, GCODES) MENU_ITEM_P(gcode, PLABEL, GCODES)
|
514
|
|
-#define GCODES_ITEM(LABEL, GCODES) GCODES_ITEM_P(GET_TEXT(LABEL), GCODES)
|
515
|
|
-
|
516
|
|
-#define SUBMENU_N_S_P(N, S, PLABEL, DEST) MENU_ITEM_N_S_P(submenu, N, S, PLABEL, DEST)
|
517
|
|
-#define SUBMENU_N_S(N, S, LABEL, DEST) SUBMENU_N_S_P(N, S, GET_TEXT(LABEL), DEST)
|
518
|
|
-#define SUBMENU_S_P(S, PLABEL, DEST) MENU_ITEM_S_P(submenu, S, PLABEL, DEST)
|
519
|
|
-#define SUBMENU_S(S, LABEL, DEST) SUBMENU_S_P(S, GET_TEXT(LABEL), DEST)
|
520
|
|
-#define SUBMENU_N_P(N, PLABEL, DEST) MENU_ITEM_N_P(submenu, N, PLABEL, DEST)
|
521
|
|
-#define SUBMENU_N(N, LABEL, DEST) SUBMENU_N_P(N, GET_TEXT(LABEL), DEST)
|
522
|
|
-#define SUBMENU_P(PLABEL, DEST) MENU_ITEM_P(submenu, PLABEL, DEST)
|
523
|
|
-#define SUBMENU(LABEL, DEST) SUBMENU_P(GET_TEXT(LABEL), DEST)
|
524
|
|
-
|
525
|
|
-#define EDIT_ITEM_N_S_P(TYPE, N, S, PLABEL, V...) MENU_ITEM_N_S_P(TYPE, N, S, PLABEL, ##V)
|
526
|
|
-#define EDIT_ITEM_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_N_S_P(TYPE, N, S, GET_TEXT(LABEL), ##V)
|
527
|
|
-#define EDIT_ITEM_S_P(TYPE, S, PLABEL, V...) MENU_ITEM_S_P(TYPE, S, PLABEL, ##V)
|
528
|
|
-#define EDIT_ITEM_S(TYPE, S, LABEL, V...) EDIT_ITEM_S_P(TYPE, S, GET_TEXT(LABEL), ##V)
|
529
|
|
-#define EDIT_ITEM_N_P(TYPE, N, PLABEL, V...) MENU_ITEM_N_P(TYPE, N, PLABEL, ##V)
|
530
|
|
-#define EDIT_ITEM_N(TYPE, N, LABEL, V...) EDIT_ITEM_N_P(TYPE, N, GET_TEXT(LABEL), ##V)
|
531
|
|
-#define EDIT_ITEM_P(TYPE, PLABEL, V...) MENU_ITEM_P(TYPE, PLABEL, ##V)
|
532
|
|
-#define EDIT_ITEM(TYPE, LABEL, V...) EDIT_ITEM_P(TYPE, GET_TEXT(LABEL), ##V)
|
533
|
|
-
|
534
|
|
-#define EDIT_ITEM_FAST_N_S_P(TYPE, N, S, PLABEL, V...) _MENU_ITEM_N_S_P(TYPE, N, S, true, PLABEL, ##V)
|
535
|
|
-#define EDIT_ITEM_FAST_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_FAST_N_S_P(TYPE, N, S, true, GET_TEXT(LABEL), ##V)
|
536
|
|
-#define EDIT_ITEM_FAST_S_P(TYPE, S, PLABEL, V...) _MENU_ITEM_S_P(TYPE, S, true, PLABEL, ##V)
|
537
|
|
-#define EDIT_ITEM_FAST_S(TYPE, S, LABEL, V...) EDIT_ITEM_FAST_S_P(TYPE, S, GET_TEXT(LABEL), ##V)
|
538
|
|
-#define EDIT_ITEM_FAST_N_P(TYPE, N, PLABEL, V...) _MENU_ITEM_N_P(TYPE, N, true, PLABEL, ##V)
|
539
|
|
-#define EDIT_ITEM_FAST_N(TYPE, N, LABEL, V...) EDIT_ITEM_FAST_N_P(TYPE, N, GET_TEXT(LABEL), ##V)
|
540
|
|
-#define EDIT_ITEM_FAST_P(TYPE, PLABEL, V...) _MENU_ITEM_P(TYPE, true, PLABEL, ##V)
|
541
|
|
-#define EDIT_ITEM_FAST(TYPE, LABEL, V...) EDIT_ITEM_FAST_P(TYPE, GET_TEXT(LABEL), ##V)
|
542
|
|
-
|
543
|
|
-#define _CONFIRM_ITEM_INNER_P(PLABEL, V...) do { \
|
544
|
|
- if (encoderLine == _thisItemNr && ui.use_click()) { \
|
545
|
|
- ui.save_previous_screen(); \
|
546
|
|
- ui.goto_screen([]{MenuItem_confirm::select_screen(V);}); \
|
547
|
|
- return; \
|
548
|
|
- } \
|
549
|
|
- if (ui.should_draw()) MenuItem_confirm::draw \
|
550
|
|
- (encoderLine == _thisItemNr, _lcdLineNr, PLABEL, ##V); \
|
551
|
|
-}while(0)
|
552
|
|
-
|
553
|
|
-// Indexed items set a global index value and optional data
|
554
|
|
-#define _CONFIRM_ITEM_P(PLABEL, V...) do { \
|
555
|
|
- if (_menuLineNr == _thisItemNr) { \
|
556
|
|
- _skipStatic = false; \
|
557
|
|
- _CONFIRM_ITEM_INNER_P(PLABEL, ##V); \
|
558
|
|
- } \
|
559
|
|
- NEXT_ITEM(); \
|
560
|
|
-}while(0)
|
561
|
|
-
|
562
|
|
-// Indexed items set a global index value
|
563
|
|
-#define _CONFIRM_ITEM_N_S_P(N, S, V...) do{ \
|
564
|
|
- if (_menuLineNr == _thisItemNr) { \
|
565
|
|
- _skipStatic = false; \
|
566
|
|
- MenuItemBase::init(N, S); \
|
567
|
|
- _CONFIRM_ITEM_INNER_P(TYPE, ##V); \
|
568
|
|
- } \
|
569
|
|
- NEXT_ITEM(); \
|
570
|
|
-}while(0)
|
571
|
|
-
|
572
|
|
-// Indexed items set a global index value
|
573
|
|
-#define _CONFIRM_ITEM_N_P(N, V...) _CONFIRM_ITEM_N_S_P(N, nullptr, V)
|
574
|
|
-
|
575
|
|
-#define CONFIRM_ITEM_P(PLABEL,A,B,V...) _CONFIRM_ITEM_P(PLABEL, GET_TEXT(A), GET_TEXT(B), ##V)
|
576
|
|
-#define CONFIRM_ITEM(LABEL, V...) CONFIRM_ITEM_P(GET_TEXT(LABEL), ##V)
|
577
|
|
-
|
578
|
|
-#define YESNO_ITEM_P(PLABEL, V...) _CONFIRM_ITEM_P(PLABEL, ##V)
|
579
|
|
-#define YESNO_ITEM(LABEL, V...) YESNO_ITEM_P(GET_TEXT(LABEL), ##V)
|
580
|
|
-
|
581
|
|
-#define CONFIRM_ITEM_N_S_P(N,S,PLABEL,A,B,V...) _CONFIRM_ITEM_N_S_P(N, S, PLABEL, GET_TEXT(A), GET_TEXT(B), ##V)
|
582
|
|
-#define CONFIRM_ITEM_N_S(N,S,LABEL,V...) CONFIRM_ITEM_N_S_P(N, S, GET_TEXT(LABEL), ##V)
|
583
|
|
-#define CONFIRM_ITEM_N_P(N,PLABEL,A,B,V...) _CONFIRM_ITEM_N_P(N, PLABEL, GET_TEXT(A), GET_TEXT(B), ##V)
|
584
|
|
-#define CONFIRM_ITEM_N(N,LABEL, V...) CONFIRM_ITEM_N_P(N, GET_TEXT(LABEL), ##V)
|
585
|
|
-
|
586
|
|
-#define YESNO_ITEM_N_S_P(N,S,PLABEL, V...) _CONFIRM_ITEM_N_S_P(N, S, PLABEL, ##V)
|
587
|
|
-#define YESNO_ITEM_N_S(N,S,LABEL, V...) YESNO_ITEM_N_S_P(N, S, GET_TEXT(LABEL), ##V)
|
588
|
|
-#define YESNO_ITEM_N_P(N,PLABEL, V...) _CONFIRM_ITEM_N_P(N, PLABEL, ##V)
|
589
|
|
-#define YESNO_ITEM_N(N,LABEL, V...) YESNO_ITEM_N_P(N, GET_TEXT(LABEL), ##V)
|
590
|
|
-
|
591
|
184
|
////////////////////////////////////////////
|
592
|
185
|
/////////////// Menu Screens ///////////////
|
593
|
186
|
////////////////////////////////////////////
|
|
@@ -599,20 +192,10 @@ void menu_move();
|
599
|
192
|
void menu_media();
|
600
|
193
|
#endif
|
601
|
194
|
|
602
|
|
-// First Fan Speed title in "Tune" and "Control>Temperature" menus
|
603
|
|
-#if HAS_FAN && HAS_FAN0
|
604
|
|
- #if FAN_COUNT > 1
|
605
|
|
- #define FAN_SPEED_1_SUFFIX " 1"
|
606
|
|
- #else
|
607
|
|
- #define FAN_SPEED_1_SUFFIX ""
|
608
|
|
- #endif
|
609
|
|
-#endif
|
610
|
|
-
|
611
|
195
|
////////////////////////////////////////////
|
612
|
196
|
//////// Menu Item Helper Functions ////////
|
613
|
197
|
////////////////////////////////////////////
|
614
|
198
|
|
615
|
|
-void lcd_move_z();
|
616
|
199
|
void _lcd_draw_homing();
|
617
|
200
|
|
618
|
201
|
#define HAS_LINE_TO_Z ANY(DELTA, PROBE_MANUALLY, MESH_BED_LEVELING, LEVEL_BED_CORNERS)
|
|
@@ -625,10 +208,6 @@ void _lcd_draw_homing();
|
625
|
208
|
void _lcd_zoffset_overlay_gfx(const float zvalue);
|
626
|
209
|
#endif
|
627
|
210
|
|
628
|
|
-#if ENABLED(LEVEL_BED_CORNERS)
|
629
|
|
- void _lcd_level_bed_corners();
|
630
|
|
-#endif
|
631
|
|
-
|
632
|
211
|
#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS))
|
633
|
212
|
void _lcd_toggle_bed_leveling();
|
634
|
213
|
#endif
|
|
@@ -651,11 +230,3 @@ void _lcd_draw_homing();
|
651
|
230
|
#endif
|
652
|
231
|
|
653
|
232
|
#endif
|
654
|
|
-
|
655
|
|
-#if ENABLED(POWER_LOSS_RECOVERY)
|
656
|
|
- void menu_job_recovery();
|
657
|
|
-#endif
|
658
|
|
-
|
659
|
|
-#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
660
|
|
- void touch_screen_calibration();
|
661
|
|
-#endif
|