|
@@ -143,7 +143,7 @@ uint16_t max_display_update_time = 0;
|
143
|
143
|
void lcd_control_temperature_preheat_material1_settings_menu();
|
144
|
144
|
void lcd_control_temperature_preheat_material2_settings_menu();
|
145
|
145
|
void lcd_control_motion_menu();
|
146
|
|
- void lcd_control_volumetric_menu();
|
|
146
|
+ void lcd_control_filament_menu();
|
147
|
147
|
|
148
|
148
|
#if ENABLED(DAC_STEPPER_CURRENT)
|
149
|
149
|
void dac_driver_commit();
|
|
@@ -198,26 +198,31 @@ uint16_t max_display_update_time = 0;
|
198
|
198
|
void menu_action_submenu(screenFunc_t data);
|
199
|
199
|
void menu_action_gcode(const char* pgcode);
|
200
|
200
|
void menu_action_function(screenFunc_t data);
|
|
201
|
+
|
|
202
|
+ #define DECLARE_MENU_EDIT_TYPE(_type, _name) \
|
|
203
|
+ bool _menu_edit_ ## _name(); \
|
|
204
|
+ void menu_edit_ ## _name(); \
|
|
205
|
+ void menu_edit_callback_ ## _name(); \
|
|
206
|
+ void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue); \
|
|
207
|
+ void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue); \
|
|
208
|
+ void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback); \
|
|
209
|
+ void _menu_action_setting_edit_accessor_ ## _name(const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue); \
|
|
210
|
+ void menu_action_setting_edit_accessor_ ## _name(const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue); \
|
|
211
|
+ typedef void _name##_void
|
|
212
|
+
|
|
213
|
+ DECLARE_MENU_EDIT_TYPE(int, int3);
|
|
214
|
+ DECLARE_MENU_EDIT_TYPE(float, float3);
|
|
215
|
+ DECLARE_MENU_EDIT_TYPE(float, float32);
|
|
216
|
+ DECLARE_MENU_EDIT_TYPE(float, float43);
|
|
217
|
+ DECLARE_MENU_EDIT_TYPE(float, float5);
|
|
218
|
+ DECLARE_MENU_EDIT_TYPE(float, float51);
|
|
219
|
+ DECLARE_MENU_EDIT_TYPE(float, float52);
|
|
220
|
+ DECLARE_MENU_EDIT_TYPE(float, float62);
|
|
221
|
+ DECLARE_MENU_EDIT_TYPE(unsigned long, long5);
|
|
222
|
+
|
201
|
223
|
void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
|
202
|
|
- void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
|
203
|
|
- void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
|
204
|
|
- void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue);
|
205
|
|
- void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue);
|
206
|
|
- void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
|
207
|
|
- void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
|
208
|
|
- void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
|
209
|
|
- void menu_action_setting_edit_float62(const char* pstr, float* ptr, float minValue, float maxValue);
|
210
|
|
- void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
|
211
|
224
|
void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
|
212
|
|
- void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callbackFunc);
|
213
|
|
- void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
214
|
|
- void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
215
|
|
- void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
216
|
|
- void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
217
|
|
- void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
218
|
|
- void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
219
|
|
- void menu_action_setting_edit_callback_float62(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
220
|
|
- void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, screenFunc_t callbackFunc);
|
|
225
|
+ void menu_action_setting_edit_accessor_bool(const char* pstr, bool (*pget)(), void (*pset)(bool));
|
221
|
226
|
|
222
|
227
|
#if ENABLED(SDSUPPORT)
|
223
|
228
|
void lcd_sdcard_menu();
|
|
@@ -375,12 +380,15 @@ uint16_t max_display_update_time = 0;
|
375
|
380
|
#define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0)
|
376
|
381
|
#define MENU_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
377
|
382
|
#define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
|
383
|
+ #define MENU_ITEM_EDIT_ACCESSOR(type, label, ...) MENU_ITEM(setting_edit_accessor_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
378
|
384
|
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
379
|
385
|
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
380
|
386
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
|
387
|
+ #define MENU_MULTIPLIER_ITEM_EDIT_ACCESSOR(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_accessor_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
381
|
388
|
#else //!ENCODER_RATE_MULTIPLIER
|
382
|
389
|
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
383
|
390
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
|
391
|
+ #define MENU_MULTIPLIER_ITEM_EDIT_ACCESSOR(type, label, ...) MENU_ITEM(setting_edit_accessor_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
384
|
392
|
#endif //!ENCODER_RATE_MULTIPLIER
|
385
|
393
|
|
386
|
394
|
/** Used variables to keep track of the menu */
|
|
@@ -417,6 +425,7 @@ uint16_t max_display_update_time = 0;
|
417
|
425
|
// Variables used when editing values.
|
418
|
426
|
const char* editLabel;
|
419
|
427
|
void* editValue;
|
|
428
|
+ void* editSetter;
|
420
|
429
|
int32_t minEditValue, maxEditValue;
|
421
|
430
|
screenFunc_t callbackFunc; // call this after editing
|
422
|
431
|
|
|
@@ -2105,7 +2114,7 @@ void kill_screen(const char* lcd_msg) {
|
2105
|
2114
|
MENU_BACK(MSG_MAIN);
|
2106
|
2115
|
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
|
2107
|
2116
|
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
|
2108
|
|
- MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu);
|
|
2117
|
+ MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_filament_menu);
|
2109
|
2118
|
|
2110
|
2119
|
#if HAS_LCD_CONTRAST
|
2111
|
2120
|
//MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
|
|
@@ -2543,10 +2552,14 @@ void kill_screen(const char* lcd_msg) {
|
2543
|
2552
|
* "Control" > "Filament" submenu
|
2544
|
2553
|
*
|
2545
|
2554
|
*/
|
2546
|
|
- void lcd_control_volumetric_menu() {
|
|
2555
|
+ void lcd_control_filament_menu() {
|
2547
|
2556
|
START_MENU();
|
2548
|
2557
|
MENU_BACK(MSG_CONTROL);
|
2549
|
2558
|
|
|
2559
|
+ #if ENABLED(LIN_ADVANCE)
|
|
2560
|
+ MENU_ITEM_EDIT_ACCESSOR(float3, MSG_ADVANCE_K, planner.get_extruder_advance_k, planner.set_extruder_advance_k, 0, 999);
|
|
2561
|
+ #endif
|
|
2562
|
+
|
2550
|
2563
|
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers);
|
2551
|
2564
|
|
2552
|
2565
|
if (volumetric_enabled) {
|
|
@@ -3101,6 +3114,8 @@ void kill_screen(const char* lcd_msg) {
|
3101
|
3114
|
* void _menu_action_setting_edit_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue);
|
3102
|
3115
|
* void menu_action_setting_edit_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue);
|
3103
|
3116
|
* void menu_action_setting_edit_callback_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue, const screenFunc_t callback); // edit int with callback
|
|
3117
|
+ * void _menu_action_setting_edit_accessor_int3(const char * const pstr, int (*pget)(), void (*pset)(int), const int minValue, const int maxValue);
|
|
3118
|
+ * void menu_action_setting_edit_accessor_int3(const char * const pstr, int (*pget)(), void (*pset)(int), const int minValue, const int maxValue); // edit int via pget and pset accessor functions
|
3104
|
3119
|
*
|
3105
|
3120
|
* You can then use one of the menu macros to present the edit interface:
|
3106
|
3121
|
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
|
|
@@ -3112,6 +3127,9 @@ void kill_screen(const char* lcd_msg) {
|
3112
|
3127
|
* Also: MENU_MULTIPLIER_ITEM_EDIT, MENU_ITEM_EDIT_CALLBACK, and MENU_MULTIPLIER_ITEM_EDIT_CALLBACK
|
3113
|
3128
|
*
|
3114
|
3129
|
* menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
|
3130
|
+ *
|
|
3131
|
+ * Values that are get/set via functions (As opposed to global variables) can use the accessor form:
|
|
3132
|
+ * MENU_ITEM_EDIT_ACCESSOR(int3, MSG_SPEED, get_feedrate_percentage, set_feedrate_percentage, 10, 999)
|
3115
|
3133
|
*/
|
3116
|
3134
|
#define menu_edit_type(_type, _name, _strFunc, _scale) \
|
3117
|
3135
|
bool _menu_edit_ ## _name () { \
|
|
@@ -3121,7 +3139,11 @@ void kill_screen(const char* lcd_msg) {
|
3121
|
3139
|
if (lcdDrawUpdate) \
|
3122
|
3140
|
lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) * (1.0 / _scale))); \
|
3123
|
3141
|
if (lcd_clicked) { \
|
3124
|
|
- *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) * (1.0 / _scale); \
|
|
3142
|
+ _type value = ((_type)((int32_t)encoderPosition + minEditValue)) * (1.0 / _scale); \
|
|
3143
|
+ if (editValue != NULL) \
|
|
3144
|
+ *((_type*)editValue) = value; \
|
|
3145
|
+ else if (editSetter != NULL) \
|
|
3146
|
+ ((void (*)(_type))editSetter)(value); \
|
3125
|
3147
|
lcd_goto_previous_menu(); \
|
3126
|
3148
|
} \
|
3127
|
3149
|
return lcd_clicked; \
|
|
@@ -3135,6 +3157,7 @@ void kill_screen(const char* lcd_msg) {
|
3135
|
3157
|
\
|
3136
|
3158
|
editLabel = pstr; \
|
3137
|
3159
|
editValue = ptr; \
|
|
3160
|
+ editSetter = NULL; \
|
3138
|
3161
|
minEditValue = minValue * _scale; \
|
3139
|
3162
|
maxEditValue = maxValue * _scale - minEditValue; \
|
3140
|
3163
|
encoderPosition = (*ptr) * _scale - minEditValue; \
|
|
@@ -3142,12 +3165,28 @@ void kill_screen(const char* lcd_msg) {
|
3142
|
3165
|
void menu_action_setting_edit_ ## _name (const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue) { \
|
3143
|
3166
|
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
|
3144
|
3167
|
currentScreen = menu_edit_ ## _name; \
|
3145
|
|
- }\
|
|
3168
|
+ } \
|
3146
|
3169
|
void menu_action_setting_edit_callback_ ## _name (const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback) { \
|
3147
|
3170
|
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
|
3148
|
3171
|
currentScreen = menu_edit_callback_ ## _name; \
|
3149
|
3172
|
callbackFunc = callback; \
|
3150
|
3173
|
} \
|
|
3174
|
+ void _menu_action_setting_edit_accessor_ ## _name (const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue) { \
|
|
3175
|
+ lcd_save_previous_screen(); \
|
|
3176
|
+ \
|
|
3177
|
+ lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; \
|
|
3178
|
+ \
|
|
3179
|
+ editLabel = pstr; \
|
|
3180
|
+ editValue = NULL; \
|
|
3181
|
+ editSetter = pset; \
|
|
3182
|
+ minEditValue = minValue * _scale; \
|
|
3183
|
+ maxEditValue = maxValue * _scale - minEditValue; \
|
|
3184
|
+ encoderPosition = pget() * _scale - minEditValue; \
|
|
3185
|
+ } \
|
|
3186
|
+ void menu_action_setting_edit_accessor_ ## _name (const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue) { \
|
|
3187
|
+ _menu_action_setting_edit_accessor_ ## _name(pstr, pget, pset, minValue, maxValue); \
|
|
3188
|
+ currentScreen = menu_edit_ ## _name; \
|
|
3189
|
+ } \
|
3151
|
3190
|
typedef void _name
|
3152
|
3191
|
|
3153
|
3192
|
menu_edit_type(int, int3, itostr3, 1);
|
|
@@ -3252,6 +3291,11 @@ void kill_screen(const char* lcd_msg) {
|
3252
|
3291
|
menu_action_setting_edit_bool(pstr, ptr);
|
3253
|
3292
|
(*callback)();
|
3254
|
3293
|
}
|
|
3294
|
+ void menu_action_setting_edit_accessor_bool(const char* pstr, bool (*pget)(), void (*pset)(bool)) {
|
|
3295
|
+ UNUSED(pstr);
|
|
3296
|
+ pset(!pget());
|
|
3297
|
+ lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
|
3298
|
+ }
|
3255
|
3299
|
|
3256
|
3300
|
#endif // ULTIPANEL
|
3257
|
3301
|
|