|
@@ -25,10 +25,6 @@ int absPreheatFanSpeed;
|
25
|
25
|
unsigned long message_millis = 0;
|
26
|
26
|
#endif
|
27
|
27
|
|
28
|
|
-#ifdef ULTIPANEL
|
29
|
|
- static float manual_feedrate[] = MANUAL_FEEDRATE;
|
30
|
|
-#endif // ULTIPANEL
|
31
|
|
-
|
32
|
28
|
/* !Configuration settings */
|
33
|
29
|
|
34
|
30
|
//Function pointer to menu functions.
|
|
@@ -38,193 +34,197 @@ uint8_t lcd_status_message_level;
|
38
|
34
|
char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
|
39
|
35
|
|
40
|
36
|
#ifdef DOGLCD
|
41
|
|
-#include "dogm_lcd_implementation.h"
|
|
37
|
+ #include "dogm_lcd_implementation.h"
|
42
|
38
|
#else
|
43
|
|
-#include "ultralcd_implementation_hitachi_HD44780.h"
|
|
39
|
+ #include "ultralcd_implementation_hitachi_HD44780.h"
|
44
|
40
|
#endif
|
45
|
41
|
|
46
|
|
-/* Different menus */
|
|
42
|
+// The main status screen
|
47
|
43
|
static void lcd_status_screen();
|
48
|
|
-#ifdef ULTIPANEL
|
49
|
|
-extern bool powersupply;
|
50
|
|
-static void lcd_main_menu();
|
51
|
|
-static void lcd_tune_menu();
|
52
|
|
-static void lcd_prepare_menu();
|
53
|
|
-static void lcd_move_menu();
|
54
|
|
-static void lcd_control_menu();
|
55
|
|
-static void lcd_control_temperature_menu();
|
56
|
|
-static void lcd_control_temperature_preheat_pla_settings_menu();
|
57
|
|
-static void lcd_control_temperature_preheat_abs_settings_menu();
|
58
|
|
-static void lcd_control_motion_menu();
|
59
|
|
-static void lcd_control_volumetric_menu();
|
60
|
|
-#ifdef DOGLCD
|
61
|
|
-static void lcd_set_contrast();
|
62
|
|
-#endif
|
63
|
|
-#ifdef FWRETRACT
|
64
|
|
-static void lcd_control_retract_menu();
|
65
|
|
-#endif
|
66
|
|
-static void lcd_sdcard_menu();
|
67
|
44
|
|
68
|
|
-#ifdef DELTA_CALIBRATION_MENU
|
69
|
|
-static void lcd_delta_calibrate_menu();
|
70
|
|
-#endif // DELTA_CALIBRATION_MENU
|
71
|
|
-
|
72
|
|
-#if defined(MANUAL_BED_LEVELING)
|
73
|
|
-#include "mesh_bed_leveling.h"
|
74
|
|
-static void _lcd_level_bed();
|
75
|
|
-static void _lcd_level_bed_homing();
|
76
|
|
-static void lcd_level_bed();
|
77
|
|
-#endif // MANUAL_BED_LEVELING
|
|
45
|
+#ifdef ULTIPANEL
|
78
|
46
|
|
79
|
|
-static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
|
80
|
|
-
|
81
|
|
-/* Different types of actions that can be used in menu items. */
|
82
|
|
-static void menu_action_back(menuFunc_t data);
|
83
|
|
-static void menu_action_submenu(menuFunc_t data);
|
84
|
|
-static void menu_action_gcode(const char* pgcode);
|
85
|
|
-static void menu_action_function(menuFunc_t data);
|
86
|
|
-static void menu_action_sdfile(const char* filename, char* longFilename);
|
87
|
|
-static void menu_action_sddirectory(const char* filename, char* longFilename);
|
88
|
|
-static void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
|
89
|
|
-static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
|
90
|
|
-static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
|
91
|
|
-static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue);
|
92
|
|
-static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue);
|
93
|
|
-static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
|
94
|
|
-static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
|
95
|
|
-static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
|
96
|
|
-static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
|
97
|
|
-static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc);
|
98
|
|
-static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
|
99
|
|
-static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
100
|
|
-static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
101
|
|
-static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
102
|
|
-static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
103
|
|
-static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
104
|
|
-static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
105
|
|
-static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
|
106
|
|
-
|
107
|
|
-#define ENCODER_FEEDRATE_DEADZONE 10
|
108
|
|
-
|
109
|
|
-#if !defined(LCD_I2C_VIKI)
|
110
|
|
- #ifndef ENCODER_STEPS_PER_MENU_ITEM
|
111
|
|
- #define ENCODER_STEPS_PER_MENU_ITEM 5
|
|
47
|
+ extern bool powersupply;
|
|
48
|
+ static float manual_feedrate[] = MANUAL_FEEDRATE;
|
|
49
|
+ static void lcd_main_menu();
|
|
50
|
+ static void lcd_tune_menu();
|
|
51
|
+ static void lcd_prepare_menu();
|
|
52
|
+ static void lcd_move_menu();
|
|
53
|
+ static void lcd_control_menu();
|
|
54
|
+ static void lcd_control_temperature_menu();
|
|
55
|
+ static void lcd_control_temperature_preheat_pla_settings_menu();
|
|
56
|
+ static void lcd_control_temperature_preheat_abs_settings_menu();
|
|
57
|
+ static void lcd_control_motion_menu();
|
|
58
|
+ static void lcd_control_volumetric_menu();
|
|
59
|
+ #ifdef DOGLCD
|
|
60
|
+ static void lcd_set_contrast();
|
112
|
61
|
#endif
|
113
|
|
- #ifndef ENCODER_PULSES_PER_STEP
|
114
|
|
- #define ENCODER_PULSES_PER_STEP 1
|
|
62
|
+ #ifdef FWRETRACT
|
|
63
|
+ static void lcd_control_retract_menu();
|
115
|
64
|
#endif
|
116
|
|
-#else
|
117
|
|
- #ifndef ENCODER_STEPS_PER_MENU_ITEM
|
118
|
|
- #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
|
|
65
|
+ static void lcd_sdcard_menu();
|
|
66
|
+
|
|
67
|
+ #ifdef DELTA_CALIBRATION_MENU
|
|
68
|
+ static void lcd_delta_calibrate_menu();
|
|
69
|
+ #endif
|
|
70
|
+
|
|
71
|
+ #if defined(MANUAL_BED_LEVELING)
|
|
72
|
+ #include "mesh_bed_leveling.h"
|
|
73
|
+ static void _lcd_level_bed();
|
|
74
|
+ static void _lcd_level_bed_homing();
|
|
75
|
+ static void lcd_level_bed();
|
119
|
76
|
#endif
|
120
|
|
- #ifndef ENCODER_PULSES_PER_STEP
|
121
|
|
- #define ENCODER_PULSES_PER_STEP 1
|
|
77
|
+
|
|
78
|
+ static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
|
|
79
|
+
|
|
80
|
+ /* Different types of actions that can be used in menu items. */
|
|
81
|
+ static void menu_action_back(menuFunc_t data);
|
|
82
|
+ static void menu_action_submenu(menuFunc_t data);
|
|
83
|
+ static void menu_action_gcode(const char* pgcode);
|
|
84
|
+ static void menu_action_function(menuFunc_t data);
|
|
85
|
+ static void menu_action_sdfile(const char* filename, char* longFilename);
|
|
86
|
+ static void menu_action_sddirectory(const char* filename, char* longFilename);
|
|
87
|
+ static void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
|
|
88
|
+ static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
|
|
89
|
+ static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
|
|
90
|
+ static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue);
|
|
91
|
+ static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue);
|
|
92
|
+ static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
|
|
93
|
+ static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
|
|
94
|
+ static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
|
|
95
|
+ static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
|
|
96
|
+ static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc);
|
|
97
|
+ static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
|
|
98
|
+ static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
|
99
|
+ static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
|
100
|
+ static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
|
101
|
+ static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
|
102
|
+ static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
|
103
|
+ static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
|
104
|
+ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
|
|
105
|
+
|
|
106
|
+ #define ENCODER_FEEDRATE_DEADZONE 10
|
|
107
|
+
|
|
108
|
+ #if !defined(LCD_I2C_VIKI)
|
|
109
|
+ #ifndef ENCODER_STEPS_PER_MENU_ITEM
|
|
110
|
+ #define ENCODER_STEPS_PER_MENU_ITEM 5
|
|
111
|
+ #endif
|
|
112
|
+ #ifndef ENCODER_PULSES_PER_STEP
|
|
113
|
+ #define ENCODER_PULSES_PER_STEP 1
|
|
114
|
+ #endif
|
|
115
|
+ #else
|
|
116
|
+ #ifndef ENCODER_STEPS_PER_MENU_ITEM
|
|
117
|
+ #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
|
|
118
|
+ #endif
|
|
119
|
+ #ifndef ENCODER_PULSES_PER_STEP
|
|
120
|
+ #define ENCODER_PULSES_PER_STEP 1
|
|
121
|
+ #endif
|
122
|
122
|
#endif
|
123
|
|
-#endif
|
124
|
123
|
|
125
|
124
|
|
126
|
|
-/* Helper macros for menus */
|
127
|
|
-
|
128
|
|
-/**
|
129
|
|
- * START_MENU generates the init code for a menu function
|
130
|
|
- */
|
131
|
|
-#define START_MENU() do { \
|
132
|
|
- encoderRateMultiplierEnabled = false; \
|
133
|
|
- if (encoderPosition > 0x8000) encoderPosition = 0; \
|
134
|
|
- uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
|
135
|
|
- if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
|
136
|
|
- uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
|
137
|
|
- bool wasClicked = LCD_CLICKED, itemSelected; \
|
138
|
|
- if (wasClicked) lcd_quick_feedback(); \
|
139
|
|
- for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
|
140
|
|
- _menuItemNr = 0;
|
141
|
|
-
|
142
|
|
-/**
|
143
|
|
- * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
|
144
|
|
- *
|
145
|
|
- * lcd_implementation_drawmenu_[type](sel, row, label, arg3...)
|
146
|
|
- * menu_action_[type](arg3...)
|
147
|
|
- *
|
148
|
|
- * Examples:
|
149
|
|
- * MENU_ITEM(back, MSG_WATCH, lcd_status_screen)
|
150
|
|
- * lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen)
|
151
|
|
- * menu_action_back(lcd_status_screen)
|
152
|
|
- *
|
153
|
|
- * MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
|
154
|
|
- * lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
|
155
|
|
- * menu_action_function(lcd_sdcard_pause)
|
156
|
|
- *
|
157
|
|
- * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999)
|
158
|
|
- * MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedmultiply, 10, 999)
|
159
|
|
- * lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedmultiply, 10, 999)
|
160
|
|
- * menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedmultiply, 10, 999)
|
161
|
|
- *
|
162
|
|
- */
|
163
|
|
-#define MENU_ITEM(type, label, args...) do { \
|
164
|
|
- if (_menuItemNr == _lineNr) { \
|
165
|
|
- itemSelected = encoderLine == _menuItemNr; \
|
166
|
|
- if (lcdDrawUpdate) \
|
167
|
|
- lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
|
168
|
|
- if (wasClicked && itemSelected) { \
|
169
|
|
- menu_action_ ## type(args); \
|
170
|
|
- return; \
|
171
|
|
- } \
|
172
|
|
- } \
|
173
|
|
- _menuItemNr++; \
|
174
|
|
-} while(0)
|
|
125
|
+ /* Helper macros for menus */
|
175
|
126
|
|
176
|
|
-#ifdef ENCODER_RATE_MULTIPLIER
|
177
|
127
|
/**
|
178
|
|
- * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
|
|
128
|
+ * START_MENU generates the init code for a menu function
|
179
|
129
|
*/
|
180
|
|
- #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
|
|
130
|
+ #define START_MENU() do { \
|
|
131
|
+ encoderRateMultiplierEnabled = false; \
|
|
132
|
+ if (encoderPosition > 0x8000) encoderPosition = 0; \
|
|
133
|
+ uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
|
|
134
|
+ if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
|
|
135
|
+ uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
|
|
136
|
+ bool wasClicked = LCD_CLICKED, itemSelected; \
|
|
137
|
+ if (wasClicked) lcd_quick_feedback(); \
|
|
138
|
+ for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
|
|
139
|
+ _menuItemNr = 0;
|
|
140
|
+
|
|
141
|
+ /**
|
|
142
|
+ * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
|
|
143
|
+ *
|
|
144
|
+ * lcd_implementation_drawmenu_[type](sel, row, label, arg3...)
|
|
145
|
+ * menu_action_[type](arg3...)
|
|
146
|
+ *
|
|
147
|
+ * Examples:
|
|
148
|
+ * MENU_ITEM(back, MSG_WATCH, lcd_status_screen)
|
|
149
|
+ * lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen)
|
|
150
|
+ * menu_action_back(lcd_status_screen)
|
|
151
|
+ *
|
|
152
|
+ * MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
|
|
153
|
+ * lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
|
|
154
|
+ * menu_action_function(lcd_sdcard_pause)
|
|
155
|
+ *
|
|
156
|
+ * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999)
|
|
157
|
+ * MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedmultiply, 10, 999)
|
|
158
|
+ * lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedmultiply, 10, 999)
|
|
159
|
+ * menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedmultiply, 10, 999)
|
|
160
|
+ *
|
|
161
|
+ */
|
|
162
|
+ #define MENU_ITEM(type, label, args...) do { \
|
181
|
163
|
if (_menuItemNr == _lineNr) { \
|
182
|
164
|
itemSelected = encoderLine == _menuItemNr; \
|
183
|
165
|
if (lcdDrawUpdate) \
|
184
|
166
|
lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
|
185
|
167
|
if (wasClicked && itemSelected) { \
|
186
|
|
- encoderRateMultiplierEnabled = true; \
|
187
|
|
- lastEncoderMovementMillis = 0; \
|
188
|
168
|
menu_action_ ## type(args); \
|
189
|
169
|
return; \
|
190
|
170
|
} \
|
191
|
171
|
} \
|
192
|
172
|
_menuItemNr++; \
|
193
|
173
|
} while(0)
|
194
|
|
-#endif //ENCODER_RATE_MULTIPLIER
|
195
|
|
-
|
196
|
|
-#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
|
197
|
|
-#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
|
198
|
|
-#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
|
199
|
|
-#ifdef ENCODER_RATE_MULTIPLIER
|
200
|
|
- #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
|
201
|
|
- #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
|
202
|
|
-#else //!ENCODER_RATE_MULTIPLIER
|
203
|
|
- #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
|
204
|
|
- #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
|
205
|
|
-#endif //!ENCODER_RATE_MULTIPLIER
|
206
|
|
-#define END_MENU() \
|
207
|
|
- if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\
|
208
|
|
- if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
|
209
|
|
- } } while(0)
|
210
|
|
-
|
211
|
|
-/** Used variables to keep track of the menu */
|
212
|
|
-#ifndef REPRAPWORLD_KEYPAD
|
213
|
|
-volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
|
214
|
|
-#else
|
215
|
|
-volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shift register values
|
216
|
|
-#endif
|
217
|
|
-#ifdef LCD_HAS_SLOW_BUTTONS
|
218
|
|
-volatile uint8_t slow_buttons;//Contains the bits of the currently pressed buttons.
|
219
|
|
-#endif
|
220
|
|
-uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
|
221
|
|
-uint32_t blocking_enc;
|
222
|
|
-uint8_t lastEncoderBits;
|
223
|
|
-uint32_t encoderPosition;
|
224
|
|
-#if (SDCARDDETECT > 0)
|
225
|
|
-bool lcd_oldcardstatus;
|
226
|
|
-#endif
|
227
|
|
-#endif //ULTIPANEL
|
|
174
|
+
|
|
175
|
+ #ifdef ENCODER_RATE_MULTIPLIER
|
|
176
|
+ /**
|
|
177
|
+ * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
|
|
178
|
+ */
|
|
179
|
+ #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
|
|
180
|
+ if (_menuItemNr == _lineNr) { \
|
|
181
|
+ itemSelected = encoderLine == _menuItemNr; \
|
|
182
|
+ if (lcdDrawUpdate) \
|
|
183
|
+ lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
|
|
184
|
+ if (wasClicked && itemSelected) { \
|
|
185
|
+ encoderRateMultiplierEnabled = true; \
|
|
186
|
+ lastEncoderMovementMillis = 0; \
|
|
187
|
+ menu_action_ ## type(args); \
|
|
188
|
+ return; \
|
|
189
|
+ } \
|
|
190
|
+ } \
|
|
191
|
+ _menuItemNr++; \
|
|
192
|
+ } while(0)
|
|
193
|
+ #endif //ENCODER_RATE_MULTIPLIER
|
|
194
|
+
|
|
195
|
+ #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
|
|
196
|
+ #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
|
|
197
|
+ #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
|
|
198
|
+ #ifdef ENCODER_RATE_MULTIPLIER
|
|
199
|
+ #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
|
|
200
|
+ #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
|
|
201
|
+ #else //!ENCODER_RATE_MULTIPLIER
|
|
202
|
+ #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
|
|
203
|
+ #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
|
|
204
|
+ #endif //!ENCODER_RATE_MULTIPLIER
|
|
205
|
+ #define END_MENU() \
|
|
206
|
+ if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\
|
|
207
|
+ if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
|
|
208
|
+ } } while(0)
|
|
209
|
+
|
|
210
|
+ /** Used variables to keep track of the menu */
|
|
211
|
+ #ifndef REPRAPWORLD_KEYPAD
|
|
212
|
+ volatile uint8_t buttons; // Bits of the pressed buttons.
|
|
213
|
+ #else
|
|
214
|
+ volatile uint8_t buttons_reprapworld_keypad; // The reprapworld_keypad shift register values
|
|
215
|
+ #endif
|
|
216
|
+ #ifdef LCD_HAS_SLOW_BUTTONS
|
|
217
|
+ volatile uint8_t slow_buttons; // Bits of the pressed buttons.
|
|
218
|
+ #endif
|
|
219
|
+ uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
|
|
220
|
+ uint32_t blocking_enc;
|
|
221
|
+ uint8_t lastEncoderBits;
|
|
222
|
+ uint32_t encoderPosition;
|
|
223
|
+ #if (SDCARDDETECT > 0)
|
|
224
|
+ bool lcd_oldcardstatus;
|
|
225
|
+ #endif
|
|
226
|
+
|
|
227
|
+#endif // ULTIPANEL
|
228
|
228
|
|
229
|
229
|
menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */
|
230
|
230
|
uint32_t lcd_next_update_millis;
|
|
@@ -520,22 +520,21 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
|
520
|
520
|
void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
521
|
521
|
void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
|
522
|
522
|
|
523
|
|
-#if TEMP_SENSOR_1 != 0 //2nd extruder preheat
|
524
|
|
- void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
525
|
|
- void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
|
526
|
|
-#endif //2nd extruder preheat
|
|
523
|
+#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0 //more than one extruder present
|
527
|
524
|
|
528
|
|
-#if TEMP_SENSOR_2 != 0 //3 extruder preheat
|
529
|
|
- void lcd_preheat_pla2() { _lcd_preheat(2, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
530
|
|
- void lcd_preheat_abs2() { _lcd_preheat(2, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
|
531
|
|
-#endif //3 extruder preheat
|
532
|
|
-
|
533
|
|
-#if TEMP_SENSOR_3 != 0 //4 extruder preheat
|
534
|
|
- void lcd_preheat_pla3() { _lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
535
|
|
- void lcd_preheat_abs3() { _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
|
536
|
|
-#endif //4 extruder preheat
|
|
525
|
+ #if TEMP_SENSOR_1 != 0
|
|
526
|
+ void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
|
527
|
+ void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
|
|
528
|
+ #endif
|
|
529
|
+ #if TEMP_SENSOR_2 != 0
|
|
530
|
+ void lcd_preheat_pla2() { _lcd_preheat(2, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
|
531
|
+ void lcd_preheat_abs2() { _lcd_preheat(2, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
|
|
532
|
+ #endif
|
|
533
|
+ #if TEMP_SENSOR_3 != 0
|
|
534
|
+ void lcd_preheat_pla3() { _lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
|
535
|
+ void lcd_preheat_abs3() { _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
|
|
536
|
+ #endif
|
537
|
537
|
|
538
|
|
-#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //more than one extruder present
|
539
|
538
|
void lcd_preheat_pla0123() {
|
540
|
539
|
setTargetHotend0(plaPreheatHotendTemp);
|
541
|
540
|
setTargetHotend1(plaPreheatHotendTemp);
|
|
@@ -548,54 +547,54 @@ void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTem
|
548
|
547
|
setTargetHotend2(absPreheatHotendTemp);
|
549
|
548
|
_lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed);
|
550
|
549
|
}
|
551
|
|
-#endif //more than one extruder present
|
552
|
550
|
|
553
|
|
-void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
554
|
|
-void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, absPreheatHPBTemp, absPreheatFanSpeed); }
|
|
551
|
+ #if TEMP_SENSOR_0 != 0
|
555
|
552
|
|
556
|
|
-static void lcd_preheat_pla_menu() {
|
557
|
|
- START_MENU();
|
558
|
|
- MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
559
|
|
- MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0);
|
560
|
|
- #if TEMP_SENSOR_1 != 0 //2 extruder preheat
|
561
|
|
- MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1);
|
562
|
|
- #endif //2 extruder preheat
|
563
|
|
- #if TEMP_SENSOR_2 != 0 //3 extruder preheat
|
564
|
|
- MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2);
|
565
|
|
- #endif //3 extruder preheat
|
566
|
|
- #if TEMP_SENSOR_3 != 0 //4 extruder preheat
|
567
|
|
- MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3);
|
568
|
|
- #endif //4 extruder preheat
|
569
|
|
- #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat
|
570
|
|
- MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123);
|
571
|
|
- #endif //all extruder preheat
|
572
|
|
- #if TEMP_SENSOR_BED != 0
|
573
|
|
- MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly);
|
574
|
|
- #endif
|
575
|
|
- END_MENU();
|
576
|
|
-}
|
|
553
|
+ void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
|
554
|
+ void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, absPreheatHPBTemp, absPreheatFanSpeed); }
|
577
|
555
|
|
578
|
|
-static void lcd_preheat_abs_menu() {
|
579
|
|
- START_MENU();
|
580
|
|
- MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
581
|
|
- MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0);
|
582
|
|
- #if TEMP_SENSOR_1 != 0 //2 extruder preheat
|
583
|
|
- MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1);
|
584
|
|
- #endif //2 extruder preheat
|
585
|
|
- #if TEMP_SENSOR_2 != 0 //3 extruder preheat
|
586
|
|
- MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2);
|
587
|
|
- #endif //3 extruder preheat
|
588
|
|
- #if TEMP_SENSOR_3 != 0 //4 extruder preheat
|
589
|
|
- MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3);
|
590
|
|
- #endif //4 extruder preheat
|
591
|
|
- #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat
|
592
|
|
- MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123);
|
593
|
|
- #endif //all extruder preheat
|
594
|
|
- #if TEMP_SENSOR_BED != 0
|
595
|
|
- MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly);
|
|
556
|
+ static void lcd_preheat_pla_menu() {
|
|
557
|
+ START_MENU();
|
|
558
|
+ MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
|
559
|
+ MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0);
|
|
560
|
+ #if TEMP_SENSOR_1 != 0
|
|
561
|
+ MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1);
|
|
562
|
+ #endif
|
|
563
|
+ #if TEMP_SENSOR_2 != 0
|
|
564
|
+ MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2);
|
|
565
|
+ #endif
|
|
566
|
+ #if TEMP_SENSOR_3 != 0
|
|
567
|
+ MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3);
|
|
568
|
+ #endif
|
|
569
|
+ MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123);
|
|
570
|
+ #if TEMP_SENSOR_BED != 0
|
|
571
|
+ MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly);
|
|
572
|
+ #endif
|
|
573
|
+ END_MENU();
|
|
574
|
+ }
|
|
575
|
+
|
|
576
|
+ static void lcd_preheat_abs_menu() {
|
|
577
|
+ START_MENU();
|
|
578
|
+ MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
|
579
|
+ MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0);
|
|
580
|
+ #if TEMP_SENSOR_1 != 0
|
|
581
|
+ MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1);
|
|
582
|
+ #endif
|
|
583
|
+ #if TEMP_SENSOR_2 != 0
|
|
584
|
+ MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2);
|
|
585
|
+ #endif
|
|
586
|
+ #if TEMP_SENSOR_3 != 0
|
|
587
|
+ MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3);
|
|
588
|
+ #endif
|
|
589
|
+ MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123);
|
|
590
|
+ #if TEMP_SENSOR_BED != 0
|
|
591
|
+ MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly);
|
|
592
|
+ #endif
|
|
593
|
+ END_MENU();
|
|
594
|
+ }
|
596
|
595
|
#endif
|
597
|
|
- END_MENU();
|
598
|
|
-}
|
|
596
|
+
|
|
597
|
+#endif // more than one temperature sensor present
|
599
|
598
|
|
600
|
599
|
void lcd_cooldown() {
|
601
|
600
|
setTargetHotend0(0);
|
|
@@ -618,7 +617,7 @@ static void lcd_prepare_menu() {
|
618
|
617
|
MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets);
|
619
|
618
|
//MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
|
620
|
619
|
#if TEMP_SENSOR_0 != 0
|
621
|
|
- #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_BED != 0
|
|
620
|
+ #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0
|
622
|
621
|
MENU_ITEM(submenu, MSG_PREHEAT_PLA, lcd_preheat_pla_menu);
|
623
|
622
|
MENU_ITEM(submenu, MSG_PREHEAT_ABS, lcd_preheat_abs_menu);
|
624
|
623
|
#else
|