1 |
ron |
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 |
|
|
|
23 |
#include "MarlinConfig.h"
|
|
|
24 |
|
|
|
25 |
#if ENABLED(ULTRA_LCD)
|
|
|
26 |
|
|
|
27 |
#include "ultralcd.h"
|
|
|
28 |
#include "Marlin.h"
|
|
|
29 |
#include "language.h"
|
|
|
30 |
#include "cardreader.h"
|
|
|
31 |
#include "temperature.h"
|
|
|
32 |
#include "planner.h"
|
|
|
33 |
#include "stepper.h"
|
|
|
34 |
#include "configuration_store.h"
|
|
|
35 |
#include "utility.h"
|
|
|
36 |
#include "parser.h"
|
|
|
37 |
|
|
|
38 |
#if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER)
|
|
|
39 |
#include "buzzer.h"
|
|
|
40 |
#endif
|
|
|
41 |
|
|
|
42 |
#include "printcounter.h"
|
|
|
43 |
|
|
|
44 |
#if ENABLED(PRINTCOUNTER)
|
|
|
45 |
#include "duration_t.h"
|
|
|
46 |
#endif
|
|
|
47 |
|
|
|
48 |
#if ENABLED(BLTOUCH)
|
|
|
49 |
#include "endstops.h"
|
|
|
50 |
#endif
|
|
|
51 |
|
|
|
52 |
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
53 |
#include "ubl.h"
|
|
|
54 |
#elif HAS_ABL
|
|
|
55 |
#include "planner.h"
|
|
|
56 |
#elif ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
|
|
|
57 |
#include "mesh_bed_leveling.h"
|
|
|
58 |
#endif
|
|
|
59 |
|
|
|
60 |
#if ENABLED(FWRETRACT)
|
|
|
61 |
#include "fwretract.h"
|
|
|
62 |
#endif
|
|
|
63 |
|
|
|
64 |
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
|
65 |
#include "power_loss_recovery.h"
|
|
|
66 |
#endif
|
|
|
67 |
|
|
|
68 |
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
|
|
69 |
#if LONG_FILENAME_LENGTH > CHARSIZE * 2 * (LCD_WIDTH)
|
|
|
70 |
#define MAX_MESSAGE_LENGTH LONG_FILENAME_LENGTH
|
|
|
71 |
#else
|
|
|
72 |
#define MAX_MESSAGE_LENGTH CHARSIZE * 2 * (LCD_WIDTH)
|
|
|
73 |
#endif
|
|
|
74 |
uint8_t status_scroll_offset = 0;
|
|
|
75 |
#else
|
|
|
76 |
#define MAX_MESSAGE_LENGTH CHARSIZE * (LCD_WIDTH)
|
|
|
77 |
#endif
|
|
|
78 |
|
|
|
79 |
char lcd_status_message[MAX_MESSAGE_LENGTH + 1];
|
|
|
80 |
uint8_t lcd_status_update_delay = 1, // First update one loop delayed
|
|
|
81 |
lcd_status_message_level; // Higher level blocks lower level
|
|
|
82 |
|
|
|
83 |
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
|
|
|
84 |
millis_t previous_lcd_status_ms = 0;
|
|
|
85 |
#endif
|
|
|
86 |
|
|
|
87 |
#if ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES)
|
|
|
88 |
uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash;
|
|
|
89 |
#endif
|
|
|
90 |
|
|
|
91 |
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
|
|
92 |
uint8_t progress_bar_percent;
|
|
|
93 |
#endif
|
|
|
94 |
|
|
|
95 |
#if ENABLED(DOGLCD)
|
|
|
96 |
#include "ultralcd_impl_DOGM.h"
|
|
|
97 |
#include <U8glib.h>
|
|
|
98 |
bool drawing_screen, first_page; // = false
|
|
|
99 |
#else
|
|
|
100 |
#include "ultralcd_impl_HD44780.h"
|
|
|
101 |
constexpr bool first_page = true;
|
|
|
102 |
#endif
|
|
|
103 |
|
|
|
104 |
// The main status screen
|
|
|
105 |
void lcd_status_screen();
|
|
|
106 |
|
|
|
107 |
millis_t next_lcd_update_ms;
|
|
|
108 |
|
|
|
109 |
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
|
|
|
110 |
uint16_t max_display_update_time = 0;
|
|
|
111 |
|
|
|
112 |
#if ENABLED(ULTIPANEL)
|
|
|
113 |
|
|
|
114 |
#define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(_type, _name, _strFunc) \
|
|
|
115 |
inline void lcd_implementation_drawmenu_setting_edit_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
|
|
|
116 |
UNUSED(pstr2); \
|
|
|
117 |
DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \
|
|
|
118 |
} \
|
|
|
119 |
inline void lcd_implementation_drawmenu_setting_edit_callback_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
|
|
|
120 |
UNUSED(pstr2); \
|
|
|
121 |
DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \
|
|
|
122 |
} \
|
|
|
123 |
inline void lcd_implementation_drawmenu_setting_edit_accessor_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type (*pget)(), void (*pset)(_type), ...) { \
|
|
|
124 |
UNUSED(pstr2); UNUSED(pset); \
|
|
|
125 |
DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(pget())); \
|
|
|
126 |
} \
|
|
|
127 |
typedef void _name##_void
|
|
|
128 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int16_t, int3, itostr3);
|
|
|
129 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(uint8_t, int8, i8tostr3);
|
|
|
130 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float3, ftostr3);
|
|
|
131 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52, ftostr52);
|
|
|
132 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float43, ftostr43sign);
|
|
|
133 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float5, ftostr5rj);
|
|
|
134 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float51, ftostr51sign);
|
|
|
135 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52sign, ftostr52sign);
|
|
|
136 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float62, ftostr62rj);
|
|
|
137 |
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(uint32_t, long5, ftostr5rj);
|
|
|
138 |
#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) DRAW_BOOL_SETTING(sel, row, pstr, data)
|
|
|
139 |
#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) DRAW_BOOL_SETTING(sel, row, pstr, data)
|
|
|
140 |
#define lcd_implementation_drawmenu_setting_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset) DRAW_BOOL_SETTING(sel, row, pstr, data)
|
|
|
141 |
|
|
|
142 |
#ifndef TALL_FONT_CORRECTION
|
|
|
143 |
#define TALL_FONT_CORRECTION 0
|
|
|
144 |
#endif
|
|
|
145 |
|
|
|
146 |
bool no_reentry = false;
|
|
|
147 |
constexpr int8_t menu_bottom = LCD_HEIGHT - (TALL_FONT_CORRECTION);
|
|
|
148 |
|
|
|
149 |
// Initialized by settings.load()
|
|
|
150 |
int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
|
|
|
151 |
|
|
|
152 |
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
|
|
|
153 |
bool lcd_external_control; // = false
|
|
|
154 |
#endif
|
|
|
155 |
|
|
|
156 |
#if ENABLED(BABYSTEPPING)
|
|
|
157 |
long babysteps_done = 0;
|
|
|
158 |
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
|
159 |
static void lcd_babystep_zoffset();
|
|
|
160 |
#else
|
|
|
161 |
static void lcd_babystep_z();
|
|
|
162 |
#endif
|
|
|
163 |
#endif
|
|
|
164 |
|
|
|
165 |
#if ENABLED(DAC_STEPPER_CURRENT)
|
|
|
166 |
#include "stepper_dac.h" //was dac_mcp4728.h MarlinMain uses stepper dac for the m-codes
|
|
|
167 |
uint8_t driverPercent[XYZE];
|
|
|
168 |
#endif
|
|
|
169 |
|
|
|
170 |
////////////////////////////////////////////
|
|
|
171 |
///////////////// Menu Tree ////////////////
|
|
|
172 |
////////////////////////////////////////////
|
|
|
173 |
|
|
|
174 |
void lcd_main_menu();
|
|
|
175 |
void lcd_tune_menu();
|
|
|
176 |
void lcd_prepare_menu();
|
|
|
177 |
void lcd_move_menu();
|
|
|
178 |
void lcd_control_menu();
|
|
|
179 |
void lcd_control_temperature_menu();
|
|
|
180 |
void lcd_control_motion_menu();
|
|
|
181 |
|
|
|
182 |
#if DISABLED(SLIM_LCD_MENUS)
|
|
|
183 |
void lcd_control_temperature_preheat_material1_settings_menu();
|
|
|
184 |
void lcd_control_temperature_preheat_material2_settings_menu();
|
|
|
185 |
#endif
|
|
|
186 |
|
|
|
187 |
#if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
188 |
void lcd_control_filament_menu();
|
|
|
189 |
#endif
|
|
|
190 |
|
|
|
191 |
#if ENABLED(LCD_INFO_MENU)
|
|
|
192 |
#if ENABLED(PRINTCOUNTER)
|
|
|
193 |
void lcd_info_stats_menu();
|
|
|
194 |
#endif
|
|
|
195 |
void lcd_info_thermistors_menu();
|
|
|
196 |
void lcd_info_board_menu();
|
|
|
197 |
void lcd_info_menu();
|
|
|
198 |
#endif // LCD_INFO_MENU
|
|
|
199 |
|
|
|
200 |
#if ENABLED(LED_CONTROL_MENU)
|
|
|
201 |
#include "leds.h"
|
|
|
202 |
void lcd_led_menu();
|
|
|
203 |
#endif
|
|
|
204 |
|
|
|
205 |
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
206 |
#if E_STEPPERS > 1 || ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
|
|
207 |
void lcd_change_filament_menu();
|
|
|
208 |
#else
|
|
|
209 |
void lcd_temp_menu_e0_filament_change();
|
|
|
210 |
#endif
|
|
|
211 |
#endif
|
|
|
212 |
|
|
|
213 |
#if ENABLED(DAC_STEPPER_CURRENT)
|
|
|
214 |
void dac_driver_commit();
|
|
|
215 |
void dac_driver_getValues();
|
|
|
216 |
void lcd_dac_menu();
|
|
|
217 |
void lcd_dac_write_eeprom();
|
|
|
218 |
#endif
|
|
|
219 |
|
|
|
220 |
#if ENABLED(FWRETRACT)
|
|
|
221 |
void lcd_control_retract_menu();
|
|
|
222 |
#endif
|
|
|
223 |
|
|
|
224 |
#if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION)
|
|
|
225 |
void lcd_delta_calibrate_menu();
|
|
|
226 |
#endif
|
|
|
227 |
|
|
|
228 |
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
229 |
static float new_z_fade_height;
|
|
|
230 |
void _lcd_set_z_fade_height() { set_z_fade_height(new_z_fade_height); }
|
|
|
231 |
#endif
|
|
|
232 |
|
|
|
233 |
////////////////////////////////////////////
|
|
|
234 |
//////////// Menu System Actions ///////////
|
|
|
235 |
////////////////////////////////////////////
|
|
|
236 |
|
|
|
237 |
#define menu_action_back(dummy) _menu_action_back()
|
|
|
238 |
void _menu_action_back();
|
|
|
239 |
void menu_action_submenu(screenFunc_t data);
|
|
|
240 |
void menu_action_gcode(const char* pgcode);
|
|
|
241 |
void menu_action_function(menuAction_t data);
|
|
|
242 |
|
|
|
243 |
#define DECLARE_MENU_EDIT_TYPE(_type, _name) \
|
|
|
244 |
bool _menu_edit_ ## _name(); \
|
|
|
245 |
void menu_edit_ ## _name(); \
|
|
|
246 |
void menu_edit_callback_ ## _name(); \
|
|
|
247 |
void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue); \
|
|
|
248 |
void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue); \
|
|
|
249 |
void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback=NULL, const bool live=false); \
|
|
|
250 |
typedef void _name##_void
|
|
|
251 |
|
|
|
252 |
DECLARE_MENU_EDIT_TYPE(int16_t, int3);
|
|
|
253 |
DECLARE_MENU_EDIT_TYPE(uint8_t, int8);
|
|
|
254 |
DECLARE_MENU_EDIT_TYPE(float, float3);
|
|
|
255 |
DECLARE_MENU_EDIT_TYPE(float, float52);
|
|
|
256 |
DECLARE_MENU_EDIT_TYPE(float, float43);
|
|
|
257 |
DECLARE_MENU_EDIT_TYPE(float, float5);
|
|
|
258 |
DECLARE_MENU_EDIT_TYPE(float, float51);
|
|
|
259 |
DECLARE_MENU_EDIT_TYPE(float, float52sign);
|
|
|
260 |
DECLARE_MENU_EDIT_TYPE(float, float62);
|
|
|
261 |
DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
|
|
|
262 |
|
|
|
263 |
void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
|
|
|
264 |
void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
|
|
|
265 |
|
|
|
266 |
#if ENABLED(SDSUPPORT)
|
|
|
267 |
void lcd_sdcard_menu();
|
|
|
268 |
void menu_action_sdfile(CardReader& theCard);
|
|
|
269 |
void menu_action_sddirectory(CardReader& theCard);
|
|
|
270 |
#endif
|
|
|
271 |
|
|
|
272 |
////////////////////////////////////////////
|
|
|
273 |
//////////// Menu System Macros ////////////
|
|
|
274 |
////////////////////////////////////////////
|
|
|
275 |
|
|
|
276 |
/**
|
|
|
277 |
* MENU_ITEM generates draw & handler code for a menu item, potentially calling:
|
|
|
278 |
*
|
|
|
279 |
* lcd_implementation_drawmenu_[type](sel, row, label, arg3...)
|
|
|
280 |
* menu_action_[type](arg3...)
|
|
|
281 |
*
|
|
|
282 |
* Examples:
|
|
|
283 |
* MENU_ITEM(back, MSG_WATCH, 0 [dummy parameter] )
|
|
|
284 |
* or
|
|
|
285 |
* MENU_BACK(MSG_WATCH)
|
|
|
286 |
* lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH))
|
|
|
287 |
* menu_action_back()
|
|
|
288 |
*
|
|
|
289 |
* MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
|
|
|
290 |
* lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
|
|
|
291 |
* menu_action_function(lcd_sdcard_pause)
|
|
|
292 |
*
|
|
|
293 |
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
|
|
|
294 |
* MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
|
|
295 |
* lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
|
|
296 |
* menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
|
|
297 |
*
|
|
|
298 |
*/
|
|
|
299 |
#define _MENU_ITEM_PART_1(TYPE, ...) \
|
|
|
300 |
if (_menuLineNr == _thisItemNr) { \
|
|
|
301 |
if (encoderLine == _thisItemNr && lcd_clicked) { \
|
|
|
302 |
lcd_clicked = false
|
|
|
303 |
|
|
|
304 |
#define _MENU_ITEM_PART_2(TYPE, PLABEL, ...) \
|
|
|
305 |
menu_action_ ## TYPE(__VA_ARGS__); \
|
|
|
306 |
if (screen_changed) return; \
|
|
|
307 |
} \
|
|
|
308 |
if (lcdDrawUpdate) \
|
|
|
309 |
lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PLABEL, ## __VA_ARGS__); \
|
|
|
310 |
} \
|
|
|
311 |
++_thisItemNr
|
|
|
312 |
|
|
|
313 |
#define MENU_ITEM_P(TYPE, PLABEL, ...) do { \
|
|
|
314 |
_skipStatic = false; \
|
|
|
315 |
_MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \
|
|
|
316 |
_MENU_ITEM_PART_2(TYPE, PLABEL, ## __VA_ARGS__); \
|
|
|
317 |
}while(0)
|
|
|
318 |
|
|
|
319 |
#define MENU_ITEM(TYPE, LABEL, ...) MENU_ITEM_P(TYPE, PSTR(LABEL), ## __VA_ARGS__)
|
|
|
320 |
|
|
|
321 |
#define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0)
|
|
|
322 |
|
|
|
323 |
// Used to print static text with no visible cursor.
|
|
|
324 |
// Parameters: label [, bool center [, bool invert [, char *value] ] ]
|
|
|
325 |
#define STATIC_ITEM_P(LABEL, ...) \
|
|
|
326 |
if (_menuLineNr == _thisItemNr) { \
|
|
|
327 |
if (_skipStatic && encoderLine <= _thisItemNr) { \
|
|
|
328 |
encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
|
|
|
329 |
++encoderLine; \
|
|
|
330 |
} \
|
|
|
331 |
if (lcdDrawUpdate) \
|
|
|
332 |
lcd_implementation_drawmenu_static(_lcdLineNr, LABEL, ## __VA_ARGS__); \
|
|
|
333 |
} \
|
|
|
334 |
++_thisItemNr
|
|
|
335 |
|
|
|
336 |
#define STATIC_ITEM(LABEL, ...) STATIC_ITEM_P(PSTR(LABEL), ## __VA_ARGS__)
|
|
|
337 |
|
|
|
338 |
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
|
|
339 |
|
|
|
340 |
bool encoderRateMultiplierEnabled;
|
|
|
341 |
#define ENCODER_RATE_MULTIPLY(F) (encoderRateMultiplierEnabled = F)
|
|
|
342 |
|
|
|
343 |
//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value
|
|
|
344 |
|
|
|
345 |
/**
|
|
|
346 |
* MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
|
|
|
347 |
*/
|
|
|
348 |
#define MENU_MULTIPLIER_ITEM(TYPE, LABEL, ...) do { \
|
|
|
349 |
_MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \
|
|
|
350 |
encoderRateMultiplierEnabled = true; \
|
|
|
351 |
lastEncoderMovementMillis = 0; \
|
|
|
352 |
_MENU_ITEM_PART_2(TYPE, PSTR(LABEL), ## __VA_ARGS__); \
|
|
|
353 |
}while(0)
|
|
|
354 |
|
|
|
355 |
#else // !ENCODER_RATE_MULTIPLIER
|
|
|
356 |
#define ENCODER_RATE_MULTIPLY(F) NOOP
|
|
|
357 |
#endif // !ENCODER_RATE_MULTIPLIER
|
|
|
358 |
|
|
|
359 |
#define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
|
|
|
360 |
#define MENU_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
|
361 |
#define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
|
362 |
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
|
|
363 |
#define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
|
364 |
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
|
365 |
#else // !ENCODER_RATE_MULTIPLIER
|
|
|
366 |
#define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
|
367 |
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
|
|
|
368 |
#endif // !ENCODER_RATE_MULTIPLIER
|
|
|
369 |
|
|
|
370 |
#define SCREEN_OR_MENU_LOOP() \
|
|
|
371 |
int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
|
|
|
372 |
for (int8_t _lcdLineNr = 0; _lcdLineNr < menu_bottom; _lcdLineNr++, _menuLineNr++) { \
|
|
|
373 |
_thisItemNr = 0
|
|
|
374 |
|
|
|
375 |
/**
|
|
|
376 |
* START_SCREEN Opening code for a screen having only static items.
|
|
|
377 |
* Do simplified scrolling of the entire screen.
|
|
|
378 |
*
|
|
|
379 |
* START_MENU Opening code for a screen with menu items.
|
|
|
380 |
* Scroll as-needed to keep the selected line in view.
|
|
|
381 |
*/
|
|
|
382 |
#define START_SCREEN() \
|
|
|
383 |
scroll_screen(menu_bottom, false); \
|
|
|
384 |
bool _skipStatic = false; \
|
|
|
385 |
SCREEN_OR_MENU_LOOP()
|
|
|
386 |
|
|
|
387 |
#define START_MENU() \
|
|
|
388 |
scroll_screen(1, true); \
|
|
|
389 |
bool _skipStatic = true; \
|
|
|
390 |
SCREEN_OR_MENU_LOOP()
|
|
|
391 |
|
|
|
392 |
#define END_SCREEN() \
|
|
|
393 |
} \
|
|
|
394 |
screen_items = _thisItemNr
|
|
|
395 |
|
|
|
396 |
#define END_MENU() \
|
|
|
397 |
} \
|
|
|
398 |
screen_items = _thisItemNr; \
|
|
|
399 |
UNUSED(_skipStatic)
|
|
|
400 |
|
|
|
401 |
////////////////////////////////////////////
|
|
|
402 |
///////////// Global Variables /////////////
|
|
|
403 |
////////////////////////////////////////////
|
|
|
404 |
|
|
|
405 |
/**
|
|
|
406 |
* REVERSE_MENU_DIRECTION
|
|
|
407 |
*
|
|
|
408 |
* To reverse the menu direction we need a general way to reverse
|
|
|
409 |
* the direction of the encoder everywhere. So encoderDirection is
|
|
|
410 |
* added to allow the encoder to go the other way.
|
|
|
411 |
*
|
|
|
412 |
* This behavior is limited to scrolling Menus and SD card listings,
|
|
|
413 |
* and is disabled in other contexts.
|
|
|
414 |
*/
|
|
|
415 |
#if ENABLED(REVERSE_MENU_DIRECTION)
|
|
|
416 |
int8_t encoderDirection = 1;
|
|
|
417 |
#define ENCODER_DIRECTION_NORMAL() (encoderDirection = 1)
|
|
|
418 |
#define ENCODER_DIRECTION_MENUS() (encoderDirection = -1)
|
|
|
419 |
#else
|
|
|
420 |
#define ENCODER_DIRECTION_NORMAL() ;
|
|
|
421 |
#define ENCODER_DIRECTION_MENUS() ;
|
|
|
422 |
#endif
|
|
|
423 |
|
|
|
424 |
// Encoder Movement
|
|
|
425 |
volatile int8_t encoderDiff; // Updated in lcd_buttons_update, added to encoderPosition every LCD update
|
|
|
426 |
uint32_t encoderPosition;
|
|
|
427 |
millis_t lastEncoderMovementMillis = 0;
|
|
|
428 |
|
|
|
429 |
// Button States
|
|
|
430 |
bool lcd_clicked, wait_for_unclick;
|
|
|
431 |
volatile uint8_t buttons;
|
|
|
432 |
millis_t next_button_update_ms;
|
|
|
433 |
#if ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
434 |
volatile uint8_t buttons_reprapworld_keypad;
|
|
|
435 |
#endif
|
|
|
436 |
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
437 |
volatile uint8_t slow_buttons;
|
|
|
438 |
#endif
|
|
|
439 |
|
|
|
440 |
// Menu System Navigation
|
|
|
441 |
screenFunc_t currentScreen = lcd_status_screen;
|
|
|
442 |
int8_t encoderTopLine;
|
|
|
443 |
typedef struct {
|
|
|
444 |
screenFunc_t menu_function;
|
|
|
445 |
uint32_t encoder_position;
|
|
|
446 |
} menuPosition;
|
|
|
447 |
menuPosition screen_history[6];
|
|
|
448 |
uint8_t screen_history_depth = 0;
|
|
|
449 |
bool screen_changed, defer_return_to_status;
|
|
|
450 |
|
|
|
451 |
// Value Editing
|
|
|
452 |
const char *editLabel;
|
|
|
453 |
void *editValue;
|
|
|
454 |
int32_t minEditValue, maxEditValue;
|
|
|
455 |
screenFunc_t callbackFunc;
|
|
|
456 |
bool liveEdit;
|
|
|
457 |
|
|
|
458 |
// Manual Moves
|
|
|
459 |
const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE;
|
|
|
460 |
millis_t manual_move_start_time = 0;
|
|
|
461 |
int8_t manual_move_axis = (int8_t)NO_AXIS;
|
|
|
462 |
#if EXTRUDERS > 1
|
|
|
463 |
int8_t manual_move_e_index = 0;
|
|
|
464 |
#else
|
|
|
465 |
#define manual_move_e_index 0
|
|
|
466 |
#endif
|
|
|
467 |
|
|
|
468 |
#if IS_KINEMATIC
|
|
|
469 |
bool processing_manual_move = false;
|
|
|
470 |
float manual_move_offset = 0;
|
|
|
471 |
#else
|
|
|
472 |
constexpr bool processing_manual_move = false;
|
|
|
473 |
#endif
|
|
|
474 |
|
|
|
475 |
#if PIN_EXISTS(SD_DETECT)
|
|
|
476 |
uint8_t lcd_sd_status;
|
|
|
477 |
#endif
|
|
|
478 |
|
|
|
479 |
#if ENABLED(PIDTEMP)
|
|
|
480 |
float raw_Ki, raw_Kd; // place-holders for Ki and Kd edits
|
|
|
481 |
#endif
|
|
|
482 |
|
|
|
483 |
inline bool use_click() {
|
|
|
484 |
const bool click = lcd_clicked;
|
|
|
485 |
lcd_clicked = false;
|
|
|
486 |
return click;
|
|
|
487 |
}
|
|
|
488 |
|
|
|
489 |
/**
|
|
|
490 |
* General function to go directly to a screen
|
|
|
491 |
*/
|
|
|
492 |
void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) {
|
|
|
493 |
if (currentScreen != screen) {
|
|
|
494 |
|
|
|
495 |
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
496 |
// Shadow for editing the fade height
|
|
|
497 |
new_z_fade_height = planner.z_fade_height;
|
|
|
498 |
#endif
|
|
|
499 |
|
|
|
500 |
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) && ENABLED(BABYSTEPPING)
|
|
|
501 |
static millis_t doubleclick_expire_ms = 0;
|
|
|
502 |
// Going to lcd_main_menu from status screen? Remember first click time.
|
|
|
503 |
// Going back to status screen within a very short time? Go to Z babystepping.
|
|
|
504 |
if (screen == lcd_main_menu) {
|
|
|
505 |
if (currentScreen == lcd_status_screen)
|
|
|
506 |
doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
|
|
|
507 |
}
|
|
|
508 |
else if (screen == lcd_status_screen && currentScreen == lcd_main_menu && PENDING(millis(), doubleclick_expire_ms) && (planner.movesplanned() || IS_SD_PRINTING()))
|
|
|
509 |
screen =
|
|
|
510 |
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
|
511 |
lcd_babystep_zoffset
|
|
|
512 |
#else
|
|
|
513 |
lcd_babystep_z
|
|
|
514 |
#endif
|
|
|
515 |
;
|
|
|
516 |
#endif
|
|
|
517 |
|
|
|
518 |
currentScreen = screen;
|
|
|
519 |
encoderPosition = encoder;
|
|
|
520 |
if (screen == lcd_status_screen) {
|
|
|
521 |
defer_return_to_status = false;
|
|
|
522 |
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
523 |
ubl.lcd_map_control = false;
|
|
|
524 |
#endif
|
|
|
525 |
screen_history_depth = 0;
|
|
|
526 |
}
|
|
|
527 |
lcd_implementation_clear();
|
|
|
528 |
// Re-initialize custom characters that may be re-used
|
|
|
529 |
#if DISABLED(DOGLCD) && ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
530 |
if (!ubl.lcd_map_control) {
|
|
|
531 |
lcd_set_custom_characters(
|
|
|
532 |
#if ENABLED(LCD_PROGRESS_BAR)
|
|
|
533 |
screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU
|
|
|
534 |
#endif
|
|
|
535 |
);
|
|
|
536 |
}
|
|
|
537 |
#elif ENABLED(LCD_PROGRESS_BAR)
|
|
|
538 |
lcd_set_custom_characters(screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU);
|
|
|
539 |
#endif
|
|
|
540 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
541 |
screen_changed = true;
|
|
|
542 |
#if ENABLED(DOGLCD)
|
|
|
543 |
drawing_screen = false;
|
|
|
544 |
#endif
|
|
|
545 |
}
|
|
|
546 |
}
|
|
|
547 |
|
|
|
548 |
/**
|
|
|
549 |
* Show "Moving..." till moves are done, then revert to previous display.
|
|
|
550 |
*/
|
|
|
551 |
static const char moving[] PROGMEM = MSG_MOVING;
|
|
|
552 |
static const char *sync_message = moving;
|
|
|
553 |
|
|
|
554 |
//
|
|
|
555 |
// Display the synchronize screen until moves are
|
|
|
556 |
// finished, and don't return to the caller until
|
|
|
557 |
// done. ** This blocks the command queue! **
|
|
|
558 |
//
|
|
|
559 |
void _lcd_synchronize() {
|
|
|
560 |
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message);
|
|
|
561 |
if (no_reentry) return;
|
|
|
562 |
// Make this the current handler till all moves are done
|
|
|
563 |
no_reentry = true;
|
|
|
564 |
const screenFunc_t old_screen = currentScreen;
|
|
|
565 |
lcd_goto_screen(_lcd_synchronize);
|
|
|
566 |
planner.synchronize(); // idle() is called until moves complete
|
|
|
567 |
no_reentry = false;
|
|
|
568 |
lcd_goto_screen(old_screen);
|
|
|
569 |
}
|
|
|
570 |
|
|
|
571 |
// Display the synchronize screen with a custom message
|
|
|
572 |
// ** This blocks the command queue! **
|
|
|
573 |
void lcd_synchronize(const char * const msg=NULL) {
|
|
|
574 |
sync_message = msg ? msg : moving;
|
|
|
575 |
_lcd_synchronize();
|
|
|
576 |
}
|
|
|
577 |
|
|
|
578 |
void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
|
|
|
579 |
|
|
|
580 |
void lcd_save_previous_screen() {
|
|
|
581 |
if (screen_history_depth < COUNT(screen_history)) {
|
|
|
582 |
screen_history[screen_history_depth].menu_function = currentScreen;
|
|
|
583 |
screen_history[screen_history_depth].encoder_position = encoderPosition;
|
|
|
584 |
++screen_history_depth;
|
|
|
585 |
}
|
|
|
586 |
}
|
|
|
587 |
|
|
|
588 |
void lcd_goto_previous_menu() {
|
|
|
589 |
if (screen_history_depth > 0) {
|
|
|
590 |
--screen_history_depth;
|
|
|
591 |
lcd_goto_screen(
|
|
|
592 |
screen_history[screen_history_depth].menu_function,
|
|
|
593 |
screen_history[screen_history_depth].encoder_position
|
|
|
594 |
);
|
|
|
595 |
}
|
|
|
596 |
else
|
|
|
597 |
lcd_return_to_status();
|
|
|
598 |
}
|
|
|
599 |
|
|
|
600 |
void lcd_goto_previous_menu_no_defer() {
|
|
|
601 |
defer_return_to_status = false;
|
|
|
602 |
lcd_goto_previous_menu();
|
|
|
603 |
}
|
|
|
604 |
|
|
|
605 |
/**
|
|
|
606 |
* Scrolling for menus and other line-based screens
|
|
|
607 |
*
|
|
|
608 |
* encoderLine is the position based on the encoder
|
|
|
609 |
* encoderTopLine is the top menu line to display
|
|
|
610 |
* _lcdLineNr is the index of the LCD line (e.g., 0-3)
|
|
|
611 |
* _menuLineNr is the menu item to draw and process
|
|
|
612 |
* _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
|
|
|
613 |
* screen_items is the total number of items in the menu (after one call)
|
|
|
614 |
*/
|
|
|
615 |
int8_t encoderLine, screen_items;
|
|
|
616 |
void scroll_screen(const uint8_t limit, const bool is_menu) {
|
|
|
617 |
ENCODER_DIRECTION_MENUS();
|
|
|
618 |
ENCODER_RATE_MULTIPLY(false);
|
|
|
619 |
if (encoderPosition > 0x8000) encoderPosition = 0;
|
|
|
620 |
if (first_page) {
|
|
|
621 |
encoderLine = encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM);
|
|
|
622 |
screen_changed = false;
|
|
|
623 |
}
|
|
|
624 |
if (screen_items > 0 && encoderLine >= screen_items - limit) {
|
|
|
625 |
encoderLine = MAX(0, screen_items - limit);
|
|
|
626 |
encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM);
|
|
|
627 |
}
|
|
|
628 |
if (is_menu) {
|
|
|
629 |
NOMORE(encoderTopLine, encoderLine);
|
|
|
630 |
if (encoderLine >= encoderTopLine + menu_bottom)
|
|
|
631 |
encoderTopLine = encoderLine - menu_bottom + 1;
|
|
|
632 |
}
|
|
|
633 |
else
|
|
|
634 |
encoderTopLine = encoderLine;
|
|
|
635 |
}
|
|
|
636 |
|
|
|
637 |
#endif // ULTIPANEL
|
|
|
638 |
|
|
|
639 |
/**
|
|
|
640 |
*
|
|
|
641 |
* "Info Screen"
|
|
|
642 |
*
|
|
|
643 |
* This is very display-dependent, so the lcd implementation draws this.
|
|
|
644 |
*/
|
|
|
645 |
|
|
|
646 |
void lcd_status_screen() {
|
|
|
647 |
|
|
|
648 |
#if ENABLED(ULTIPANEL)
|
|
|
649 |
ENCODER_DIRECTION_NORMAL();
|
|
|
650 |
ENCODER_RATE_MULTIPLY(false);
|
|
|
651 |
#endif
|
|
|
652 |
|
|
|
653 |
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
|
|
|
654 |
// Progress bar % comes from SD when actively printing
|
|
|
655 |
if (IS_SD_PRINTING())
|
|
|
656 |
progress_bar_percent = card.percentDone();
|
|
|
657 |
#endif
|
|
|
658 |
|
|
|
659 |
#if ENABLED(LCD_PROGRESS_BAR)
|
|
|
660 |
|
|
|
661 |
//
|
|
|
662 |
// HD44780 implements the following message blinking and
|
|
|
663 |
// message expiration because Status Line and Progress Bar
|
|
|
664 |
// share the same line on the display.
|
|
|
665 |
//
|
|
|
666 |
|
|
|
667 |
millis_t ms = millis();
|
|
|
668 |
|
|
|
669 |
// If the message will blink rather than expire...
|
|
|
670 |
#if DISABLED(PROGRESS_MSG_ONCE)
|
|
|
671 |
if (ELAPSED(ms, progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME))
|
|
|
672 |
progress_bar_ms = ms;
|
|
|
673 |
#endif
|
|
|
674 |
|
|
|
675 |
#if PROGRESS_MSG_EXPIRE > 0
|
|
|
676 |
|
|
|
677 |
// Handle message expire
|
|
|
678 |
if (expire_status_ms > 0) {
|
|
|
679 |
|
|
|
680 |
#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
|
|
|
681 |
const uint8_t progress_bar_percent = card.percentDone();
|
|
|
682 |
#endif
|
|
|
683 |
|
|
|
684 |
// Expire the message if a job is active and the bar has ticks
|
|
|
685 |
if (progress_bar_percent > 2 && !print_job_timer.isPaused()) {
|
|
|
686 |
if (ELAPSED(ms, expire_status_ms)) {
|
|
|
687 |
lcd_status_message[0] = '\0';
|
|
|
688 |
expire_status_ms = 0;
|
|
|
689 |
}
|
|
|
690 |
}
|
|
|
691 |
else {
|
|
|
692 |
// Defer message expiration before bar appears
|
|
|
693 |
// and during any pause (not just SD)
|
|
|
694 |
expire_status_ms += LCD_UPDATE_INTERVAL;
|
|
|
695 |
}
|
|
|
696 |
}
|
|
|
697 |
|
|
|
698 |
#endif // PROGRESS_MSG_EXPIRE
|
|
|
699 |
|
|
|
700 |
#endif // LCD_PROGRESS_BAR
|
|
|
701 |
|
|
|
702 |
#if ENABLED(ULTIPANEL)
|
|
|
703 |
|
|
|
704 |
if (use_click()) {
|
|
|
705 |
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
|
|
|
706 |
previous_lcd_status_ms = millis(); // get status message to show up for a while
|
|
|
707 |
#endif
|
|
|
708 |
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
|
|
|
709 |
#if ENABLED(LCD_PROGRESS_BAR)
|
|
|
710 |
CHARSET_MENU
|
|
|
711 |
#endif
|
|
|
712 |
);
|
|
|
713 |
lcd_goto_screen(lcd_main_menu);
|
|
|
714 |
return;
|
|
|
715 |
}
|
|
|
716 |
|
|
|
717 |
#if ENABLED(ULTIPANEL_FEEDMULTIPLY)
|
|
|
718 |
const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition;
|
|
|
719 |
// Dead zone at 100% feedrate
|
|
|
720 |
if ((feedrate_percentage < 100 && new_frm > 100) || (feedrate_percentage > 100 && new_frm < 100)) {
|
|
|
721 |
feedrate_percentage = 100;
|
|
|
722 |
encoderPosition = 0;
|
|
|
723 |
}
|
|
|
724 |
else if (feedrate_percentage == 100) {
|
|
|
725 |
if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) {
|
|
|
726 |
feedrate_percentage += (int32_t)encoderPosition - (ENCODER_FEEDRATE_DEADZONE);
|
|
|
727 |
encoderPosition = 0;
|
|
|
728 |
}
|
|
|
729 |
else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) {
|
|
|
730 |
feedrate_percentage += (int32_t)encoderPosition + ENCODER_FEEDRATE_DEADZONE;
|
|
|
731 |
encoderPosition = 0;
|
|
|
732 |
}
|
|
|
733 |
}
|
|
|
734 |
else {
|
|
|
735 |
feedrate_percentage = new_frm;
|
|
|
736 |
encoderPosition = 0;
|
|
|
737 |
}
|
|
|
738 |
#endif // ULTIPANEL_FEEDMULTIPLY
|
|
|
739 |
|
|
|
740 |
feedrate_percentage = constrain(feedrate_percentage, 10, 999);
|
|
|
741 |
|
|
|
742 |
#endif // ULTIPANEL
|
|
|
743 |
|
|
|
744 |
lcd_implementation_status_screen();
|
|
|
745 |
}
|
|
|
746 |
|
|
|
747 |
/**
|
|
|
748 |
* Reset the status message
|
|
|
749 |
*/
|
|
|
750 |
void lcd_reset_status() {
|
|
|
751 |
static const char paused[] PROGMEM = MSG_PRINT_PAUSED;
|
|
|
752 |
static const char printing[] PROGMEM = MSG_PRINTING;
|
|
|
753 |
static const char welcome[] PROGMEM = WELCOME_MSG;
|
|
|
754 |
const char *msg;
|
|
|
755 |
if (print_job_timer.isPaused())
|
|
|
756 |
msg = paused;
|
|
|
757 |
#if ENABLED(SDSUPPORT)
|
|
|
758 |
else if (card.sdprinting)
|
|
|
759 |
return lcd_setstatus(card.longest_filename(), true);
|
|
|
760 |
#endif
|
|
|
761 |
else if (print_job_timer.isRunning())
|
|
|
762 |
msg = printing;
|
|
|
763 |
else
|
|
|
764 |
msg = welcome;
|
|
|
765 |
|
|
|
766 |
lcd_setstatusPGM(msg, -1);
|
|
|
767 |
}
|
|
|
768 |
|
|
|
769 |
/**
|
|
|
770 |
*
|
|
|
771 |
* draw the kill screen
|
|
|
772 |
*
|
|
|
773 |
*/
|
|
|
774 |
void kill_screen(const char* lcd_msg) {
|
|
|
775 |
lcd_init();
|
|
|
776 |
lcd_setalertstatusPGM(lcd_msg);
|
|
|
777 |
lcd_kill_screen();
|
|
|
778 |
}
|
|
|
779 |
|
|
|
780 |
/**
|
|
|
781 |
*
|
|
|
782 |
* Audio feedback for controller clicks
|
|
|
783 |
*
|
|
|
784 |
*/
|
|
|
785 |
void lcd_buzz(const long duration, const uint16_t freq) {
|
|
|
786 |
#if ENABLED(LCD_USE_I2C_BUZZER)
|
|
|
787 |
lcd.buzz(duration, freq);
|
|
|
788 |
#elif PIN_EXISTS(BEEPER)
|
|
|
789 |
buzzer.tone(duration, freq);
|
|
|
790 |
#else
|
|
|
791 |
UNUSED(duration); UNUSED(freq);
|
|
|
792 |
#endif
|
|
|
793 |
}
|
|
|
794 |
|
|
|
795 |
void lcd_quick_feedback(const bool clear_buttons) {
|
|
|
796 |
|
|
|
797 |
#if ENABLED(ULTIPANEL)
|
|
|
798 |
lcd_refresh();
|
|
|
799 |
if (clear_buttons) buttons = 0;
|
|
|
800 |
next_button_update_ms = millis() + 500;
|
|
|
801 |
#else
|
|
|
802 |
UNUSED(clear_buttons);
|
|
|
803 |
#endif
|
|
|
804 |
|
|
|
805 |
// Buzz and wait. The delay is needed for buttons to settle!
|
|
|
806 |
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
|
|
807 |
|
|
|
808 |
#if ENABLED(ULTIPANEL)
|
|
|
809 |
#if ENABLED(LCD_USE_I2C_BUZZER)
|
|
|
810 |
delay(10);
|
|
|
811 |
#elif PIN_EXISTS(BEEPER)
|
|
|
812 |
for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); }
|
|
|
813 |
#endif
|
|
|
814 |
#endif
|
|
|
815 |
}
|
|
|
816 |
|
|
|
817 |
#if ENABLED(ULTIPANEL)
|
|
|
818 |
|
|
|
819 |
void lcd_completion_feedback(const bool good/*=true*/) {
|
|
|
820 |
if (good) {
|
|
|
821 |
lcd_buzz(100, 659);
|
|
|
822 |
lcd_buzz(100, 698);
|
|
|
823 |
}
|
|
|
824 |
else lcd_buzz(20, 440);
|
|
|
825 |
}
|
|
|
826 |
|
|
|
827 |
inline void line_to_current_z() {
|
|
|
828 |
planner.buffer_line_kinematic(current_position, MMM_TO_MMS(manual_feedrate_mm_m[Z_AXIS]), active_extruder);
|
|
|
829 |
}
|
|
|
830 |
|
|
|
831 |
inline void line_to_z(const float &z) {
|
|
|
832 |
current_position[Z_AXIS] = z;
|
|
|
833 |
line_to_current_z();
|
|
|
834 |
}
|
|
|
835 |
|
|
|
836 |
#if ENABLED(SDSUPPORT)
|
|
|
837 |
|
|
|
838 |
void lcd_sdcard_pause() {
|
|
|
839 |
card.pauseSDPrint();
|
|
|
840 |
print_job_timer.pause();
|
|
|
841 |
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
|
|
842 |
enqueue_and_echo_commands_P(PSTR("M125"));
|
|
|
843 |
#endif
|
|
|
844 |
lcd_reset_status();
|
|
|
845 |
}
|
|
|
846 |
|
|
|
847 |
void lcd_sdcard_resume() {
|
|
|
848 |
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
|
|
849 |
enqueue_and_echo_commands_P(PSTR("M24"));
|
|
|
850 |
#else
|
|
|
851 |
card.startFileprint();
|
|
|
852 |
print_job_timer.start();
|
|
|
853 |
#endif
|
|
|
854 |
lcd_reset_status();
|
|
|
855 |
}
|
|
|
856 |
|
|
|
857 |
void lcd_sdcard_stop() {
|
|
|
858 |
wait_for_heatup = wait_for_user = false;
|
|
|
859 |
card.abort_sd_printing = true;
|
|
|
860 |
lcd_setstatusPGM(PSTR(MSG_PRINT_ABORTED), -1);
|
|
|
861 |
lcd_return_to_status();
|
|
|
862 |
}
|
|
|
863 |
|
|
|
864 |
#endif // SDSUPPORT
|
|
|
865 |
|
|
|
866 |
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
|
867 |
|
|
|
868 |
static void lcd_power_loss_recovery_resume() {
|
|
|
869 |
char cmd[20];
|
|
|
870 |
|
|
|
871 |
// Return to status now
|
|
|
872 |
lcd_return_to_status();
|
|
|
873 |
|
|
|
874 |
// Turn leveling off and home
|
|
|
875 |
enqueue_and_echo_commands_P(PSTR("M420 S0\nG28 R0"
|
|
|
876 |
#if ENABLED(MARLIN_DEV_MODE)
|
|
|
877 |
" S"
|
|
|
878 |
#elif !IS_KINEMATIC
|
|
|
879 |
" X Y"
|
|
|
880 |
#endif
|
|
|
881 |
));
|
|
|
882 |
|
|
|
883 |
#if HAS_HEATED_BED
|
|
|
884 |
const int16_t bt = job_recovery_info.target_temperature_bed;
|
|
|
885 |
if (bt) {
|
|
|
886 |
// Restore the bed temperature
|
|
|
887 |
sprintf_P(cmd, PSTR("M190 S%i"), bt);
|
|
|
888 |
enqueue_and_echo_command(cmd);
|
|
|
889 |
}
|
|
|
890 |
#endif
|
|
|
891 |
|
|
|
892 |
// Restore all hotend temperatures
|
|
|
893 |
HOTEND_LOOP() {
|
|
|
894 |
const int16_t et = job_recovery_info.target_temperature[e];
|
|
|
895 |
if (et) {
|
|
|
896 |
#if HOTENDS > 1
|
|
|
897 |
sprintf_P(cmd, PSTR("T%i"), e);
|
|
|
898 |
enqueue_and_echo_command(cmd);
|
|
|
899 |
#endif
|
|
|
900 |
sprintf_P(cmd, PSTR("M109 S%i"), et);
|
|
|
901 |
enqueue_and_echo_command(cmd);
|
|
|
902 |
}
|
|
|
903 |
}
|
|
|
904 |
|
|
|
905 |
#if HOTENDS > 1
|
|
|
906 |
sprintf_P(cmd, PSTR("T%i"), job_recovery_info.active_hotend);
|
|
|
907 |
enqueue_and_echo_command(cmd);
|
|
|
908 |
#endif
|
|
|
909 |
|
|
|
910 |
// Restore print cooling fan speeds
|
|
|
911 |
for (uint8_t i = 0; i < FAN_COUNT; i++) {
|
|
|
912 |
int16_t f = job_recovery_info.fanSpeeds[i];
|
|
|
913 |
if (f) {
|
|
|
914 |
sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f);
|
|
|
915 |
enqueue_and_echo_command(cmd);
|
|
|
916 |
}
|
|
|
917 |
}
|
|
|
918 |
|
|
|
919 |
// Start draining the job recovery command queue
|
|
|
920 |
job_recovery_phase = JOB_RECOVERY_YES;
|
|
|
921 |
}
|
|
|
922 |
|
|
|
923 |
static void lcd_power_loss_recovery_cancel() {
|
|
|
924 |
card.removeJobRecoveryFile();
|
|
|
925 |
card.autostart_index = 0;
|
|
|
926 |
lcd_return_to_status();
|
|
|
927 |
}
|
|
|
928 |
|
|
|
929 |
static void lcd_job_recovery_menu() {
|
|
|
930 |
defer_return_to_status = true;
|
|
|
931 |
START_MENU();
|
|
|
932 |
STATIC_ITEM(MSG_POWER_LOSS_RECOVERY);
|
|
|
933 |
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_power_loss_recovery_resume);
|
|
|
934 |
MENU_ITEM(function, MSG_STOP_PRINT, lcd_power_loss_recovery_cancel);
|
|
|
935 |
END_MENU();
|
|
|
936 |
}
|
|
|
937 |
|
|
|
938 |
#endif // POWER_LOSS_RECOVERY
|
|
|
939 |
|
|
|
940 |
#if ENABLED(MENU_ITEM_CASE_LIGHT)
|
|
|
941 |
|
|
|
942 |
extern uint8_t case_light_brightness;
|
|
|
943 |
extern bool case_light_on;
|
|
|
944 |
extern void update_case_light();
|
|
|
945 |
|
|
|
946 |
void case_light_menu() {
|
|
|
947 |
START_MENU();
|
|
|
948 |
//
|
|
|
949 |
// ^ Main
|
|
|
950 |
//
|
|
|
951 |
MENU_BACK(MSG_MAIN);
|
|
|
952 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true);
|
|
|
953 |
MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
|
|
|
954 |
END_MENU();
|
|
|
955 |
}
|
|
|
956 |
#endif // MENU_ITEM_CASE_LIGHT
|
|
|
957 |
|
|
|
958 |
#if ENABLED(BLTOUCH)
|
|
|
959 |
|
|
|
960 |
extern void _bltouch_reset();
|
|
|
961 |
extern void _bltouch_selftest();
|
|
|
962 |
extern void _bltouch_deploy();
|
|
|
963 |
extern void _bltouch_stow();
|
|
|
964 |
extern void _bltouch_set_SW_mode();
|
|
|
965 |
extern void _bltouch_set_5V_mode();
|
|
|
966 |
extern void _bltouch_set_OD_mode();
|
|
|
967 |
extern void _bltouch_mode_store();
|
|
|
968 |
extern void bltouch_mode_conv_5V();
|
|
|
969 |
extern void bltouch_mode_conv_OD();
|
|
|
970 |
extern bool bltouch_last_written_mode;
|
|
|
971 |
|
|
|
972 |
#if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU)
|
|
|
973 |
void bltouch_report() {
|
|
|
974 |
SERIAL_ECHOLNPAIR("EEPROM Last BLTouch Mode - ", (int)bltouch_last_written_mode);
|
|
|
975 |
SERIAL_ECHOLNPGM("Configuration BLTouch Mode - "
|
|
|
976 |
#if ENABLED(BLTOUCH_SET_5V_MODE)
|
|
|
977 |
"5V"
|
|
|
978 |
#else
|
|
|
979 |
"OD"
|
|
|
980 |
#endif
|
|
|
981 |
);
|
|
|
982 |
char mess[21];
|
|
|
983 |
strcpy_P(mess, PSTR("BLTouch Mode - "));
|
|
|
984 |
strcpy_P(&mess[15], bltouch_last_written_mode ? PSTR("5V") : PSTR("OD"));
|
|
|
985 |
lcd_setalertstatusPGM(mess);
|
|
|
986 |
lcd_return_to_status();
|
|
|
987 |
}
|
|
|
988 |
#endif
|
|
|
989 |
|
|
|
990 |
void bltouch_menu() {
|
|
|
991 |
START_MENU();
|
|
|
992 |
MENU_BACK(MSG_MAIN);
|
|
|
993 |
MENU_ITEM(function, MSG_BLTOUCH_RESET, _bltouch_reset);
|
|
|
994 |
MENU_ITEM(function, MSG_BLTOUCH_SELFTEST, _bltouch_selftest);
|
|
|
995 |
MENU_ITEM(function, MSG_BLTOUCH_DEPLOY, _bltouch_deploy);
|
|
|
996 |
MENU_ITEM(function, MSG_BLTOUCH_STOW, _bltouch_stow);
|
|
|
997 |
MENU_ITEM(function, MSG_BLTOUCH_SW_MODE, _bltouch_set_SW_mode);
|
|
|
998 |
#if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU)
|
|
|
999 |
MENU_ITEM(function, MSG_BLTOUCH_5V_MODE, _bltouch_set_5V_mode);
|
|
|
1000 |
MENU_ITEM(function, MSG_BLTOUCH_OD_MODE, _bltouch_set_OD_mode);
|
|
|
1001 |
MENU_ITEM(function, MSG_BLTOUCH_MODE_STORE, _bltouch_mode_store);
|
|
|
1002 |
MENU_ITEM(function, MSG_BLTOUCH_MODE_STORE_5V, bltouch_mode_conv_5V);
|
|
|
1003 |
MENU_ITEM(function, MSG_BLTOUCH_MODE_STORE_OD, bltouch_mode_conv_OD);
|
|
|
1004 |
MENU_ITEM(function, MSG_BLTOUCH_MODE_ECHO, bltouch_report);
|
|
|
1005 |
#endif
|
|
|
1006 |
END_MENU();
|
|
|
1007 |
}
|
|
|
1008 |
|
|
|
1009 |
#endif
|
|
|
1010 |
|
|
|
1011 |
#if ENABLED(LCD_PROGRESS_BAR_TEST)
|
|
|
1012 |
|
|
|
1013 |
static void progress_bar_test() {
|
|
|
1014 |
static int8_t bar_percent = 0;
|
|
|
1015 |
if (use_click()) {
|
|
|
1016 |
lcd_goto_previous_menu();
|
|
|
1017 |
lcd_set_custom_characters(CHARSET_MENU);
|
|
|
1018 |
return;
|
|
|
1019 |
}
|
|
|
1020 |
bar_percent += (int8_t)encoderPosition;
|
|
|
1021 |
bar_percent = constrain(bar_percent, 0, 100);
|
|
|
1022 |
encoderPosition = 0;
|
|
|
1023 |
lcd_implementation_drawmenu_static(0, PSTR(MSG_PROGRESS_BAR_TEST), true, true);
|
|
|
1024 |
lcd.setCursor((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2);
|
|
|
1025 |
lcd.print(itostr3(bar_percent)); lcd.write('%');
|
|
|
1026 |
lcd.setCursor(0, LCD_HEIGHT - 1); lcd_draw_progress_bar(bar_percent);
|
|
|
1027 |
}
|
|
|
1028 |
|
|
|
1029 |
void _progress_bar_test() {
|
|
|
1030 |
lcd_goto_screen(progress_bar_test);
|
|
|
1031 |
lcd_set_custom_characters();
|
|
|
1032 |
}
|
|
|
1033 |
|
|
|
1034 |
#endif // LCD_PROGRESS_BAR_TEST
|
|
|
1035 |
|
|
|
1036 |
#if HAS_DEBUG_MENU
|
|
|
1037 |
|
|
|
1038 |
void lcd_debug_menu() {
|
|
|
1039 |
START_MENU();
|
|
|
1040 |
|
|
|
1041 |
MENU_BACK(MSG_MAIN); // ^ Main
|
|
|
1042 |
|
|
|
1043 |
#if ENABLED(LCD_PROGRESS_BAR_TEST)
|
|
|
1044 |
MENU_ITEM(submenu, MSG_PROGRESS_BAR_TEST, _progress_bar_test);
|
|
|
1045 |
#endif
|
|
|
1046 |
|
|
|
1047 |
END_MENU();
|
|
|
1048 |
}
|
|
|
1049 |
|
|
|
1050 |
#endif // HAS_DEBUG_MENU
|
|
|
1051 |
|
|
|
1052 |
#if ENABLED(CUSTOM_USER_MENUS)
|
|
|
1053 |
|
|
|
1054 |
#ifdef USER_SCRIPT_DONE
|
|
|
1055 |
#define _DONE_SCRIPT "\n" USER_SCRIPT_DONE
|
|
|
1056 |
#else
|
|
|
1057 |
#define _DONE_SCRIPT ""
|
|
|
1058 |
#endif
|
|
|
1059 |
|
|
|
1060 |
void _lcd_user_gcode(const char * const cmd) {
|
|
|
1061 |
enqueue_and_echo_commands_P(cmd);
|
|
|
1062 |
#if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK)
|
|
|
1063 |
lcd_completion_feedback();
|
|
|
1064 |
#endif
|
|
|
1065 |
#if ENABLED(USER_SCRIPT_RETURN)
|
|
|
1066 |
lcd_return_to_status();
|
|
|
1067 |
#endif
|
|
|
1068 |
}
|
|
|
1069 |
|
|
|
1070 |
#if defined(USER_DESC_1) && defined(USER_GCODE_1)
|
|
|
1071 |
void lcd_user_gcode_1() { _lcd_user_gcode(PSTR(USER_GCODE_1 _DONE_SCRIPT)); }
|
|
|
1072 |
#endif
|
|
|
1073 |
#if defined(USER_DESC_2) && defined(USER_GCODE_2)
|
|
|
1074 |
void lcd_user_gcode_2() { _lcd_user_gcode(PSTR(USER_GCODE_2 _DONE_SCRIPT)); }
|
|
|
1075 |
#endif
|
|
|
1076 |
#if defined(USER_DESC_3) && defined(USER_GCODE_3)
|
|
|
1077 |
void lcd_user_gcode_3() { _lcd_user_gcode(PSTR(USER_GCODE_3 _DONE_SCRIPT)); }
|
|
|
1078 |
#endif
|
|
|
1079 |
#if defined(USER_DESC_4) && defined(USER_GCODE_4)
|
|
|
1080 |
void lcd_user_gcode_4() { _lcd_user_gcode(PSTR(USER_GCODE_4 _DONE_SCRIPT)); }
|
|
|
1081 |
#endif
|
|
|
1082 |
#if defined(USER_DESC_5) && defined(USER_GCODE_5)
|
|
|
1083 |
void lcd_user_gcode_5() { _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); }
|
|
|
1084 |
#endif
|
|
|
1085 |
|
|
|
1086 |
void _lcd_user_menu() {
|
|
|
1087 |
START_MENU();
|
|
|
1088 |
MENU_BACK(MSG_MAIN);
|
|
|
1089 |
#if defined(USER_DESC_1) && defined(USER_GCODE_1)
|
|
|
1090 |
MENU_ITEM(function, USER_DESC_1, lcd_user_gcode_1);
|
|
|
1091 |
#endif
|
|
|
1092 |
#if defined(USER_DESC_2) && defined(USER_GCODE_2)
|
|
|
1093 |
MENU_ITEM(function, USER_DESC_2, lcd_user_gcode_2);
|
|
|
1094 |
#endif
|
|
|
1095 |
#if defined(USER_DESC_3) && defined(USER_GCODE_3)
|
|
|
1096 |
MENU_ITEM(function, USER_DESC_3, lcd_user_gcode_3);
|
|
|
1097 |
#endif
|
|
|
1098 |
#if defined(USER_DESC_4) && defined(USER_GCODE_4)
|
|
|
1099 |
MENU_ITEM(function, USER_DESC_4, lcd_user_gcode_4);
|
|
|
1100 |
#endif
|
|
|
1101 |
#if defined(USER_DESC_5) && defined(USER_GCODE_5)
|
|
|
1102 |
MENU_ITEM(function, USER_DESC_5, lcd_user_gcode_5);
|
|
|
1103 |
#endif
|
|
|
1104 |
END_MENU();
|
|
|
1105 |
}
|
|
|
1106 |
|
|
|
1107 |
#endif
|
|
|
1108 |
|
|
|
1109 |
/**
|
|
|
1110 |
*
|
|
|
1111 |
* "Main" menu
|
|
|
1112 |
*
|
|
|
1113 |
*/
|
|
|
1114 |
|
|
|
1115 |
void lcd_main_menu() {
|
|
|
1116 |
START_MENU();
|
|
|
1117 |
MENU_BACK(MSG_WATCH);
|
|
|
1118 |
|
|
|
1119 |
#if ENABLED(CUSTOM_USER_MENUS)
|
|
|
1120 |
MENU_ITEM(submenu, MSG_USER_MENU, _lcd_user_menu);
|
|
|
1121 |
#endif
|
|
|
1122 |
|
|
|
1123 |
//
|
|
|
1124 |
// Debug Menu when certain options are enabled
|
|
|
1125 |
//
|
|
|
1126 |
#if HAS_DEBUG_MENU
|
|
|
1127 |
MENU_ITEM(submenu, MSG_DEBUG_MENU, lcd_debug_menu);
|
|
|
1128 |
#endif
|
|
|
1129 |
|
|
|
1130 |
//
|
|
|
1131 |
// Set Case light on/off/brightness
|
|
|
1132 |
//
|
|
|
1133 |
#if ENABLED(MENU_ITEM_CASE_LIGHT)
|
|
|
1134 |
if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) {
|
|
|
1135 |
MENU_ITEM(submenu, MSG_CASE_LIGHT, case_light_menu);
|
|
|
1136 |
}
|
|
|
1137 |
else
|
|
|
1138 |
MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
|
|
|
1139 |
#endif
|
|
|
1140 |
|
|
|
1141 |
if (planner.movesplanned() || IS_SD_PRINTING())
|
|
|
1142 |
MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
|
|
|
1143 |
else
|
|
|
1144 |
MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
|
|
|
1145 |
|
|
|
1146 |
MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu);
|
|
|
1147 |
|
|
|
1148 |
#if ENABLED(SDSUPPORT)
|
|
|
1149 |
if (card.cardOK) {
|
|
|
1150 |
if (card.isFileOpen()) {
|
|
|
1151 |
if (card.sdprinting)
|
|
|
1152 |
MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
|
|
|
1153 |
else
|
|
|
1154 |
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
|
|
|
1155 |
MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop);
|
|
|
1156 |
}
|
|
|
1157 |
else {
|
|
|
1158 |
MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
|
|
|
1159 |
#if !PIN_EXISTS(SD_DETECT)
|
|
|
1160 |
MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21")); // SD-card changed by user
|
|
|
1161 |
#endif
|
|
|
1162 |
}
|
|
|
1163 |
}
|
|
|
1164 |
else {
|
|
|
1165 |
MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
|
|
|
1166 |
#if !PIN_EXISTS(SD_DETECT)
|
|
|
1167 |
MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
|
|
|
1168 |
#endif
|
|
|
1169 |
}
|
|
|
1170 |
#endif // SDSUPPORT
|
|
|
1171 |
|
|
|
1172 |
#if ENABLED(LCD_INFO_MENU)
|
|
|
1173 |
MENU_ITEM(submenu, MSG_INFO_MENU, lcd_info_menu);
|
|
|
1174 |
#endif
|
|
|
1175 |
|
|
|
1176 |
#if ENABLED(LED_CONTROL_MENU)
|
|
|
1177 |
MENU_ITEM(submenu, MSG_LED_CONTROL, lcd_led_menu);
|
|
|
1178 |
#endif
|
|
|
1179 |
|
|
|
1180 |
END_MENU();
|
|
|
1181 |
}
|
|
|
1182 |
|
|
|
1183 |
/**
|
|
|
1184 |
*
|
|
|
1185 |
* "Tune" submenu items
|
|
|
1186 |
*
|
|
|
1187 |
*/
|
|
|
1188 |
|
|
|
1189 |
#if HAS_M206_COMMAND
|
|
|
1190 |
/**
|
|
|
1191 |
* Set the home offset based on the current_position
|
|
|
1192 |
*/
|
|
|
1193 |
void lcd_set_home_offsets() {
|
|
|
1194 |
// M428 Command
|
|
|
1195 |
enqueue_and_echo_commands_P(PSTR("M428"));
|
|
|
1196 |
lcd_return_to_status();
|
|
|
1197 |
}
|
|
|
1198 |
#endif
|
|
|
1199 |
|
|
|
1200 |
#if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY)
|
|
|
1201 |
|
|
|
1202 |
void _lcd_zoffset_overlay_gfx(const float zvalue) {
|
|
|
1203 |
// Determine whether the user is raising or lowering the nozzle.
|
|
|
1204 |
static int8_t dir;
|
|
|
1205 |
static float old_zvalue;
|
|
|
1206 |
if (zvalue != old_zvalue) {
|
|
|
1207 |
dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0;
|
|
|
1208 |
old_zvalue = zvalue;
|
|
|
1209 |
}
|
|
|
1210 |
|
|
|
1211 |
#if ENABLED(OVERLAY_GFX_REVERSE)
|
|
|
1212 |
const unsigned char *rot_up = ccw_bmp, *rot_down = cw_bmp;
|
|
|
1213 |
#else
|
|
|
1214 |
const unsigned char *rot_up = cw_bmp, *rot_down = ccw_bmp;
|
|
|
1215 |
#endif
|
|
|
1216 |
|
|
|
1217 |
#if ENABLED(USE_BIG_EDIT_FONT)
|
|
|
1218 |
const int left = 0, right = 45, nozzle = 95;
|
|
|
1219 |
#else
|
|
|
1220 |
const int left = 5, right = 90, nozzle = 60;
|
|
|
1221 |
#endif
|
|
|
1222 |
|
|
|
1223 |
// Draw a representation of the nozzle
|
|
|
1224 |
if (PAGE_CONTAINS(3, 16)) u8g.drawBitmapP(nozzle + 6, 4 - dir, 2, 12, nozzle_bmp);
|
|
|
1225 |
if (PAGE_CONTAINS(20, 20)) u8g.drawBitmapP(nozzle + 0, 20, 3, 1, offset_bedline_bmp);
|
|
|
1226 |
|
|
|
1227 |
// Draw cw/ccw indicator and up/down arrows.
|
|
|
1228 |
if (PAGE_CONTAINS(47, 62)) {
|
|
|
1229 |
u8g.drawBitmapP(left + 0, 47, 3, 16, rot_down);
|
|
|
1230 |
u8g.drawBitmapP(right + 0, 47, 3, 16, rot_up);
|
|
|
1231 |
u8g.drawBitmapP(right + 20, 48 - dir, 2, 13, up_arrow_bmp);
|
|
|
1232 |
u8g.drawBitmapP(left + 20, 49 - dir, 2, 13, down_arrow_bmp);
|
|
|
1233 |
}
|
|
|
1234 |
}
|
|
|
1235 |
|
|
|
1236 |
#endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY
|
|
|
1237 |
|
|
|
1238 |
#if ENABLED(BABYSTEPPING)
|
|
|
1239 |
|
|
|
1240 |
void _lcd_babystep(const AxisEnum axis, const char* msg) {
|
|
|
1241 |
if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
|
|
|
1242 |
ENCODER_DIRECTION_NORMAL();
|
|
|
1243 |
if (encoderPosition) {
|
|
|
1244 |
const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
|
|
|
1245 |
encoderPosition = 0;
|
|
|
1246 |
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
|
1247 |
thermalManager.babystep_axis(axis, babystep_increment);
|
|
|
1248 |
babysteps_done += babystep_increment;
|
|
|
1249 |
}
|
|
|
1250 |
if (lcdDrawUpdate)
|
|
|
1251 |
lcd_implementation_drawedit(msg, ftostr43sign(planner.steps_to_mm[axis] * babysteps_done));
|
|
|
1252 |
}
|
|
|
1253 |
|
|
|
1254 |
#if ENABLED(BABYSTEP_XY)
|
|
|
1255 |
void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEP_X)); }
|
|
|
1256 |
void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEP_Y)); }
|
|
|
1257 |
void lcd_babystep_x() { lcd_goto_screen(_lcd_babystep_x); babysteps_done = 0; defer_return_to_status = true; }
|
|
|
1258 |
void lcd_babystep_y() { lcd_goto_screen(_lcd_babystep_y); babysteps_done = 0; defer_return_to_status = true; }
|
|
|
1259 |
#endif
|
|
|
1260 |
|
|
|
1261 |
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
|
1262 |
|
|
|
1263 |
void lcd_babystep_zoffset() {
|
|
|
1264 |
if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
|
|
|
1265 |
defer_return_to_status = true;
|
|
|
1266 |
ENCODER_DIRECTION_NORMAL();
|
|
|
1267 |
if (encoderPosition) {
|
|
|
1268 |
const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
|
|
|
1269 |
encoderPosition = 0;
|
|
|
1270 |
|
|
|
1271 |
const float new_zoffset = zprobe_zoffset + planner.steps_to_mm[Z_AXIS] * babystep_increment;
|
|
|
1272 |
if (WITHIN(new_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
|
|
1273 |
thermalManager.babystep_axis(Z_AXIS, babystep_increment);
|
|
|
1274 |
zprobe_zoffset = new_zoffset;
|
|
|
1275 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
1276 |
}
|
|
|
1277 |
}
|
|
|
1278 |
if (lcdDrawUpdate) {
|
|
|
1279 |
lcd_implementation_drawedit(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset));
|
|
|
1280 |
#if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY)
|
|
|
1281 |
_lcd_zoffset_overlay_gfx(zprobe_zoffset);
|
|
|
1282 |
#endif
|
|
|
1283 |
}
|
|
|
1284 |
}
|
|
|
1285 |
|
|
|
1286 |
#else // !BABYSTEP_ZPROBE_OFFSET
|
|
|
1287 |
|
|
|
1288 |
void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); }
|
|
|
1289 |
void lcd_babystep_z() { lcd_goto_screen(_lcd_babystep_z); babysteps_done = 0; defer_return_to_status = true; }
|
|
|
1290 |
|
|
|
1291 |
#endif // !BABYSTEP_ZPROBE_OFFSET
|
|
|
1292 |
|
|
|
1293 |
#endif // BABYSTEPPING
|
|
|
1294 |
|
|
|
1295 |
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
1296 |
|
|
|
1297 |
float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5 decimal places. So we keep a
|
|
|
1298 |
// separate value that doesn't lose precision.
|
|
|
1299 |
static int16_t ubl_encoderPosition = 0;
|
|
|
1300 |
|
|
|
1301 |
static void _lcd_mesh_fine_tune(const char* msg) {
|
|
|
1302 |
defer_return_to_status = true;
|
|
|
1303 |
if (ubl.encoder_diff) {
|
|
|
1304 |
ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1;
|
|
|
1305 |
ubl.encoder_diff = 0;
|
|
|
1306 |
|
|
|
1307 |
mesh_edit_accumulator += float(ubl_encoderPosition) * 0.005f * 0.5f;
|
|
|
1308 |
mesh_edit_value = mesh_edit_accumulator;
|
|
|
1309 |
encoderPosition = 0;
|
|
|
1310 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
1311 |
|
|
|
1312 |
const int32_t rounded = (int32_t)(mesh_edit_value * 1000);
|
|
|
1313 |
mesh_edit_value = float(rounded - (rounded % 5L)) / 1000;
|
|
|
1314 |
}
|
|
|
1315 |
|
|
|
1316 |
if (lcdDrawUpdate) {
|
|
|
1317 |
lcd_implementation_drawedit(msg, ftostr43sign(mesh_edit_value));
|
|
|
1318 |
#if ENABLED(MESH_EDIT_GFX_OVERLAY)
|
|
|
1319 |
_lcd_zoffset_overlay_gfx(mesh_edit_value);
|
|
|
1320 |
#endif
|
|
|
1321 |
}
|
|
|
1322 |
}
|
|
|
1323 |
|
|
|
1324 |
void _lcd_mesh_edit_NOP() {
|
|
|
1325 |
defer_return_to_status = true;
|
|
|
1326 |
}
|
|
|
1327 |
|
|
|
1328 |
float lcd_mesh_edit() {
|
|
|
1329 |
lcd_goto_screen(_lcd_mesh_edit_NOP);
|
|
|
1330 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
1331 |
_lcd_mesh_fine_tune(PSTR("Mesh Editor"));
|
|
|
1332 |
return mesh_edit_value;
|
|
|
1333 |
}
|
|
|
1334 |
|
|
|
1335 |
void lcd_mesh_edit_setup(const float &initial) {
|
|
|
1336 |
mesh_edit_value = mesh_edit_accumulator = initial;
|
|
|
1337 |
lcd_goto_screen(_lcd_mesh_edit_NOP);
|
|
|
1338 |
}
|
|
|
1339 |
|
|
|
1340 |
void _lcd_z_offset_edit() {
|
|
|
1341 |
_lcd_mesh_fine_tune(PSTR("Z-Offset: "));
|
|
|
1342 |
}
|
|
|
1343 |
|
|
|
1344 |
float lcd_z_offset_edit() {
|
|
|
1345 |
lcd_goto_screen(_lcd_z_offset_edit);
|
|
|
1346 |
return mesh_edit_value;
|
|
|
1347 |
}
|
|
|
1348 |
|
|
|
1349 |
void lcd_z_offset_edit_setup(const float &initial) {
|
|
|
1350 |
mesh_edit_value = mesh_edit_accumulator = initial;
|
|
|
1351 |
lcd_goto_screen(_lcd_z_offset_edit);
|
|
|
1352 |
}
|
|
|
1353 |
|
|
|
1354 |
#endif // AUTO_BED_LEVELING_UBL
|
|
|
1355 |
|
|
|
1356 |
|
|
|
1357 |
/**
|
|
|
1358 |
* Watch temperature callbacks
|
|
|
1359 |
*/
|
|
|
1360 |
#if HAS_TEMP_HOTEND
|
|
|
1361 |
#if WATCH_HOTENDS
|
|
|
1362 |
#define _WATCH_FUNC(N) thermalManager.start_watching_heater(N)
|
|
|
1363 |
#else
|
|
|
1364 |
#define _WATCH_FUNC(N) NOOP
|
|
|
1365 |
#endif
|
|
|
1366 |
void watch_temp_callback_E0() { _WATCH_FUNC(0); }
|
|
|
1367 |
#if HOTENDS > 1
|
|
|
1368 |
void watch_temp_callback_E1() { _WATCH_FUNC(1); }
|
|
|
1369 |
#if HOTENDS > 2
|
|
|
1370 |
void watch_temp_callback_E2() { _WATCH_FUNC(2); }
|
|
|
1371 |
#if HOTENDS > 3
|
|
|
1372 |
void watch_temp_callback_E3() { _WATCH_FUNC(3); }
|
|
|
1373 |
#if HOTENDS > 4
|
|
|
1374 |
void watch_temp_callback_E4() { _WATCH_FUNC(4); }
|
|
|
1375 |
#endif // HOTENDS > 4
|
|
|
1376 |
#endif // HOTENDS > 3
|
|
|
1377 |
#endif // HOTENDS > 2
|
|
|
1378 |
#endif // HOTENDS > 1
|
|
|
1379 |
#endif // HAS_TEMP_HOTEND
|
|
|
1380 |
|
|
|
1381 |
void watch_temp_callback_bed() {
|
|
|
1382 |
#if WATCH_THE_BED
|
|
|
1383 |
thermalManager.start_watching_bed();
|
|
|
1384 |
#endif
|
|
|
1385 |
}
|
|
|
1386 |
|
|
|
1387 |
// First Fan Speed title in "Tune" and "Control>Temperature" menus
|
|
|
1388 |
#if FAN_COUNT > 0 && HAS_FAN0
|
|
|
1389 |
#if FAN_COUNT > 1
|
|
|
1390 |
#define FAN_SPEED_1_SUFFIX " 1"
|
|
|
1391 |
#else
|
|
|
1392 |
#define FAN_SPEED_1_SUFFIX ""
|
|
|
1393 |
#endif
|
|
|
1394 |
#endif
|
|
|
1395 |
|
|
|
1396 |
// Refresh the E factor after changing flow
|
|
|
1397 |
inline void _lcd_refresh_e_factor_0() { planner.refresh_e_factor(0); }
|
|
|
1398 |
#if EXTRUDERS > 1
|
|
|
1399 |
inline void _lcd_refresh_e_factor() { planner.refresh_e_factor(active_extruder); }
|
|
|
1400 |
inline void _lcd_refresh_e_factor_1() { planner.refresh_e_factor(1); }
|
|
|
1401 |
#if EXTRUDERS > 2
|
|
|
1402 |
inline void _lcd_refresh_e_factor_2() { planner.refresh_e_factor(2); }
|
|
|
1403 |
#if EXTRUDERS > 3
|
|
|
1404 |
inline void _lcd_refresh_e_factor_3() { planner.refresh_e_factor(3); }
|
|
|
1405 |
#if EXTRUDERS > 4
|
|
|
1406 |
inline void _lcd_refresh_e_factor_4() { planner.refresh_e_factor(4); }
|
|
|
1407 |
#endif // EXTRUDERS > 4
|
|
|
1408 |
#endif // EXTRUDERS > 3
|
|
|
1409 |
#endif // EXTRUDERS > 2
|
|
|
1410 |
#endif // EXTRUDERS > 1
|
|
|
1411 |
|
|
|
1412 |
/**
|
|
|
1413 |
*
|
|
|
1414 |
* "Tune" submenu
|
|
|
1415 |
*
|
|
|
1416 |
*/
|
|
|
1417 |
void lcd_tune_menu() {
|
|
|
1418 |
START_MENU();
|
|
|
1419 |
|
|
|
1420 |
//
|
|
|
1421 |
// ^ Main
|
|
|
1422 |
//
|
|
|
1423 |
MENU_BACK(MSG_MAIN);
|
|
|
1424 |
|
|
|
1425 |
//
|
|
|
1426 |
// Speed:
|
|
|
1427 |
//
|
|
|
1428 |
MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999);
|
|
|
1429 |
|
|
|
1430 |
//
|
|
|
1431 |
// Manual bed leveling, Bed Z:
|
|
|
1432 |
//
|
|
|
1433 |
#if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
|
|
|
1434 |
MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);
|
|
|
1435 |
#endif
|
|
|
1436 |
|
|
|
1437 |
//
|
|
|
1438 |
// Leveling Fade Height
|
|
|
1439 |
//
|
|
|
1440 |
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(SLIM_LCD_MENUS)
|
|
|
1441 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0, 100, _lcd_set_z_fade_height);
|
|
|
1442 |
#endif
|
|
|
1443 |
|
|
|
1444 |
//
|
|
|
1445 |
// Nozzle:
|
|
|
1446 |
// Nozzle [1-4]:
|
|
|
1447 |
//
|
|
|
1448 |
#if HOTENDS == 1
|
|
|
1449 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
|
|
|
1450 |
#else // HOTENDS > 1
|
|
|
1451 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
|
|
|
1452 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1);
|
|
|
1453 |
#if HOTENDS > 2
|
|
|
1454 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2);
|
|
|
1455 |
#if HOTENDS > 3
|
|
|
1456 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3);
|
|
|
1457 |
#if HOTENDS > 4
|
|
|
1458 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4);
|
|
|
1459 |
#endif // HOTENDS > 4
|
|
|
1460 |
#endif // HOTENDS > 3
|
|
|
1461 |
#endif // HOTENDS > 2
|
|
|
1462 |
#endif // HOTENDS > 1
|
|
|
1463 |
|
|
|
1464 |
//
|
|
|
1465 |
// Bed:
|
|
|
1466 |
//
|
|
|
1467 |
#if HAS_HEATED_BED
|
|
|
1468 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
|
|
|
1469 |
#endif
|
|
|
1470 |
|
|
|
1471 |
//
|
|
|
1472 |
// Fan Speed:
|
|
|
1473 |
//
|
|
|
1474 |
#if FAN_COUNT > 0
|
|
|
1475 |
#if HAS_FAN0
|
|
|
1476 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255);
|
|
|
1477 |
#if ENABLED(EXTRA_FAN_SPEED)
|
|
|
1478 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255);
|
|
|
1479 |
#endif
|
|
|
1480 |
#endif
|
|
|
1481 |
#if HAS_FAN1
|
|
|
1482 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255);
|
|
|
1483 |
#if ENABLED(EXTRA_FAN_SPEED)
|
|
|
1484 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 2", &new_fanSpeeds[1], 3, 255);
|
|
|
1485 |
#endif
|
|
|
1486 |
#endif
|
|
|
1487 |
#if HAS_FAN2
|
|
|
1488 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 3", &fanSpeeds[2], 0, 255);
|
|
|
1489 |
#if ENABLED(EXTRA_FAN_SPEED)
|
|
|
1490 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 3", &new_fanSpeeds[2], 3, 255);
|
|
|
1491 |
#endif
|
|
|
1492 |
#endif
|
|
|
1493 |
#endif // FAN_COUNT > 0
|
|
|
1494 |
|
|
|
1495 |
//
|
|
|
1496 |
// Flow:
|
|
|
1497 |
// Flow [1-5]:
|
|
|
1498 |
//
|
|
|
1499 |
#if EXTRUDERS == 1
|
|
|
1500 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW, &planner.flow_percentage[0], 10, 999, _lcd_refresh_e_factor_0);
|
|
|
1501 |
#else // EXTRUDERS > 1
|
|
|
1502 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, _lcd_refresh_e_factor);
|
|
|
1503 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N1, &planner.flow_percentage[0], 10, 999, _lcd_refresh_e_factor_0);
|
|
|
1504 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N2, &planner.flow_percentage[1], 10, 999, _lcd_refresh_e_factor_1);
|
|
|
1505 |
#if EXTRUDERS > 2
|
|
|
1506 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N3, &planner.flow_percentage[2], 10, 999, _lcd_refresh_e_factor_2);
|
|
|
1507 |
#if EXTRUDERS > 3
|
|
|
1508 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N4, &planner.flow_percentage[3], 10, 999, _lcd_refresh_e_factor_3);
|
|
|
1509 |
#if EXTRUDERS > 4
|
|
|
1510 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N5, &planner.flow_percentage[4], 10, 999, _lcd_refresh_e_factor_4);
|
|
|
1511 |
#endif // EXTRUDERS > 4
|
|
|
1512 |
#endif // EXTRUDERS > 3
|
|
|
1513 |
#endif // EXTRUDERS > 2
|
|
|
1514 |
#endif // EXTRUDERS > 1
|
|
|
1515 |
|
|
|
1516 |
//
|
|
|
1517 |
// Babystep X:
|
|
|
1518 |
// Babystep Y:
|
|
|
1519 |
// Babystep Z:
|
|
|
1520 |
//
|
|
|
1521 |
#if ENABLED(BABYSTEPPING)
|
|
|
1522 |
#if ENABLED(BABYSTEP_XY)
|
|
|
1523 |
MENU_ITEM(submenu, MSG_BABYSTEP_X, lcd_babystep_x);
|
|
|
1524 |
MENU_ITEM(submenu, MSG_BABYSTEP_Y, lcd_babystep_y);
|
|
|
1525 |
#endif
|
|
|
1526 |
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
|
1527 |
MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
|
|
1528 |
#else
|
|
|
1529 |
MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);
|
|
|
1530 |
#endif
|
|
|
1531 |
#endif
|
|
|
1532 |
|
|
|
1533 |
//
|
|
|
1534 |
// Change filament
|
|
|
1535 |
//
|
|
|
1536 |
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
1537 |
#if E_STEPPERS == 1 && !ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
|
|
1538 |
if (thermalManager.targetHotEnoughToExtrude(active_extruder))
|
|
|
1539 |
MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0"));
|
|
|
1540 |
else
|
|
|
1541 |
MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_temp_menu_e0_filament_change);
|
|
|
1542 |
#else
|
|
|
1543 |
MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_change_filament_menu);
|
|
|
1544 |
#endif
|
|
|
1545 |
#endif
|
|
|
1546 |
|
|
|
1547 |
END_MENU();
|
|
|
1548 |
}
|
|
|
1549 |
|
|
|
1550 |
/**
|
|
|
1551 |
*
|
|
|
1552 |
* "Driver current control" submenu items
|
|
|
1553 |
*
|
|
|
1554 |
*/
|
|
|
1555 |
#if ENABLED(DAC_STEPPER_CURRENT)
|
|
|
1556 |
|
|
|
1557 |
void dac_driver_getValues() { LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i); }
|
|
|
1558 |
|
|
|
1559 |
void dac_driver_commit() { dac_current_set_percents(driverPercent); }
|
|
|
1560 |
|
|
|
1561 |
void dac_driver_eeprom_write() { dac_commit_eeprom(); }
|
|
|
1562 |
|
|
|
1563 |
void lcd_dac_menu() {
|
|
|
1564 |
dac_driver_getValues();
|
|
|
1565 |
START_MENU();
|
|
|
1566 |
MENU_BACK(MSG_CONTROL);
|
|
|
1567 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_X " " MSG_DAC_PERCENT, &driverPercent[X_AXIS], 0, 100, dac_driver_commit);
|
|
|
1568 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_Y " " MSG_DAC_PERCENT, &driverPercent[Y_AXIS], 0, 100, dac_driver_commit);
|
|
|
1569 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_Z " " MSG_DAC_PERCENT, &driverPercent[Z_AXIS], 0, 100, dac_driver_commit);
|
|
|
1570 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_E " " MSG_DAC_PERCENT, &driverPercent[E_AXIS], 0, 100, dac_driver_commit);
|
|
|
1571 |
MENU_ITEM(function, MSG_DAC_EEPROM_WRITE, dac_driver_eeprom_write);
|
|
|
1572 |
END_MENU();
|
|
|
1573 |
}
|
|
|
1574 |
|
|
|
1575 |
#endif // DAC_STEPPER_CURRENT
|
|
|
1576 |
|
|
|
1577 |
#if HAS_MOTOR_CURRENT_PWM
|
|
|
1578 |
|
|
|
1579 |
void lcd_pwm_menu() {
|
|
|
1580 |
START_MENU();
|
|
|
1581 |
MENU_BACK(MSG_CONTROL);
|
|
|
1582 |
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
|
|
|
1583 |
MENU_ITEM_EDIT_CALLBACK(long5, MSG_X MSG_Y, &stepper.motor_current_setting[0], 100, 2000, Stepper::refresh_motor_power);
|
|
|
1584 |
#endif
|
|
|
1585 |
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
|
|
1586 |
MENU_ITEM_EDIT_CALLBACK(long5, MSG_Z, &stepper.motor_current_setting[1], 100, 2000, Stepper::refresh_motor_power);
|
|
|
1587 |
#endif
|
|
|
1588 |
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
|
|
|
1589 |
MENU_ITEM_EDIT_CALLBACK(long5, MSG_E, &stepper.motor_current_setting[2], 100, 2000, Stepper::refresh_motor_power);
|
|
|
1590 |
#endif
|
|
|
1591 |
END_MENU();
|
|
|
1592 |
}
|
|
|
1593 |
|
|
|
1594 |
#endif // HAS_MOTOR_CURRENT_PWM
|
|
|
1595 |
|
|
|
1596 |
constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
|
|
|
1597 |
|
|
|
1598 |
/**
|
|
|
1599 |
*
|
|
|
1600 |
* "Prepare" submenu items
|
|
|
1601 |
*
|
|
|
1602 |
*/
|
|
|
1603 |
void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const int16_t fan) {
|
|
|
1604 |
if (temph > 0) thermalManager.setTargetHotend(MIN(heater_maxtemp[endnum], temph), endnum);
|
|
|
1605 |
#if HAS_HEATED_BED
|
|
|
1606 |
if (tempb >= 0) thermalManager.setTargetBed(tempb);
|
|
|
1607 |
#else
|
|
|
1608 |
UNUSED(tempb);
|
|
|
1609 |
#endif
|
|
|
1610 |
#if FAN_COUNT > 0
|
|
|
1611 |
#if FAN_COUNT > 1
|
|
|
1612 |
fanSpeeds[active_extruder < FAN_COUNT ? active_extruder : 0] = fan;
|
|
|
1613 |
#else
|
|
|
1614 |
fanSpeeds[0] = fan;
|
|
|
1615 |
#endif
|
|
|
1616 |
#else
|
|
|
1617 |
UNUSED(fan);
|
|
|
1618 |
#endif
|
|
|
1619 |
lcd_return_to_status();
|
|
|
1620 |
}
|
|
|
1621 |
|
|
|
1622 |
#if HAS_TEMP_HOTEND
|
|
|
1623 |
void lcd_preheat_m1_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
|
|
|
1624 |
void lcd_preheat_m2_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
|
|
|
1625 |
#if HAS_HEATED_BED
|
|
|
1626 |
void lcd_preheat_m1_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
|
|
|
1627 |
void lcd_preheat_m2_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
|
|
|
1628 |
#endif
|
|
|
1629 |
#endif
|
|
|
1630 |
|
|
|
1631 |
#if HOTENDS > 1
|
|
|
1632 |
void lcd_preheat_m1_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
|
|
|
1633 |
void lcd_preheat_m2_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
|
|
|
1634 |
#if HAS_HEATED_BED
|
|
|
1635 |
void lcd_preheat_m1_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
|
|
|
1636 |
void lcd_preheat_m2_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
|
|
|
1637 |
#endif
|
|
|
1638 |
#if HOTENDS > 2
|
|
|
1639 |
void lcd_preheat_m1_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
|
|
|
1640 |
void lcd_preheat_m2_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
|
|
|
1641 |
#if HAS_HEATED_BED
|
|
|
1642 |
void lcd_preheat_m1_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
|
|
|
1643 |
void lcd_preheat_m2_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
|
|
|
1644 |
#endif
|
|
|
1645 |
#if HOTENDS > 3
|
|
|
1646 |
void lcd_preheat_m1_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
|
|
|
1647 |
void lcd_preheat_m2_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
|
|
|
1648 |
#if HAS_HEATED_BED
|
|
|
1649 |
void lcd_preheat_m1_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
|
|
|
1650 |
void lcd_preheat_m2_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
|
|
|
1651 |
#endif
|
|
|
1652 |
#if HOTENDS > 4
|
|
|
1653 |
void lcd_preheat_m1_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
|
|
|
1654 |
void lcd_preheat_m2_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
|
|
|
1655 |
#if HAS_HEATED_BED
|
|
|
1656 |
void lcd_preheat_m1_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
|
|
|
1657 |
void lcd_preheat_m2_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
|
|
|
1658 |
#endif
|
|
|
1659 |
#endif // HOTENDS > 4
|
|
|
1660 |
#endif // HOTENDS > 3
|
|
|
1661 |
#endif // HOTENDS > 2
|
|
|
1662 |
|
|
|
1663 |
void lcd_preheat_m1_all() {
|
|
|
1664 |
#if HOTENDS > 1
|
|
|
1665 |
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 1);
|
|
|
1666 |
#if HOTENDS > 2
|
|
|
1667 |
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 2);
|
|
|
1668 |
#if HOTENDS > 3
|
|
|
1669 |
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 3);
|
|
|
1670 |
#if HOTENDS > 4
|
|
|
1671 |
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 4);
|
|
|
1672 |
#endif // HOTENDS > 4
|
|
|
1673 |
#endif // HOTENDS > 3
|
|
|
1674 |
#endif // HOTENDS > 2
|
|
|
1675 |
#endif // HOTENDS > 1
|
|
|
1676 |
#if HAS_HEATED_BED
|
|
|
1677 |
lcd_preheat_m1_e0();
|
|
|
1678 |
#else
|
|
|
1679 |
lcd_preheat_m1_e0_only();
|
|
|
1680 |
#endif
|
|
|
1681 |
}
|
|
|
1682 |
void lcd_preheat_m2_all() {
|
|
|
1683 |
#if HOTENDS > 1
|
|
|
1684 |
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 1);
|
|
|
1685 |
#if HOTENDS > 2
|
|
|
1686 |
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 2);
|
|
|
1687 |
#if HOTENDS > 3
|
|
|
1688 |
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 3);
|
|
|
1689 |
#if HOTENDS > 4
|
|
|
1690 |
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 4);
|
|
|
1691 |
#endif // HOTENDS > 4
|
|
|
1692 |
#endif // HOTENDS > 3
|
|
|
1693 |
#endif // HOTENDS > 2
|
|
|
1694 |
#endif // HOTENDS > 1
|
|
|
1695 |
#if HAS_HEATED_BED
|
|
|
1696 |
lcd_preheat_m2_e0();
|
|
|
1697 |
#else
|
|
|
1698 |
lcd_preheat_m2_e0_only();
|
|
|
1699 |
#endif
|
|
|
1700 |
}
|
|
|
1701 |
|
|
|
1702 |
#endif // HOTENDS > 1
|
|
|
1703 |
|
|
|
1704 |
#if HAS_HEATED_BED
|
|
|
1705 |
void lcd_preheat_m1_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
|
|
|
1706 |
void lcd_preheat_m2_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
|
|
|
1707 |
#endif
|
|
|
1708 |
|
|
|
1709 |
#if HAS_TEMP_HOTEND || HAS_HEATED_BED
|
|
|
1710 |
|
|
|
1711 |
void lcd_preheat_m1_menu() {
|
|
|
1712 |
START_MENU();
|
|
|
1713 |
MENU_BACK(MSG_PREPARE);
|
|
|
1714 |
#if HOTENDS == 1
|
|
|
1715 |
#if HAS_HEATED_BED
|
|
|
1716 |
MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0);
|
|
|
1717 |
MENU_ITEM(function, MSG_PREHEAT_1_END, lcd_preheat_m1_e0_only);
|
|
|
1718 |
#else
|
|
|
1719 |
MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only);
|
|
|
1720 |
#endif
|
|
|
1721 |
#elif HOTENDS > 1
|
|
|
1722 |
#if HAS_HEATED_BED
|
|
|
1723 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0);
|
|
|
1724 |
MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E1, lcd_preheat_m1_e0_only);
|
|
|
1725 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1);
|
|
|
1726 |
MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E2, lcd_preheat_m1_e1_only);
|
|
|
1727 |
#else
|
|
|
1728 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0_only);
|
|
|
1729 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1_only);
|
|
|
1730 |
#endif
|
|
|
1731 |
#if HOTENDS > 2
|
|
|
1732 |
#if HAS_HEATED_BED
|
|
|
1733 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2);
|
|
|
1734 |
MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E3, lcd_preheat_m1_e2_only);
|
|
|
1735 |
#else
|
|
|
1736 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2_only);
|
|
|
1737 |
#endif
|
|
|
1738 |
#if HOTENDS > 3
|
|
|
1739 |
#if HAS_HEATED_BED
|
|
|
1740 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3);
|
|
|
1741 |
MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E4, lcd_preheat_m1_e3_only);
|
|
|
1742 |
#else
|
|
|
1743 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3_only);
|
|
|
1744 |
#endif
|
|
|
1745 |
#if HOTENDS > 4
|
|
|
1746 |
#if HAS_HEATED_BED
|
|
|
1747 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4);
|
|
|
1748 |
MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E5, lcd_preheat_m1_e4_only);
|
|
|
1749 |
#else
|
|
|
1750 |
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4_only);
|
|
|
1751 |
#endif
|
|
|
1752 |
#endif // HOTENDS > 4
|
|
|
1753 |
#endif // HOTENDS > 3
|
|
|
1754 |
#endif // HOTENDS > 2
|
|
|
1755 |
MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_m1_all);
|
|
|
1756 |
#endif // HOTENDS > 1
|
|
|
1757 |
#if HAS_HEATED_BED
|
|
|
1758 |
MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_m1_bedonly);
|
|
|
1759 |
#endif
|
|
|
1760 |
END_MENU();
|
|
|
1761 |
}
|
|
|
1762 |
|
|
|
1763 |
void lcd_preheat_m2_menu() {
|
|
|
1764 |
START_MENU();
|
|
|
1765 |
MENU_BACK(MSG_PREPARE);
|
|
|
1766 |
#if HOTENDS == 1
|
|
|
1767 |
#if HAS_HEATED_BED
|
|
|
1768 |
MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0);
|
|
|
1769 |
MENU_ITEM(function, MSG_PREHEAT_2_END, lcd_preheat_m2_e0_only);
|
|
|
1770 |
#else
|
|
|
1771 |
MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only);
|
|
|
1772 |
#endif
|
|
|
1773 |
#elif HOTENDS > 1
|
|
|
1774 |
#if HAS_HEATED_BED
|
|
|
1775 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0);
|
|
|
1776 |
MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E1, lcd_preheat_m2_e0_only);
|
|
|
1777 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1);
|
|
|
1778 |
MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E2, lcd_preheat_m2_e1_only);
|
|
|
1779 |
#else
|
|
|
1780 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0_only);
|
|
|
1781 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1_only);
|
|
|
1782 |
#endif
|
|
|
1783 |
#if HOTENDS > 2
|
|
|
1784 |
#if HAS_HEATED_BED
|
|
|
1785 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2);
|
|
|
1786 |
MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E3, lcd_preheat_m2_e2_only);
|
|
|
1787 |
#else
|
|
|
1788 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2_only);
|
|
|
1789 |
#endif
|
|
|
1790 |
#if HOTENDS > 3
|
|
|
1791 |
#if HAS_HEATED_BED
|
|
|
1792 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3);
|
|
|
1793 |
MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E4, lcd_preheat_m2_e3_only);
|
|
|
1794 |
#else
|
|
|
1795 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3_only);
|
|
|
1796 |
#endif
|
|
|
1797 |
#if HOTENDS > 4
|
|
|
1798 |
#if HAS_HEATED_BED
|
|
|
1799 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4);
|
|
|
1800 |
MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E5, lcd_preheat_m2_e4_only);
|
|
|
1801 |
#else
|
|
|
1802 |
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4_only);
|
|
|
1803 |
#endif
|
|
|
1804 |
#endif // HOTENDS > 4
|
|
|
1805 |
#endif // HOTENDS > 3
|
|
|
1806 |
#endif // HOTENDS > 2
|
|
|
1807 |
MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_m2_all);
|
|
|
1808 |
#endif // HOTENDS > 1
|
|
|
1809 |
#if HAS_HEATED_BED
|
|
|
1810 |
MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_m2_bedonly);
|
|
|
1811 |
#endif
|
|
|
1812 |
END_MENU();
|
|
|
1813 |
}
|
|
|
1814 |
|
|
|
1815 |
#endif // HAS_TEMP_HOTEND || HAS_HEATED_BED
|
|
|
1816 |
|
|
|
1817 |
void lcd_cooldown() {
|
|
|
1818 |
#if FAN_COUNT > 0
|
|
|
1819 |
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
|
|
|
1820 |
#endif
|
|
|
1821 |
thermalManager.disable_all_heaters();
|
|
|
1822 |
lcd_return_to_status();
|
|
|
1823 |
}
|
|
|
1824 |
|
|
|
1825 |
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
1826 |
|
|
|
1827 |
/**
|
|
|
1828 |
* If the queue is full, the command will fail, so we have to loop
|
|
|
1829 |
* with idle() to make sure the command has been enqueued.
|
|
|
1830 |
*/
|
|
|
1831 |
void lcd_enqueue_command(char * const cmd) {
|
|
|
1832 |
no_reentry = true;
|
|
|
1833 |
enqueue_and_echo_command_now(cmd);
|
|
|
1834 |
no_reentry = false;
|
|
|
1835 |
}
|
|
|
1836 |
|
|
|
1837 |
void lcd_enqueue_commands_P(const char * const cmd) {
|
|
|
1838 |
no_reentry = true;
|
|
|
1839 |
enqueue_and_echo_commands_now_P(cmd);
|
|
|
1840 |
no_reentry = false;
|
|
|
1841 |
}
|
|
|
1842 |
|
|
|
1843 |
#endif
|
|
|
1844 |
|
|
|
1845 |
#if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
|
|
|
1846 |
|
|
|
1847 |
void lcd_autostart_sd() { card.beginautostart(); }
|
|
|
1848 |
|
|
|
1849 |
#endif
|
|
|
1850 |
|
|
|
1851 |
#if ENABLED(EEPROM_SETTINGS)
|
|
|
1852 |
static void lcd_store_settings() { lcd_completion_feedback(settings.save()); }
|
|
|
1853 |
static void lcd_load_settings() { lcd_completion_feedback(settings.load()); }
|
|
|
1854 |
#endif
|
|
|
1855 |
|
|
|
1856 |
#if ENABLED(LEVEL_BED_CORNERS)
|
|
|
1857 |
|
|
|
1858 |
#ifndef LEVEL_CORNERS_Z_HOP
|
|
|
1859 |
#define LEVEL_CORNERS_Z_HOP 4.0
|
|
|
1860 |
#endif
|
|
|
1861 |
|
|
|
1862 |
static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Please update your configuration.");
|
|
|
1863 |
|
|
|
1864 |
/**
|
|
|
1865 |
* Level corners, starting in the front-left corner.
|
|
|
1866 |
*/
|
|
|
1867 |
static int8_t bed_corner;
|
|
|
1868 |
void _lcd_goto_next_corner() {
|
|
|
1869 |
line_to_z(LEVEL_CORNERS_Z_HOP);
|
|
|
1870 |
switch (bed_corner) {
|
|
|
1871 |
case 0:
|
|
|
1872 |
current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET;
|
|
|
1873 |
current_position[Y_AXIS] = Y_MIN_BED + LEVEL_CORNERS_INSET;
|
|
|
1874 |
break;
|
|
|
1875 |
case 1:
|
|
|
1876 |
current_position[X_AXIS] = X_MAX_BED - LEVEL_CORNERS_INSET;
|
|
|
1877 |
break;
|
|
|
1878 |
case 2:
|
|
|
1879 |
current_position[Y_AXIS] = Y_MAX_BED - LEVEL_CORNERS_INSET;
|
|
|
1880 |
break;
|
|
|
1881 |
case 3:
|
|
|
1882 |
current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET;
|
|
|
1883 |
break;
|
|
|
1884 |
#if ENABLED(LEVEL_CENTER_TOO)
|
|
|
1885 |
case 4:
|
|
|
1886 |
current_position[X_AXIS] = X_CENTER;
|
|
|
1887 |
current_position[Y_AXIS] = Y_CENTER;
|
|
|
1888 |
break;
|
|
|
1889 |
#endif
|
|
|
1890 |
}
|
|
|
1891 |
planner.buffer_line_kinematic(current_position, MMM_TO_MMS(manual_feedrate_mm_m[X_AXIS]), active_extruder);
|
|
|
1892 |
line_to_z(0.0);
|
|
|
1893 |
if (++bed_corner > 3
|
|
|
1894 |
#if ENABLED(LEVEL_CENTER_TOO)
|
|
|
1895 |
+ 1
|
|
|
1896 |
#endif
|
|
|
1897 |
) bed_corner = 0;
|
|
|
1898 |
}
|
|
|
1899 |
|
|
|
1900 |
void _lcd_corner_submenu() {
|
|
|
1901 |
START_MENU();
|
|
|
1902 |
MENU_ITEM(function,
|
|
|
1903 |
#if ENABLED(LEVEL_CENTER_TOO)
|
|
|
1904 |
MSG_LEVEL_BED_NEXT_POINT
|
|
|
1905 |
#else
|
|
|
1906 |
MSG_NEXT_CORNER
|
|
|
1907 |
#endif
|
|
|
1908 |
, _lcd_goto_next_corner);
|
|
|
1909 |
MENU_ITEM(function, MSG_BACK, lcd_goto_previous_menu_no_defer);
|
|
|
1910 |
END_MENU();
|
|
|
1911 |
}
|
|
|
1912 |
|
|
|
1913 |
void _lcd_level_bed_corners() {
|
|
|
1914 |
defer_return_to_status = true;
|
|
|
1915 |
lcd_goto_screen(_lcd_corner_submenu);
|
|
|
1916 |
bed_corner = 0;
|
|
|
1917 |
_lcd_goto_next_corner();
|
|
|
1918 |
}
|
|
|
1919 |
|
|
|
1920 |
#endif // LEVEL_BED_CORNERS
|
|
|
1921 |
|
|
|
1922 |
#if ENABLED(LCD_BED_LEVELING) && (ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING))
|
|
|
1923 |
|
|
|
1924 |
/**
|
|
|
1925 |
*
|
|
|
1926 |
* "Prepare" > "Level Bed" handlers
|
|
|
1927 |
*
|
|
|
1928 |
*/
|
|
|
1929 |
|
|
|
1930 |
static uint8_t manual_probe_index;
|
|
|
1931 |
|
|
|
1932 |
// LCD probed points are from defaults
|
|
|
1933 |
constexpr uint8_t total_probe_points = (
|
|
|
1934 |
#if ENABLED(AUTO_BED_LEVELING_3POINT)
|
|
|
1935 |
3
|
|
|
1936 |
#elif ABL_GRID || ENABLED(MESH_BED_LEVELING)
|
|
|
1937 |
GRID_MAX_POINTS
|
|
|
1938 |
#endif
|
|
|
1939 |
);
|
|
|
1940 |
|
|
|
1941 |
bool lcd_wait_for_move;
|
|
|
1942 |
|
|
|
1943 |
//
|
|
|
1944 |
// Bed leveling is done. Wait for G29 to complete.
|
|
|
1945 |
// A flag is used so that this can release control
|
|
|
1946 |
// and allow the command queue to be processed.
|
|
|
1947 |
//
|
|
|
1948 |
// When G29 finishes the last move:
|
|
|
1949 |
// - Raise Z to the "manual probe height"
|
|
|
1950 |
// - Don't return until done.
|
|
|
1951 |
//
|
|
|
1952 |
// ** This blocks the command queue! **
|
|
|
1953 |
//
|
|
|
1954 |
void _lcd_level_bed_done() {
|
|
|
1955 |
if (!lcd_wait_for_move) {
|
|
|
1956 |
#if MANUAL_PROBE_HEIGHT > 0 && DISABLED(MESH_BED_LEVELING)
|
|
|
1957 |
// Display "Done" screen and wait for moves to complete
|
|
|
1958 |
line_to_z(MANUAL_PROBE_HEIGHT);
|
|
|
1959 |
lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE));
|
|
|
1960 |
#endif
|
|
|
1961 |
lcd_goto_previous_menu_no_defer();
|
|
|
1962 |
lcd_completion_feedback();
|
|
|
1963 |
}
|
|
|
1964 |
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_DONE));
|
|
|
1965 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
1966 |
}
|
|
|
1967 |
|
|
|
1968 |
void _lcd_level_goto_next_point();
|
|
|
1969 |
|
|
|
1970 |
/**
|
|
|
1971 |
* Step 7: Get the Z coordinate, click goes to the next point or exits
|
|
|
1972 |
*/
|
|
|
1973 |
void _lcd_level_bed_get_z() {
|
|
|
1974 |
ENCODER_DIRECTION_NORMAL();
|
|
|
1975 |
|
|
|
1976 |
if (use_click()) {
|
|
|
1977 |
|
|
|
1978 |
//
|
|
|
1979 |
// Save the current Z position and move
|
|
|
1980 |
//
|
|
|
1981 |
|
|
|
1982 |
// If done...
|
|
|
1983 |
if (++manual_probe_index >= total_probe_points) {
|
|
|
1984 |
//
|
|
|
1985 |
// The last G29 records the point and enables bed leveling
|
|
|
1986 |
//
|
|
|
1987 |
lcd_wait_for_move = true;
|
|
|
1988 |
lcd_goto_screen(_lcd_level_bed_done);
|
|
|
1989 |
#if ENABLED(MESH_BED_LEVELING)
|
|
|
1990 |
enqueue_and_echo_commands_P(PSTR("G29 S2"));
|
|
|
1991 |
#elif ENABLED(PROBE_MANUALLY)
|
|
|
1992 |
enqueue_and_echo_commands_P(PSTR("G29 V1"));
|
|
|
1993 |
#endif
|
|
|
1994 |
}
|
|
|
1995 |
else
|
|
|
1996 |
_lcd_level_goto_next_point();
|
|
|
1997 |
|
|
|
1998 |
return;
|
|
|
1999 |
}
|
|
|
2000 |
|
|
|
2001 |
//
|
|
|
2002 |
// Encoder knob or keypad buttons adjust the Z position
|
|
|
2003 |
//
|
|
|
2004 |
if (encoderPosition) {
|
|
|
2005 |
const float z = current_position[Z_AXIS] + float((int32_t)encoderPosition) * (MBL_Z_STEP);
|
|
|
2006 |
line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5f, (LCD_PROBE_Z_RANGE) * 0.5f));
|
|
|
2007 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
2008 |
encoderPosition = 0;
|
|
|
2009 |
}
|
|
|
2010 |
|
|
|
2011 |
//
|
|
|
2012 |
// Draw on first display, then only on Z change
|
|
|
2013 |
//
|
|
|
2014 |
if (lcdDrawUpdate) {
|
|
|
2015 |
const float v = current_position[Z_AXIS];
|
|
|
2016 |
lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001f : 0.0001f), '+'));
|
|
|
2017 |
}
|
|
|
2018 |
}
|
|
|
2019 |
|
|
|
2020 |
/**
|
|
|
2021 |
* Step 6: Display "Next point: 1 / 9" while waiting for move to finish
|
|
|
2022 |
*/
|
|
|
2023 |
void _lcd_level_bed_moving() {
|
|
|
2024 |
if (lcdDrawUpdate) {
|
|
|
2025 |
char msg[10];
|
|
|
2026 |
sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), total_probe_points);
|
|
|
2027 |
lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg);
|
|
|
2028 |
}
|
|
|
2029 |
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
|
|
2030 |
if (!lcd_wait_for_move) lcd_goto_screen(_lcd_level_bed_get_z);
|
|
|
2031 |
}
|
|
|
2032 |
|
|
|
2033 |
/**
|
|
|
2034 |
* Step 5: Initiate a move to the next point
|
|
|
2035 |
*/
|
|
|
2036 |
void _lcd_level_goto_next_point() {
|
|
|
2037 |
lcd_goto_screen(_lcd_level_bed_moving);
|
|
|
2038 |
|
|
|
2039 |
// G29 Records Z, moves, and signals when it pauses
|
|
|
2040 |
lcd_wait_for_move = true;
|
|
|
2041 |
#if ENABLED(MESH_BED_LEVELING)
|
|
|
2042 |
enqueue_and_echo_commands_P(manual_probe_index ? PSTR("G29 S2") : PSTR("G29 S1"));
|
|
|
2043 |
#elif ENABLED(PROBE_MANUALLY)
|
|
|
2044 |
enqueue_and_echo_commands_P(PSTR("G29 V1"));
|
|
|
2045 |
#endif
|
|
|
2046 |
}
|
|
|
2047 |
|
|
|
2048 |
/**
|
|
|
2049 |
* Step 4: Display "Click to Begin", wait for click
|
|
|
2050 |
* Move to the first probe position
|
|
|
2051 |
*/
|
|
|
2052 |
void _lcd_level_bed_homing_done() {
|
|
|
2053 |
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING));
|
|
|
2054 |
if (use_click()) {
|
|
|
2055 |
manual_probe_index = 0;
|
|
|
2056 |
_lcd_level_goto_next_point();
|
|
|
2057 |
}
|
|
|
2058 |
}
|
|
|
2059 |
|
|
|
2060 |
/**
|
|
|
2061 |
* Step 3: Display "Homing XYZ" - Wait for homing to finish
|
|
|
2062 |
*/
|
|
|
2063 |
void _lcd_level_bed_homing() {
|
|
|
2064 |
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
|
|
2065 |
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
|
|
2066 |
if (all_axes_homed()) lcd_goto_screen(_lcd_level_bed_homing_done);
|
|
|
2067 |
}
|
|
|
2068 |
|
|
|
2069 |
#if ENABLED(PROBE_MANUALLY)
|
|
|
2070 |
extern bool g29_in_progress;
|
|
|
2071 |
#endif
|
|
|
2072 |
|
|
|
2073 |
/**
|
|
|
2074 |
* Step 2: Continue Bed Leveling...
|
|
|
2075 |
*/
|
|
|
2076 |
void _lcd_level_bed_continue() {
|
|
|
2077 |
defer_return_to_status = true;
|
|
|
2078 |
axis_homed = 0;
|
|
|
2079 |
lcd_goto_screen(_lcd_level_bed_homing);
|
|
|
2080 |
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
2081 |
}
|
|
|
2082 |
|
|
|
2083 |
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
2084 |
|
|
|
2085 |
void _lcd_ubl_level_bed();
|
|
|
2086 |
|
|
|
2087 |
static int16_t ubl_storage_slot = 0,
|
|
|
2088 |
custom_hotend_temp = 190,
|
|
|
2089 |
side_points = 3,
|
|
|
2090 |
ubl_fillin_amount = 5,
|
|
|
2091 |
ubl_height_amount = 1,
|
|
|
2092 |
n_edit_pts = 1,
|
|
|
2093 |
x_plot = 0,
|
|
|
2094 |
y_plot = 0;
|
|
|
2095 |
|
|
|
2096 |
#if HAS_HEATED_BED
|
|
|
2097 |
static int16_t custom_bed_temp = 50;
|
|
|
2098 |
#endif
|
|
|
2099 |
|
|
|
2100 |
/**
|
|
|
2101 |
* UBL Build Custom Mesh Command
|
|
|
2102 |
*/
|
|
|
2103 |
void _lcd_ubl_build_custom_mesh() {
|
|
|
2104 |
char UBL_LCD_GCODE[20];
|
|
|
2105 |
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
2106 |
#if HAS_HEATED_BED
|
|
|
2107 |
sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
|
|
|
2108 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2109 |
#endif
|
|
|
2110 |
sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp);
|
|
|
2111 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2112 |
enqueue_and_echo_commands_P(PSTR("G29 P1"));
|
|
|
2113 |
}
|
|
|
2114 |
|
|
|
2115 |
/**
|
|
|
2116 |
* UBL Custom Mesh submenu
|
|
|
2117 |
*
|
|
|
2118 |
* << Build Mesh
|
|
|
2119 |
* Hotend Temp: ---
|
|
|
2120 |
* Bed Temp: ---
|
|
|
2121 |
* Build Custom Mesh
|
|
|
2122 |
*/
|
|
|
2123 |
void _lcd_ubl_custom_mesh() {
|
|
|
2124 |
START_MENU();
|
|
|
2125 |
MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
|
|
|
2126 |
MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10));
|
|
|
2127 |
#if HAS_HEATED_BED
|
|
|
2128 |
MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 15));
|
|
|
2129 |
#endif
|
|
|
2130 |
MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
|
|
|
2131 |
END_MENU();
|
|
|
2132 |
}
|
|
|
2133 |
|
|
|
2134 |
/**
|
|
|
2135 |
* UBL Adjust Mesh Height Command
|
|
|
2136 |
*/
|
|
|
2137 |
void _lcd_ubl_adjust_height_cmd() {
|
|
|
2138 |
char UBL_LCD_GCODE[16];
|
|
|
2139 |
const int ind = ubl_height_amount > 0 ? 9 : 10;
|
|
|
2140 |
strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -"));
|
|
|
2141 |
sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), ABS(ubl_height_amount));
|
|
|
2142 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2143 |
}
|
|
|
2144 |
|
|
|
2145 |
/**
|
|
|
2146 |
* UBL Adjust Mesh Height submenu
|
|
|
2147 |
*
|
|
|
2148 |
* << Edit Mesh
|
|
|
2149 |
* Height Amount: ---
|
|
|
2150 |
* Adjust Mesh Height
|
|
|
2151 |
* << Info Screen
|
|
|
2152 |
*/
|
|
|
2153 |
void _lcd_ubl_height_adjust_menu() {
|
|
|
2154 |
START_MENU();
|
|
|
2155 |
MENU_BACK(MSG_UBL_EDIT_MESH_MENU);
|
|
|
2156 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &ubl_height_amount, -9, 9, _lcd_ubl_adjust_height_cmd);
|
|
|
2157 |
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
|
|
2158 |
END_MENU();
|
|
|
2159 |
}
|
|
|
2160 |
|
|
|
2161 |
/**
|
|
|
2162 |
* UBL Edit Mesh submenu
|
|
|
2163 |
*
|
|
|
2164 |
* << UBL Tools
|
|
|
2165 |
* Fine Tune All
|
|
|
2166 |
* Fine Tune Closest
|
|
|
2167 |
* - Adjust Mesh Height >>
|
|
|
2168 |
* << Info Screen
|
|
|
2169 |
*/
|
|
|
2170 |
void _lcd_ubl_edit_mesh() {
|
|
|
2171 |
START_MENU();
|
|
|
2172 |
MENU_BACK(MSG_UBL_TOOLS);
|
|
|
2173 |
MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T"));
|
|
|
2174 |
MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_CLOSEST, PSTR("G29 P4 T"));
|
|
|
2175 |
MENU_ITEM(submenu, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_height_adjust_menu);
|
|
|
2176 |
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
|
|
2177 |
END_MENU();
|
|
|
2178 |
}
|
|
|
2179 |
|
|
|
2180 |
/**
|
|
|
2181 |
* UBL Validate Custom Mesh Command
|
|
|
2182 |
*/
|
|
|
2183 |
void _lcd_ubl_validate_custom_mesh() {
|
|
|
2184 |
char UBL_LCD_GCODE[24];
|
|
|
2185 |
const int temp =
|
|
|
2186 |
#if HAS_HEATED_BED
|
|
|
2187 |
custom_bed_temp
|
|
|
2188 |
#else
|
|
|
2189 |
|
|
|
2190 |
#endif
|
|
|
2191 |
;
|
|
|
2192 |
sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B%i H%i P"), temp, custom_hotend_temp);
|
|
|
2193 |
lcd_enqueue_commands_P(PSTR("G28"));
|
|
|
2194 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2195 |
}
|
|
|
2196 |
|
|
|
2197 |
/**
|
|
|
2198 |
* UBL Validate Mesh submenu
|
|
|
2199 |
*
|
|
|
2200 |
* << UBL Tools
|
|
|
2201 |
* PLA Mesh Validation
|
|
|
2202 |
* ABS Mesh Validation
|
|
|
2203 |
* Validate Custom Mesh
|
|
|
2204 |
* << Info Screen
|
|
|
2205 |
*/
|
|
|
2206 |
void _lcd_ubl_validate_mesh() {
|
|
|
2207 |
START_MENU();
|
|
|
2208 |
MENU_BACK(MSG_UBL_TOOLS);
|
|
|
2209 |
#if HAS_HEATED_BED
|
|
|
2210 |
MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
|
|
|
2211 |
MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
|
|
|
2212 |
#else
|
|
|
2213 |
MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
|
|
|
2214 |
MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
|
|
|
2215 |
#endif
|
|
|
2216 |
MENU_ITEM(function, MSG_UBL_VALIDATE_CUSTOM_MESH, _lcd_ubl_validate_custom_mesh);
|
|
|
2217 |
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
|
|
2218 |
END_MENU();
|
|
|
2219 |
}
|
|
|
2220 |
|
|
|
2221 |
/**
|
|
|
2222 |
* UBL Grid Leveling Command
|
|
|
2223 |
*/
|
|
|
2224 |
void _lcd_ubl_grid_level_cmd() {
|
|
|
2225 |
char UBL_LCD_GCODE[10];
|
|
|
2226 |
sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points);
|
|
|
2227 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2228 |
}
|
|
|
2229 |
|
|
|
2230 |
/**
|
|
|
2231 |
* UBL Grid Leveling submenu
|
|
|
2232 |
*
|
|
|
2233 |
* << UBL Tools
|
|
|
2234 |
* Side points: ---
|
|
|
2235 |
* Level Mesh
|
|
|
2236 |
*/
|
|
|
2237 |
void _lcd_ubl_grid_level() {
|
|
|
2238 |
START_MENU();
|
|
|
2239 |
MENU_BACK(MSG_UBL_TOOLS);
|
|
|
2240 |
MENU_ITEM_EDIT(int3, MSG_UBL_SIDE_POINTS, &side_points, 2, 6);
|
|
|
2241 |
MENU_ITEM(function, MSG_UBL_MESH_LEVEL, _lcd_ubl_grid_level_cmd);
|
|
|
2242 |
END_MENU();
|
|
|
2243 |
}
|
|
|
2244 |
|
|
|
2245 |
/**
|
|
|
2246 |
* UBL Mesh Leveling submenu
|
|
|
2247 |
*
|
|
|
2248 |
* << UBL Tools
|
|
|
2249 |
* 3-Point Mesh Leveling
|
|
|
2250 |
* - Grid Mesh Leveling >>
|
|
|
2251 |
* << Info Screen
|
|
|
2252 |
*/
|
|
|
2253 |
void _lcd_ubl_mesh_leveling() {
|
|
|
2254 |
START_MENU();
|
|
|
2255 |
MENU_BACK(MSG_UBL_TOOLS);
|
|
|
2256 |
MENU_ITEM(gcode, MSG_UBL_3POINT_MESH_LEVELING, PSTR("G29 J0"));
|
|
|
2257 |
MENU_ITEM(submenu, MSG_UBL_GRID_MESH_LEVELING, _lcd_ubl_grid_level);
|
|
|
2258 |
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
|
|
2259 |
END_MENU();
|
|
|
2260 |
}
|
|
|
2261 |
|
|
|
2262 |
/**
|
|
|
2263 |
* UBL Fill-in Amount Mesh Command
|
|
|
2264 |
*/
|
|
|
2265 |
void _lcd_ubl_fillin_amount_cmd() {
|
|
|
2266 |
char UBL_LCD_GCODE[16];
|
|
|
2267 |
sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount);
|
|
|
2268 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2269 |
}
|
|
|
2270 |
|
|
|
2271 |
/**
|
|
|
2272 |
* UBL Fill-in Mesh submenu
|
|
|
2273 |
*
|
|
|
2274 |
* << Build Mesh
|
|
|
2275 |
* Fill-in Amount: ---
|
|
|
2276 |
* Fill-in Mesh
|
|
|
2277 |
* Smart Fill-in
|
|
|
2278 |
* Manual Fill-in
|
|
|
2279 |
* << Info Screen
|
|
|
2280 |
*/
|
|
|
2281 |
void _lcd_ubl_fillin_menu() {
|
|
|
2282 |
START_MENU();
|
|
|
2283 |
MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
|
|
|
2284 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9, _lcd_ubl_fillin_amount_cmd);
|
|
|
2285 |
MENU_ITEM(gcode, MSG_UBL_SMART_FILLIN, PSTR("G29 P3 T0"));
|
|
|
2286 |
MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B T0"));
|
|
|
2287 |
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
|
|
2288 |
END_MENU();
|
|
|
2289 |
}
|
|
|
2290 |
|
|
|
2291 |
void _lcd_ubl_invalidate() {
|
|
|
2292 |
ubl.invalidate();
|
|
|
2293 |
SERIAL_PROTOCOLLNPGM("Mesh invalidated.");
|
|
|
2294 |
}
|
|
|
2295 |
|
|
|
2296 |
/**
|
|
|
2297 |
* UBL Build Mesh submenu
|
|
|
2298 |
*
|
|
|
2299 |
* << UBL Tools
|
|
|
2300 |
* Build PLA Mesh
|
|
|
2301 |
* Build ABS Mesh
|
|
|
2302 |
* - Build Custom Mesh >>
|
|
|
2303 |
* Build Cold Mesh
|
|
|
2304 |
* - Fill-in Mesh >>
|
|
|
2305 |
* Continue Bed Mesh
|
|
|
2306 |
* Invalidate All
|
|
|
2307 |
* Invalidate Closest
|
|
|
2308 |
* << Info Screen
|
|
|
2309 |
*/
|
|
|
2310 |
void _lcd_ubl_build_mesh() {
|
|
|
2311 |
START_MENU();
|
|
|
2312 |
MENU_BACK(MSG_UBL_TOOLS);
|
|
|
2313 |
#if HAS_HEATED_BED
|
|
|
2314 |
MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
|
|
|
2315 |
"G28\n"
|
|
|
2316 |
"M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n"
|
|
|
2317 |
"M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n"
|
|
|
2318 |
"G29 P1\n"
|
|
|
2319 |
"M104 S0\n"
|
|
|
2320 |
"M140 S0"
|
|
|
2321 |
));
|
|
|
2322 |
MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR(
|
|
|
2323 |
"G28\n"
|
|
|
2324 |
"M190 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\n"
|
|
|
2325 |
"M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n"
|
|
|
2326 |
"G29 P1\n"
|
|
|
2327 |
"M104 S0\n"
|
|
|
2328 |
"M140 S0"
|
|
|
2329 |
));
|
|
|
2330 |
#else
|
|
|
2331 |
MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
|
|
|
2332 |
"G28\n"
|
|
|
2333 |
"M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n"
|
|
|
2334 |
"G29 P1\n"
|
|
|
2335 |
"M104 S0"
|
|
|
2336 |
));
|
|
|
2337 |
MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR(
|
|
|
2338 |
"G28\n"
|
|
|
2339 |
"M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n"
|
|
|
2340 |
"G29 P1\n"
|
|
|
2341 |
"M104 S0"
|
|
|
2342 |
));
|
|
|
2343 |
#endif
|
|
|
2344 |
MENU_ITEM(submenu, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_custom_mesh);
|
|
|
2345 |
MENU_ITEM(gcode, MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1"));
|
|
|
2346 |
MENU_ITEM(submenu, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_menu);
|
|
|
2347 |
MENU_ITEM(gcode, MSG_UBL_CONTINUE_MESH, PSTR("G29 P1 C"));
|
|
|
2348 |
MENU_ITEM(function, MSG_UBL_INVALIDATE_ALL, _lcd_ubl_invalidate);
|
|
|
2349 |
MENU_ITEM(gcode, MSG_UBL_INVALIDATE_CLOSEST, PSTR("G29 I"));
|
|
|
2350 |
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
|
|
2351 |
END_MENU();
|
|
|
2352 |
}
|
|
|
2353 |
|
|
|
2354 |
/**
|
|
|
2355 |
* UBL Load Mesh Command
|
|
|
2356 |
*/
|
|
|
2357 |
void _lcd_ubl_load_mesh_cmd() {
|
|
|
2358 |
char UBL_LCD_GCODE[25];
|
|
|
2359 |
sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot);
|
|
|
2360 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2361 |
sprintf_P(UBL_LCD_GCODE, PSTR("M117 " MSG_MESH_LOADED), ubl_storage_slot);
|
|
|
2362 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2363 |
}
|
|
|
2364 |
|
|
|
2365 |
/**
|
|
|
2366 |
* UBL Save Mesh Command
|
|
|
2367 |
*/
|
|
|
2368 |
void _lcd_ubl_save_mesh_cmd() {
|
|
|
2369 |
char UBL_LCD_GCODE[25];
|
|
|
2370 |
sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot);
|
|
|
2371 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2372 |
sprintf_P(UBL_LCD_GCODE, PSTR("M117 " MSG_MESH_SAVED), ubl_storage_slot);
|
|
|
2373 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2374 |
}
|
|
|
2375 |
|
|
|
2376 |
/**
|
|
|
2377 |
* UBL Mesh Storage submenu
|
|
|
2378 |
*
|
|
|
2379 |
* << Unified Bed Leveling
|
|
|
2380 |
* Memory Slot: ---
|
|
|
2381 |
* Load Bed Mesh
|
|
|
2382 |
* Save Bed Mesh
|
|
|
2383 |
*/
|
|
|
2384 |
void _lcd_ubl_storage_mesh() {
|
|
|
2385 |
int16_t a = settings.calc_num_meshes();
|
|
|
2386 |
START_MENU();
|
|
|
2387 |
MENU_BACK(MSG_UBL_LEVEL_BED);
|
|
|
2388 |
if (!WITHIN(ubl_storage_slot, 0, a - 1)) {
|
|
|
2389 |
STATIC_ITEM(MSG_NO_STORAGE);
|
|
|
2390 |
}
|
|
|
2391 |
else {
|
|
|
2392 |
MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, a - 1);
|
|
|
2393 |
MENU_ITEM(function, MSG_UBL_LOAD_MESH, _lcd_ubl_load_mesh_cmd);
|
|
|
2394 |
MENU_ITEM(function, MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd);
|
|
|
2395 |
}
|
|
|
2396 |
END_MENU();
|
|
|
2397 |
}
|
|
|
2398 |
|
|
|
2399 |
/**
|
|
|
2400 |
* UBL LCD "radar" map homing
|
|
|
2401 |
*/
|
|
|
2402 |
void _lcd_ubl_output_map_lcd();
|
|
|
2403 |
|
|
|
2404 |
void _lcd_ubl_map_homing() {
|
|
|
2405 |
defer_return_to_status = true;
|
|
|
2406 |
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT < 3 ? 0 : (LCD_HEIGHT > 4 ? 2 : 1), PSTR(MSG_LEVEL_BED_HOMING));
|
|
|
2407 |
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
|
|
2408 |
if (all_axes_homed()) {
|
|
|
2409 |
ubl.lcd_map_control = true; // Return to the map screen
|
|
|
2410 |
lcd_goto_screen(_lcd_ubl_output_map_lcd);
|
|
|
2411 |
}
|
|
|
2412 |
}
|
|
|
2413 |
|
|
|
2414 |
/**
|
|
|
2415 |
* UBL LCD "radar" map point editing
|
|
|
2416 |
*/
|
|
|
2417 |
void _lcd_ubl_map_lcd_edit_cmd() {
|
|
|
2418 |
char UBL_LCD_GCODE[50], str[10], str2[10];
|
|
|
2419 |
dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
|
|
|
2420 |
dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
|
|
|
2421 |
snprintf_P(UBL_LCD_GCODE, sizeof(UBL_LCD_GCODE), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts);
|
|
|
2422 |
lcd_enqueue_command(UBL_LCD_GCODE);
|
|
|
2423 |
}
|
|
|
2424 |
|
|
|
2425 |
/**
|
|
|
2426 |
* UBL LCD Map Movement
|
|
|
2427 |
*/
|
|
|
2428 |
void ubl_map_move_to_xy() {
|
|
|
2429 |
current_position[X_AXIS] = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]);
|
|
|
2430 |
current_position[Y_AXIS] = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]);
|
|
|
2431 |
planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
|
|
|
2432 |
}
|
|
|
2433 |
|
|
|
2434 |
/**
|
|
|
2435 |
* UBL LCD "radar" map
|
|
|
2436 |
*/
|
|
|
2437 |
void set_current_from_steppers_for_axis(const AxisEnum axis);
|
|
|
2438 |
|
|
|
2439 |
void _lcd_do_nothing() {}
|
|
|
2440 |
void _lcd_hard_stop() {
|
|
|
2441 |
const screenFunc_t old_screen = currentScreen;
|
|
|
2442 |
currentScreen = _lcd_do_nothing;
|
|
|
2443 |
planner.quick_stop();
|
|
|
2444 |
currentScreen = old_screen;
|
|
|
2445 |
set_current_from_steppers_for_axis(ALL_AXES);
|
|
|
2446 |
sync_plan_position();
|
|
|
2447 |
}
|
|
|
2448 |
|
|
|
2449 |
void _lcd_ubl_output_map_lcd() {
|
|
|
2450 |
static int16_t step_scaler = 0;
|
|
|
2451 |
|
|
|
2452 |
if (use_click()) return _lcd_ubl_map_lcd_edit_cmd();
|
|
|
2453 |
ENCODER_DIRECTION_NORMAL();
|
|
|
2454 |
|
|
|
2455 |
if (encoderPosition) {
|
|
|
2456 |
step_scaler += (int32_t)encoderPosition;
|
|
|
2457 |
x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
|
|
|
2458 |
if (ABS(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM) step_scaler = 0;
|
|
|
2459 |
encoderPosition = 0;
|
|
|
2460 |
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
|
2461 |
}
|
|
|
2462 |
|
|
|
2463 |
// Encoder to the right (++)
|
|
|
2464 |
if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
|
|
|
2465 |
if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
|
|
|
2466 |
|
|
|
2467 |
// Encoder to the left (--)
|
|
|
2468 |
if (x_plot <= GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1)) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; }
|
|
|
2469 |
if (y_plot <= GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1)) y_plot = GRID_MAX_POINTS_Y - 1;
|
|
|
2470 |
|
|
|
2471 |
// Prevent underrun/overrun of plot numbers
|
|
|
2472 |
x_plot = constrain(x_plot, GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1), GRID_MAX_POINTS_X + 1);
|
|
|
2473 |
y_plot = constrain(y_plot, GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1), GRID_MAX_POINTS_Y + 1);
|
|
|
2474 |
|
|
|
2475 |
// Determine number of points to edit
|
|
|
2476 |
#if IS_KINEMATIC
|
|
|
2477 |
n_edit_pts = 9; //TODO: Delta accessible edit points
|
|
|
2478 |
#else
|
|
|
2479 |
const bool xc = WITHIN(x_plot, 1, GRID_MAX_POINTS_X - 2),
|
|
|
2480 |
yc = WITHIN(y_plot, 1, GRID_MAX_POINTS_Y - 2);
|
|
|
2481 |
n_edit_pts = yc ? (xc ? 9 : 6) : (xc ? 6 : 4); // Corners
|
|
|
2482 |
#endif
|
|
|
2483 |
|
|
|
2484 |
if (lcdDrawUpdate) {
|
|
|
2485 |
lcd_implementation_ubl_plot(x_plot, y_plot);
|
|
|
2486 |
|
|
|
2487 |
if (planner.movesplanned()) // If the nozzle is already moving, cancel the move.
|
|
|
2488 |
_lcd_hard_stop();
|
|
|
2489 |
|
|
|
2490 |
ubl_map_move_to_xy(); // Move to new location
|
|
|
2491 |
}
|
|
|
2492 |
}
|
|
|
2493 |
|
|
|
2494 |
/**
|
|
|
2495 |
* UBL Homing before LCD map
|
|
|
2496 |
*/
|
|
|
2497 |
void _lcd_ubl_output_map_lcd_cmd() {
|
|
|
2498 |
if (!all_axes_known()) {
|
|
|
2499 |
axis_homed = 0;
|
|
|
2500 |
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
2501 |
}
|
|
|
2502 |
lcd_goto_screen(_lcd_ubl_map_homing);
|
|
|
2503 |
}
|
|
|
2504 |
|
|
|
2505 |
/**
|
|
|
2506 |
* UBL Output map submenu
|
|
|
2507 |
*
|
|
|
2508 |
* << Unified Bed Leveling
|
|
|
2509 |
* Output for Host
|
|
|
2510 |
* Output for CSV
|
|
|
2511 |
* Off Printer Backup
|
|
|
2512 |
* Output Mesh Map
|
|
|
2513 |
*/
|
|
|
2514 |
void _lcd_ubl_output_map() {
|
|
|
2515 |
START_MENU();
|
|
|
2516 |
MENU_BACK(MSG_UBL_LEVEL_BED);
|
|
|
2517 |
MENU_ITEM(gcode, MSG_UBL_OUTPUT_MAP_HOST, PSTR("G29 T0"));
|
|
|
2518 |
MENU_ITEM(gcode, MSG_UBL_OUTPUT_MAP_CSV, PSTR("G29 T1"));
|
|
|
2519 |
MENU_ITEM(gcode, MSG_UBL_OUTPUT_MAP_BACKUP, PSTR("G29 S-1"));
|
|
|
2520 |
MENU_ITEM(function, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map_lcd_cmd);
|
|
|
2521 |
END_MENU();
|
|
|
2522 |
}
|
|
|
2523 |
|
|
|
2524 |
/**
|
|
|
2525 |
* UBL Tools submenu
|
|
|
2526 |
*
|
|
|
2527 |
* << Unified Bed Leveling
|
|
|
2528 |
* - Build Mesh >>
|
|
|
2529 |
* - Validate Mesh >>
|
|
|
2530 |
* - Edit Mesh >>
|
|
|
2531 |
* - Mesh Leveling >>
|
|
|
2532 |
*/
|
|
|
2533 |
void _lcd_ubl_tools_menu() {
|
|
|
2534 |
START_MENU();
|
|
|
2535 |
MENU_BACK(MSG_UBL_LEVEL_BED);
|
|
|
2536 |
MENU_ITEM(submenu, MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh);
|
|
|
2537 |
MENU_ITEM(gcode, MSG_UBL_MANUAL_MESH, PSTR("G29 I999\nG29 P2 B T0"));
|
|
|
2538 |
MENU_ITEM(submenu, MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
|
|
|
2539 |
MENU_ITEM(submenu, MSG_UBL_EDIT_MESH_MENU, _lcd_ubl_edit_mesh);
|
|
|
2540 |
MENU_ITEM(submenu, MSG_UBL_MESH_LEVELING, _lcd_ubl_mesh_leveling);
|
|
|
2541 |
END_MENU();
|
|
|
2542 |
}
|
|
|
2543 |
|
|
|
2544 |
/**
|
|
|
2545 |
* UBL Step-By-Step submenu
|
|
|
2546 |
*
|
|
|
2547 |
* << Unified Bed Leveling
|
|
|
2548 |
* 1 Build Cold Mesh
|
|
|
2549 |
* 2 Smart Fill-in
|
|
|
2550 |
* - 3 Validate Mesh >>
|
|
|
2551 |
* 4 Fine Tune All
|
|
|
2552 |
* - 5 Validate Mesh >>
|
|
|
2553 |
* 6 Fine Tune All
|
|
|
2554 |
* 7 Save Bed Mesh
|
|
|
2555 |
*/
|
|
|
2556 |
void _lcd_ubl_step_by_step() {
|
|
|
2557 |
START_MENU();
|
|
|
2558 |
MENU_BACK(MSG_UBL_LEVEL_BED);
|
|
|
2559 |
MENU_ITEM(gcode, "1 " MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1"));
|
|
|
2560 |
MENU_ITEM(gcode, "2 " MSG_UBL_SMART_FILLIN, PSTR("G29 P3 T0"));
|
|
|
2561 |
MENU_ITEM(submenu, "3 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
|
|
|
2562 |
MENU_ITEM(gcode, "4 " MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T"));
|
|
|
2563 |
MENU_ITEM(submenu, "5 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
|
|
|
2564 |
MENU_ITEM(gcode, "6 " MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T"));
|
|
|
2565 |
MENU_ITEM(function, "7 " MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd);
|
|
|
2566 |
END_MENU();
|
|
|
2567 |
}
|
|
|
2568 |
|
|
|
2569 |
/**
|
|
|
2570 |
* UBL System submenu
|
|
|
2571 |
*
|
|
|
2572 |
* << Prepare
|
|
|
2573 |
* - Manually Build Mesh >>
|
|
|
2574 |
* - Activate UBL >>
|
|
|
2575 |
* - Deactivate UBL >>
|
|
|
2576 |
* - Step-By-Step UBL >>
|
|
|
2577 |
* - Mesh Storage >>
|
|
|
2578 |
* - Output Map >>
|
|
|
2579 |
* - UBL Tools >>
|
|
|
2580 |
* - Output UBL Info >>
|
|
|
2581 |
*/
|
|
|
2582 |
|
|
|
2583 |
void _lcd_ubl_level_bed() {
|
|
|
2584 |
START_MENU();
|
|
|
2585 |
MENU_BACK(MSG_PREPARE);
|
|
|
2586 |
MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A"));
|
|
|
2587 |
MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D"));
|
|
|
2588 |
MENU_ITEM(submenu, MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step);
|
|
|
2589 |
MENU_ITEM(function, MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd);
|
|
|
2590 |
MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh);
|
|
|
2591 |
MENU_ITEM(submenu, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map);
|
|
|
2592 |
MENU_ITEM(submenu, MSG_UBL_TOOLS, _lcd_ubl_tools_menu);
|
|
|
2593 |
MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W"));
|
|
|
2594 |
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
2595 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0, 100, _lcd_set_z_fade_height);
|
|
|
2596 |
#endif
|
|
|
2597 |
END_MENU();
|
|
|
2598 |
}
|
|
|
2599 |
|
|
|
2600 |
#endif // AUTO_BED_LEVELING_UBL
|
|
|
2601 |
|
|
|
2602 |
|
|
|
2603 |
#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS))
|
|
|
2604 |
void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); }
|
|
|
2605 |
#endif
|
|
|
2606 |
|
|
|
2607 |
#if ENABLED(LCD_BED_LEVELING)
|
|
|
2608 |
|
|
|
2609 |
/**
|
|
|
2610 |
* Step 1: Bed Level entry-point
|
|
|
2611 |
*
|
|
|
2612 |
* << Prepare
|
|
|
2613 |
* Auto Home (if homing needed)
|
|
|
2614 |
* Leveling On/Off (if data exists, and homed)
|
|
|
2615 |
* Fade Height: --- (Req: ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
2616 |
* Mesh Z Offset: --- (Req: MESH_BED_LEVELING)
|
|
|
2617 |
* Z Probe Offset: --- (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET)
|
|
|
2618 |
* Level Bed >
|
|
|
2619 |
* Level Corners > (if homed)
|
|
|
2620 |
* Load Settings (Req: EEPROM_SETTINGS)
|
|
|
2621 |
* Save Settings (Req: EEPROM_SETTINGS)
|
|
|
2622 |
*/
|
|
|
2623 |
void lcd_bed_leveling() {
|
|
|
2624 |
START_MENU();
|
|
|
2625 |
MENU_BACK(MSG_PREPARE);
|
|
|
2626 |
|
|
|
2627 |
const bool is_homed = all_axes_known();
|
|
|
2628 |
|
|
|
2629 |
// Auto Home if not using manual probing
|
|
|
2630 |
#if DISABLED(PROBE_MANUALLY) && DISABLED(MESH_BED_LEVELING)
|
|
|
2631 |
if (!is_homed) MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
|
|
|
2632 |
#endif
|
|
|
2633 |
|
|
|
2634 |
// Level Bed
|
|
|
2635 |
#if ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING)
|
|
|
2636 |
// Manual leveling uses a guided procedure
|
|
|
2637 |
MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue);
|
|
|
2638 |
#else
|
|
|
2639 |
// Automatic leveling can just run the G-code
|
|
|
2640 |
MENU_ITEM(gcode, MSG_LEVEL_BED, is_homed ? PSTR("G29") : PSTR("G28\nG29"));
|
|
|
2641 |
#endif
|
|
|
2642 |
|
|
|
2643 |
// Homed and leveling is valid? Then leveling can be toggled.
|
|
|
2644 |
if (is_homed && leveling_is_valid()) {
|
|
|
2645 |
bool new_level_state = planner.leveling_active;
|
|
|
2646 |
MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling);
|
|
|
2647 |
}
|
|
|
2648 |
|
|
|
2649 |
// Z Fade Height
|
|
|
2650 |
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
2651 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0, 100, _lcd_set_z_fade_height);
|
|
|
2652 |
#endif
|
|
|
2653 |
|
|
|
2654 |
//
|
|
|
2655 |
// MBL Z Offset
|
|
|
2656 |
//
|
|
|
2657 |
#if ENABLED(MESH_BED_LEVELING)
|
|
|
2658 |
MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);
|
|
|
2659 |
#endif
|
|
|
2660 |
|
|
|
2661 |
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
|
2662 |
MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
|
|
2663 |
#elif HAS_BED_PROBE
|
|
|
2664 |
MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
|
|
2665 |
#endif
|
|
|
2666 |
|
|
|
2667 |
#if ENABLED(LEVEL_BED_CORNERS)
|
|
|
2668 |
// Move to the next corner for leveling
|
|
|
2669 |
if (all_axes_homed()) MENU_ITEM(submenu, MSG_LEVEL_CORNERS, _lcd_level_bed_corners);
|
|
|
2670 |
#endif
|
|
|
2671 |
|
|
|
2672 |
#if ENABLED(EEPROM_SETTINGS)
|
|
|
2673 |
MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
|
|
|
2674 |
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
|
|
|
2675 |
#endif
|
|
|
2676 |
END_MENU();
|
|
|
2677 |
}
|
|
|
2678 |
|
|
|
2679 |
#endif // LCD_BED_LEVELING
|
|
|
2680 |
|
|
|
2681 |
/**
|
|
|
2682 |
*
|
|
|
2683 |
* "Prepare" submenu
|
|
|
2684 |
*
|
|
|
2685 |
*/
|
|
|
2686 |
|
|
|
2687 |
void lcd_prepare_menu() {
|
|
|
2688 |
START_MENU();
|
|
|
2689 |
|
|
|
2690 |
//
|
|
|
2691 |
// ^ Main
|
|
|
2692 |
//
|
|
|
2693 |
MENU_BACK(MSG_MAIN);
|
|
|
2694 |
|
|
|
2695 |
//
|
|
|
2696 |
// Move Axis
|
|
|
2697 |
//
|
|
|
2698 |
#if ENABLED(DELTA)
|
|
|
2699 |
if (all_axes_homed())
|
|
|
2700 |
#endif
|
|
|
2701 |
MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
|
|
|
2702 |
|
|
|
2703 |
//
|
|
|
2704 |
// Auto Home
|
|
|
2705 |
//
|
|
|
2706 |
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
|
|
|
2707 |
#if ENABLED(INDIVIDUAL_AXIS_HOMING_MENU)
|
|
|
2708 |
MENU_ITEM(gcode, MSG_AUTO_HOME_X, PSTR("G28 X"));
|
|
|
2709 |
MENU_ITEM(gcode, MSG_AUTO_HOME_Y, PSTR("G28 Y"));
|
|
|
2710 |
MENU_ITEM(gcode, MSG_AUTO_HOME_Z, PSTR("G28 Z"));
|
|
|
2711 |
#endif
|
|
|
2712 |
|
|
|
2713 |
//
|
|
|
2714 |
// TMC Z Calibration
|
|
|
2715 |
//
|
|
|
2716 |
#if ENABLED(TMC_Z_CALIBRATION)
|
|
|
2717 |
MENU_ITEM(gcode, MSG_TMC_Z_CALIBRATION, PSTR("G28\nM915"));
|
|
|
2718 |
#endif
|
|
|
2719 |
|
|
|
2720 |
//
|
|
|
2721 |
// Level Bed
|
|
|
2722 |
//
|
|
|
2723 |
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
2724 |
|
|
|
2725 |
MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed);
|
|
|
2726 |
|
|
|
2727 |
#elif ENABLED(LCD_BED_LEVELING)
|
|
|
2728 |
|
|
|
2729 |
#if ENABLED(PROBE_MANUALLY)
|
|
|
2730 |
if (!g29_in_progress)
|
|
|
2731 |
#endif
|
|
|
2732 |
MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling);
|
|
|
2733 |
|
|
|
2734 |
#elif HAS_LEVELING && DISABLED(SLIM_LCD_MENUS)
|
|
|
2735 |
|
|
|
2736 |
#if DISABLED(PROBE_MANUALLY)
|
|
|
2737 |
MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G28\nG29"));
|
|
|
2738 |
#endif
|
|
|
2739 |
if (leveling_is_valid()) {
|
|
|
2740 |
bool new_level_state = planner.leveling_active;
|
|
|
2741 |
MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling);
|
|
|
2742 |
}
|
|
|
2743 |
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
2744 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0, 100, _lcd_set_z_fade_height);
|
|
|
2745 |
#endif
|
|
|
2746 |
|
|
|
2747 |
#endif
|
|
|
2748 |
|
|
|
2749 |
#if ENABLED(LEVEL_BED_CORNERS) && DISABLED(LCD_BED_LEVELING)
|
|
|
2750 |
if (all_axes_homed())
|
|
|
2751 |
MENU_ITEM(function, MSG_LEVEL_CORNERS, _lcd_level_bed_corners);
|
|
|
2752 |
#endif
|
|
|
2753 |
|
|
|
2754 |
#if HAS_M206_COMMAND && DISABLED(SLIM_LCD_MENUS)
|
|
|
2755 |
//
|
|
|
2756 |
// Set Home Offsets
|
|
|
2757 |
//
|
|
|
2758 |
MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets);
|
|
|
2759 |
#endif
|
|
|
2760 |
|
|
|
2761 |
//
|
|
|
2762 |
// Disable Steppers
|
|
|
2763 |
//
|
|
|
2764 |
MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84"));
|
|
|
2765 |
|
|
|
2766 |
//
|
|
|
2767 |
// Change filament
|
|
|
2768 |
//
|
|
|
2769 |
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
2770 |
if (!IS_SD_FILE_OPEN()) {
|
|
|
2771 |
#if E_STEPPERS == 1 && !ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
|
|
2772 |
if (thermalManager.targetHotEnoughToExtrude(active_extruder))
|
|
|
2773 |
MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0"));
|
|
|
2774 |
else
|
|
|
2775 |
MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_temp_menu_e0_filament_change);
|
|
|
2776 |
#else
|
|
|
2777 |
MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_change_filament_menu);
|
|
|
2778 |
#endif
|
|
|
2779 |
}
|
|
|
2780 |
#endif // ADVANCED_PAUSE_FEATURE
|
|
|
2781 |
|
|
|
2782 |
#if HAS_TEMP_HOTEND
|
|
|
2783 |
|
|
|
2784 |
//
|
|
|
2785 |
// Cooldown
|
|
|
2786 |
//
|
|
|
2787 |
bool has_heat = false;
|
|
|
2788 |
HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; }
|
|
|
2789 |
#if HAS_HEATED_BED
|
|
|
2790 |
if (thermalManager.target_temperature_bed) has_heat = true;
|
|
|
2791 |
#endif
|
|
|
2792 |
if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
|
|
|
2793 |
|
|
|
2794 |
//
|
|
|
2795 |
// Preheat for Material 1 and 2
|
|
|
2796 |
//
|
|
|
2797 |
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || HAS_HEATED_BED
|
|
|
2798 |
MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_m1_menu);
|
|
|
2799 |
MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_m2_menu);
|
|
|
2800 |
#else
|
|
|
2801 |
MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only);
|
|
|
2802 |
MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only);
|
|
|
2803 |
#endif
|
|
|
2804 |
|
|
|
2805 |
#endif // HAS_TEMP_HOTEND
|
|
|
2806 |
|
|
|
2807 |
//
|
|
|
2808 |
// BLTouch Self-Test and Reset
|
|
|
2809 |
//
|
|
|
2810 |
#if ENABLED(BLTOUCH)
|
|
|
2811 |
MENU_ITEM(gcode, MSG_BLTOUCH_SELFTEST, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_SELFTEST)));
|
|
|
2812 |
if (!endstops.z_probe_enabled && TEST_BLTOUCH())
|
|
|
2813 |
MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
|
|
|
2814 |
#endif
|
|
|
2815 |
|
|
|
2816 |
//
|
|
|
2817 |
// Switch power on/off
|
|
|
2818 |
//
|
|
|
2819 |
#if HAS_POWER_SWITCH
|
|
|
2820 |
if (powersupply_on)
|
|
|
2821 |
MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
|
|
|
2822 |
else
|
|
|
2823 |
MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
|
|
|
2824 |
#endif
|
|
|
2825 |
|
|
|
2826 |
//
|
|
|
2827 |
// Autostart
|
|
|
2828 |
//
|
|
|
2829 |
#if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
|
|
|
2830 |
MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd);
|
|
|
2831 |
#endif
|
|
|
2832 |
|
|
|
2833 |
//
|
|
|
2834 |
// Delta Calibration
|
|
|
2835 |
//
|
|
|
2836 |
#if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION)
|
|
|
2837 |
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
|
|
|
2838 |
#endif
|
|
|
2839 |
|
|
|
2840 |
END_MENU();
|
|
|
2841 |
}
|
|
|
2842 |
|
|
|
2843 |
float move_menu_scale;
|
|
|
2844 |
|
|
|
2845 |
#if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION)
|
|
|
2846 |
|
|
|
2847 |
void lcd_move_z();
|
|
|
2848 |
|
|
|
2849 |
void _man_probe_pt(const float &rx, const float &ry) {
|
|
|
2850 |
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
|
|
2851 |
do_blocking_move_to_xy(rx, ry);
|
|
|
2852 |
|
|
|
2853 |
lcd_synchronize();
|
|
|
2854 |
move_menu_scale = MAX(PROBE_MANUALLY_STEP, MIN_STEPS_PER_SEGMENT / float(DEFAULT_XYZ_STEPS_PER_UNIT));
|
|
|
2855 |
lcd_goto_screen(lcd_move_z);
|
|
|
2856 |
}
|
|
|
2857 |
|
|
|
2858 |
#endif // DELTA_CALIBRATION_MENU || DELTA_AUTO_CALIBRATION
|
|
|
2859 |
|
|
|
2860 |
#if ENABLED(DELTA_AUTO_CALIBRATION)
|
|
|
2861 |
|
|
|
2862 |
float lcd_probe_pt(const float &rx, const float &ry) {
|
|
|
2863 |
_man_probe_pt(rx, ry);
|
|
|
2864 |
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
2865 |
defer_return_to_status = true;
|
|
|
2866 |
wait_for_user = true;
|
|
|
2867 |
while (wait_for_user) idle();
|
|
|
2868 |
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
2869 |
lcd_goto_previous_menu_no_defer();
|
|
|
2870 |
return current_position[Z_AXIS];
|
|
|
2871 |
}
|
|
|
2872 |
|
|
|
2873 |
#endif // DELTA_AUTO_CALIBRATION
|
|
|
2874 |
|
|
|
2875 |
#if ENABLED(DELTA_CALIBRATION_MENU)
|
|
|
2876 |
|
|
|
2877 |
void _lcd_calibrate_homing() {
|
|
|
2878 |
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_HOMING));
|
|
|
2879 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
2880 |
if (all_axes_homed())
|
|
|
2881 |
lcd_goto_previous_menu();
|
|
|
2882 |
}
|
|
|
2883 |
|
|
|
2884 |
void _lcd_delta_calibrate_home() {
|
|
|
2885 |
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
2886 |
lcd_goto_screen(_lcd_calibrate_homing);
|
|
|
2887 |
}
|
|
|
2888 |
|
|
|
2889 |
void _goto_tower_x() { _man_probe_pt(cos(RADIANS(210)) * delta_calibration_radius, sin(RADIANS(210)) * delta_calibration_radius); }
|
|
|
2890 |
void _goto_tower_y() { _man_probe_pt(cos(RADIANS(330)) * delta_calibration_radius, sin(RADIANS(330)) * delta_calibration_radius); }
|
|
|
2891 |
void _goto_tower_z() { _man_probe_pt(cos(RADIANS( 90)) * delta_calibration_radius, sin(RADIANS( 90)) * delta_calibration_radius); }
|
|
|
2892 |
void _goto_center() { _man_probe_pt(0,0); }
|
|
|
2893 |
|
|
|
2894 |
#endif // DELTA_CALIBRATION_MENU
|
|
|
2895 |
|
|
|
2896 |
#if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION)
|
|
|
2897 |
|
|
|
2898 |
void _recalc_delta_settings() {
|
|
|
2899 |
#if HAS_LEVELING
|
|
|
2900 |
reset_bed_level(); // After changing kinematics bed-level data is no longer valid
|
|
|
2901 |
#endif
|
|
|
2902 |
recalc_delta_settings();
|
|
|
2903 |
}
|
|
|
2904 |
|
|
|
2905 |
void lcd_delta_settings() {
|
|
|
2906 |
START_MENU();
|
|
|
2907 |
MENU_BACK(MSG_DELTA_CALIBRATE);
|
|
|
2908 |
MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10, delta_height + 10, _recalc_delta_settings);
|
|
|
2909 |
MENU_ITEM_EDIT_CALLBACK(float43, "Ex", &delta_endstop_adj[A_AXIS], -5, 5, _recalc_delta_settings);
|
|
|
2910 |
MENU_ITEM_EDIT_CALLBACK(float43, "Ey", &delta_endstop_adj[B_AXIS], -5, 5, _recalc_delta_settings);
|
|
|
2911 |
MENU_ITEM_EDIT_CALLBACK(float43, "Ez", &delta_endstop_adj[C_AXIS], -5, 5, _recalc_delta_settings);
|
|
|
2912 |
MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_RADIUS, &delta_radius, delta_radius - 5, delta_radius + 5, _recalc_delta_settings);
|
|
|
2913 |
MENU_ITEM_EDIT_CALLBACK(float43, "Tx", &delta_tower_angle_trim[A_AXIS], -5, 5, _recalc_delta_settings);
|
|
|
2914 |
MENU_ITEM_EDIT_CALLBACK(float43, "Ty", &delta_tower_angle_trim[B_AXIS], -5, 5, _recalc_delta_settings);
|
|
|
2915 |
MENU_ITEM_EDIT_CALLBACK(float43, "Tz", &delta_tower_angle_trim[C_AXIS], -5, 5, _recalc_delta_settings);
|
|
|
2916 |
MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_DIAG_ROD, &delta_diagonal_rod, delta_diagonal_rod - 5, delta_diagonal_rod + 5, _recalc_delta_settings);
|
|
|
2917 |
END_MENU();
|
|
|
2918 |
}
|
|
|
2919 |
|
|
|
2920 |
void lcd_delta_calibrate_menu() {
|
|
|
2921 |
START_MENU();
|
|
|
2922 |
MENU_BACK(MSG_MAIN);
|
|
|
2923 |
#if ENABLED(DELTA_AUTO_CALIBRATION)
|
|
|
2924 |
MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33"));
|
|
|
2925 |
#if ENABLED(EEPROM_SETTINGS)
|
|
|
2926 |
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
|
|
|
2927 |
MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
|
|
|
2928 |
#endif
|
|
|
2929 |
#endif
|
|
|
2930 |
MENU_ITEM(submenu, MSG_DELTA_SETTINGS, lcd_delta_settings);
|
|
|
2931 |
#if ENABLED(DELTA_CALIBRATION_MENU)
|
|
|
2932 |
MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home);
|
|
|
2933 |
if (all_axes_homed()) {
|
|
|
2934 |
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_X, _goto_tower_x);
|
|
|
2935 |
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Y, _goto_tower_y);
|
|
|
2936 |
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Z, _goto_tower_z);
|
|
|
2937 |
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_CENTER, _goto_center);
|
|
|
2938 |
}
|
|
|
2939 |
#endif
|
|
|
2940 |
END_MENU();
|
|
|
2941 |
}
|
|
|
2942 |
|
|
|
2943 |
#endif // DELTA_CALIBRATION_MENU || DELTA_AUTO_CALIBRATION
|
|
|
2944 |
|
|
|
2945 |
/**
|
|
|
2946 |
* If the most recent manual move hasn't been fed to the planner yet,
|
|
|
2947 |
* and the planner can accept one, send immediately
|
|
|
2948 |
*/
|
|
|
2949 |
inline void manage_manual_move() {
|
|
|
2950 |
|
|
|
2951 |
if (processing_manual_move) return;
|
|
|
2952 |
|
|
|
2953 |
if (manual_move_axis != (int8_t)NO_AXIS && ELAPSED(millis(), manual_move_start_time) && !planner.is_full()) {
|
|
|
2954 |
|
|
|
2955 |
#if IS_KINEMATIC
|
|
|
2956 |
|
|
|
2957 |
const float old_feedrate = feedrate_mm_s;
|
|
|
2958 |
feedrate_mm_s = MMM_TO_MMS(manual_feedrate_mm_m[manual_move_axis]);
|
|
|
2959 |
|
|
|
2960 |
#if EXTRUDERS > 1
|
|
|
2961 |
const int8_t old_extruder = active_extruder;
|
|
|
2962 |
if (manual_move_axis == E_AXIS) active_extruder = manual_move_e_index;
|
|
|
2963 |
#endif
|
|
|
2964 |
|
|
|
2965 |
// Set movement on a single axis
|
|
|
2966 |
set_destination_from_current();
|
|
|
2967 |
destination[manual_move_axis] += manual_move_offset;
|
|
|
2968 |
|
|
|
2969 |
// Reset for the next move
|
|
|
2970 |
manual_move_offset = 0;
|
|
|
2971 |
manual_move_axis = (int8_t)NO_AXIS;
|
|
|
2972 |
|
|
|
2973 |
// DELTA and SCARA machines use segmented moves, which could fill the planner during the call to
|
|
|
2974 |
// move_to_destination. This will cause idle() to be called, which can then call this function while the
|
|
|
2975 |
// previous invocation is being blocked. Modifications to manual_move_offset shouldn't be made while
|
|
|
2976 |
// processing_manual_move is true or the planner will get out of sync.
|
|
|
2977 |
processing_manual_move = true;
|
|
|
2978 |
prepare_move_to_destination(); // will call set_current_from_destination()
|
|
|
2979 |
processing_manual_move = false;
|
|
|
2980 |
|
|
|
2981 |
feedrate_mm_s = old_feedrate;
|
|
|
2982 |
#if EXTRUDERS > 1
|
|
|
2983 |
active_extruder = old_extruder;
|
|
|
2984 |
#endif
|
|
|
2985 |
|
|
|
2986 |
#else
|
|
|
2987 |
|
|
|
2988 |
planner.buffer_line_kinematic(current_position, MMM_TO_MMS(manual_feedrate_mm_m[manual_move_axis]), manual_move_axis == E_AXIS ? manual_move_e_index : active_extruder);
|
|
|
2989 |
manual_move_axis = (int8_t)NO_AXIS;
|
|
|
2990 |
|
|
|
2991 |
#endif
|
|
|
2992 |
}
|
|
|
2993 |
}
|
|
|
2994 |
|
|
|
2995 |
/**
|
|
|
2996 |
* Set a flag that lcd_update() should start a move
|
|
|
2997 |
* to "current_position" after a short delay.
|
|
|
2998 |
*/
|
|
|
2999 |
inline void manual_move_to_current(AxisEnum axis
|
|
|
3000 |
#if E_MANUAL > 1
|
|
|
3001 |
, const int8_t eindex=-1
|
|
|
3002 |
#endif
|
|
|
3003 |
) {
|
|
|
3004 |
#if ENABLED(DUAL_X_CARRIAGE) || E_MANUAL > 1
|
|
|
3005 |
#if E_MANUAL > 1
|
|
|
3006 |
if (axis == E_AXIS)
|
|
|
3007 |
#endif
|
|
|
3008 |
manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
|
|
|
3009 |
#endif
|
|
|
3010 |
manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
|
|
|
3011 |
manual_move_axis = (int8_t)axis;
|
|
|
3012 |
}
|
|
|
3013 |
|
|
|
3014 |
/**
|
|
|
3015 |
*
|
|
|
3016 |
* "Prepare" > "Move Axis" submenu
|
|
|
3017 |
*
|
|
|
3018 |
*/
|
|
|
3019 |
|
|
|
3020 |
void _lcd_move_xyz(const char* name, AxisEnum axis) {
|
|
|
3021 |
if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
|
|
|
3022 |
ENCODER_DIRECTION_NORMAL();
|
|
|
3023 |
if (encoderPosition && !processing_manual_move) {
|
|
|
3024 |
|
|
|
3025 |
// Start with no limits to movement
|
|
|
3026 |
float min = current_position[axis] - 1000,
|
|
|
3027 |
max = current_position[axis] + 1000;
|
|
|
3028 |
|
|
|
3029 |
// Limit to software endstops, if enabled
|
|
|
3030 |
#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS)
|
|
|
3031 |
if (soft_endstops_enabled) switch (axis) {
|
|
|
3032 |
case X_AXIS:
|
|
|
3033 |
#if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
|
|
|
3034 |
min = soft_endstop_min[X_AXIS];
|
|
|
3035 |
#endif
|
|
|
3036 |
#if ENABLED(MAX_SOFTWARE_ENDSTOP_X)
|
|
|
3037 |
max = soft_endstop_max[X_AXIS];
|
|
|
3038 |
#endif
|
|
|
3039 |
break;
|
|
|
3040 |
case Y_AXIS:
|
|
|
3041 |
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Y)
|
|
|
3042 |
min = soft_endstop_min[Y_AXIS];
|
|
|
3043 |
#endif
|
|
|
3044 |
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Y)
|
|
|
3045 |
max = soft_endstop_max[Y_AXIS];
|
|
|
3046 |
#endif
|
|
|
3047 |
break;
|
|
|
3048 |
case Z_AXIS:
|
|
|
3049 |
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Z)
|
|
|
3050 |
min = soft_endstop_min[Z_AXIS];
|
|
|
3051 |
#endif
|
|
|
3052 |
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
|
|
|
3053 |
max = soft_endstop_max[Z_AXIS];
|
|
|
3054 |
#endif
|
|
|
3055 |
default: break;
|
|
|
3056 |
}
|
|
|
3057 |
#endif // MIN_SOFTWARE_ENDSTOPS || MAX_SOFTWARE_ENDSTOPS
|
|
|
3058 |
|
|
|
3059 |
// Delta limits XY based on the current offset from center
|
|
|
3060 |
// This assumes the center is 0,0
|
|
|
3061 |
#if ENABLED(DELTA)
|
|
|
3062 |
if (axis != Z_AXIS) {
|
|
|
3063 |
max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
|
|
3064 |
min = -max;
|
|
|
3065 |
}
|
|
|
3066 |
#endif
|
|
|
3067 |
|
|
|
3068 |
// Get the new position
|
|
|
3069 |
const float diff = float((int32_t)encoderPosition) * move_menu_scale;
|
|
|
3070 |
#if IS_KINEMATIC
|
|
|
3071 |
manual_move_offset += diff;
|
|
|
3072 |
if ((int32_t)encoderPosition < 0)
|
|
|
3073 |
NOLESS(manual_move_offset, min - current_position[axis]);
|
|
|
3074 |
else
|
|
|
3075 |
NOMORE(manual_move_offset, max - current_position[axis]);
|
|
|
3076 |
#else
|
|
|
3077 |
current_position[axis] += diff;
|
|
|
3078 |
if ((int32_t)encoderPosition < 0)
|
|
|
3079 |
NOLESS(current_position[axis], min);
|
|
|
3080 |
else
|
|
|
3081 |
NOMORE(current_position[axis], max);
|
|
|
3082 |
#endif
|
|
|
3083 |
|
|
|
3084 |
manual_move_to_current(axis);
|
|
|
3085 |
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
|
3086 |
}
|
|
|
3087 |
encoderPosition = 0;
|
|
|
3088 |
if (lcdDrawUpdate) {
|
|
|
3089 |
const float pos = NATIVE_TO_LOGICAL(processing_manual_move ? destination[axis] : current_position[axis]
|
|
|
3090 |
#if IS_KINEMATIC
|
|
|
3091 |
+ manual_move_offset
|
|
|
3092 |
#endif
|
|
|
3093 |
, axis);
|
|
|
3094 |
lcd_implementation_drawedit(name, move_menu_scale >= 0.1f ? ftostr41sign(pos) : ftostr43sign(pos));
|
|
|
3095 |
}
|
|
|
3096 |
}
|
|
|
3097 |
void lcd_move_x() { _lcd_move_xyz(PSTR(MSG_MOVE_X), X_AXIS); }
|
|
|
3098 |
void lcd_move_y() { _lcd_move_xyz(PSTR(MSG_MOVE_Y), Y_AXIS); }
|
|
|
3099 |
void lcd_move_z() { _lcd_move_xyz(PSTR(MSG_MOVE_Z), Z_AXIS); }
|
|
|
3100 |
void _lcd_move_e(
|
|
|
3101 |
#if E_MANUAL > 1
|
|
|
3102 |
const int8_t eindex=-1
|
|
|
3103 |
#endif
|
|
|
3104 |
) {
|
|
|
3105 |
if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
|
|
|
3106 |
ENCODER_DIRECTION_NORMAL();
|
|
|
3107 |
if (encoderPosition) {
|
|
|
3108 |
if (!processing_manual_move) {
|
|
|
3109 |
const float diff = float((int32_t)encoderPosition) * move_menu_scale;
|
|
|
3110 |
#if IS_KINEMATIC
|
|
|
3111 |
manual_move_offset += diff;
|
|
|
3112 |
#else
|
|
|
3113 |
current_position[E_CART] += diff;
|
|
|
3114 |
#endif
|
|
|
3115 |
manual_move_to_current(E_AXIS
|
|
|
3116 |
#if E_MANUAL > 1
|
|
|
3117 |
, eindex
|
|
|
3118 |
#endif
|
|
|
3119 |
);
|
|
|
3120 |
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
|
3121 |
}
|
|
|
3122 |
encoderPosition = 0;
|
|
|
3123 |
}
|
|
|
3124 |
if (lcdDrawUpdate) {
|
|
|
3125 |
PGM_P pos_label;
|
|
|
3126 |
#if E_MANUAL == 1
|
|
|
3127 |
pos_label = PSTR(MSG_MOVE_E);
|
|
|
3128 |
#else
|
|
|
3129 |
switch (eindex) {
|
|
|
3130 |
default: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E1); break;
|
|
|
3131 |
case 1: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E2); break;
|
|
|
3132 |
#if E_MANUAL > 2
|
|
|
3133 |
case 2: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E3); break;
|
|
|
3134 |
#if E_MANUAL > 3
|
|
|
3135 |
case 3: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E4); break;
|
|
|
3136 |
#if E_MANUAL > 4
|
|
|
3137 |
case 4: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E5); break;
|
|
|
3138 |
#endif // E_MANUAL > 4
|
|
|
3139 |
#endif // E_MANUAL > 3
|
|
|
3140 |
#endif // E_MANUAL > 2
|
|
|
3141 |
}
|
|
|
3142 |
#endif // E_MANUAL > 1
|
|
|
3143 |
lcd_implementation_drawedit(pos_label, ftostr41sign(current_position[E_CART]
|
|
|
3144 |
#if IS_KINEMATIC
|
|
|
3145 |
+ manual_move_offset
|
|
|
3146 |
#endif
|
|
|
3147 |
));
|
|
|
3148 |
}
|
|
|
3149 |
}
|
|
|
3150 |
|
|
|
3151 |
void lcd_move_e() { _lcd_move_e(); }
|
|
|
3152 |
#if E_MANUAL > 1
|
|
|
3153 |
void lcd_move_e0() { _lcd_move_e(0); }
|
|
|
3154 |
void lcd_move_e1() { _lcd_move_e(1); }
|
|
|
3155 |
#if E_MANUAL > 2
|
|
|
3156 |
void lcd_move_e2() { _lcd_move_e(2); }
|
|
|
3157 |
#if E_MANUAL > 3
|
|
|
3158 |
void lcd_move_e3() { _lcd_move_e(3); }
|
|
|
3159 |
#if E_MANUAL > 4
|
|
|
3160 |
void lcd_move_e4() { _lcd_move_e(4); }
|
|
|
3161 |
#endif // E_MANUAL > 4
|
|
|
3162 |
#endif // E_MANUAL > 3
|
|
|
3163 |
#endif // E_MANUAL > 2
|
|
|
3164 |
#endif // E_MANUAL > 1
|
|
|
3165 |
|
|
|
3166 |
/**
|
|
|
3167 |
*
|
|
|
3168 |
* "Prepare" > "Move Xmm" > "Move XYZ" submenu
|
|
|
3169 |
*
|
|
|
3170 |
*/
|
|
|
3171 |
|
|
|
3172 |
screenFunc_t _manual_move_func_ptr;
|
|
|
3173 |
|
|
|
3174 |
void _goto_manual_move(const float scale) {
|
|
|
3175 |
defer_return_to_status = true;
|
|
|
3176 |
move_menu_scale = scale;
|
|
|
3177 |
lcd_goto_screen(_manual_move_func_ptr);
|
|
|
3178 |
}
|
|
|
3179 |
void lcd_move_menu_10mm() { _goto_manual_move(10); }
|
|
|
3180 |
void lcd_move_menu_1mm() { _goto_manual_move( 1); }
|
|
|
3181 |
void lcd_move_menu_01mm() { _goto_manual_move( 0.1f); }
|
|
|
3182 |
|
|
|
3183 |
void _lcd_move_distance_menu(const AxisEnum axis, const screenFunc_t func) {
|
|
|
3184 |
_manual_move_func_ptr = func;
|
|
|
3185 |
START_MENU();
|
|
|
3186 |
if (LCD_HEIGHT >= 4) {
|
|
|
3187 |
switch (axis) {
|
|
|
3188 |
case X_AXIS:
|
|
|
3189 |
STATIC_ITEM(MSG_MOVE_X, true, true); break;
|
|
|
3190 |
case Y_AXIS:
|
|
|
3191 |
STATIC_ITEM(MSG_MOVE_Y, true, true); break;
|
|
|
3192 |
case Z_AXIS:
|
|
|
3193 |
STATIC_ITEM(MSG_MOVE_Z, true, true); break;
|
|
|
3194 |
default:
|
|
|
3195 |
STATIC_ITEM(MSG_MOVE_E, true, true); break;
|
|
|
3196 |
}
|
|
|
3197 |
}
|
|
|
3198 |
MENU_BACK(MSG_MOVE_AXIS);
|
|
|
3199 |
MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm);
|
|
|
3200 |
MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm);
|
|
|
3201 |
MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm);
|
|
|
3202 |
END_MENU();
|
|
|
3203 |
}
|
|
|
3204 |
void lcd_move_get_x_amount() { _lcd_move_distance_menu(X_AXIS, lcd_move_x); }
|
|
|
3205 |
void lcd_move_get_y_amount() { _lcd_move_distance_menu(Y_AXIS, lcd_move_y); }
|
|
|
3206 |
void lcd_move_get_z_amount() { _lcd_move_distance_menu(Z_AXIS, lcd_move_z); }
|
|
|
3207 |
void lcd_move_get_e_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e); }
|
|
|
3208 |
#if E_MANUAL > 1
|
|
|
3209 |
void lcd_move_get_e0_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e0); }
|
|
|
3210 |
void lcd_move_get_e1_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e1); }
|
|
|
3211 |
#if E_MANUAL > 2
|
|
|
3212 |
void lcd_move_get_e2_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e2); }
|
|
|
3213 |
#if E_MANUAL > 3
|
|
|
3214 |
void lcd_move_get_e3_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e3); }
|
|
|
3215 |
#if E_MANUAL > 4
|
|
|
3216 |
void lcd_move_get_e4_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e4); }
|
|
|
3217 |
#endif // E_MANUAL > 4
|
|
|
3218 |
#endif // E_MANUAL > 3
|
|
|
3219 |
#endif // E_MANUAL > 2
|
|
|
3220 |
#endif // E_MANUAL > 1
|
|
|
3221 |
|
|
|
3222 |
/**
|
|
|
3223 |
*
|
|
|
3224 |
* "Prepare" > "Move Axis" submenu
|
|
|
3225 |
*
|
|
|
3226 |
*/
|
|
|
3227 |
|
|
|
3228 |
#if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
|
|
|
3229 |
#define _MOVE_XYZ_ALLOWED (all_axes_homed())
|
|
|
3230 |
#else
|
|
|
3231 |
#define _MOVE_XYZ_ALLOWED true
|
|
|
3232 |
#endif
|
|
|
3233 |
|
|
|
3234 |
#if ENABLED(DELTA)
|
|
|
3235 |
#define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
|
|
|
3236 |
void lcd_lower_z_to_clip_height() {
|
|
|
3237 |
line_to_z(delta_clip_start_height);
|
|
|
3238 |
lcd_synchronize();
|
|
|
3239 |
}
|
|
|
3240 |
#else
|
|
|
3241 |
#define _MOVE_XY_ALLOWED true
|
|
|
3242 |
#endif
|
|
|
3243 |
|
|
|
3244 |
void lcd_move_menu() {
|
|
|
3245 |
START_MENU();
|
|
|
3246 |
MENU_BACK(MSG_PREPARE);
|
|
|
3247 |
|
|
|
3248 |
#if HAS_SOFTWARE_ENDSTOPS && ENABLED(SOFT_ENDSTOPS_MENU_ITEM)
|
|
|
3249 |
MENU_ITEM_EDIT(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstops_enabled);
|
|
|
3250 |
#endif
|
|
|
3251 |
|
|
|
3252 |
if (_MOVE_XYZ_ALLOWED) {
|
|
|
3253 |
if (_MOVE_XY_ALLOWED) {
|
|
|
3254 |
MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_get_x_amount);
|
|
|
3255 |
MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_get_y_amount);
|
|
|
3256 |
}
|
|
|
3257 |
#if ENABLED(DELTA)
|
|
|
3258 |
else
|
|
|
3259 |
MENU_ITEM(function, MSG_FREE_XY, lcd_lower_z_to_clip_height);
|
|
|
3260 |
#endif
|
|
|
3261 |
|
|
|
3262 |
MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_get_z_amount);
|
|
|
3263 |
}
|
|
|
3264 |
else
|
|
|
3265 |
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
|
|
|
3266 |
|
|
|
3267 |
#if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE)
|
|
|
3268 |
|
|
|
3269 |
#if EXTRUDERS == 4
|
|
|
3270 |
switch (active_extruder) {
|
|
|
3271 |
case 0: MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); break;
|
|
|
3272 |
case 1: MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); break;
|
|
|
3273 |
case 2: MENU_ITEM(gcode, MSG_SELECT " " MSG_E4, PSTR("T3")); break;
|
|
|
3274 |
case 3: MENU_ITEM(gcode, MSG_SELECT " " MSG_E3, PSTR("T2")); break;
|
|
|
3275 |
}
|
|
|
3276 |
#elif EXTRUDERS == 3
|
|
|
3277 |
if (active_extruder < 2) {
|
|
|
3278 |
if (active_extruder)
|
|
|
3279 |
MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0"));
|
|
|
3280 |
else
|
|
|
3281 |
MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1"));
|
|
|
3282 |
}
|
|
|
3283 |
#else
|
|
|
3284 |
if (active_extruder)
|
|
|
3285 |
MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0"));
|
|
|
3286 |
else
|
|
|
3287 |
MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1"));
|
|
|
3288 |
#endif
|
|
|
3289 |
|
|
|
3290 |
#elif ENABLED(DUAL_X_CARRIAGE)
|
|
|
3291 |
|
|
|
3292 |
if (active_extruder)
|
|
|
3293 |
MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0"));
|
|
|
3294 |
else
|
|
|
3295 |
MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1"));
|
|
|
3296 |
|
|
|
3297 |
#endif
|
|
|
3298 |
|
|
|
3299 |
#if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE)
|
|
|
3300 |
|
|
|
3301 |
// Only the current...
|
|
|
3302 |
MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount);
|
|
|
3303 |
// ...and the non-switching
|
|
|
3304 |
#if E_MANUAL == 5
|
|
|
3305 |
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E5, lcd_move_get_e4_amount);
|
|
|
3306 |
#elif E_MANUAL == 3
|
|
|
3307 |
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount);
|
|
|
3308 |
#endif
|
|
|
3309 |
|
|
|
3310 |
#else
|
|
|
3311 |
|
|
|
3312 |
// Independent extruders with one E-stepper per hotend
|
|
|
3313 |
MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount);
|
|
|
3314 |
#if E_MANUAL > 1
|
|
|
3315 |
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E1, lcd_move_get_e0_amount);
|
|
|
3316 |
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E2, lcd_move_get_e1_amount);
|
|
|
3317 |
#if E_MANUAL > 2
|
|
|
3318 |
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount);
|
|
|
3319 |
#if E_MANUAL > 3
|
|
|
3320 |
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E4, lcd_move_get_e3_amount);
|
|
|
3321 |
#if E_MANUAL > 4
|
|
|
3322 |
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E5, lcd_move_get_e4_amount);
|
|
|
3323 |
#endif // E_MANUAL > 4
|
|
|
3324 |
#endif // E_MANUAL > 3
|
|
|
3325 |
#endif // E_MANUAL > 2
|
|
|
3326 |
#endif // E_MANUAL > 1
|
|
|
3327 |
|
|
|
3328 |
#endif
|
|
|
3329 |
|
|
|
3330 |
END_MENU();
|
|
|
3331 |
}
|
|
|
3332 |
|
|
|
3333 |
/**
|
|
|
3334 |
*
|
|
|
3335 |
* "Control" submenu
|
|
|
3336 |
*
|
|
|
3337 |
*/
|
|
|
3338 |
|
|
|
3339 |
#if HAS_LCD_CONTRAST
|
|
|
3340 |
void lcd_callback_set_contrast() { set_lcd_contrast(lcd_contrast); }
|
|
|
3341 |
#endif
|
|
|
3342 |
|
|
|
3343 |
static void lcd_factory_settings() {
|
|
|
3344 |
settings.reset();
|
|
|
3345 |
lcd_completion_feedback();
|
|
|
3346 |
}
|
|
|
3347 |
|
|
|
3348 |
#if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS)
|
|
|
3349 |
|
|
|
3350 |
static void lcd_init_eeprom() {
|
|
|
3351 |
lcd_completion_feedback(settings.init_eeprom());
|
|
|
3352 |
lcd_goto_previous_menu();
|
|
|
3353 |
}
|
|
|
3354 |
|
|
|
3355 |
static void lcd_init_eeprom_confirm() {
|
|
|
3356 |
START_MENU();
|
|
|
3357 |
MENU_BACK(MSG_CONTROL);
|
|
|
3358 |
MENU_ITEM(function, MSG_INIT_EEPROM, lcd_init_eeprom);
|
|
|
3359 |
END_MENU();
|
|
|
3360 |
}
|
|
|
3361 |
|
|
|
3362 |
#endif
|
|
|
3363 |
|
|
|
3364 |
void lcd_control_menu() {
|
|
|
3365 |
START_MENU();
|
|
|
3366 |
MENU_BACK(MSG_MAIN);
|
|
|
3367 |
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
|
|
|
3368 |
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
|
|
|
3369 |
|
|
|
3370 |
#if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
3371 |
MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_filament_menu);
|
|
|
3372 |
#elif ENABLED(LIN_ADVANCE)
|
|
|
3373 |
MENU_ITEM_EDIT(float52, MSG_ADVANCE_K, &planner.extruder_advance_K, 0, 999);
|
|
|
3374 |
#endif
|
|
|
3375 |
|
|
|
3376 |
#if HAS_LCD_CONTRAST
|
|
|
3377 |
MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, &lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true);
|
|
|
3378 |
#endif
|
|
|
3379 |
#if ENABLED(FWRETRACT)
|
|
|
3380 |
MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
|
|
|
3381 |
#endif
|
|
|
3382 |
#if ENABLED(DAC_STEPPER_CURRENT)
|
|
|
3383 |
MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_dac_menu);
|
|
|
3384 |
#endif
|
|
|
3385 |
#if HAS_MOTOR_CURRENT_PWM
|
|
|
3386 |
MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_pwm_menu);
|
|
|
3387 |
#endif
|
|
|
3388 |
|
|
|
3389 |
#if ENABLED(BLTOUCH)
|
|
|
3390 |
MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu);
|
|
|
3391 |
#endif
|
|
|
3392 |
|
|
|
3393 |
#if ENABLED(EEPROM_SETTINGS)
|
|
|
3394 |
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
|
|
|
3395 |
MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
|
|
|
3396 |
#endif
|
|
|
3397 |
|
|
|
3398 |
MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings);
|
|
|
3399 |
|
|
|
3400 |
#if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS)
|
|
|
3401 |
MENU_ITEM(submenu, MSG_INIT_EEPROM, lcd_init_eeprom_confirm);
|
|
|
3402 |
#endif
|
|
|
3403 |
|
|
|
3404 |
END_MENU();
|
|
|
3405 |
}
|
|
|
3406 |
|
|
|
3407 |
/**
|
|
|
3408 |
*
|
|
|
3409 |
* "Temperature" submenu
|
|
|
3410 |
*
|
|
|
3411 |
*/
|
|
|
3412 |
|
|
|
3413 |
#if ENABLED(PID_AUTOTUNE_MENU)
|
|
|
3414 |
|
|
|
3415 |
#if ENABLED(PIDTEMP)
|
|
|
3416 |
int16_t autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150);
|
|
|
3417 |
#endif
|
|
|
3418 |
|
|
|
3419 |
#if ENABLED(PIDTEMPBED)
|
|
|
3420 |
int16_t autotune_temp_bed = 70;
|
|
|
3421 |
#endif
|
|
|
3422 |
|
|
|
3423 |
void _lcd_autotune(int16_t e) {
|
|
|
3424 |
char cmd[30];
|
|
|
3425 |
sprintf_P(cmd, PSTR("M303 U1 E%i S%i"), e,
|
|
|
3426 |
#if HAS_PID_FOR_BOTH
|
|
|
3427 |
e < 0 ? autotune_temp_bed : autotune_temp[e]
|
|
|
3428 |
#elif ENABLED(PIDTEMPBED)
|
|
|
3429 |
autotune_temp_bed
|
|
|
3430 |
#else
|
|
|
3431 |
autotune_temp[e]
|
|
|
3432 |
#endif
|
|
|
3433 |
);
|
|
|
3434 |
lcd_enqueue_command(cmd);
|
|
|
3435 |
}
|
|
|
3436 |
|
|
|
3437 |
#endif // PID_AUTOTUNE_MENU
|
|
|
3438 |
|
|
|
3439 |
#if ENABLED(PIDTEMP)
|
|
|
3440 |
|
|
|
3441 |
// Helpers for editing PID Ki & Kd values
|
|
|
3442 |
// grab the PID value out of the temp variable; scale it; then update the PID driver
|
|
|
3443 |
void copy_and_scalePID_i(int16_t e) {
|
|
|
3444 |
#if DISABLED(PID_PARAMS_PER_HOTEND) || HOTENDS == 1
|
|
|
3445 |
UNUSED(e);
|
|
|
3446 |
#endif
|
|
|
3447 |
PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
|
|
|
3448 |
thermalManager.update_pid();
|
|
|
3449 |
}
|
|
|
3450 |
void copy_and_scalePID_d(int16_t e) {
|
|
|
3451 |
#if DISABLED(PID_PARAMS_PER_HOTEND) || HOTENDS == 1
|
|
|
3452 |
UNUSED(e);
|
|
|
3453 |
#endif
|
|
|
3454 |
PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
|
|
|
3455 |
thermalManager.update_pid();
|
|
|
3456 |
}
|
|
|
3457 |
#define _DEFINE_PIDTEMP_BASE_FUNCS(N) \
|
|
|
3458 |
void copy_and_scalePID_i_E ## N() { copy_and_scalePID_i(N); } \
|
|
|
3459 |
void copy_and_scalePID_d_E ## N() { copy_and_scalePID_d(N); }
|
|
|
3460 |
|
|
|
3461 |
#if ENABLED(PID_AUTOTUNE_MENU)
|
|
|
3462 |
#define DEFINE_PIDTEMP_FUNCS(N) \
|
|
|
3463 |
_DEFINE_PIDTEMP_BASE_FUNCS(N); \
|
|
|
3464 |
void lcd_autotune_callback_E ## N() { _lcd_autotune(N); } typedef void _pid_##N##_void
|
|
|
3465 |
#else
|
|
|
3466 |
#define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N) typedef void _pid_##N##_void
|
|
|
3467 |
#endif
|
|
|
3468 |
|
|
|
3469 |
DEFINE_PIDTEMP_FUNCS(0);
|
|
|
3470 |
#if ENABLED(PID_PARAMS_PER_HOTEND)
|
|
|
3471 |
#if HOTENDS > 1
|
|
|
3472 |
DEFINE_PIDTEMP_FUNCS(1);
|
|
|
3473 |
#if HOTENDS > 2
|
|
|
3474 |
DEFINE_PIDTEMP_FUNCS(2);
|
|
|
3475 |
#if HOTENDS > 3
|
|
|
3476 |
DEFINE_PIDTEMP_FUNCS(3);
|
|
|
3477 |
#if HOTENDS > 4
|
|
|
3478 |
DEFINE_PIDTEMP_FUNCS(4);
|
|
|
3479 |
#endif // HOTENDS > 4
|
|
|
3480 |
#endif // HOTENDS > 3
|
|
|
3481 |
#endif // HOTENDS > 2
|
|
|
3482 |
#endif // HOTENDS > 1
|
|
|
3483 |
#endif // PID_PARAMS_PER_HOTEND
|
|
|
3484 |
|
|
|
3485 |
#endif // PIDTEMP
|
|
|
3486 |
|
|
|
3487 |
/**
|
|
|
3488 |
*
|
|
|
3489 |
* "Control" > "Temperature" submenu
|
|
|
3490 |
*
|
|
|
3491 |
*/
|
|
|
3492 |
void lcd_control_temperature_menu() {
|
|
|
3493 |
START_MENU();
|
|
|
3494 |
|
|
|
3495 |
//
|
|
|
3496 |
// ^ Control
|
|
|
3497 |
//
|
|
|
3498 |
MENU_BACK(MSG_CONTROL);
|
|
|
3499 |
|
|
|
3500 |
//
|
|
|
3501 |
// Nozzle:
|
|
|
3502 |
// Nozzle [1-5]:
|
|
|
3503 |
//
|
|
|
3504 |
#if HOTENDS == 1
|
|
|
3505 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
|
|
|
3506 |
#else // HOTENDS > 1
|
|
|
3507 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
|
|
|
3508 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1);
|
|
|
3509 |
#if HOTENDS > 2
|
|
|
3510 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2);
|
|
|
3511 |
#if HOTENDS > 3
|
|
|
3512 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3);
|
|
|
3513 |
#if HOTENDS > 4
|
|
|
3514 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4);
|
|
|
3515 |
#endif // HOTENDS > 4
|
|
|
3516 |
#endif // HOTENDS > 3
|
|
|
3517 |
#endif // HOTENDS > 2
|
|
|
3518 |
#endif // HOTENDS > 1
|
|
|
3519 |
|
|
|
3520 |
//
|
|
|
3521 |
// Bed:
|
|
|
3522 |
//
|
|
|
3523 |
#if HAS_HEATED_BED
|
|
|
3524 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
|
|
|
3525 |
#endif
|
|
|
3526 |
|
|
|
3527 |
//
|
|
|
3528 |
// Fan Speed:
|
|
|
3529 |
//
|
|
|
3530 |
#if FAN_COUNT > 0
|
|
|
3531 |
#if HAS_FAN0
|
|
|
3532 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255);
|
|
|
3533 |
#if ENABLED(EXTRA_FAN_SPEED)
|
|
|
3534 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255);
|
|
|
3535 |
#endif
|
|
|
3536 |
#endif
|
|
|
3537 |
#if HAS_FAN1
|
|
|
3538 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255);
|
|
|
3539 |
#if ENABLED(EXTRA_FAN_SPEED)
|
|
|
3540 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 2", &new_fanSpeeds[1], 3, 255);
|
|
|
3541 |
#endif
|
|
|
3542 |
#endif
|
|
|
3543 |
#if HAS_FAN2
|
|
|
3544 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 3", &fanSpeeds[2], 0, 255);
|
|
|
3545 |
#if ENABLED(EXTRA_FAN_SPEED)
|
|
|
3546 |
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 3", &new_fanSpeeds[2], 3, 255);
|
|
|
3547 |
#endif
|
|
|
3548 |
#endif
|
|
|
3549 |
#endif // FAN_COUNT > 0
|
|
|
3550 |
|
|
|
3551 |
//
|
|
|
3552 |
// Autotemp, Min, Max, Fact
|
|
|
3553 |
//
|
|
|
3554 |
#if ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND
|
|
|
3555 |
MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &planner.autotemp_enabled);
|
|
|
3556 |
MENU_ITEM_EDIT(float3, MSG_MIN, &planner.autotemp_min, 0, float(HEATER_0_MAXTEMP) - 15);
|
|
|
3557 |
MENU_ITEM_EDIT(float3, MSG_MAX, &planner.autotemp_max, 0, float(HEATER_0_MAXTEMP) - 15);
|
|
|
3558 |
MENU_ITEM_EDIT(float52, MSG_FACTOR, &planner.autotemp_factor, 0, 10);
|
|
|
3559 |
#endif
|
|
|
3560 |
|
|
|
3561 |
//
|
|
|
3562 |
// PID-P, PID-I, PID-D, PID-C, PID Autotune
|
|
|
3563 |
// PID-P E1, PID-I E1, PID-D E1, PID-C E1, PID Autotune E1
|
|
|
3564 |
// PID-P E2, PID-I E2, PID-D E2, PID-C E2, PID Autotune E2
|
|
|
3565 |
// PID-P E3, PID-I E3, PID-D E3, PID-C E3, PID Autotune E3
|
|
|
3566 |
// PID-P E4, PID-I E4, PID-D E4, PID-C E4, PID Autotune E4
|
|
|
3567 |
// PID-P E5, PID-I E5, PID-D E5, PID-C E5, PID Autotune E5
|
|
|
3568 |
//
|
|
|
3569 |
#if ENABLED(PIDTEMP)
|
|
|
3570 |
|
|
|
3571 |
#define _PID_BASE_MENU_ITEMS(ELABEL, eindex) \
|
|
|
3572 |
raw_Ki = unscalePID_i(PID_PARAM(Ki, eindex)); \
|
|
|
3573 |
raw_Kd = unscalePID_d(PID_PARAM(Kd, eindex)); \
|
|
|
3574 |
MENU_ITEM_EDIT(float52sign, MSG_PID_P ELABEL, &PID_PARAM(Kp, eindex), 1, 9990); \
|
|
|
3575 |
MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_I ELABEL, &raw_Ki, 0.01f, 9990, copy_and_scalePID_i_E ## eindex); \
|
|
|
3576 |
MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex)
|
|
|
3577 |
|
|
|
3578 |
#if ENABLED(PID_EXTRUSION_SCALING)
|
|
|
3579 |
#define _PID_MENU_ITEMS(ELABEL, eindex) \
|
|
|
3580 |
_PID_BASE_MENU_ITEMS(ELABEL, eindex); \
|
|
|
3581 |
MENU_ITEM_EDIT(float3, MSG_PID_C ELABEL, &PID_PARAM(Kc, eindex), 1, 9990)
|
|
|
3582 |
#else
|
|
|
3583 |
#define _PID_MENU_ITEMS(ELABEL, eindex) _PID_BASE_MENU_ITEMS(ELABEL, eindex)
|
|
|
3584 |
#endif
|
|
|
3585 |
|
|
|
3586 |
#if ENABLED(PID_AUTOTUNE_MENU)
|
|
|
3587 |
#define PID_MENU_ITEMS(ELABEL, eindex) \
|
|
|
3588 |
_PID_MENU_ITEMS(ELABEL, eindex); \
|
|
|
3589 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PID_AUTOTUNE ELABEL, &autotune_temp[eindex], 150, heater_maxtemp[eindex] - 15, lcd_autotune_callback_E ## eindex)
|
|
|
3590 |
#else
|
|
|
3591 |
#define PID_MENU_ITEMS(ELABEL, eindex) _PID_MENU_ITEMS(ELABEL, eindex)
|
|
|
3592 |
#endif
|
|
|
3593 |
|
|
|
3594 |
#if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
|
|
|
3595 |
PID_MENU_ITEMS(" " MSG_E1, 0);
|
|
|
3596 |
PID_MENU_ITEMS(" " MSG_E2, 1);
|
|
|
3597 |
#if HOTENDS > 2
|
|
|
3598 |
PID_MENU_ITEMS(" " MSG_E3, 2);
|
|
|
3599 |
#if HOTENDS > 3
|
|
|
3600 |
PID_MENU_ITEMS(" " MSG_E4, 3);
|
|
|
3601 |
#if HOTENDS > 4
|
|
|
3602 |
PID_MENU_ITEMS(" " MSG_E5, 4);
|
|
|
3603 |
#endif // HOTENDS > 4
|
|
|
3604 |
#endif // HOTENDS > 3
|
|
|
3605 |
#endif // HOTENDS > 2
|
|
|
3606 |
#else // !PID_PARAMS_PER_HOTEND || HOTENDS == 1
|
|
|
3607 |
PID_MENU_ITEMS("", 0);
|
|
|
3608 |
#endif // !PID_PARAMS_PER_HOTEND || HOTENDS == 1
|
|
|
3609 |
|
|
|
3610 |
#endif // PIDTEMP
|
|
|
3611 |
|
|
|
3612 |
#if DISABLED(SLIM_LCD_MENUS)
|
|
|
3613 |
//
|
|
|
3614 |
// Preheat Material 1 conf
|
|
|
3615 |
//
|
|
|
3616 |
MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_control_temperature_preheat_material1_settings_menu);
|
|
|
3617 |
|
|
|
3618 |
//
|
|
|
3619 |
// Preheat Material 2 conf
|
|
|
3620 |
//
|
|
|
3621 |
MENU_ITEM(submenu, MSG_PREHEAT_2_SETTINGS, lcd_control_temperature_preheat_material2_settings_menu);
|
|
|
3622 |
#endif
|
|
|
3623 |
|
|
|
3624 |
END_MENU();
|
|
|
3625 |
}
|
|
|
3626 |
|
|
|
3627 |
#if DISABLED(SLIM_LCD_MENUS)
|
|
|
3628 |
|
|
|
3629 |
void _lcd_control_temperature_preheat_settings_menu(const uint8_t material) {
|
|
|
3630 |
#if HOTENDS > 4
|
|
|
3631 |
#define MINTEMP_ALL MIN5(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP, HEATER_4_MINTEMP)
|
|
|
3632 |
#define MAXTEMP_ALL MAX5(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP)
|
|
|
3633 |
#elif HOTENDS > 3
|
|
|
3634 |
#define MINTEMP_ALL MIN4(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP)
|
|
|
3635 |
#define MAXTEMP_ALL MAX4(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP)
|
|
|
3636 |
#elif HOTENDS > 2
|
|
|
3637 |
#define MINTEMP_ALL MIN3(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP)
|
|
|
3638 |
#define MAXTEMP_ALL MAX3(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP)
|
|
|
3639 |
#elif HOTENDS > 1
|
|
|
3640 |
#define MINTEMP_ALL MIN(HEATER_0_MINTEMP, HEATER_1_MINTEMP)
|
|
|
3641 |
#define MAXTEMP_ALL MAX(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP)
|
|
|
3642 |
#else
|
|
|
3643 |
#define MINTEMP_ALL HEATER_0_MINTEMP
|
|
|
3644 |
#define MAXTEMP_ALL HEATER_0_MAXTEMP
|
|
|
3645 |
#endif
|
|
|
3646 |
START_MENU();
|
|
|
3647 |
MENU_BACK(MSG_TEMPERATURE);
|
|
|
3648 |
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &lcd_preheat_fan_speed[material], 0, 255);
|
|
|
3649 |
#if HAS_TEMP_HOTEND
|
|
|
3650 |
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15);
|
|
|
3651 |
#endif
|
|
|
3652 |
#if HAS_HEATED_BED
|
|
|
3653 |
MENU_ITEM_EDIT(int3, MSG_BED, &lcd_preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15);
|
|
|
3654 |
#endif
|
|
|
3655 |
#if ENABLED(EEPROM_SETTINGS)
|
|
|
3656 |
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
|
|
|
3657 |
#endif
|
|
|
3658 |
END_MENU();
|
|
|
3659 |
}
|
|
|
3660 |
|
|
|
3661 |
/**
|
|
|
3662 |
*
|
|
|
3663 |
* "Temperature" > "Preheat Material 1 conf" submenu
|
|
|
3664 |
*
|
|
|
3665 |
*/
|
|
|
3666 |
void lcd_control_temperature_preheat_material1_settings_menu() { _lcd_control_temperature_preheat_settings_menu(0); }
|
|
|
3667 |
|
|
|
3668 |
/**
|
|
|
3669 |
*
|
|
|
3670 |
* "Temperature" > "Preheat Material 2 conf" submenu
|
|
|
3671 |
*
|
|
|
3672 |
*/
|
|
|
3673 |
void lcd_control_temperature_preheat_material2_settings_menu() { _lcd_control_temperature_preheat_settings_menu(1); }
|
|
|
3674 |
|
|
|
3675 |
void _reset_acceleration_rates() { planner.reset_acceleration_rates(); }
|
|
|
3676 |
#if ENABLED(DISTINCT_E_FACTORS)
|
|
|
3677 |
void _reset_e_acceleration_rate(const uint8_t e) { if (e == active_extruder) _reset_acceleration_rates(); }
|
|
|
3678 |
void _reset_e0_acceleration_rate() { _reset_e_acceleration_rate(0); }
|
|
|
3679 |
void _reset_e1_acceleration_rate() { _reset_e_acceleration_rate(1); }
|
|
|
3680 |
#if E_STEPPERS > 2
|
|
|
3681 |
void _reset_e2_acceleration_rate() { _reset_e_acceleration_rate(2); }
|
|
|
3682 |
#if E_STEPPERS > 3
|
|
|
3683 |
void _reset_e3_acceleration_rate() { _reset_e_acceleration_rate(3); }
|
|
|
3684 |
#if E_STEPPERS > 4
|
|
|
3685 |
void _reset_e4_acceleration_rate() { _reset_e_acceleration_rate(4); }
|
|
|
3686 |
#endif // E_STEPPERS > 4
|
|
|
3687 |
#endif // E_STEPPERS > 3
|
|
|
3688 |
#endif // E_STEPPERS > 2
|
|
|
3689 |
#endif
|
|
|
3690 |
|
|
|
3691 |
void _planner_refresh_positioning() { planner.refresh_positioning(); }
|
|
|
3692 |
#if ENABLED(DISTINCT_E_FACTORS)
|
|
|
3693 |
void _planner_refresh_e_positioning(const uint8_t e) {
|
|
|
3694 |
if (e == active_extruder)
|
|
|
3695 |
_planner_refresh_positioning();
|
|
|
3696 |
else
|
|
|
3697 |
planner.steps_to_mm[E_AXIS + e] = 1.0f / planner.axis_steps_per_mm[E_AXIS + e];
|
|
|
3698 |
}
|
|
|
3699 |
void _planner_refresh_e0_positioning() { _planner_refresh_e_positioning(0); }
|
|
|
3700 |
void _planner_refresh_e1_positioning() { _planner_refresh_e_positioning(1); }
|
|
|
3701 |
#if E_STEPPERS > 2
|
|
|
3702 |
void _planner_refresh_e2_positioning() { _planner_refresh_e_positioning(2); }
|
|
|
3703 |
#if E_STEPPERS > 3
|
|
|
3704 |
void _planner_refresh_e3_positioning() { _planner_refresh_e_positioning(3); }
|
|
|
3705 |
#if E_STEPPERS > 4
|
|
|
3706 |
void _planner_refresh_e4_positioning() { _planner_refresh_e_positioning(4); }
|
|
|
3707 |
#endif // E_STEPPERS > 4
|
|
|
3708 |
#endif // E_STEPPERS > 3
|
|
|
3709 |
#endif // E_STEPPERS > 2
|
|
|
3710 |
#endif
|
|
|
3711 |
|
|
|
3712 |
// M203 / M205 Velocity options
|
|
|
3713 |
void lcd_control_motion_velocity_menu() {
|
|
|
3714 |
START_MENU();
|
|
|
3715 |
MENU_BACK(MSG_MOTION);
|
|
|
3716 |
|
|
|
3717 |
// M203 Max Feedrate
|
|
|
3718 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_A, &planner.max_feedrate_mm_s[A_AXIS], 1, 999);
|
|
|
3719 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_B, &planner.max_feedrate_mm_s[B_AXIS], 1, 999);
|
|
|
3720 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_C, &planner.max_feedrate_mm_s[C_AXIS], 1, 999);
|
|
|
3721 |
|
|
|
3722 |
#if ENABLED(DISTINCT_E_FACTORS)
|
|
|
3723 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.max_feedrate_mm_s[E_AXIS + active_extruder], 1, 999);
|
|
|
3724 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E1, &planner.max_feedrate_mm_s[E_AXIS], 1, 999);
|
|
|
3725 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E2, &planner.max_feedrate_mm_s[E_AXIS + 1], 1, 999);
|
|
|
3726 |
#if E_STEPPERS > 2
|
|
|
3727 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E3, &planner.max_feedrate_mm_s[E_AXIS + 2], 1, 999);
|
|
|
3728 |
#if E_STEPPERS > 3
|
|
|
3729 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E4, &planner.max_feedrate_mm_s[E_AXIS + 3], 1, 999);
|
|
|
3730 |
#if E_STEPPERS > 4
|
|
|
3731 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E5, &planner.max_feedrate_mm_s[E_AXIS + 4], 1, 999);
|
|
|
3732 |
#endif // E_STEPPERS > 4
|
|
|
3733 |
#endif // E_STEPPERS > 3
|
|
|
3734 |
#endif // E_STEPPERS > 2
|
|
|
3735 |
#else
|
|
|
3736 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.max_feedrate_mm_s[E_AXIS], 1, 999);
|
|
|
3737 |
#endif
|
|
|
3738 |
|
|
|
3739 |
// M205 S Min Feedrate
|
|
|
3740 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMIN, &planner.min_feedrate_mm_s, 0, 999);
|
|
|
3741 |
|
|
|
3742 |
// M205 T Min Travel Feedrate
|
|
|
3743 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VTRAV_MIN, &planner.min_travel_feedrate_mm_s, 0, 999);
|
|
|
3744 |
|
|
|
3745 |
END_MENU();
|
|
|
3746 |
}
|
|
|
3747 |
|
|
|
3748 |
// M201 / M204 Accelerations
|
|
|
3749 |
void lcd_control_motion_acceleration_menu() {
|
|
|
3750 |
START_MENU();
|
|
|
3751 |
MENU_BACK(MSG_MOTION);
|
|
|
3752 |
|
|
|
3753 |
// M204 P Acceleration
|
|
|
3754 |
MENU_MULTIPLIER_ITEM_EDIT(float5, MSG_ACC, &planner.acceleration, 10, 99000);
|
|
|
3755 |
|
|
|
3756 |
// M204 R Retract Acceleration
|
|
|
3757 |
MENU_MULTIPLIER_ITEM_EDIT(float5, MSG_A_RETRACT, &planner.retract_acceleration, 100, 99000);
|
|
|
3758 |
|
|
|
3759 |
// M204 T Travel Acceleration
|
|
|
3760 |
MENU_MULTIPLIER_ITEM_EDIT(float5, MSG_A_TRAVEL, &planner.travel_acceleration, 100, 99000);
|
|
|
3761 |
|
|
|
3762 |
// M201 settings
|
|
|
3763 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_A, &planner.max_acceleration_mm_per_s2[A_AXIS], 100, 99000, _reset_acceleration_rates);
|
|
|
3764 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_B, &planner.max_acceleration_mm_per_s2[B_AXIS], 100, 99000, _reset_acceleration_rates);
|
|
|
3765 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_C, &planner.max_acceleration_mm_per_s2[C_AXIS], 10, 99000, _reset_acceleration_rates);
|
|
|
3766 |
|
|
|
3767 |
#if ENABLED(DISTINCT_E_FACTORS)
|
|
|
3768 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS + active_extruder], 100, 99000, _reset_acceleration_rates);
|
|
|
3769 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E1, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_e0_acceleration_rate);
|
|
|
3770 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E2, &planner.max_acceleration_mm_per_s2[E_AXIS + 1], 100, 99000, _reset_e1_acceleration_rate);
|
|
|
3771 |
#if E_STEPPERS > 2
|
|
|
3772 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E3, &planner.max_acceleration_mm_per_s2[E_AXIS + 2], 100, 99000, _reset_e2_acceleration_rate);
|
|
|
3773 |
#if E_STEPPERS > 3
|
|
|
3774 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E4, &planner.max_acceleration_mm_per_s2[E_AXIS + 3], 100, 99000, _reset_e3_acceleration_rate);
|
|
|
3775 |
#if E_STEPPERS > 4
|
|
|
3776 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E5, &planner.max_acceleration_mm_per_s2[E_AXIS + 4], 100, 99000, _reset_e4_acceleration_rate);
|
|
|
3777 |
#endif // E_STEPPERS > 4
|
|
|
3778 |
#endif // E_STEPPERS > 3
|
|
|
3779 |
#endif // E_STEPPERS > 2
|
|
|
3780 |
#else
|
|
|
3781 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_acceleration_rates);
|
|
|
3782 |
#endif
|
|
|
3783 |
|
|
|
3784 |
END_MENU();
|
|
|
3785 |
}
|
|
|
3786 |
|
|
|
3787 |
// M205 Jerk
|
|
|
3788 |
void lcd_control_motion_jerk_menu() {
|
|
|
3789 |
START_MENU();
|
|
|
3790 |
MENU_BACK(MSG_MOTION);
|
|
|
3791 |
|
|
|
3792 |
#if ENABLED(JUNCTION_DEVIATION)
|
|
|
3793 |
MENU_ITEM_EDIT_CALLBACK(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.01f, 0.3f, planner.recalculate_max_e_jerk);
|
|
|
3794 |
#else
|
|
|
3795 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VA_JERK, &planner.max_jerk[A_AXIS], 1, 990);
|
|
|
3796 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VB_JERK, &planner.max_jerk[B_AXIS], 1, 990);
|
|
|
3797 |
#if ENABLED(DELTA)
|
|
|
3798 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VC_JERK, &planner.max_jerk[C_AXIS], 1, 990);
|
|
|
3799 |
#else
|
|
|
3800 |
MENU_MULTIPLIER_ITEM_EDIT(float52sign, MSG_VC_JERK, &planner.max_jerk[C_AXIS], 0.1f, 990);
|
|
|
3801 |
#endif
|
|
|
3802 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VE_JERK, &planner.max_jerk[E_AXIS], 1, 990);
|
|
|
3803 |
#endif
|
|
|
3804 |
|
|
|
3805 |
END_MENU();
|
|
|
3806 |
}
|
|
|
3807 |
|
|
|
3808 |
// M92 Steps-per-mm
|
|
|
3809 |
void lcd_control_motion_steps_per_mm_menu() {
|
|
|
3810 |
START_MENU();
|
|
|
3811 |
MENU_BACK(MSG_MOTION);
|
|
|
3812 |
|
|
|
3813 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ASTEPS, &planner.axis_steps_per_mm[A_AXIS], 5, 9999, _planner_refresh_positioning);
|
|
|
3814 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_BSTEPS, &planner.axis_steps_per_mm[B_AXIS], 5, 9999, _planner_refresh_positioning);
|
|
|
3815 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_CSTEPS, &planner.axis_steps_per_mm[C_AXIS], 5, 9999, _planner_refresh_positioning);
|
|
|
3816 |
|
|
|
3817 |
#if ENABLED(DISTINCT_E_FACTORS)
|
|
|
3818 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS + active_extruder], 5, 9999, _planner_refresh_positioning);
|
|
|
3819 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E1STEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_e0_positioning);
|
|
|
3820 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E2STEPS, &planner.axis_steps_per_mm[E_AXIS + 1], 5, 9999, _planner_refresh_e1_positioning);
|
|
|
3821 |
#if E_STEPPERS > 2
|
|
|
3822 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E3STEPS, &planner.axis_steps_per_mm[E_AXIS + 2], 5, 9999, _planner_refresh_e2_positioning);
|
|
|
3823 |
#if E_STEPPERS > 3
|
|
|
3824 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E4STEPS, &planner.axis_steps_per_mm[E_AXIS + 3], 5, 9999, _planner_refresh_e3_positioning);
|
|
|
3825 |
#if E_STEPPERS > 4
|
|
|
3826 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E5STEPS, &planner.axis_steps_per_mm[E_AXIS + 4], 5, 9999, _planner_refresh_e4_positioning);
|
|
|
3827 |
#endif // E_STEPPERS > 4
|
|
|
3828 |
#endif // E_STEPPERS > 3
|
|
|
3829 |
#endif // E_STEPPERS > 2
|
|
|
3830 |
#else
|
|
|
3831 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning);
|
|
|
3832 |
#endif
|
|
|
3833 |
|
|
|
3834 |
END_MENU();
|
|
|
3835 |
}
|
|
|
3836 |
|
|
|
3837 |
#endif // !SLIM_LCD_MENUS
|
|
|
3838 |
|
|
|
3839 |
/**
|
|
|
3840 |
*
|
|
|
3841 |
* "Control" > "Motion" submenu
|
|
|
3842 |
*
|
|
|
3843 |
*/
|
|
|
3844 |
|
|
|
3845 |
void lcd_control_motion_menu() {
|
|
|
3846 |
START_MENU();
|
|
|
3847 |
MENU_BACK(MSG_CONTROL);
|
|
|
3848 |
|
|
|
3849 |
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
|
3850 |
MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
|
|
3851 |
#elif HAS_BED_PROBE
|
|
|
3852 |
MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
|
|
3853 |
#endif
|
|
|
3854 |
|
|
|
3855 |
#if DISABLED(SLIM_LCD_MENUS)
|
|
|
3856 |
|
|
|
3857 |
// M203 / M205 - Feedrate items
|
|
|
3858 |
MENU_ITEM(submenu, MSG_VELOCITY, lcd_control_motion_velocity_menu);
|
|
|
3859 |
|
|
|
3860 |
// M201 - Acceleration items
|
|
|
3861 |
MENU_ITEM(submenu, MSG_ACCELERATION, lcd_control_motion_acceleration_menu);
|
|
|
3862 |
|
|
|
3863 |
// M205 - Max Jerk
|
|
|
3864 |
MENU_ITEM(submenu, MSG_JERK, lcd_control_motion_jerk_menu);
|
|
|
3865 |
|
|
|
3866 |
// M92 - Steps Per mm
|
|
|
3867 |
MENU_ITEM(submenu, MSG_STEPS_PER_MM, lcd_control_motion_steps_per_mm_menu);
|
|
|
3868 |
|
|
|
3869 |
#endif // !SLIM_LCD_MENUS
|
|
|
3870 |
|
|
|
3871 |
// M540 S - Abort on endstop hit when SD printing
|
|
|
3872 |
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
|
|
3873 |
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &planner.abort_on_endstop_hit);
|
|
|
3874 |
#endif
|
|
|
3875 |
|
|
|
3876 |
END_MENU();
|
|
|
3877 |
}
|
|
|
3878 |
|
|
|
3879 |
#if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
3880 |
/**
|
|
|
3881 |
*
|
|
|
3882 |
* "Control" > "Filament" submenu
|
|
|
3883 |
*
|
|
|
3884 |
*/
|
|
|
3885 |
void lcd_control_filament_menu() {
|
|
|
3886 |
START_MENU();
|
|
|
3887 |
MENU_BACK(MSG_CONTROL);
|
|
|
3888 |
|
|
|
3889 |
#if ENABLED(LIN_ADVANCE)
|
|
|
3890 |
MENU_ITEM_EDIT(float52, MSG_ADVANCE_K, &planner.extruder_advance_K, 0, 999);
|
|
|
3891 |
#endif
|
|
|
3892 |
|
|
|
3893 |
#if DISABLED(NO_VOLUMETRICS)
|
|
|
3894 |
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers);
|
|
|
3895 |
|
|
|
3896 |
if (parser.volumetric_enabled) {
|
|
|
3897 |
#if EXTRUDERS == 1
|
|
|
3898 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM, &planner.filament_size[0], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
|
|
|
3899 |
#else // EXTRUDERS > 1
|
|
|
3900 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM, &planner.filament_size[active_extruder], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
|
|
|
3901 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E1, &planner.filament_size[0], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
|
|
|
3902 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E2, &planner.filament_size[1], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
|
|
|
3903 |
#if EXTRUDERS > 2
|
|
|
3904 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E3, &planner.filament_size[2], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
|
|
|
3905 |
#if EXTRUDERS > 3
|
|
|
3906 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E4, &planner.filament_size[3], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
|
|
|
3907 |
#if EXTRUDERS > 4
|
|
|
3908 |
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E5, &planner.filament_size[4], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
|
|
|
3909 |
#endif // EXTRUDERS > 4
|
|
|
3910 |
#endif // EXTRUDERS > 3
|
|
|
3911 |
#endif // EXTRUDERS > 2
|
|
|
3912 |
#endif // EXTRUDERS > 1
|
|
|
3913 |
}
|
|
|
3914 |
#endif
|
|
|
3915 |
|
|
|
3916 |
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
3917 |
const float extrude_maxlength =
|
|
|
3918 |
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
|
|
3919 |
EXTRUDE_MAXLENGTH
|
|
|
3920 |
#else
|
|
|
3921 |
999
|
|
|
3922 |
#endif
|
|
|
3923 |
;
|
|
|
3924 |
|
|
|
3925 |
#if EXTRUDERS == 1
|
|
|
3926 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD, &filament_change_unload_length[0], 0, extrude_maxlength);
|
|
|
3927 |
#else // EXTRUDERS > 1
|
|
|
3928 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD, &filament_change_unload_length[active_extruder], 0, extrude_maxlength);
|
|
|
3929 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E1, &filament_change_unload_length[0], 0, extrude_maxlength);
|
|
|
3930 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E2, &filament_change_unload_length[1], 0, extrude_maxlength);
|
|
|
3931 |
#if EXTRUDERS > 2
|
|
|
3932 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E3, &filament_change_unload_length[2], 0, extrude_maxlength);
|
|
|
3933 |
#if EXTRUDERS > 3
|
|
|
3934 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E4, &filament_change_unload_length[3], 0, extrude_maxlength);
|
|
|
3935 |
#if EXTRUDERS > 4
|
|
|
3936 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E5, &filament_change_unload_length[4], 0, extrude_maxlength);
|
|
|
3937 |
#endif // EXTRUDERS > 4
|
|
|
3938 |
#endif // EXTRUDERS > 3
|
|
|
3939 |
#endif // EXTRUDERS > 2
|
|
|
3940 |
#endif // EXTRUDERS > 1
|
|
|
3941 |
|
|
|
3942 |
#if EXTRUDERS == 1
|
|
|
3943 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD, &filament_change_load_length[0], 0, extrude_maxlength);
|
|
|
3944 |
#else // EXTRUDERS > 1
|
|
|
3945 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD, &filament_change_load_length[active_extruder], 0, extrude_maxlength);
|
|
|
3946 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E1, &filament_change_load_length[0], 0, extrude_maxlength);
|
|
|
3947 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E2, &filament_change_load_length[1], 0, extrude_maxlength);
|
|
|
3948 |
#if EXTRUDERS > 2
|
|
|
3949 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E3, &filament_change_load_length[2], 0, extrude_maxlength);
|
|
|
3950 |
#if EXTRUDERS > 3
|
|
|
3951 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E4, &filament_change_load_length[3], 0, extrude_maxlength);
|
|
|
3952 |
#if EXTRUDERS > 4
|
|
|
3953 |
MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E5, &filament_change_load_length[4], 0, extrude_maxlength);
|
|
|
3954 |
#endif // EXTRUDERS > 4
|
|
|
3955 |
#endif // EXTRUDERS > 3
|
|
|
3956 |
#endif // EXTRUDERS > 2
|
|
|
3957 |
#endif // EXTRUDERS > 1
|
|
|
3958 |
#endif
|
|
|
3959 |
|
|
|
3960 |
END_MENU();
|
|
|
3961 |
}
|
|
|
3962 |
#endif // !NO_VOLUMETRICS || ADVANCED_PAUSE_FEATURE
|
|
|
3963 |
|
|
|
3964 |
/**
|
|
|
3965 |
*
|
|
|
3966 |
* "Control" > "Retract" submenu
|
|
|
3967 |
*
|
|
|
3968 |
*/
|
|
|
3969 |
#if ENABLED(FWRETRACT)
|
|
|
3970 |
|
|
|
3971 |
void lcd_control_retract_menu() {
|
|
|
3972 |
START_MENU();
|
|
|
3973 |
MENU_BACK(MSG_CONTROL);
|
|
|
3974 |
MENU_ITEM_EDIT_CALLBACK(bool, MSG_AUTORETRACT, &fwretract.autoretract_enabled, fwretract.refresh_autoretract);
|
|
|
3975 |
MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT, &fwretract.retract_length, 0, 100);
|
|
|
3976 |
#if EXTRUDERS > 1
|
|
|
3977 |
MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_SWAP, &fwretract.swap_retract_length, 0, 100);
|
|
|
3978 |
#endif
|
|
|
3979 |
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &fwretract.retract_feedrate_mm_s, 1, 999);
|
|
|
3980 |
MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_ZLIFT, &fwretract.retract_zlift, 0, 999);
|
|
|
3981 |
MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_RECOVER, &fwretract.retract_recover_length, -100, 100);
|
|
|
3982 |
#if EXTRUDERS > 1
|
|
|
3983 |
MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_RECOVER_SWAP, &fwretract.swap_retract_recover_length, -100, 100);
|
|
|
3984 |
#endif
|
|
|
3985 |
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &fwretract.retract_recover_feedrate_mm_s, 1, 999);
|
|
|
3986 |
#if EXTRUDERS > 1
|
|
|
3987 |
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVER_SWAPF, &fwretract.swap_retract_recover_feedrate_mm_s, 1, 999);
|
|
|
3988 |
#endif
|
|
|
3989 |
END_MENU();
|
|
|
3990 |
}
|
|
|
3991 |
|
|
|
3992 |
#endif // FWRETRACT
|
|
|
3993 |
|
|
|
3994 |
#if ENABLED(SDSUPPORT)
|
|
|
3995 |
|
|
|
3996 |
#if !PIN_EXISTS(SD_DETECT)
|
|
|
3997 |
void lcd_sd_refresh() {
|
|
|
3998 |
card.initsd();
|
|
|
3999 |
encoderTopLine = 0;
|
|
|
4000 |
}
|
|
|
4001 |
#endif
|
|
|
4002 |
|
|
|
4003 |
void lcd_sd_updir() {
|
|
|
4004 |
encoderPosition = card.updir() ? ENCODER_STEPS_PER_MENU_ITEM : 0;
|
|
|
4005 |
encoderTopLine = 0;
|
|
|
4006 |
screen_changed = true;
|
|
|
4007 |
lcd_refresh();
|
|
|
4008 |
}
|
|
|
4009 |
|
|
|
4010 |
/**
|
|
|
4011 |
*
|
|
|
4012 |
* "Print from SD" submenu
|
|
|
4013 |
*
|
|
|
4014 |
*/
|
|
|
4015 |
|
|
|
4016 |
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
|
|
4017 |
uint32_t last_sdfile_encoderPosition = 0xFFFF;
|
|
|
4018 |
|
|
|
4019 |
void lcd_reselect_last_file() {
|
|
|
4020 |
if (last_sdfile_encoderPosition == 0xFFFF) return;
|
|
|
4021 |
#if ENABLED(DOGLCD)
|
|
|
4022 |
// Some of this is a hack to force the screen update to work.
|
|
|
4023 |
// TODO: Fix the real issue that causes this!
|
|
|
4024 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
4025 |
_lcd_synchronize();
|
|
|
4026 |
safe_delay(50);
|
|
|
4027 |
_lcd_synchronize();
|
|
|
4028 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
4029 |
drawing_screen = screen_changed = true;
|
|
|
4030 |
#endif
|
|
|
4031 |
|
|
|
4032 |
lcd_goto_screen(lcd_sdcard_menu, last_sdfile_encoderPosition);
|
|
|
4033 |
defer_return_to_status = true;
|
|
|
4034 |
last_sdfile_encoderPosition = 0xFFFF;
|
|
|
4035 |
|
|
|
4036 |
#if ENABLED(DOGLCD)
|
|
|
4037 |
lcd_update();
|
|
|
4038 |
#endif
|
|
|
4039 |
}
|
|
|
4040 |
#endif
|
|
|
4041 |
|
|
|
4042 |
void lcd_sdcard_menu() {
|
|
|
4043 |
ENCODER_DIRECTION_MENUS();
|
|
|
4044 |
|
|
|
4045 |
const uint16_t fileCnt = card.get_num_Files();
|
|
|
4046 |
|
|
|
4047 |
START_MENU();
|
|
|
4048 |
MENU_BACK(MSG_MAIN);
|
|
|
4049 |
card.getWorkDirName();
|
|
|
4050 |
if (card.filename[0] == '/') {
|
|
|
4051 |
#if !PIN_EXISTS(SD_DETECT)
|
|
|
4052 |
MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
|
|
|
4053 |
#endif
|
|
|
4054 |
}
|
|
|
4055 |
else {
|
|
|
4056 |
MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
|
|
|
4057 |
}
|
|
|
4058 |
|
|
|
4059 |
for (uint16_t i = 0; i < fileCnt; i++) {
|
|
|
4060 |
if (_menuLineNr == _thisItemNr) {
|
|
|
4061 |
const uint16_t nr =
|
|
|
4062 |
#if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA)
|
|
|
4063 |
fileCnt - 1 -
|
|
|
4064 |
#endif
|
|
|
4065 |
i;
|
|
|
4066 |
|
|
|
4067 |
#if ENABLED(SDCARD_SORT_ALPHA)
|
|
|
4068 |
card.getfilename_sorted(nr);
|
|
|
4069 |
#else
|
|
|
4070 |
card.getfilename(nr);
|
|
|
4071 |
#endif
|
|
|
4072 |
|
|
|
4073 |
if (card.filenameIsDir)
|
|
|
4074 |
MENU_ITEM(sddirectory, MSG_CARD_MENU, card);
|
|
|
4075 |
else
|
|
|
4076 |
MENU_ITEM(sdfile, MSG_CARD_MENU, card);
|
|
|
4077 |
}
|
|
|
4078 |
else {
|
|
|
4079 |
MENU_ITEM_DUMMY();
|
|
|
4080 |
}
|
|
|
4081 |
}
|
|
|
4082 |
END_MENU();
|
|
|
4083 |
}
|
|
|
4084 |
|
|
|
4085 |
#endif // SDSUPPORT
|
|
|
4086 |
|
|
|
4087 |
#if ENABLED(LCD_INFO_MENU)
|
|
|
4088 |
|
|
|
4089 |
#if ENABLED(PRINTCOUNTER)
|
|
|
4090 |
/**
|
|
|
4091 |
*
|
|
|
4092 |
* About Printer > Statistics submenu
|
|
|
4093 |
*
|
|
|
4094 |
*/
|
|
|
4095 |
void lcd_info_stats_menu() {
|
|
|
4096 |
if (use_click()) { return lcd_goto_previous_menu(); }
|
|
|
4097 |
|
|
|
4098 |
char buffer[21];
|
|
|
4099 |
printStatistics stats = print_job_timer.getStats();
|
|
|
4100 |
|
|
|
4101 |
START_SCREEN(); // 12345678901234567890
|
|
|
4102 |
STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints)); // Print Count: 999
|
|
|
4103 |
STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, itostr3left(stats.finishedPrints)); // Completed : 666
|
|
|
4104 |
|
|
|
4105 |
duration_t elapsed = stats.printTime;
|
|
|
4106 |
elapsed.toString(buffer);
|
|
|
4107 |
|
|
|
4108 |
STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false); // Total print Time:
|
|
|
4109 |
STATIC_ITEM("", false, false, buffer); // 99y 364d 23h 59m 59s
|
|
|
4110 |
|
|
|
4111 |
elapsed = stats.longestPrint;
|
|
|
4112 |
elapsed.toString(buffer);
|
|
|
4113 |
|
|
|
4114 |
STATIC_ITEM(MSG_INFO_PRINT_LONGEST ": ", false, false); // Longest job time:
|
|
|
4115 |
STATIC_ITEM("", false, false, buffer); // 99y 364d 23h 59m 59s
|
|
|
4116 |
|
|
|
4117 |
sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10);
|
|
|
4118 |
STATIC_ITEM(MSG_INFO_PRINT_FILAMENT ": ", false, false); // Extruded total:
|
|
|
4119 |
STATIC_ITEM("", false, false, buffer); // 125m
|
|
|
4120 |
END_SCREEN();
|
|
|
4121 |
}
|
|
|
4122 |
#endif // PRINTCOUNTER
|
|
|
4123 |
|
|
|
4124 |
/**
|
|
|
4125 |
*
|
|
|
4126 |
* About Printer > Thermistors
|
|
|
4127 |
*
|
|
|
4128 |
*/
|
|
|
4129 |
void lcd_info_thermistors_menu() {
|
|
|
4130 |
if (use_click()) { return lcd_goto_previous_menu(); }
|
|
|
4131 |
START_SCREEN();
|
|
|
4132 |
#define THERMISTOR_ID TEMP_SENSOR_0
|
|
|
4133 |
#include "thermistornames.h"
|
|
|
4134 |
STATIC_ITEM("T0: " THERMISTOR_NAME, false, true);
|
|
|
4135 |
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_0_MINTEMP), false);
|
|
|
4136 |
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_0_MAXTEMP), false);
|
|
|
4137 |
|
|
|
4138 |
#if TEMP_SENSOR_1 != 0
|
|
|
4139 |
#undef THERMISTOR_ID
|
|
|
4140 |
#define THERMISTOR_ID TEMP_SENSOR_1
|
|
|
4141 |
#include "thermistornames.h"
|
|
|
4142 |
STATIC_ITEM("T1: " THERMISTOR_NAME, false, true);
|
|
|
4143 |
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_1_MINTEMP), false);
|
|
|
4144 |
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_1_MAXTEMP), false);
|
|
|
4145 |
#endif
|
|
|
4146 |
|
|
|
4147 |
#if TEMP_SENSOR_2 != 0
|
|
|
4148 |
#undef THERMISTOR_ID
|
|
|
4149 |
#define THERMISTOR_ID TEMP_SENSOR_2
|
|
|
4150 |
#include "thermistornames.h"
|
|
|
4151 |
STATIC_ITEM("T2: " THERMISTOR_NAME, false, true);
|
|
|
4152 |
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_2_MINTEMP), false);
|
|
|
4153 |
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_2_MAXTEMP), false);
|
|
|
4154 |
#endif
|
|
|
4155 |
|
|
|
4156 |
#if TEMP_SENSOR_3 != 0
|
|
|
4157 |
#undef THERMISTOR_ID
|
|
|
4158 |
#define THERMISTOR_ID TEMP_SENSOR_3
|
|
|
4159 |
#include "thermistornames.h"
|
|
|
4160 |
STATIC_ITEM("T3: " THERMISTOR_NAME, false, true);
|
|
|
4161 |
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_3_MINTEMP), false);
|
|
|
4162 |
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP), false);
|
|
|
4163 |
#endif
|
|
|
4164 |
|
|
|
4165 |
#if TEMP_SENSOR_4 != 0
|
|
|
4166 |
#undef THERMISTOR_ID
|
|
|
4167 |
#define THERMISTOR_ID TEMP_SENSOR_4
|
|
|
4168 |
#include "thermistornames.h"
|
|
|
4169 |
STATIC_ITEM("T4: " THERMISTOR_NAME, false, true);
|
|
|
4170 |
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_4_MINTEMP), false);
|
|
|
4171 |
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_4_MAXTEMP), false);
|
|
|
4172 |
#endif
|
|
|
4173 |
|
|
|
4174 |
#if HAS_HEATED_BED
|
|
|
4175 |
#undef THERMISTOR_ID
|
|
|
4176 |
#define THERMISTOR_ID TEMP_SENSOR_BED
|
|
|
4177 |
#include "thermistornames.h"
|
|
|
4178 |
STATIC_ITEM("TBed:" THERMISTOR_NAME, false, true);
|
|
|
4179 |
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(BED_MINTEMP), false);
|
|
|
4180 |
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(BED_MAXTEMP), false);
|
|
|
4181 |
#endif
|
|
|
4182 |
END_SCREEN();
|
|
|
4183 |
}
|
|
|
4184 |
|
|
|
4185 |
/**
|
|
|
4186 |
*
|
|
|
4187 |
* About Printer > Board Info
|
|
|
4188 |
*
|
|
|
4189 |
*/
|
|
|
4190 |
void lcd_info_board_menu() {
|
|
|
4191 |
if (use_click()) { return lcd_goto_previous_menu(); }
|
|
|
4192 |
START_SCREEN();
|
|
|
4193 |
STATIC_ITEM(BOARD_NAME, true, true); // MyPrinterController
|
|
|
4194 |
STATIC_ITEM(MSG_INFO_BAUDRATE ": " STRINGIFY(BAUDRATE), true); // Baud: 250000
|
|
|
4195 |
STATIC_ITEM(MSG_INFO_PROTOCOL ": " PROTOCOL_VERSION, true); // Protocol: 1.0
|
|
|
4196 |
#if POWER_SUPPLY == 0
|
|
|
4197 |
STATIC_ITEM(MSG_INFO_PSU ": Generic", true);
|
|
|
4198 |
#elif POWER_SUPPLY == 1
|
|
|
4199 |
STATIC_ITEM(MSG_INFO_PSU ": ATX", true); // Power Supply: ATX
|
|
|
4200 |
#elif POWER_SUPPLY == 2
|
|
|
4201 |
STATIC_ITEM(MSG_INFO_PSU ": XBox", true); // Power Supply: XBox
|
|
|
4202 |
#endif
|
|
|
4203 |
END_SCREEN();
|
|
|
4204 |
}
|
|
|
4205 |
|
|
|
4206 |
/**
|
|
|
4207 |
*
|
|
|
4208 |
* About Printer > Printer Info
|
|
|
4209 |
*
|
|
|
4210 |
*/
|
|
|
4211 |
void lcd_info_printer_menu() {
|
|
|
4212 |
if (use_click()) { return lcd_goto_previous_menu(); }
|
|
|
4213 |
START_SCREEN();
|
|
|
4214 |
STATIC_ITEM(MSG_MARLIN, true, true); // Marlin
|
|
|
4215 |
STATIC_ITEM(SHORT_BUILD_VERSION, true); // x.x.x-Branch
|
|
|
4216 |
STATIC_ITEM(STRING_DISTRIBUTION_DATE, true); // YYYY-MM-DD HH:MM
|
|
|
4217 |
STATIC_ITEM(MACHINE_NAME, true); // My3DPrinter
|
|
|
4218 |
STATIC_ITEM(WEBSITE_URL, true); // www.my3dprinter.com
|
|
|
4219 |
STATIC_ITEM(MSG_INFO_EXTRUDERS ": " STRINGIFY(EXTRUDERS), true); // Extruders: 2
|
|
|
4220 |
#if ENABLED(AUTO_BED_LEVELING_3POINT)
|
|
|
4221 |
STATIC_ITEM(MSG_3POINT_LEVELING, true); // 3-Point Leveling
|
|
|
4222 |
#elif ENABLED(AUTO_BED_LEVELING_LINEAR)
|
|
|
4223 |
STATIC_ITEM(MSG_LINEAR_LEVELING, true); // Linear Leveling
|
|
|
4224 |
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
|
4225 |
STATIC_ITEM(MSG_BILINEAR_LEVELING, true); // Bi-linear Leveling
|
|
|
4226 |
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
4227 |
STATIC_ITEM(MSG_UBL_LEVELING, true); // Unified Bed Leveling
|
|
|
4228 |
#elif ENABLED(MESH_BED_LEVELING)
|
|
|
4229 |
STATIC_ITEM(MSG_MESH_LEVELING, true); // Mesh Leveling
|
|
|
4230 |
#endif
|
|
|
4231 |
END_SCREEN();
|
|
|
4232 |
}
|
|
|
4233 |
|
|
|
4234 |
/**
|
|
|
4235 |
*
|
|
|
4236 |
* "About Printer" submenu
|
|
|
4237 |
*
|
|
|
4238 |
*/
|
|
|
4239 |
void lcd_info_menu() {
|
|
|
4240 |
START_MENU();
|
|
|
4241 |
MENU_BACK(MSG_MAIN);
|
|
|
4242 |
MENU_ITEM(submenu, MSG_INFO_PRINTER_MENU, lcd_info_printer_menu); // Printer Info >
|
|
|
4243 |
MENU_ITEM(submenu, MSG_INFO_BOARD_MENU, lcd_info_board_menu); // Board Info >
|
|
|
4244 |
MENU_ITEM(submenu, MSG_INFO_THERMISTOR_MENU, lcd_info_thermistors_menu); // Thermistors >
|
|
|
4245 |
#if ENABLED(PRINTCOUNTER)
|
|
|
4246 |
MENU_ITEM(submenu, MSG_INFO_STATS_MENU, lcd_info_stats_menu); // Printer Statistics >
|
|
|
4247 |
#endif
|
|
|
4248 |
END_MENU();
|
|
|
4249 |
}
|
|
|
4250 |
#endif // LCD_INFO_MENU
|
|
|
4251 |
|
|
|
4252 |
/**
|
|
|
4253 |
*
|
|
|
4254 |
* LED Menu
|
|
|
4255 |
*
|
|
|
4256 |
*/
|
|
|
4257 |
|
|
|
4258 |
#if ENABLED(LED_CONTROL_MENU)
|
|
|
4259 |
|
|
|
4260 |
#if ENABLED(LED_COLOR_PRESETS)
|
|
|
4261 |
|
|
|
4262 |
void lcd_led_presets_menu() {
|
|
|
4263 |
START_MENU();
|
|
|
4264 |
#if LCD_HEIGHT > 2
|
|
|
4265 |
STATIC_ITEM(MSG_LED_PRESETS, true, true);
|
|
|
4266 |
#endif
|
|
|
4267 |
MENU_BACK(MSG_LED_CONTROL);
|
|
|
4268 |
MENU_ITEM(function, MSG_SET_LEDS_WHITE, leds.set_white);
|
|
|
4269 |
MENU_ITEM(function, MSG_SET_LEDS_RED, leds.set_red);
|
|
|
4270 |
MENU_ITEM(function, MSG_SET_LEDS_ORANGE, leds.set_orange);
|
|
|
4271 |
MENU_ITEM(function, MSG_SET_LEDS_YELLOW,leds.set_yellow);
|
|
|
4272 |
MENU_ITEM(function, MSG_SET_LEDS_GREEN, leds.set_green);
|
|
|
4273 |
MENU_ITEM(function, MSG_SET_LEDS_BLUE, leds.set_blue);
|
|
|
4274 |
MENU_ITEM(function, MSG_SET_LEDS_INDIGO, leds.set_indigo);
|
|
|
4275 |
MENU_ITEM(function, MSG_SET_LEDS_VIOLET, leds.set_violet);
|
|
|
4276 |
END_MENU();
|
|
|
4277 |
}
|
|
|
4278 |
#endif // LED_COLOR_PRESETS
|
|
|
4279 |
|
|
|
4280 |
void lcd_led_custom_menu() {
|
|
|
4281 |
START_MENU();
|
|
|
4282 |
MENU_BACK(MSG_LED_CONTROL);
|
|
|
4283 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true);
|
|
|
4284 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true);
|
|
|
4285 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true);
|
|
|
4286 |
#if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED)
|
|
|
4287 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true);
|
|
|
4288 |
#if ENABLED(NEOPIXEL_LED)
|
|
|
4289 |
MENU_ITEM_EDIT_CALLBACK(int8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true);
|
|
|
4290 |
#endif
|
|
|
4291 |
#endif
|
|
|
4292 |
END_MENU();
|
|
|
4293 |
}
|
|
|
4294 |
|
|
|
4295 |
void lcd_led_menu() {
|
|
|
4296 |
START_MENU();
|
|
|
4297 |
MENU_BACK(MSG_MAIN);
|
|
|
4298 |
bool led_on = leds.lights_on;
|
|
|
4299 |
MENU_ITEM_EDIT_CALLBACK(bool, MSG_LEDS, &led_on, leds.toggle);
|
|
|
4300 |
MENU_ITEM(function, MSG_SET_LEDS_DEFAULT, leds.set_default);
|
|
|
4301 |
#if ENABLED(LED_COLOR_PRESETS)
|
|
|
4302 |
MENU_ITEM(submenu, MSG_LED_PRESETS, lcd_led_presets_menu);
|
|
|
4303 |
#endif
|
|
|
4304 |
MENU_ITEM(submenu, MSG_CUSTOM_LEDS, lcd_led_custom_menu);
|
|
|
4305 |
END_MENU();
|
|
|
4306 |
}
|
|
|
4307 |
|
|
|
4308 |
#endif // LED_CONTROL_MENU
|
|
|
4309 |
|
|
|
4310 |
/**
|
|
|
4311 |
*
|
|
|
4312 |
* Filament Change Feature Screens
|
|
|
4313 |
*
|
|
|
4314 |
*/
|
|
|
4315 |
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
4316 |
|
|
|
4317 |
/**
|
|
|
4318 |
*
|
|
|
4319 |
* "Change Filament" > "Change/Unload/Load Filament" submenu
|
|
|
4320 |
*
|
|
|
4321 |
*/
|
|
|
4322 |
static AdvancedPauseMode _change_filament_temp_mode;
|
|
|
4323 |
static int8_t _change_filament_temp_extruder;
|
|
|
4324 |
|
|
|
4325 |
static const char* _change_filament_temp_command() {
|
|
|
4326 |
switch (_change_filament_temp_mode) {
|
|
|
4327 |
case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
|
|
|
4328 |
return PSTR("M701 T%d");
|
|
|
4329 |
case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT:
|
|
|
4330 |
return _change_filament_temp_extruder >= 0 ? PSTR("M702 T%d") : PSTR("M702 ;%d");
|
|
|
4331 |
case ADVANCED_PAUSE_MODE_PAUSE_PRINT:
|
|
|
4332 |
default:
|
|
|
4333 |
return PSTR("M600 B0 T%d");
|
|
|
4334 |
}
|
|
|
4335 |
return PSTR(MSG_FILAMENTCHANGE);
|
|
|
4336 |
}
|
|
|
4337 |
|
|
|
4338 |
void _change_filament_temp(const uint8_t index) {
|
|
|
4339 |
char cmd[11];
|
|
|
4340 |
sprintf_P(cmd, _change_filament_temp_command(), _change_filament_temp_extruder);
|
|
|
4341 |
thermalManager.setTargetHotend(index == 1 ? PREHEAT_1_TEMP_HOTEND : PREHEAT_2_TEMP_HOTEND, _change_filament_temp_extruder);
|
|
|
4342 |
lcd_enqueue_command(cmd);
|
|
|
4343 |
}
|
|
|
4344 |
void _lcd_change_filament_temp_1_menu() { _change_filament_temp(1); }
|
|
|
4345 |
void _lcd_change_filament_temp_2_menu() { _change_filament_temp(2); }
|
|
|
4346 |
|
|
|
4347 |
static const char* change_filament_header(const AdvancedPauseMode mode) {
|
|
|
4348 |
switch (mode) {
|
|
|
4349 |
case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
|
|
|
4350 |
return PSTR(MSG_FILAMENTLOAD);
|
|
|
4351 |
case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT:
|
|
|
4352 |
return PSTR(MSG_FILAMENTUNLOAD);
|
|
|
4353 |
default: break;
|
|
|
4354 |
}
|
|
|
4355 |
return PSTR(MSG_FILAMENTCHANGE);
|
|
|
4356 |
}
|
|
|
4357 |
|
|
|
4358 |
void _lcd_temp_menu_filament_op(const AdvancedPauseMode mode, const int8_t extruder) {
|
|
|
4359 |
_change_filament_temp_mode = mode;
|
|
|
4360 |
_change_filament_temp_extruder = extruder;
|
|
|
4361 |
START_MENU();
|
|
|
4362 |
if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), true, true);
|
|
|
4363 |
MENU_BACK(MSG_FILAMENTCHANGE);
|
|
|
4364 |
MENU_ITEM(submenu, MSG_PREHEAT_1, _lcd_change_filament_temp_1_menu);
|
|
|
4365 |
MENU_ITEM(submenu, MSG_PREHEAT_2, _lcd_change_filament_temp_2_menu);
|
|
|
4366 |
END_MENU();
|
|
|
4367 |
}
|
|
|
4368 |
void lcd_temp_menu_e0_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 0); }
|
|
|
4369 |
void lcd_temp_menu_e0_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 0); }
|
|
|
4370 |
void lcd_temp_menu_e0_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 0); }
|
|
|
4371 |
#if E_STEPPERS > 1
|
|
|
4372 |
void lcd_temp_menu_e1_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 1); }
|
|
|
4373 |
void lcd_temp_menu_e1_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 1); }
|
|
|
4374 |
void lcd_temp_menu_e1_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 1); }
|
|
|
4375 |
#if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
|
|
|
4376 |
void lcd_unload_filament_all_temp_menu() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, -1); }
|
|
|
4377 |
#endif
|
|
|
4378 |
#if E_STEPPERS > 2
|
|
|
4379 |
void lcd_temp_menu_e2_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 2); }
|
|
|
4380 |
void lcd_temp_menu_e2_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 2); }
|
|
|
4381 |
void lcd_temp_menu_e2_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 2); }
|
|
|
4382 |
#if E_STEPPERS > 3
|
|
|
4383 |
void lcd_temp_menu_e3_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 3); }
|
|
|
4384 |
void lcd_temp_menu_e3_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 3); }
|
|
|
4385 |
void lcd_temp_menu_e3_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 3); }
|
|
|
4386 |
#if E_STEPPERS > 4
|
|
|
4387 |
void lcd_temp_menu_e4_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 4); }
|
|
|
4388 |
void lcd_temp_menu_e4_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 4); }
|
|
|
4389 |
void lcd_temp_menu_e4_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 4); }
|
|
|
4390 |
#endif // E_STEPPERS > 4
|
|
|
4391 |
#endif // E_STEPPERS > 3
|
|
|
4392 |
#endif // E_STEPPERS > 2
|
|
|
4393 |
#endif // E_STEPPERS > 1
|
|
|
4394 |
|
|
|
4395 |
/**
|
|
|
4396 |
*
|
|
|
4397 |
* "Change Filament" submenu
|
|
|
4398 |
*
|
|
|
4399 |
*/
|
|
|
4400 |
#if E_STEPPERS > 1 || ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
|
|
4401 |
void lcd_change_filament_menu() {
|
|
|
4402 |
START_MENU();
|
|
|
4403 |
MENU_BACK(MSG_PREPARE);
|
|
|
4404 |
|
|
|
4405 |
// Change filament
|
|
|
4406 |
#if E_STEPPERS == 1
|
|
|
4407 |
PGM_P msg0 = PSTR(MSG_FILAMENTCHANGE);
|
|
|
4408 |
if (thermalManager.targetTooColdToExtrude(active_extruder))
|
|
|
4409 |
MENU_ITEM_P(submenu, msg0, lcd_temp_menu_e0_filament_change);
|
|
|
4410 |
else
|
|
|
4411 |
MENU_ITEM_P(gcode, msg0, PSTR("M600 B0"));
|
|
|
4412 |
#else
|
|
|
4413 |
PGM_P msg0 = PSTR(MSG_FILAMENTCHANGE " " MSG_E1);
|
|
|
4414 |
PGM_P msg1 = PSTR(MSG_FILAMENTCHANGE " " MSG_E2);
|
|
|
4415 |
if (thermalManager.targetTooColdToExtrude(0))
|
|
|
4416 |
MENU_ITEM_P(submenu, msg0, lcd_temp_menu_e0_filament_change);
|
|
|
4417 |
else
|
|
|
4418 |
MENU_ITEM_P(gcode, msg0, PSTR("M600 B0 T0"));
|
|
|
4419 |
if (thermalManager.targetTooColdToExtrude(1))
|
|
|
4420 |
MENU_ITEM_P(submenu, msg1, lcd_temp_menu_e1_filament_change);
|
|
|
4421 |
else
|
|
|
4422 |
MENU_ITEM_P(gcode, msg1, PSTR("M600 B0 T1"));
|
|
|
4423 |
#if E_STEPPERS > 2
|
|
|
4424 |
PGM_P msg2 = PSTR(MSG_FILAMENTCHANGE " " MSG_E3);
|
|
|
4425 |
if (thermalManager.targetTooColdToExtrude(2))
|
|
|
4426 |
MENU_ITEM_P(submenu, msg2, lcd_temp_menu_e2_filament_change);
|
|
|
4427 |
else
|
|
|
4428 |
MENU_ITEM_P(gcode, msg2, PSTR("M600 B0 T2"));
|
|
|
4429 |
#if E_STEPPERS > 3
|
|
|
4430 |
PGM_P msg3 = PSTR(MSG_FILAMENTCHANGE " " MSG_E4);
|
|
|
4431 |
if (thermalManager.targetTooColdToExtrude(3))
|
|
|
4432 |
MENU_ITEM_P(submenu, msg3, lcd_temp_menu_e3_filament_change);
|
|
|
4433 |
else
|
|
|
4434 |
MENU_ITEM_P(gcode, msg3, PSTR("M600 B0 T3"));
|
|
|
4435 |
#if E_STEPPERS > 4
|
|
|
4436 |
PGM_P msg4 = PSTR(MSG_FILAMENTCHANGE " " MSG_E5);
|
|
|
4437 |
if (thermalManager.targetTooColdToExtrude(4))
|
|
|
4438 |
MENU_ITEM_P(submenu, msg4, lcd_temp_menu_e4_filament_change);
|
|
|
4439 |
else
|
|
|
4440 |
MENU_ITEM_P(gcode, msg4, PSTR("M600 B0 T4"));
|
|
|
4441 |
#endif // E_STEPPERS > 4
|
|
|
4442 |
#endif // E_STEPPERS > 3
|
|
|
4443 |
#endif // E_STEPPERS > 2
|
|
|
4444 |
#endif // E_STEPPERS == 1
|
|
|
4445 |
|
|
|
4446 |
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
|
|
4447 |
if (!planner.movesplanned() && !IS_SD_FILE_OPEN()) {
|
|
|
4448 |
// Load filament
|
|
|
4449 |
#if E_STEPPERS == 1
|
|
|
4450 |
PGM_P msg0 = PSTR(MSG_FILAMENTLOAD);
|
|
|
4451 |
if (thermalManager.targetTooColdToExtrude(active_extruder))
|
|
|
4452 |
MENU_ITEM_P(submenu, msg0, lcd_temp_menu_e0_filament_load);
|
|
|
4453 |
else
|
|
|
4454 |
MENU_ITEM_P(gcode, msg0, PSTR("M701"));
|
|
|
4455 |
#else
|
|
|
4456 |
PGM_P msg0 = PSTR(MSG_FILAMENTLOAD " " MSG_E1);
|
|
|
4457 |
PGM_P msg1 = PSTR(MSG_FILAMENTLOAD " " MSG_E2);
|
|
|
4458 |
if (thermalManager.targetTooColdToExtrude(0))
|
|
|
4459 |
MENU_ITEM_P(submenu, msg0, lcd_temp_menu_e0_filament_load);
|
|
|
4460 |
else
|
|
|
4461 |
MENU_ITEM_P(gcode, msg0, PSTR("M701 T0"));
|
|
|
4462 |
if (thermalManager.targetTooColdToExtrude(1))
|
|
|
4463 |
MENU_ITEM_P(submenu, msg1, lcd_temp_menu_e1_filament_load);
|
|
|
4464 |
else
|
|
|
4465 |
MENU_ITEM_P(gcode, msg1, PSTR("M701 T1"));
|
|
|
4466 |
#if E_STEPPERS > 2
|
|
|
4467 |
PGM_P msg2 = PSTR(MSG_FILAMENTLOAD " " MSG_E3);
|
|
|
4468 |
if (thermalManager.targetTooColdToExtrude(2))
|
|
|
4469 |
MENU_ITEM_P(submenu, msg2, lcd_temp_menu_e2_filament_load);
|
|
|
4470 |
else
|
|
|
4471 |
MENU_ITEM_P(gcode, msg2, PSTR("M701 T2"));
|
|
|
4472 |
#if E_STEPPERS > 3
|
|
|
4473 |
PGM_P msg3 = PSTR(MSG_FILAMENTLOAD " " MSG_E4);
|
|
|
4474 |
if (thermalManager.targetTooColdToExtrude(3))
|
|
|
4475 |
MENU_ITEM_P(submenu, msg3, lcd_temp_menu_e3_filament_load);
|
|
|
4476 |
else
|
|
|
4477 |
MENU_ITEM_P(gcode, msg3, PSTR("M701 T3"));
|
|
|
4478 |
#if E_STEPPERS > 4
|
|
|
4479 |
PGM_P msg4 = PSTR(MSG_FILAMENTLOAD " " MSG_E5);
|
|
|
4480 |
if (thermalManager.targetTooColdToExtrude(4))
|
|
|
4481 |
MENU_ITEM_P(submenu, msg4, lcd_temp_menu_e4_filament_load);
|
|
|
4482 |
else
|
|
|
4483 |
MENU_ITEM_P(gcode, msg4, PSTR("M701 T4"));
|
|
|
4484 |
#endif // E_STEPPERS > 4
|
|
|
4485 |
#endif // E_STEPPERS > 3
|
|
|
4486 |
#endif // E_STEPPERS > 2
|
|
|
4487 |
#endif // E_STEPPERS == 1
|
|
|
4488 |
|
|
|
4489 |
// Unload filament
|
|
|
4490 |
#if E_STEPPERS == 1
|
|
|
4491 |
if (thermalManager.targetHotEnoughToExtrude(active_extruder))
|
|
|
4492 |
MENU_ITEM(gcode, MSG_FILAMENTUNLOAD, PSTR("M702"));
|
|
|
4493 |
else
|
|
|
4494 |
MENU_ITEM(submenu, MSG_FILAMENTUNLOAD, lcd_temp_menu_e0_filament_unload);
|
|
|
4495 |
#else
|
|
|
4496 |
#if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
|
|
|
4497 |
if (thermalManager.targetHotEnoughToExtrude(0)
|
|
|
4498 |
#if E_STEPPERS > 1
|
|
|
4499 |
&& thermalManager.targetHotEnoughToExtrude(1)
|
|
|
4500 |
#if E_STEPPERS > 2
|
|
|
4501 |
&& thermalManager.targetHotEnoughToExtrude(2)
|
|
|
4502 |
#if E_STEPPERS > 3
|
|
|
4503 |
&& thermalManager.targetHotEnoughToExtrude(3)
|
|
|
4504 |
#if E_STEPPERS > 4
|
|
|
4505 |
&& thermalManager.targetHotEnoughToExtrude(4)
|
|
|
4506 |
#endif // E_STEPPERS > 4
|
|
|
4507 |
#endif // E_STEPPERS > 3
|
|
|
4508 |
#endif // E_STEPPERS > 2
|
|
|
4509 |
#endif // E_STEPPERS > 1
|
|
|
4510 |
)
|
|
|
4511 |
MENU_ITEM(gcode, MSG_FILAMENTUNLOAD_ALL, PSTR("M702"));
|
|
|
4512 |
else
|
|
|
4513 |
MENU_ITEM(submenu, MSG_FILAMENTUNLOAD_ALL, lcd_unload_filament_all_temp_menu);
|
|
|
4514 |
#endif
|
|
|
4515 |
if (thermalManager.targetHotEnoughToExtrude(0))
|
|
|
4516 |
MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E1, PSTR("M702 T0"));
|
|
|
4517 |
else
|
|
|
4518 |
MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E1, lcd_temp_menu_e0_filament_unload);
|
|
|
4519 |
if (thermalManager.targetHotEnoughToExtrude(1))
|
|
|
4520 |
MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E2, PSTR("M702 T1"));
|
|
|
4521 |
else
|
|
|
4522 |
MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E2, lcd_temp_menu_e1_filament_unload);
|
|
|
4523 |
#if E_STEPPERS > 2
|
|
|
4524 |
if (thermalManager.targetHotEnoughToExtrude(2))
|
|
|
4525 |
MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E3, PSTR("M702 T2"));
|
|
|
4526 |
else
|
|
|
4527 |
MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E3, lcd_temp_menu_e2_filament_unload);
|
|
|
4528 |
#if E_STEPPERS > 3
|
|
|
4529 |
if (thermalManager.targetHotEnoughToExtrude(3))
|
|
|
4530 |
MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E4, PSTR("M702 T3"));
|
|
|
4531 |
else
|
|
|
4532 |
MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E4, lcd_temp_menu_e3_filament_unload);
|
|
|
4533 |
#if E_STEPPERS > 4
|
|
|
4534 |
if (thermalManager.targetHotEnoughToExtrude(4))
|
|
|
4535 |
MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E5, PSTR("M702 T4"));
|
|
|
4536 |
else
|
|
|
4537 |
MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E5, lcd_temp_menu_e4_filament_unload);
|
|
|
4538 |
#endif // E_STEPPERS > 4
|
|
|
4539 |
#endif // E_STEPPERS > 3
|
|
|
4540 |
#endif // E_STEPPERS > 2
|
|
|
4541 |
#endif // E_STEPPERS == 1
|
|
|
4542 |
}
|
|
|
4543 |
#endif
|
|
|
4544 |
|
|
|
4545 |
END_MENU();
|
|
|
4546 |
}
|
|
|
4547 |
#endif
|
|
|
4548 |
|
|
|
4549 |
static AdvancedPauseMode advanced_pause_mode = ADVANCED_PAUSE_MODE_PAUSE_PRINT;
|
|
|
4550 |
static uint8_t hotend_status_extruder = 0;
|
|
|
4551 |
|
|
|
4552 |
static const char* advanced_pause_header() {
|
|
|
4553 |
switch (advanced_pause_mode) {
|
|
|
4554 |
case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
|
|
|
4555 |
return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD);
|
|
|
4556 |
case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT:
|
|
|
4557 |
return PSTR(MSG_FILAMENT_CHANGE_HEADER_UNLOAD);
|
|
|
4558 |
default: break;
|
|
|
4559 |
}
|
|
|
4560 |
return PSTR(MSG_FILAMENT_CHANGE_HEADER_PAUSE);
|
|
|
4561 |
}
|
|
|
4562 |
|
|
|
4563 |
// Portions from STATIC_ITEM...
|
|
|
4564 |
#define HOTEND_STATUS_ITEM() do { \
|
|
|
4565 |
if (_menuLineNr == _thisItemNr) { \
|
|
|
4566 |
if (lcdDrawUpdate) { \
|
|
|
4567 |
lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(MSG_FILAMENT_CHANGE_NOZZLE), false, true); \
|
|
|
4568 |
lcd_implementation_hotend_status(_lcdLineNr, hotend_status_extruder); \
|
|
|
4569 |
} \
|
|
|
4570 |
if (_skipStatic && encoderLine <= _thisItemNr) { \
|
|
|
4571 |
encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
|
|
|
4572 |
++encoderLine; \
|
|
|
4573 |
} \
|
|
|
4574 |
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
|
|
|
4575 |
} \
|
|
|
4576 |
++_thisItemNr; \
|
|
|
4577 |
}while(0)
|
|
|
4578 |
|
|
|
4579 |
void lcd_advanced_pause_resume_print() {
|
|
|
4580 |
advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_RESUME_PRINT;
|
|
|
4581 |
}
|
|
|
4582 |
|
|
|
4583 |
void lcd_advanced_pause_extrude_more() {
|
|
|
4584 |
advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE;
|
|
|
4585 |
}
|
|
|
4586 |
|
|
|
4587 |
void lcd_advanced_pause_option_menu() {
|
|
|
4588 |
START_MENU();
|
|
|
4589 |
#if LCD_HEIGHT > 2
|
|
|
4590 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER, true, false);
|
|
|
4591 |
#endif
|
|
|
4592 |
MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_advanced_pause_resume_print);
|
|
|
4593 |
MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_PURGE, lcd_advanced_pause_extrude_more);
|
|
|
4594 |
END_MENU();
|
|
|
4595 |
}
|
|
|
4596 |
|
|
|
4597 |
void lcd_advanced_pause_init_message() {
|
|
|
4598 |
START_SCREEN();
|
|
|
4599 |
STATIC_ITEM_P(advanced_pause_header(), true, true);
|
|
|
4600 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_1);
|
|
|
4601 |
#ifdef MSG_FILAMENT_CHANGE_INIT_2
|
|
|
4602 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_2);
|
|
|
4603 |
#define __FC_LINES_A 3
|
|
|
4604 |
#else
|
|
|
4605 |
#define __FC_LINES_A 2
|
|
|
4606 |
#endif
|
|
|
4607 |
#ifdef MSG_FILAMENT_CHANGE_INIT_3
|
|
|
4608 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_3);
|
|
|
4609 |
#define _FC_LINES_A (__FC_LINES_A + 1)
|
|
|
4610 |
#else
|
|
|
4611 |
#define _FC_LINES_A __FC_LINES_A
|
|
|
4612 |
#endif
|
|
|
4613 |
#if LCD_HEIGHT > _FC_LINES_A + 1
|
|
|
4614 |
STATIC_ITEM(" ");
|
|
|
4615 |
#endif
|
|
|
4616 |
HOTEND_STATUS_ITEM();
|
|
|
4617 |
END_SCREEN();
|
|
|
4618 |
}
|
|
|
4619 |
|
|
|
4620 |
void lcd_advanced_pause_unload_message() {
|
|
|
4621 |
START_SCREEN();
|
|
|
4622 |
STATIC_ITEM_P(advanced_pause_header(), true, true);
|
|
|
4623 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_1);
|
|
|
4624 |
#ifdef MSG_FILAMENT_CHANGE_UNLOAD_2
|
|
|
4625 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_2);
|
|
|
4626 |
#define __FC_LINES_B 3
|
|
|
4627 |
#else
|
|
|
4628 |
#define __FC_LINES_B 2
|
|
|
4629 |
#endif
|
|
|
4630 |
#ifdef MSG_FILAMENT_CHANGE_UNLOAD_3
|
|
|
4631 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_3);
|
|
|
4632 |
#define _FC_LINES_B (__FC_LINES_B + 1)
|
|
|
4633 |
#else
|
|
|
4634 |
#define _FC_LINES_B __FC_LINES_B
|
|
|
4635 |
#endif
|
|
|
4636 |
#if LCD_HEIGHT > _FC_LINES_B + 1
|
|
|
4637 |
STATIC_ITEM(" ");
|
|
|
4638 |
#endif
|
|
|
4639 |
HOTEND_STATUS_ITEM();
|
|
|
4640 |
END_SCREEN();
|
|
|
4641 |
}
|
|
|
4642 |
|
|
|
4643 |
void lcd_advanced_pause_wait_for_nozzles_to_heat() {
|
|
|
4644 |
START_SCREEN();
|
|
|
4645 |
STATIC_ITEM_P(advanced_pause_header(), true, true);
|
|
|
4646 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEATING_1);
|
|
|
4647 |
#ifdef MSG_FILAMENT_CHANGE_HEATING_2
|
|
|
4648 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEATING_2);
|
|
|
4649 |
#define _FC_LINES_C 3
|
|
|
4650 |
#else
|
|
|
4651 |
#define _FC_LINES_C 2
|
|
|
4652 |
#endif
|
|
|
4653 |
#if LCD_HEIGHT > _FC_LINES_C + 1
|
|
|
4654 |
STATIC_ITEM(" ");
|
|
|
4655 |
#endif
|
|
|
4656 |
HOTEND_STATUS_ITEM();
|
|
|
4657 |
END_SCREEN();
|
|
|
4658 |
}
|
|
|
4659 |
|
|
|
4660 |
void lcd_advanced_pause_heat_nozzle() {
|
|
|
4661 |
START_SCREEN();
|
|
|
4662 |
STATIC_ITEM_P(advanced_pause_header(), true, true);
|
|
|
4663 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEAT_1);
|
|
|
4664 |
#ifdef MSG_FILAMENT_CHANGE_INSERT_2
|
|
|
4665 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEAT_2);
|
|
|
4666 |
#define _FC_LINES_D 3
|
|
|
4667 |
#else
|
|
|
4668 |
#define _FC_LINES_D 2
|
|
|
4669 |
#endif
|
|
|
4670 |
#if LCD_HEIGHT > _FC_LINES_D + 1
|
|
|
4671 |
STATIC_ITEM(" ");
|
|
|
4672 |
#endif
|
|
|
4673 |
HOTEND_STATUS_ITEM();
|
|
|
4674 |
END_SCREEN();
|
|
|
4675 |
}
|
|
|
4676 |
|
|
|
4677 |
void lcd_advanced_pause_insert_message() {
|
|
|
4678 |
START_SCREEN();
|
|
|
4679 |
STATIC_ITEM_P(advanced_pause_header(), true, true);
|
|
|
4680 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_1);
|
|
|
4681 |
#ifdef MSG_FILAMENT_CHANGE_INSERT_2
|
|
|
4682 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_2);
|
|
|
4683 |
#define __FC_LINES_E 3
|
|
|
4684 |
#else
|
|
|
4685 |
#define __FC_LINES_E 2
|
|
|
4686 |
#endif
|
|
|
4687 |
#ifdef MSG_FILAMENT_CHANGE_INSERT_3
|
|
|
4688 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_3);
|
|
|
4689 |
#define _FC_LINES_E (__FC_LINES_E + 1)
|
|
|
4690 |
#else
|
|
|
4691 |
#define _FC_LINES_E __FC_LINES_E
|
|
|
4692 |
#endif
|
|
|
4693 |
#if LCD_HEIGHT > _FC_LINES_E + 1
|
|
|
4694 |
STATIC_ITEM(" ");
|
|
|
4695 |
#endif
|
|
|
4696 |
HOTEND_STATUS_ITEM();
|
|
|
4697 |
END_SCREEN();
|
|
|
4698 |
}
|
|
|
4699 |
|
|
|
4700 |
void lcd_advanced_pause_load_message() {
|
|
|
4701 |
START_SCREEN();
|
|
|
4702 |
STATIC_ITEM_P(advanced_pause_header(), true, true);
|
|
|
4703 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_1);
|
|
|
4704 |
#ifdef MSG_FILAMENT_CHANGE_LOAD_2
|
|
|
4705 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_2);
|
|
|
4706 |
#define __FC_LINES_F 3
|
|
|
4707 |
#else
|
|
|
4708 |
#define __FC_LINES_F 2
|
|
|
4709 |
#endif
|
|
|
4710 |
#ifdef MSG_FILAMENT_CHANGE_LOAD_3
|
|
|
4711 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_3);
|
|
|
4712 |
#define _FC_LINES_F (__FC_LINES_F + 1)
|
|
|
4713 |
#else
|
|
|
4714 |
#define _FC_LINES_F __FC_LINES_F
|
|
|
4715 |
#endif
|
|
|
4716 |
#if LCD_HEIGHT > _FC_LINES_F + 1
|
|
|
4717 |
STATIC_ITEM(" ");
|
|
|
4718 |
#endif
|
|
|
4719 |
HOTEND_STATUS_ITEM();
|
|
|
4720 |
END_SCREEN();
|
|
|
4721 |
}
|
|
|
4722 |
|
|
|
4723 |
void lcd_advanced_pause_purge_message() {
|
|
|
4724 |
START_SCREEN();
|
|
|
4725 |
STATIC_ITEM_P(advanced_pause_header(), true, true);
|
|
|
4726 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_1);
|
|
|
4727 |
#ifdef MSG_FILAMENT_CHANGE_PURGE_2
|
|
|
4728 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_2);
|
|
|
4729 |
#define __FC_LINES_G 3
|
|
|
4730 |
#else
|
|
|
4731 |
#define __FC_LINES_G 2
|
|
|
4732 |
#endif
|
|
|
4733 |
#ifdef MSG_FILAMENT_CHANGE_PURGE_3
|
|
|
4734 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_3);
|
|
|
4735 |
#define _FC_LINES_G (__FC_LINES_G + 1)
|
|
|
4736 |
#else
|
|
|
4737 |
#define _FC_LINES_G __FC_LINES_G
|
|
|
4738 |
#endif
|
|
|
4739 |
#if LCD_HEIGHT > _FC_LINES_G + 1
|
|
|
4740 |
STATIC_ITEM(" ");
|
|
|
4741 |
#endif
|
|
|
4742 |
HOTEND_STATUS_ITEM();
|
|
|
4743 |
END_SCREEN();
|
|
|
4744 |
}
|
|
|
4745 |
|
|
|
4746 |
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
|
|
|
4747 |
void lcd_advanced_pause_continuous_purge_menu() {
|
|
|
4748 |
START_SCREEN();
|
|
|
4749 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_1);
|
|
|
4750 |
#ifdef MSG_FILAMENT_CHANGE_PURGE_2
|
|
|
4751 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_2);
|
|
|
4752 |
#define __FC_LINES_G 3
|
|
|
4753 |
#else
|
|
|
4754 |
#define __FC_LINES_G 2
|
|
|
4755 |
#endif
|
|
|
4756 |
#ifdef MSG_FILAMENT_CHANGE_PURGE_3
|
|
|
4757 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_3);
|
|
|
4758 |
#define _FC_LINES_G (__FC_LINES_G + 1)
|
|
|
4759 |
#else
|
|
|
4760 |
#define _FC_LINES_G __FC_LINES_G
|
|
|
4761 |
#endif
|
|
|
4762 |
#if LCD_HEIGHT > _FC_LINES_G + 1
|
|
|
4763 |
STATIC_ITEM(" ");
|
|
|
4764 |
#endif
|
|
|
4765 |
HOTEND_STATUS_ITEM();
|
|
|
4766 |
STATIC_ITEM(MSG_USERWAIT);
|
|
|
4767 |
END_SCREEN();
|
|
|
4768 |
}
|
|
|
4769 |
#endif
|
|
|
4770 |
|
|
|
4771 |
void lcd_advanced_pause_resume_message() {
|
|
|
4772 |
START_SCREEN();
|
|
|
4773 |
STATIC_ITEM_P(advanced_pause_header(), true, true);
|
|
|
4774 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_1);
|
|
|
4775 |
#ifdef MSG_FILAMENT_CHANGE_RESUME_2
|
|
|
4776 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_2);
|
|
|
4777 |
#endif
|
|
|
4778 |
#ifdef MSG_FILAMENT_CHANGE_RESUME_3
|
|
|
4779 |
STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_3);
|
|
|
4780 |
#endif
|
|
|
4781 |
END_SCREEN();
|
|
|
4782 |
}
|
|
|
4783 |
|
|
|
4784 |
FORCE_INLINE screenFunc_t ap_message_screen(const AdvancedPauseMessage message) {
|
|
|
4785 |
switch (message) {
|
|
|
4786 |
case ADVANCED_PAUSE_MESSAGE_INIT: return lcd_advanced_pause_init_message;
|
|
|
4787 |
case ADVANCED_PAUSE_MESSAGE_UNLOAD: return lcd_advanced_pause_unload_message;
|
|
|
4788 |
case ADVANCED_PAUSE_MESSAGE_INSERT: return lcd_advanced_pause_insert_message;
|
|
|
4789 |
case ADVANCED_PAUSE_MESSAGE_LOAD: return lcd_advanced_pause_load_message;
|
|
|
4790 |
case ADVANCED_PAUSE_MESSAGE_PURGE: return lcd_advanced_pause_purge_message;
|
|
|
4791 |
case ADVANCED_PAUSE_MESSAGE_RESUME: return lcd_advanced_pause_resume_message;
|
|
|
4792 |
case ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE: return lcd_advanced_pause_heat_nozzle;
|
|
|
4793 |
case ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT: return lcd_advanced_pause_wait_for_nozzles_to_heat;
|
|
|
4794 |
case ADVANCED_PAUSE_MESSAGE_OPTION: advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_WAIT_FOR;
|
|
|
4795 |
return lcd_advanced_pause_option_menu;
|
|
|
4796 |
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
|
|
|
4797 |
case ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE: return lcd_advanced_pause_continuous_purge_menu;
|
|
|
4798 |
#endif
|
|
|
4799 |
case ADVANCED_PAUSE_MESSAGE_STATUS:
|
|
|
4800 |
default: break;
|
|
|
4801 |
}
|
|
|
4802 |
return NULL;
|
|
|
4803 |
}
|
|
|
4804 |
|
|
|
4805 |
void lcd_advanced_pause_show_message(
|
|
|
4806 |
const AdvancedPauseMessage message,
|
|
|
4807 |
const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/,
|
|
|
4808 |
const uint8_t extruder/*=active_extruder*/
|
|
|
4809 |
) {
|
|
|
4810 |
advanced_pause_mode = mode;
|
|
|
4811 |
hotend_status_extruder = extruder;
|
|
|
4812 |
const screenFunc_t next_screen = ap_message_screen(message);
|
|
|
4813 |
if (next_screen) {
|
|
|
4814 |
defer_return_to_status = true;
|
|
|
4815 |
lcd_goto_screen(next_screen);
|
|
|
4816 |
}
|
|
|
4817 |
else
|
|
|
4818 |
lcd_return_to_status();
|
|
|
4819 |
}
|
|
|
4820 |
|
|
|
4821 |
#endif // ADVANCED_PAUSE_FEATURE
|
|
|
4822 |
|
|
|
4823 |
/**
|
|
|
4824 |
*
|
|
|
4825 |
* Functions for editing single values
|
|
|
4826 |
*
|
|
|
4827 |
* The "DEFINE_MENU_EDIT_TYPE" macro generates the functions needed to edit a numerical value.
|
|
|
4828 |
*
|
|
|
4829 |
* For example, DEFINE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1) expands into these functions:
|
|
|
4830 |
*
|
|
|
4831 |
* bool _menu_edit_int3();
|
|
|
4832 |
* void menu_edit_int3(); // edit int16_t (interactively)
|
|
|
4833 |
* void menu_edit_callback_int3(); // edit int16_t (interactively) with callback on completion
|
|
|
4834 |
* void _menu_action_setting_edit_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
|
|
|
4835 |
* void menu_action_setting_edit_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
|
|
|
4836 |
* void menu_action_setting_edit_callback_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue, const screenFunc_t callback, const bool live); // edit int16_t with callback
|
|
|
4837 |
*
|
|
|
4838 |
* You can then use one of the menu macros to present the edit interface:
|
|
|
4839 |
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
|
|
|
4840 |
*
|
|
|
4841 |
* This expands into a more primitive menu item:
|
|
|
4842 |
* MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
|
|
4843 |
*
|
|
|
4844 |
* ...which calls:
|
|
|
4845 |
* menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
|
|
4846 |
*/
|
|
|
4847 |
#define DEFINE_MENU_EDIT_TYPE(_type, _name, _strFunc, _scale) \
|
|
|
4848 |
bool _menu_edit_ ## _name() { \
|
|
|
4849 |
ENCODER_DIRECTION_NORMAL(); \
|
|
|
4850 |
if ((int32_t)encoderPosition < 0) encoderPosition = 0; \
|
|
|
4851 |
if ((int32_t)encoderPosition > maxEditValue) encoderPosition = maxEditValue; \
|
|
|
4852 |
if (lcdDrawUpdate) \
|
|
|
4853 |
lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) * (1.0f / _scale))); \
|
|
|
4854 |
if (lcd_clicked || (liveEdit && lcdDrawUpdate)) { \
|
|
|
4855 |
_type value = ((_type)((int32_t)encoderPosition + minEditValue)) * (1.0f / _scale); \
|
|
|
4856 |
if (editValue != NULL) *((_type*)editValue) = value; \
|
|
|
4857 |
if (callbackFunc && (liveEdit || lcd_clicked)) (*callbackFunc)(); \
|
|
|
4858 |
if (lcd_clicked) lcd_goto_previous_menu(); \
|
|
|
4859 |
} \
|
|
|
4860 |
return use_click(); \
|
|
|
4861 |
} \
|
|
|
4862 |
void menu_edit_ ## _name() { _menu_edit_ ## _name(); } \
|
|
|
4863 |
void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue) { \
|
|
|
4864 |
lcd_save_previous_screen(); \
|
|
|
4865 |
lcd_refresh(); \
|
|
|
4866 |
\
|
|
|
4867 |
editLabel = pstr; \
|
|
|
4868 |
editValue = ptr; \
|
|
|
4869 |
minEditValue = minValue * _scale; \
|
|
|
4870 |
maxEditValue = maxValue * _scale - minEditValue; \
|
|
|
4871 |
encoderPosition = (*ptr) * _scale - minEditValue; \
|
|
|
4872 |
} \
|
|
|
4873 |
void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback, const bool live) { \
|
|
|
4874 |
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
|
|
|
4875 |
currentScreen = menu_edit_ ## _name; \
|
|
|
4876 |
callbackFunc = callback; \
|
|
|
4877 |
liveEdit = live; \
|
|
|
4878 |
} \
|
|
|
4879 |
FORCE_INLINE void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue) { \
|
|
|
4880 |
menu_action_setting_edit_callback_ ## _name(pstr, ptr, minValue, maxValue); \
|
|
|
4881 |
} \
|
|
|
4882 |
typedef void _name##_void
|
|
|
4883 |
|
|
|
4884 |
DEFINE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1);
|
|
|
4885 |
DEFINE_MENU_EDIT_TYPE(uint8_t, int8, i8tostr3, 1);
|
|
|
4886 |
DEFINE_MENU_EDIT_TYPE(float, float3, ftostr3, 1);
|
|
|
4887 |
DEFINE_MENU_EDIT_TYPE(float, float52, ftostr52, 100);
|
|
|
4888 |
DEFINE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000);
|
|
|
4889 |
DEFINE_MENU_EDIT_TYPE(float, float5, ftostr5rj, 0.01f);
|
|
|
4890 |
DEFINE_MENU_EDIT_TYPE(float, float51, ftostr51sign, 10);
|
|
|
4891 |
DEFINE_MENU_EDIT_TYPE(float, float52sign, ftostr52sign, 100);
|
|
|
4892 |
DEFINE_MENU_EDIT_TYPE(float, float62, ftostr62rj, 100);
|
|
|
4893 |
DEFINE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f);
|
|
|
4894 |
|
|
|
4895 |
/**
|
|
|
4896 |
*
|
|
|
4897 |
* Handlers for Keypad input
|
|
|
4898 |
*
|
|
|
4899 |
*/
|
|
|
4900 |
#if ENABLED(ADC_KEYPAD)
|
|
|
4901 |
|
|
|
4902 |
inline bool handle_adc_keypad() {
|
|
|
4903 |
#define ADC_MIN_KEY_DELAY 100
|
|
|
4904 |
if (buttons_reprapworld_keypad) {
|
|
|
4905 |
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
|
4906 |
if (encoderDirection == -1) { // side effect which signals we are inside a menu
|
|
|
4907 |
if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
|
|
|
4908 |
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
|
|
|
4909 |
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT) { menu_action_back(); lcd_quick_feedback(true); }
|
|
|
4910 |
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) { lcd_return_to_status(); lcd_quick_feedback(true); }
|
|
|
4911 |
}
|
|
|
4912 |
else {
|
|
|
4913 |
if (buttons_reprapworld_keypad & (EN_REPRAPWORLD_KEYPAD_DOWN|EN_REPRAPWORLD_KEYPAD_UP|EN_REPRAPWORLD_KEYPAD_RIGHT)) {
|
|
|
4914 |
if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) encoderPosition += ENCODER_PULSES_PER_STEP;
|
|
|
4915 |
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) encoderPosition -= ENCODER_PULSES_PER_STEP;
|
|
|
4916 |
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) encoderPosition = 0;
|
|
|
4917 |
}
|
|
|
4918 |
}
|
|
|
4919 |
#if ENABLED(ADC_KEYPAD_DEBUG)
|
|
|
4920 |
SERIAL_PROTOCOLLNPAIR("buttons_reprapworld_keypad = ", (uint32_t)buttons_reprapworld_keypad);
|
|
|
4921 |
SERIAL_PROTOCOLLNPAIR("encoderPosition = ", (uint32_t)encoderPosition);
|
|
|
4922 |
#endif
|
|
|
4923 |
next_button_update_ms = millis() + ADC_MIN_KEY_DELAY;
|
|
|
4924 |
return true;
|
|
|
4925 |
}
|
|
|
4926 |
|
|
|
4927 |
return false;
|
|
|
4928 |
}
|
|
|
4929 |
|
|
|
4930 |
#elif ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
4931 |
|
|
|
4932 |
void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
|
|
|
4933 |
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
|
4934 |
encoderPosition = dir;
|
|
|
4935 |
switch (axis) {
|
|
|
4936 |
case X_AXIS: lcd_move_x(); break;
|
|
|
4937 |
case Y_AXIS: lcd_move_y(); break;
|
|
|
4938 |
case Z_AXIS: lcd_move_z();
|
|
|
4939 |
default: break;
|
|
|
4940 |
}
|
|
|
4941 |
}
|
|
|
4942 |
void reprapworld_keypad_move_z_up() { _reprapworld_keypad_move(Z_AXIS, 1); }
|
|
|
4943 |
void reprapworld_keypad_move_z_down() { _reprapworld_keypad_move(Z_AXIS, -1); }
|
|
|
4944 |
void reprapworld_keypad_move_x_left() { _reprapworld_keypad_move(X_AXIS, -1); }
|
|
|
4945 |
void reprapworld_keypad_move_x_right() { _reprapworld_keypad_move(X_AXIS, 1); }
|
|
|
4946 |
void reprapworld_keypad_move_y_up() { _reprapworld_keypad_move(Y_AXIS, -1); }
|
|
|
4947 |
void reprapworld_keypad_move_y_down() { _reprapworld_keypad_move(Y_AXIS, 1); }
|
|
|
4948 |
void reprapworld_keypad_move_home() { enqueue_and_echo_commands_P(PSTR("G28")); } // move all axes home and wait
|
|
|
4949 |
void reprapworld_keypad_move_menu() { lcd_goto_screen(lcd_move_menu); }
|
|
|
4950 |
|
|
|
4951 |
inline void handle_reprapworld_keypad() {
|
|
|
4952 |
|
|
|
4953 |
static uint8_t keypad_debounce = 0;
|
|
|
4954 |
|
|
|
4955 |
if (!REPRAPWORLD_KEYPAD_PRESSED) {
|
|
|
4956 |
if (keypad_debounce > 0) keypad_debounce--;
|
|
|
4957 |
}
|
|
|
4958 |
else if (!keypad_debounce) {
|
|
|
4959 |
keypad_debounce = 2;
|
|
|
4960 |
|
|
|
4961 |
if (REPRAPWORLD_KEYPAD_MOVE_MENU) reprapworld_keypad_move_menu();
|
|
|
4962 |
|
|
|
4963 |
#if DISABLED(DELTA) && Z_HOME_DIR == -1
|
|
|
4964 |
if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) reprapworld_keypad_move_z_up();
|
|
|
4965 |
#endif
|
|
|
4966 |
|
|
|
4967 |
if (all_axes_homed()) {
|
|
|
4968 |
#if ENABLED(DELTA) || Z_HOME_DIR != -1
|
|
|
4969 |
if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) reprapworld_keypad_move_z_up();
|
|
|
4970 |
#endif
|
|
|
4971 |
if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) reprapworld_keypad_move_z_down();
|
|
|
4972 |
if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) reprapworld_keypad_move_x_left();
|
|
|
4973 |
if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT) reprapworld_keypad_move_x_right();
|
|
|
4974 |
if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) reprapworld_keypad_move_y_down();
|
|
|
4975 |
if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) reprapworld_keypad_move_y_up();
|
|
|
4976 |
}
|
|
|
4977 |
else {
|
|
|
4978 |
if (REPRAPWORLD_KEYPAD_MOVE_HOME) reprapworld_keypad_move_home();
|
|
|
4979 |
}
|
|
|
4980 |
}
|
|
|
4981 |
}
|
|
|
4982 |
|
|
|
4983 |
#endif // REPRAPWORLD_KEYPAD
|
|
|
4984 |
|
|
|
4985 |
/**
|
|
|
4986 |
*
|
|
|
4987 |
* Menu actions
|
|
|
4988 |
*
|
|
|
4989 |
*/
|
|
|
4990 |
void _menu_action_back() { lcd_goto_previous_menu(); }
|
|
|
4991 |
void menu_action_submenu(screenFunc_t func) { lcd_save_previous_screen(); lcd_goto_screen(func); }
|
|
|
4992 |
void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); }
|
|
|
4993 |
void menu_action_function(screenFunc_t func) { (*func)(); }
|
|
|
4994 |
|
|
|
4995 |
#if ENABLED(SDSUPPORT)
|
|
|
4996 |
|
|
|
4997 |
void menu_action_sdfile(CardReader& theCard) {
|
|
|
4998 |
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
|
|
4999 |
last_sdfile_encoderPosition = encoderPosition; // Save which file was selected for later use
|
|
|
5000 |
#endif
|
|
|
5001 |
card.openAndPrintFile(theCard.filename);
|
|
|
5002 |
lcd_return_to_status();
|
|
|
5003 |
lcd_reset_status();
|
|
|
5004 |
}
|
|
|
5005 |
|
|
|
5006 |
void menu_action_sddirectory(CardReader& theCard) {
|
|
|
5007 |
card.chdir(theCard.filename);
|
|
|
5008 |
encoderTopLine = 0;
|
|
|
5009 |
encoderPosition = 2 * ENCODER_STEPS_PER_MENU_ITEM;
|
|
|
5010 |
screen_changed = true;
|
|
|
5011 |
#if ENABLED(DOGLCD)
|
|
|
5012 |
drawing_screen = false;
|
|
|
5013 |
#endif
|
|
|
5014 |
lcd_refresh();
|
|
|
5015 |
}
|
|
|
5016 |
|
|
|
5017 |
#endif // SDSUPPORT
|
|
|
5018 |
|
|
|
5019 |
void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { UNUSED(pstr); *ptr ^= true; lcd_refresh(); }
|
|
|
5020 |
void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callback) {
|
|
|
5021 |
menu_action_setting_edit_bool(pstr, ptr);
|
|
|
5022 |
(*callback)();
|
|
|
5023 |
}
|
|
|
5024 |
|
|
|
5025 |
#endif // ULTIPANEL
|
|
|
5026 |
|
|
|
5027 |
void lcd_init() {
|
|
|
5028 |
|
|
|
5029 |
lcd_implementation_init();
|
|
|
5030 |
|
|
|
5031 |
#if ENABLED(NEWPANEL)
|
|
|
5032 |
#if BUTTON_EXISTS(EN1)
|
|
|
5033 |
SET_INPUT_PULLUP(BTN_EN1);
|
|
|
5034 |
#endif
|
|
|
5035 |
#if BUTTON_EXISTS(EN2)
|
|
|
5036 |
SET_INPUT_PULLUP(BTN_EN2);
|
|
|
5037 |
#endif
|
|
|
5038 |
#if BUTTON_EXISTS(ENC)
|
|
|
5039 |
SET_INPUT_PULLUP(BTN_ENC);
|
|
|
5040 |
#endif
|
|
|
5041 |
|
|
|
5042 |
#if ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(ADC_KEYPAD)
|
|
|
5043 |
SET_OUTPUT(SHIFT_CLK);
|
|
|
5044 |
OUT_WRITE(SHIFT_LD, HIGH);
|
|
|
5045 |
SET_INPUT_PULLUP(SHIFT_OUT);
|
|
|
5046 |
#endif
|
|
|
5047 |
|
|
|
5048 |
#if BUTTON_EXISTS(UP)
|
|
|
5049 |
SET_INPUT(BTN_UP);
|
|
|
5050 |
#endif
|
|
|
5051 |
#if BUTTON_EXISTS(DWN)
|
|
|
5052 |
SET_INPUT(BTN_DWN);
|
|
|
5053 |
#endif
|
|
|
5054 |
#if BUTTON_EXISTS(LFT)
|
|
|
5055 |
SET_INPUT(BTN_LFT);
|
|
|
5056 |
#endif
|
|
|
5057 |
#if BUTTON_EXISTS(RT)
|
|
|
5058 |
SET_INPUT(BTN_RT);
|
|
|
5059 |
#endif
|
|
|
5060 |
|
|
|
5061 |
#else // !NEWPANEL
|
|
|
5062 |
|
|
|
5063 |
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
|
|
|
5064 |
SET_OUTPUT(SR_DATA_PIN);
|
|
|
5065 |
SET_OUTPUT(SR_CLK_PIN);
|
|
|
5066 |
#elif defined(SHIFT_CLK)
|
|
|
5067 |
SET_OUTPUT(SHIFT_CLK);
|
|
|
5068 |
OUT_WRITE(SHIFT_LD, HIGH);
|
|
|
5069 |
OUT_WRITE(SHIFT_EN, LOW);
|
|
|
5070 |
SET_INPUT_PULLUP(SHIFT_OUT);
|
|
|
5071 |
#endif // SR_LCD_2W_NL
|
|
|
5072 |
|
|
|
5073 |
#endif // !NEWPANEL
|
|
|
5074 |
|
|
|
5075 |
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
|
|
|
5076 |
SET_INPUT_PULLUP(SD_DETECT_PIN);
|
|
|
5077 |
lcd_sd_status = 2; // UNKNOWN
|
|
|
5078 |
#endif
|
|
|
5079 |
|
|
|
5080 |
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
5081 |
slow_buttons = 0;
|
|
|
5082 |
#endif
|
|
|
5083 |
|
|
|
5084 |
lcd_buttons_update();
|
|
|
5085 |
|
|
|
5086 |
#if ENABLED(ULTIPANEL)
|
|
|
5087 |
encoderDiff = 0;
|
|
|
5088 |
#endif
|
|
|
5089 |
}
|
|
|
5090 |
|
|
|
5091 |
int16_t utf8_strlen(const char* s) {
|
|
|
5092 |
int16_t i = 0, j = 0;
|
|
|
5093 |
while (s[i]) {
|
|
|
5094 |
if (START_OF_UTF8_CHAR(s[i])) j++;
|
|
|
5095 |
i++;
|
|
|
5096 |
}
|
|
|
5097 |
return j;
|
|
|
5098 |
}
|
|
|
5099 |
|
|
|
5100 |
int16_t utf8_strlen_P(const char* s) {
|
|
|
5101 |
int16_t j = 0;
|
|
|
5102 |
while (pgm_read_byte(s)) {
|
|
|
5103 |
if (START_OF_UTF8_CHAR(pgm_read_byte(s))) j++;
|
|
|
5104 |
s++;
|
|
|
5105 |
}
|
|
|
5106 |
return j;
|
|
|
5107 |
}
|
|
|
5108 |
|
|
|
5109 |
bool lcd_blink() {
|
|
|
5110 |
static uint8_t blink = 0;
|
|
|
5111 |
static millis_t next_blink_ms = 0;
|
|
|
5112 |
millis_t ms = millis();
|
|
|
5113 |
if (ELAPSED(ms, next_blink_ms)) {
|
|
|
5114 |
blink ^= 0xFF;
|
|
|
5115 |
next_blink_ms = ms + 1000 - (LCD_UPDATE_INTERVAL) / 2;
|
|
|
5116 |
}
|
|
|
5117 |
return blink != 0;
|
|
|
5118 |
}
|
|
|
5119 |
|
|
|
5120 |
/**
|
|
|
5121 |
* Update the LCD, read encoder buttons, etc.
|
|
|
5122 |
* - Read button states
|
|
|
5123 |
* - Check the SD Card slot state
|
|
|
5124 |
* - Act on RepRap World keypad input
|
|
|
5125 |
* - Update the encoder position
|
|
|
5126 |
* - Apply acceleration to the encoder position
|
|
|
5127 |
* - Set lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NOW on controller events
|
|
|
5128 |
* - Reset the Info Screen timeout if there's any input
|
|
|
5129 |
* - Update status indicators, if any
|
|
|
5130 |
*
|
|
|
5131 |
* Run the current LCD menu handler callback function:
|
|
|
5132 |
* - Call the handler only if lcdDrawUpdate != LCDVIEW_NONE
|
|
|
5133 |
* - Before calling the handler, LCDVIEW_CALL_NO_REDRAW => LCDVIEW_NONE
|
|
|
5134 |
* - Call the menu handler. Menu handlers should do the following:
|
|
|
5135 |
* - If a value changes, set lcdDrawUpdate to LCDVIEW_REDRAW_NOW and draw the value
|
|
|
5136 |
* (Encoder events automatically set lcdDrawUpdate for you.)
|
|
|
5137 |
* - if (lcdDrawUpdate) { redraw }
|
|
|
5138 |
* - Before exiting the handler set lcdDrawUpdate to:
|
|
|
5139 |
* - LCDVIEW_CLEAR_CALL_REDRAW to clear screen and set LCDVIEW_CALL_REDRAW_NEXT.
|
|
|
5140 |
* - LCDVIEW_REDRAW_NOW to draw now (including remaining stripes).
|
|
|
5141 |
* - LCDVIEW_CALL_REDRAW_NEXT to draw now and get LCDVIEW_REDRAW_NOW on the next loop.
|
|
|
5142 |
* - LCDVIEW_CALL_NO_REDRAW to draw now and get LCDVIEW_NONE on the next loop.
|
|
|
5143 |
* - NOTE: For graphical displays menu handlers may be called 2 or more times per loop,
|
|
|
5144 |
* so don't change lcdDrawUpdate without considering this.
|
|
|
5145 |
*
|
|
|
5146 |
* After the menu handler callback runs (or not):
|
|
|
5147 |
* - Clear the LCD if lcdDrawUpdate == LCDVIEW_CLEAR_CALL_REDRAW
|
|
|
5148 |
* - Update lcdDrawUpdate for the next loop (i.e., move one state down, usually)
|
|
|
5149 |
*
|
|
|
5150 |
* No worries. This function is only called from the main thread.
|
|
|
5151 |
*/
|
|
|
5152 |
void lcd_update() {
|
|
|
5153 |
|
|
|
5154 |
#if ENABLED(ULTIPANEL)
|
|
|
5155 |
static millis_t return_to_status_ms = 0;
|
|
|
5156 |
|
|
|
5157 |
// Handle any queued Move Axis motion
|
|
|
5158 |
manage_manual_move();
|
|
|
5159 |
|
|
|
5160 |
// Update button states for LCD_CLICKED, etc.
|
|
|
5161 |
// After state changes the next button update
|
|
|
5162 |
// may be delayed 300-500ms.
|
|
|
5163 |
lcd_buttons_update();
|
|
|
5164 |
|
|
|
5165 |
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
5166 |
// Don't run the debouncer if UBL owns the display
|
|
|
5167 |
#define UBL_CONDITION !lcd_external_control
|
|
|
5168 |
#else
|
|
|
5169 |
#define UBL_CONDITION true
|
|
|
5170 |
#endif
|
|
|
5171 |
|
|
|
5172 |
// If the action button is pressed...
|
|
|
5173 |
if (UBL_CONDITION && LCD_CLICKED) {
|
|
|
5174 |
if (!wait_for_unclick) { // If not waiting for a debounce release:
|
|
|
5175 |
wait_for_unclick = true; // Set debounce flag to ignore continous clicks
|
|
|
5176 |
lcd_clicked = !wait_for_user && !no_reentry; // Keep the click if not waiting for a user-click
|
|
|
5177 |
wait_for_user = false; // Any click clears wait for user
|
|
|
5178 |
lcd_quick_feedback(true); // Always make a click sound
|
|
|
5179 |
}
|
|
|
5180 |
}
|
|
|
5181 |
else wait_for_unclick = false;
|
|
|
5182 |
|
|
|
5183 |
#if BUTTON_EXISTS(BACK)
|
|
|
5184 |
if (LCD_BACK_CLICKED) {
|
|
|
5185 |
lcd_quick_feedback(true);
|
|
|
5186 |
lcd_goto_previous_menu();
|
|
|
5187 |
}
|
|
|
5188 |
#endif
|
|
|
5189 |
|
|
|
5190 |
#endif // ULTIPANEL
|
|
|
5191 |
|
|
|
5192 |
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
|
|
|
5193 |
|
|
|
5194 |
const uint8_t sd_status = (uint8_t)IS_SD_INSERTED();
|
|
|
5195 |
if (sd_status != lcd_sd_status && lcd_detected()) {
|
|
|
5196 |
|
|
|
5197 |
uint8_t old_sd_status = lcd_sd_status; // prevent re-entry to this block!
|
|
|
5198 |
lcd_sd_status = sd_status;
|
|
|
5199 |
|
|
|
5200 |
if (sd_status) {
|
|
|
5201 |
safe_delay(500); // Some boards need a delay to get settled
|
|
|
5202 |
card.initsd();
|
|
|
5203 |
if (old_sd_status == 2)
|
|
|
5204 |
card.beginautostart(); // Initial boot
|
|
|
5205 |
else
|
|
|
5206 |
LCD_MESSAGEPGM(MSG_SD_INSERTED);
|
|
|
5207 |
}
|
|
|
5208 |
else {
|
|
|
5209 |
card.release();
|
|
|
5210 |
if (old_sd_status != 2) LCD_MESSAGEPGM(MSG_SD_REMOVED);
|
|
|
5211 |
}
|
|
|
5212 |
|
|
|
5213 |
lcd_refresh();
|
|
|
5214 |
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
|
|
|
5215 |
#if ENABLED(LCD_PROGRESS_BAR)
|
|
|
5216 |
currentScreen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU
|
|
|
5217 |
#endif
|
|
|
5218 |
);
|
|
|
5219 |
}
|
|
|
5220 |
|
|
|
5221 |
#endif // SDSUPPORT && SD_DETECT_PIN
|
|
|
5222 |
|
|
|
5223 |
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
|
5224 |
if (job_recovery_commands_count && job_recovery_phase == JOB_RECOVERY_IDLE) {
|
|
|
5225 |
lcd_goto_screen(lcd_job_recovery_menu);
|
|
|
5226 |
job_recovery_phase = JOB_RECOVERY_MAYBE; // Waiting for a response
|
|
|
5227 |
}
|
|
|
5228 |
#endif
|
|
|
5229 |
|
|
|
5230 |
const millis_t ms = millis();
|
|
|
5231 |
if (ELAPSED(ms, next_lcd_update_ms)
|
|
|
5232 |
#if ENABLED(DOGLCD)
|
|
|
5233 |
|| drawing_screen
|
|
|
5234 |
#endif
|
|
|
5235 |
) {
|
|
|
5236 |
|
|
|
5237 |
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
|
|
|
5238 |
|
|
|
5239 |
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
|
|
|
5240 |
lcd_implementation_update_indicators();
|
|
|
5241 |
#endif
|
|
|
5242 |
|
|
|
5243 |
#if ENABLED(ULTIPANEL)
|
|
|
5244 |
|
|
|
5245 |
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
5246 |
slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
|
|
|
5247 |
#endif
|
|
|
5248 |
|
|
|
5249 |
#if ENABLED(ADC_KEYPAD)
|
|
|
5250 |
|
|
|
5251 |
if (handle_adc_keypad())
|
|
|
5252 |
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
|
|
5253 |
|
|
|
5254 |
#elif ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
5255 |
|
|
|
5256 |
handle_reprapworld_keypad();
|
|
|
5257 |
|
|
|
5258 |
#endif
|
|
|
5259 |
|
|
|
5260 |
const bool encoderPastThreshold = (ABS(encoderDiff) >= ENCODER_PULSES_PER_STEP);
|
|
|
5261 |
if (encoderPastThreshold || lcd_clicked) {
|
|
|
5262 |
if (encoderPastThreshold) {
|
|
|
5263 |
int32_t encoderMultiplier = 1;
|
|
|
5264 |
|
|
|
5265 |
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
|
|
5266 |
|
|
|
5267 |
if (encoderRateMultiplierEnabled) {
|
|
|
5268 |
int32_t encoderMovementSteps = ABS(encoderDiff) / ENCODER_PULSES_PER_STEP;
|
|
|
5269 |
|
|
|
5270 |
if (lastEncoderMovementMillis) {
|
|
|
5271 |
// Note that the rate is always calculated between two passes through the
|
|
|
5272 |
// loop and that the abs of the encoderDiff value is tracked.
|
|
|
5273 |
float encoderStepRate = float(encoderMovementSteps) / float(ms - lastEncoderMovementMillis) * 1000;
|
|
|
5274 |
|
|
|
5275 |
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
|
|
|
5276 |
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
|
|
|
5277 |
|
|
|
5278 |
#if ENABLED(ENCODER_RATE_MULTIPLIER_DEBUG)
|
|
|
5279 |
SERIAL_ECHO_START();
|
|
|
5280 |
SERIAL_ECHOPAIR("Enc Step Rate: ", encoderStepRate);
|
|
|
5281 |
SERIAL_ECHOPAIR(" Multiplier: ", encoderMultiplier);
|
|
|
5282 |
SERIAL_ECHOPAIR(" ENCODER_10X_STEPS_PER_SEC: ", ENCODER_10X_STEPS_PER_SEC);
|
|
|
5283 |
SERIAL_ECHOPAIR(" ENCODER_100X_STEPS_PER_SEC: ", ENCODER_100X_STEPS_PER_SEC);
|
|
|
5284 |
SERIAL_EOL();
|
|
|
5285 |
#endif // ENCODER_RATE_MULTIPLIER_DEBUG
|
|
|
5286 |
}
|
|
|
5287 |
|
|
|
5288 |
lastEncoderMovementMillis = ms;
|
|
|
5289 |
} // encoderRateMultiplierEnabled
|
|
|
5290 |
#endif // ENCODER_RATE_MULTIPLIER
|
|
|
5291 |
|
|
|
5292 |
encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
|
|
|
5293 |
encoderDiff = 0;
|
|
|
5294 |
}
|
|
|
5295 |
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
|
|
5296 |
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
|
5297 |
}
|
|
|
5298 |
#endif // ULTIPANEL
|
|
|
5299 |
|
|
|
5300 |
// We arrive here every ~100ms when idling often enough.
|
|
|
5301 |
// Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
|
|
|
5302 |
if (
|
|
|
5303 |
#if ENABLED(ULTIPANEL)
|
|
|
5304 |
currentScreen == lcd_status_screen &&
|
|
|
5305 |
#endif
|
|
|
5306 |
!lcd_status_update_delay--
|
|
|
5307 |
) {
|
|
|
5308 |
lcd_status_update_delay = 9
|
|
|
5309 |
#if ENABLED(DOGLCD)
|
|
|
5310 |
+ 3
|
|
|
5311 |
#endif
|
|
|
5312 |
;
|
|
|
5313 |
max_display_update_time--;
|
|
|
5314 |
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
|
5315 |
}
|
|
|
5316 |
|
|
|
5317 |
#if ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES)
|
|
|
5318 |
// If scrolling of long file names is enabled and we are in the sd card menu,
|
|
|
5319 |
// cause a refresh to occur until all the text has scrolled into view.
|
|
|
5320 |
if (currentScreen == lcd_sdcard_menu && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) {
|
|
|
5321 |
lcd_status_update_delay = 6;
|
|
|
5322 |
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
|
5323 |
filename_scroll_pos++;
|
|
|
5324 |
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
|
|
5325 |
}
|
|
|
5326 |
#endif
|
|
|
5327 |
|
|
|
5328 |
// then we want to use 1/2 of the time only.
|
|
|
5329 |
uint16_t bbr2 = planner.block_buffer_runtime() >> 1;
|
|
|
5330 |
|
|
|
5331 |
#if ENABLED(DOGLCD)
|
|
|
5332 |
#define IS_DRAWING drawing_screen
|
|
|
5333 |
#else
|
|
|
5334 |
#define IS_DRAWING false
|
|
|
5335 |
#endif
|
|
|
5336 |
|
|
|
5337 |
if ((lcdDrawUpdate || IS_DRAWING) && (!bbr2 || bbr2 > max_display_update_time)) {
|
|
|
5338 |
|
|
|
5339 |
// Change state of drawing flag between screen updates
|
|
|
5340 |
if (!IS_DRAWING) switch (lcdDrawUpdate) {
|
|
|
5341 |
case LCDVIEW_CALL_NO_REDRAW:
|
|
|
5342 |
lcdDrawUpdate = LCDVIEW_NONE;
|
|
|
5343 |
break;
|
|
|
5344 |
case LCDVIEW_CLEAR_CALL_REDRAW:
|
|
|
5345 |
case LCDVIEW_CALL_REDRAW_NEXT:
|
|
|
5346 |
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
|
5347 |
case LCDVIEW_REDRAW_NOW: // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT
|
|
|
5348 |
case LCDVIEW_NONE:
|
|
|
5349 |
break;
|
|
|
5350 |
} // switch
|
|
|
5351 |
|
|
|
5352 |
#if ENABLED(ADC_KEYPAD)
|
|
|
5353 |
buttons_reprapworld_keypad = 0;
|
|
|
5354 |
#endif
|
|
|
5355 |
|
|
|
5356 |
#if ENABLED(ULTIPANEL)
|
|
|
5357 |
#define CURRENTSCREEN() (*currentScreen)()
|
|
|
5358 |
#else
|
|
|
5359 |
#define CURRENTSCREEN() lcd_status_screen()
|
|
|
5360 |
#endif
|
|
|
5361 |
|
|
|
5362 |
#if ENABLED(DOGLCD)
|
|
|
5363 |
#if ENABLED(LIGHTWEIGHT_UI)
|
|
|
5364 |
#if ENABLED(ULTIPANEL)
|
|
|
5365 |
const bool in_status = currentScreen == lcd_status_screen;
|
|
|
5366 |
#else
|
|
|
5367 |
constexpr bool in_status = true;
|
|
|
5368 |
#endif
|
|
|
5369 |
const bool do_u8g_loop = !in_status;
|
|
|
5370 |
lcd_in_status(in_status);
|
|
|
5371 |
if (in_status) lcd_status_screen();
|
|
|
5372 |
#else
|
|
|
5373 |
constexpr bool do_u8g_loop = true;
|
|
|
5374 |
#endif
|
|
|
5375 |
if (do_u8g_loop) {
|
|
|
5376 |
if (!drawing_screen) { // If not already drawing pages
|
|
|
5377 |
u8g.firstPage(); // Start the first page
|
|
|
5378 |
drawing_screen = first_page = true; // Flag as drawing pages
|
|
|
5379 |
}
|
|
|
5380 |
lcd_setFont(FONT_MENU); // Setup font for every page draw
|
|
|
5381 |
u8g.setColorIndex(1); // And reset the color
|
|
|
5382 |
CURRENTSCREEN(); // Draw and process the current screen
|
|
|
5383 |
first_page = false;
|
|
|
5384 |
|
|
|
5385 |
// The screen handler can clear drawing_screen for an action that changes the screen.
|
|
|
5386 |
// If still drawing and there's another page, update max-time and return now.
|
|
|
5387 |
// The nextPage will already be set up on the next call.
|
|
|
5388 |
if (drawing_screen && (drawing_screen = u8g.nextPage())) {
|
|
|
5389 |
NOLESS(max_display_update_time, millis() - ms);
|
|
|
5390 |
return;
|
|
|
5391 |
}
|
|
|
5392 |
}
|
|
|
5393 |
#else
|
|
|
5394 |
CURRENTSCREEN();
|
|
|
5395 |
#endif
|
|
|
5396 |
|
|
|
5397 |
#if ENABLED(ULTIPANEL)
|
|
|
5398 |
lcd_clicked = false;
|
|
|
5399 |
#endif
|
|
|
5400 |
|
|
|
5401 |
// Keeping track of the longest time for an individual LCD update.
|
|
|
5402 |
// Used to do screen throttling when the planner starts to fill up.
|
|
|
5403 |
NOLESS(max_display_update_time, millis() - ms);
|
|
|
5404 |
}
|
|
|
5405 |
|
|
|
5406 |
#if ENABLED(ULTIPANEL)
|
|
|
5407 |
|
|
|
5408 |
// Return to Status Screen after a timeout
|
|
|
5409 |
if (currentScreen == lcd_status_screen || defer_return_to_status)
|
|
|
5410 |
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
|
|
5411 |
else if (ELAPSED(ms, return_to_status_ms))
|
|
|
5412 |
lcd_return_to_status();
|
|
|
5413 |
|
|
|
5414 |
#endif // ULTIPANEL
|
|
|
5415 |
|
|
|
5416 |
// Change state of drawing flag between screen updates
|
|
|
5417 |
if (!IS_DRAWING) switch (lcdDrawUpdate) {
|
|
|
5418 |
case LCDVIEW_CLEAR_CALL_REDRAW:
|
|
|
5419 |
lcd_implementation_clear(); break;
|
|
|
5420 |
case LCDVIEW_REDRAW_NOW:
|
|
|
5421 |
lcdDrawUpdate = LCDVIEW_NONE;
|
|
|
5422 |
case LCDVIEW_NONE:
|
|
|
5423 |
case LCDVIEW_CALL_REDRAW_NEXT:
|
|
|
5424 |
case LCDVIEW_CALL_NO_REDRAW:
|
|
|
5425 |
default: break;
|
|
|
5426 |
} // switch
|
|
|
5427 |
|
|
|
5428 |
} // ELAPSED(ms, next_lcd_update_ms)
|
|
|
5429 |
}
|
|
|
5430 |
|
|
|
5431 |
void lcd_finishstatus(const bool persist=false) {
|
|
|
5432 |
|
|
|
5433 |
#if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
|
|
|
5434 |
UNUSED(persist);
|
|
|
5435 |
#endif
|
|
|
5436 |
|
|
|
5437 |
#if ENABLED(LCD_PROGRESS_BAR)
|
|
|
5438 |
progress_bar_ms = millis();
|
|
|
5439 |
#if PROGRESS_MSG_EXPIRE > 0
|
|
|
5440 |
expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
|
|
|
5441 |
#endif
|
|
|
5442 |
#endif
|
|
|
5443 |
lcd_refresh();
|
|
|
5444 |
|
|
|
5445 |
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
|
|
|
5446 |
previous_lcd_status_ms = millis(); //get status message to show up for a while
|
|
|
5447 |
#endif
|
|
|
5448 |
|
|
|
5449 |
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
|
|
5450 |
status_scroll_offset = 0;
|
|
|
5451 |
#endif
|
|
|
5452 |
}
|
|
|
5453 |
|
|
|
5454 |
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
|
|
|
5455 |
void dontExpireStatus() { expire_status_ms = 0; }
|
|
|
5456 |
#endif
|
|
|
5457 |
|
|
|
5458 |
bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
|
|
|
5459 |
|
|
|
5460 |
void lcd_setstatus(const char * const message, const bool persist) {
|
|
|
5461 |
if (lcd_status_message_level > 0) return;
|
|
|
5462 |
|
|
|
5463 |
// Here we have a problem. The message is encoded in UTF8, so
|
|
|
5464 |
// arbitrarily cutting it will be a problem. We MUST be sure
|
|
|
5465 |
// that there is no cutting in the middle of a multibyte character!
|
|
|
5466 |
|
|
|
5467 |
// Get a pointer to the null terminator
|
|
|
5468 |
const char* pend = message + strlen(message);
|
|
|
5469 |
|
|
|
5470 |
// If length of supplied UTF8 string is greater than
|
|
|
5471 |
// our buffer size, start cutting whole UTF8 chars
|
|
|
5472 |
while ((pend - message) > MAX_MESSAGE_LENGTH) {
|
|
|
5473 |
--pend;
|
|
|
5474 |
while (!START_OF_UTF8_CHAR(*pend)) --pend;
|
|
|
5475 |
};
|
|
|
5476 |
|
|
|
5477 |
// At this point, we have the proper cut point. Use it
|
|
|
5478 |
uint8_t maxLen = pend - message;
|
|
|
5479 |
strncpy(lcd_status_message, message, maxLen);
|
|
|
5480 |
lcd_status_message[maxLen] = '\0';
|
|
|
5481 |
|
|
|
5482 |
lcd_finishstatus(persist);
|
|
|
5483 |
}
|
|
|
5484 |
|
|
|
5485 |
void lcd_setstatusPGM(const char * const message, int8_t level) {
|
|
|
5486 |
if (level < 0) level = lcd_status_message_level = 0;
|
|
|
5487 |
if (level < lcd_status_message_level) return;
|
|
|
5488 |
lcd_status_message_level = level;
|
|
|
5489 |
|
|
|
5490 |
// Here we have a problem. The message is encoded in UTF8, so
|
|
|
5491 |
// arbitrarily cutting it will be a problem. We MUST be sure
|
|
|
5492 |
// that there is no cutting in the middle of a multibyte character!
|
|
|
5493 |
|
|
|
5494 |
// Get a pointer to the null terminator
|
|
|
5495 |
const char* pend = message + strlen_P(message);
|
|
|
5496 |
|
|
|
5497 |
// If length of supplied UTF8 string is greater than
|
|
|
5498 |
// our buffer size, start cutting whole UTF8 chars
|
|
|
5499 |
while ((pend - message) > MAX_MESSAGE_LENGTH) {
|
|
|
5500 |
--pend;
|
|
|
5501 |
while (!START_OF_UTF8_CHAR(pgm_read_byte(pend))) --pend;
|
|
|
5502 |
};
|
|
|
5503 |
|
|
|
5504 |
// At this point, we have the proper cut point. Use it
|
|
|
5505 |
uint8_t maxLen = pend - message;
|
|
|
5506 |
strncpy_P(lcd_status_message, message, maxLen);
|
|
|
5507 |
lcd_status_message[maxLen] = '\0';
|
|
|
5508 |
|
|
|
5509 |
lcd_finishstatus(level > 0);
|
|
|
5510 |
}
|
|
|
5511 |
|
|
|
5512 |
void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
|
|
|
5513 |
if (level < lcd_status_message_level) return;
|
|
|
5514 |
lcd_status_message_level = level;
|
|
|
5515 |
va_list args;
|
|
|
5516 |
va_start(args, fmt);
|
|
|
5517 |
vsnprintf_P(lcd_status_message, MAX_MESSAGE_LENGTH, fmt, args);
|
|
|
5518 |
va_end(args);
|
|
|
5519 |
lcd_finishstatus(level > 0);
|
|
|
5520 |
}
|
|
|
5521 |
|
|
|
5522 |
void lcd_setalertstatusPGM(const char * const message) {
|
|
|
5523 |
lcd_setstatusPGM(message, 1);
|
|
|
5524 |
#if ENABLED(ULTIPANEL)
|
|
|
5525 |
lcd_return_to_status();
|
|
|
5526 |
#endif
|
|
|
5527 |
}
|
|
|
5528 |
|
|
|
5529 |
void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
|
|
5530 |
|
|
|
5531 |
#if HAS_LCD_CONTRAST
|
|
|
5532 |
|
|
|
5533 |
void set_lcd_contrast(const int16_t value) {
|
|
|
5534 |
lcd_contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
|
|
|
5535 |
u8g.setContrast(lcd_contrast);
|
|
|
5536 |
}
|
|
|
5537 |
|
|
|
5538 |
#endif
|
|
|
5539 |
|
|
|
5540 |
#if ENABLED(ULTIPANEL)
|
|
|
5541 |
|
|
|
5542 |
/**
|
|
|
5543 |
* Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
|
|
|
5544 |
* These values are independent of which pins are used for EN_A and EN_B indications
|
|
|
5545 |
* The rotary encoder part is also independent to the chipset used for the LCD
|
|
|
5546 |
*/
|
|
|
5547 |
#if defined(EN_A) && defined(EN_B)
|
|
|
5548 |
#define encrot0 0
|
|
|
5549 |
#define encrot1 2
|
|
|
5550 |
#define encrot2 3
|
|
|
5551 |
#define encrot3 1
|
|
|
5552 |
#endif
|
|
|
5553 |
|
|
|
5554 |
#define GET_SHIFT_BUTTON_STATES(DST) \
|
|
|
5555 |
uint8_t new_##DST = 0; \
|
|
|
5556 |
WRITE(SHIFT_LD, LOW); \
|
|
|
5557 |
WRITE(SHIFT_LD, HIGH); \
|
|
|
5558 |
for (int8_t i = 0; i < 8; i++) { \
|
|
|
5559 |
new_##DST >>= 1; \
|
|
|
5560 |
if (READ(SHIFT_OUT)) SBI(new_##DST, 7); \
|
|
|
5561 |
WRITE(SHIFT_CLK, HIGH); \
|
|
|
5562 |
WRITE(SHIFT_CLK, LOW); \
|
|
|
5563 |
} \
|
|
|
5564 |
DST = ~new_##DST; //invert it, because a pressed switch produces a logical 0
|
|
|
5565 |
|
|
|
5566 |
|
|
|
5567 |
/**
|
|
|
5568 |
* Read encoder buttons from the hardware registers
|
|
|
5569 |
* Warning: This function is called from interrupt context!
|
|
|
5570 |
*/
|
|
|
5571 |
void lcd_buttons_update() {
|
|
|
5572 |
static uint8_t lastEncoderBits;
|
|
|
5573 |
const millis_t now = millis();
|
|
|
5574 |
if (ELAPSED(now, next_button_update_ms)) {
|
|
|
5575 |
|
|
|
5576 |
#if ENABLED(NEWPANEL)
|
|
|
5577 |
uint8_t newbutton = 0;
|
|
|
5578 |
|
|
|
5579 |
#if BUTTON_EXISTS(EN1)
|
|
|
5580 |
if (BUTTON_PRESSED(EN1)) newbutton |= EN_A;
|
|
|
5581 |
#endif
|
|
|
5582 |
#if BUTTON_EXISTS(EN2)
|
|
|
5583 |
if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
|
|
|
5584 |
#endif
|
|
|
5585 |
#if BUTTON_EXISTS(ENC)
|
|
|
5586 |
if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
|
|
|
5587 |
#endif
|
|
|
5588 |
#if BUTTON_EXISTS(BACK)
|
|
|
5589 |
if (BUTTON_PRESSED(BACK)) newbutton |= EN_D;
|
|
|
5590 |
#endif
|
|
|
5591 |
|
|
|
5592 |
//
|
|
|
5593 |
// Directional buttons
|
|
|
5594 |
//
|
|
|
5595 |
#if LCD_HAS_DIRECTIONAL_BUTTONS
|
|
|
5596 |
|
|
|
5597 |
#if ENABLED(REVERSE_MENU_DIRECTION)
|
|
|
5598 |
#define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection)
|
|
|
5599 |
#else
|
|
|
5600 |
#define _ENCODER_UD_STEPS ENCODER_STEPS_PER_MENU_ITEM
|
|
|
5601 |
#endif
|
|
|
5602 |
#if ENABLED(REVERSE_ENCODER_DIRECTION)
|
|
|
5603 |
#define ENCODER_UD_STEPS _ENCODER_UD_STEPS
|
|
|
5604 |
#define ENCODER_LR_PULSES ENCODER_PULSES_PER_STEP
|
|
|
5605 |
#else
|
|
|
5606 |
#define ENCODER_UD_STEPS -(_ENCODER_UD_STEPS)
|
|
|
5607 |
#define ENCODER_LR_PULSES -(ENCODER_PULSES_PER_STEP)
|
|
|
5608 |
#endif
|
|
|
5609 |
|
|
|
5610 |
if (false) {
|
|
|
5611 |
// for the else-ifs below
|
|
|
5612 |
}
|
|
|
5613 |
#if BUTTON_EXISTS(UP)
|
|
|
5614 |
else if (BUTTON_PRESSED(UP)) {
|
|
|
5615 |
encoderDiff = -(ENCODER_UD_STEPS);
|
|
|
5616 |
next_button_update_ms = now + 300;
|
|
|
5617 |
}
|
|
|
5618 |
#endif
|
|
|
5619 |
#if BUTTON_EXISTS(DWN)
|
|
|
5620 |
else if (BUTTON_PRESSED(DWN)) {
|
|
|
5621 |
encoderDiff = ENCODER_UD_STEPS;
|
|
|
5622 |
next_button_update_ms = now + 300;
|
|
|
5623 |
}
|
|
|
5624 |
#endif
|
|
|
5625 |
#if BUTTON_EXISTS(LFT)
|
|
|
5626 |
else if (BUTTON_PRESSED(LFT)) {
|
|
|
5627 |
encoderDiff = -(ENCODER_LR_PULSES);
|
|
|
5628 |
next_button_update_ms = now + 300;
|
|
|
5629 |
}
|
|
|
5630 |
#endif
|
|
|
5631 |
#if BUTTON_EXISTS(RT)
|
|
|
5632 |
else if (BUTTON_PRESSED(RT)) {
|
|
|
5633 |
encoderDiff = ENCODER_LR_PULSES;
|
|
|
5634 |
next_button_update_ms = now + 300;
|
|
|
5635 |
}
|
|
|
5636 |
#endif
|
|
|
5637 |
|
|
|
5638 |
#endif // LCD_HAS_DIRECTIONAL_BUTTONS
|
|
|
5639 |
|
|
|
5640 |
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
5641 |
newbutton |= slow_buttons;
|
|
|
5642 |
#endif
|
|
|
5643 |
buttons = newbutton;
|
|
|
5644 |
|
|
|
5645 |
#if ENABLED(ADC_KEYPAD)
|
|
|
5646 |
|
|
|
5647 |
uint8_t newbutton_reprapworld_keypad = 0;
|
|
|
5648 |
if (buttons_reprapworld_keypad == 0) {
|
|
|
5649 |
newbutton_reprapworld_keypad = get_ADC_keyValue();
|
|
|
5650 |
if (WITHIN(newbutton_reprapworld_keypad, 1, 8))
|
|
|
5651 |
buttons_reprapworld_keypad = _BV(newbutton_reprapworld_keypad - 1);
|
|
|
5652 |
}
|
|
|
5653 |
|
|
|
5654 |
#elif ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
5655 |
|
|
|
5656 |
GET_SHIFT_BUTTON_STATES(buttons_reprapworld_keypad);
|
|
|
5657 |
|
|
|
5658 |
#endif
|
|
|
5659 |
|
|
|
5660 |
#else // !NEWPANEL
|
|
|
5661 |
|
|
|
5662 |
GET_SHIFT_BUTTON_STATES(buttons);
|
|
|
5663 |
|
|
|
5664 |
#endif
|
|
|
5665 |
|
|
|
5666 |
} // next_button_update_ms
|
|
|
5667 |
|
|
|
5668 |
// Manage encoder rotation
|
|
|
5669 |
#if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION)
|
|
|
5670 |
#define ENCODER_DIFF_CW (encoderDiff -= encoderDirection)
|
|
|
5671 |
#define ENCODER_DIFF_CCW (encoderDiff += encoderDirection)
|
|
|
5672 |
#elif ENABLED(REVERSE_MENU_DIRECTION)
|
|
|
5673 |
#define ENCODER_DIFF_CW (encoderDiff += encoderDirection)
|
|
|
5674 |
#define ENCODER_DIFF_CCW (encoderDiff -= encoderDirection)
|
|
|
5675 |
#elif ENABLED(REVERSE_ENCODER_DIRECTION)
|
|
|
5676 |
#define ENCODER_DIFF_CW (encoderDiff--)
|
|
|
5677 |
#define ENCODER_DIFF_CCW (encoderDiff++)
|
|
|
5678 |
#else
|
|
|
5679 |
#define ENCODER_DIFF_CW (encoderDiff++)
|
|
|
5680 |
#define ENCODER_DIFF_CCW (encoderDiff--)
|
|
|
5681 |
#endif
|
|
|
5682 |
#define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: ENCODER_DIFF_CW; break; case _E2: ENCODER_DIFF_CCW; }
|
|
|
5683 |
|
|
|
5684 |
uint8_t enc = 0;
|
|
|
5685 |
if (buttons & EN_A) enc |= B01;
|
|
|
5686 |
if (buttons & EN_B) enc |= B10;
|
|
|
5687 |
if (enc != lastEncoderBits) {
|
|
|
5688 |
switch (enc) {
|
|
|
5689 |
case encrot0: ENCODER_SPIN(encrot3, encrot1); break;
|
|
|
5690 |
case encrot1: ENCODER_SPIN(encrot0, encrot2); break;
|
|
|
5691 |
case encrot2: ENCODER_SPIN(encrot1, encrot3); break;
|
|
|
5692 |
case encrot3: ENCODER_SPIN(encrot2, encrot0); break;
|
|
|
5693 |
}
|
|
|
5694 |
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
5695 |
if (lcd_external_control) {
|
|
|
5696 |
ubl.encoder_diff = encoderDiff; // Make encoder rotation available to UBL G29 mesh editing.
|
|
|
5697 |
encoderDiff = 0; // Hide the encoder event from the current screen handler.
|
|
|
5698 |
}
|
|
|
5699 |
#endif
|
|
|
5700 |
lastEncoderBits = enc;
|
|
|
5701 |
}
|
|
|
5702 |
}
|
|
|
5703 |
|
|
|
5704 |
#if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
|
|
|
5705 |
bool lcd_detected() { return lcd.LcdDetected() == 1; }
|
|
|
5706 |
#else
|
|
|
5707 |
bool lcd_detected() { return true; }
|
|
|
5708 |
#endif
|
|
|
5709 |
|
|
|
5710 |
#if ENABLED(G26_MESH_VALIDATION)
|
|
|
5711 |
void lcd_chirp() {
|
|
|
5712 |
#if ENABLED(LCD_USE_I2C_BUZZER)
|
|
|
5713 |
lcd.buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
|
|
5714 |
#elif PIN_EXISTS(BEEPER)
|
|
|
5715 |
buzzer.tone(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
|
|
5716 |
#endif
|
|
|
5717 |
}
|
|
|
5718 |
#endif
|
|
|
5719 |
|
|
|
5720 |
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
|
|
|
5721 |
bool is_lcd_clicked() { return LCD_CLICKED; }
|
|
|
5722 |
void wait_for_release() {
|
|
|
5723 |
while (is_lcd_clicked()) safe_delay(50);
|
|
|
5724 |
safe_delay(50);
|
|
|
5725 |
}
|
|
|
5726 |
#endif
|
|
|
5727 |
|
|
|
5728 |
#endif // ULTIPANEL
|
|
|
5729 |
|
|
|
5730 |
#if ENABLED(ADC_KEYPAD)
|
|
|
5731 |
|
|
|
5732 |
typedef struct {
|
|
|
5733 |
uint16_t ADCKeyValueMin, ADCKeyValueMax;
|
|
|
5734 |
uint8_t ADCKeyNo;
|
|
|
5735 |
} _stADCKeypadTable_;
|
|
|
5736 |
|
|
|
5737 |
static const _stADCKeypadTable_ stADCKeyTable[] PROGMEM = {
|
|
|
5738 |
// VALUE_MIN, VALUE_MAX, KEY
|
|
|
5739 |
{ 4000, 4096, BLEN_REPRAPWORLD_KEYPAD_F1 + 1 }, // F1
|
|
|
5740 |
{ 4000, 4096, BLEN_REPRAPWORLD_KEYPAD_F2 + 1 }, // F2
|
|
|
5741 |
{ 4000, 4096, BLEN_REPRAPWORLD_KEYPAD_F3 + 1 }, // F3
|
|
|
5742 |
{ 300, 500, BLEN_REPRAPWORLD_KEYPAD_LEFT + 1 }, // LEFT
|
|
|
5743 |
{ 1900, 2200, BLEN_REPRAPWORLD_KEYPAD_RIGHT + 1 }, // RIGHT
|
|
|
5744 |
{ 570, 870, BLEN_REPRAPWORLD_KEYPAD_UP + 1 }, // UP
|
|
|
5745 |
{ 2670, 2870, BLEN_REPRAPWORLD_KEYPAD_DOWN + 1 }, // DOWN
|
|
|
5746 |
{ 1150, 1450, BLEN_REPRAPWORLD_KEYPAD_MIDDLE + 1 }, // ENTER
|
|
|
5747 |
};
|
|
|
5748 |
|
|
|
5749 |
uint8_t get_ADC_keyValue(void) {
|
|
|
5750 |
if (thermalManager.ADCKey_count >= 16) {
|
|
|
5751 |
const uint16_t currentkpADCValue = thermalManager.current_ADCKey_raw >> 2;
|
|
|
5752 |
#if ENABLED(ADC_KEYPAD_DEBUG)
|
|
|
5753 |
SERIAL_PROTOCOLLN(currentkpADCValue);
|
|
|
5754 |
#endif
|
|
|
5755 |
thermalManager.current_ADCKey_raw = 0;
|
|
|
5756 |
thermalManager.ADCKey_count = 0;
|
|
|
5757 |
if (currentkpADCValue < 4000)
|
|
|
5758 |
for (uint8_t i = 0; i < ADC_KEY_NUM; i++) {
|
|
|
5759 |
const uint16_t lo = pgm_read_word(&stADCKeyTable[i].ADCKeyValueMin),
|
|
|
5760 |
hi = pgm_read_word(&stADCKeyTable[i].ADCKeyValueMax);
|
|
|
5761 |
if (WITHIN(currentkpADCValue, lo, hi)) return pgm_read_byte(&stADCKeyTable[i].ADCKeyNo);
|
|
|
5762 |
}
|
|
|
5763 |
}
|
|
|
5764 |
return 0;
|
|
|
5765 |
}
|
|
|
5766 |
#endif
|
|
|
5767 |
|
|
|
5768 |
#endif // ULTRA_LCD
|