|
@@ -181,8 +181,6 @@ uint16_t max_display_update_time = 0;
|
181
|
181
|
void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue); \
|
182
|
182
|
void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue); \
|
183
|
183
|
void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback); \
|
184
|
|
- void _menu_action_setting_edit_accessor_ ## _name(const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue); \
|
185
|
|
- void menu_action_setting_edit_accessor_ ## _name(const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue); \
|
186
|
184
|
typedef void _name##_void
|
187
|
185
|
|
188
|
186
|
DECLARE_MENU_EDIT_TYPE(int, int3);
|
|
@@ -197,7 +195,6 @@ uint16_t max_display_update_time = 0;
|
197
|
195
|
|
198
|
196
|
void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
|
199
|
197
|
void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
|
200
|
|
- void menu_action_setting_edit_accessor_bool(const char* pstr, bool (*pget)(), void (*pset)(bool));
|
201
|
198
|
|
202
|
199
|
#if ENABLED(SDSUPPORT)
|
203
|
200
|
void lcd_sdcard_menu();
|
|
@@ -300,15 +297,12 @@ uint16_t max_display_update_time = 0;
|
300
|
297
|
#define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0)
|
301
|
298
|
#define MENU_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
302
|
299
|
#define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
303
|
|
- #define MENU_ITEM_EDIT_ACCESSOR(type, label, ...) MENU_ITEM(setting_edit_accessor_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
304
|
300
|
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
305
|
301
|
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
306
|
302
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
307
|
|
- #define MENU_MULTIPLIER_ITEM_EDIT_ACCESSOR(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_accessor_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
308
|
303
|
#else //!ENCODER_RATE_MULTIPLIER
|
309
|
304
|
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
310
|
305
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
311
|
|
- #define MENU_MULTIPLIER_ITEM_EDIT_ACCESSOR(type, label, ...) MENU_ITEM(setting_edit_accessor_ ## type, label, PSTR(label), ## __VA_ARGS__)
|
312
|
306
|
#endif //!ENCODER_RATE_MULTIPLIER
|
313
|
307
|
|
314
|
308
|
/**
|
|
@@ -421,7 +415,7 @@ uint16_t max_display_update_time = 0;
|
421
|
415
|
|
422
|
416
|
// Value Editing
|
423
|
417
|
const char *editLabel;
|
424
|
|
- void *editValue, *editSetter;
|
|
418
|
+ void *editValue;
|
425
|
419
|
int32_t minEditValue, maxEditValue;
|
426
|
420
|
screenFunc_t callbackFunc;
|
427
|
421
|
|
|
@@ -2571,7 +2565,7 @@ void kill_screen(const char* lcd_msg) {
|
2571
|
2565
|
MENU_BACK(MSG_CONTROL);
|
2572
|
2566
|
|
2573
|
2567
|
#if ENABLED(LIN_ADVANCE)
|
2574
|
|
- MENU_ITEM_EDIT_ACCESSOR(float3, MSG_ADVANCE_K, planner.get_extruder_advance_k, planner.set_extruder_advance_k, 0, 999);
|
|
2568
|
+ MENU_ITEM_EDIT(float3, MSG_ADVANCE_K, &planner.extruder_advance_k, 0, 999);
|
2575
|
2569
|
#endif
|
2576
|
2570
|
|
2577
|
2571
|
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers);
|
|
@@ -3128,8 +3122,6 @@ void kill_screen(const char* lcd_msg) {
|
3128
|
3122
|
* void _menu_action_setting_edit_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue);
|
3129
|
3123
|
* void menu_action_setting_edit_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue);
|
3130
|
3124
|
* 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
|
3131
|
|
- * void _menu_action_setting_edit_accessor_int3(const char * const pstr, int (*pget)(), void (*pset)(int), const int minValue, const int maxValue);
|
3132
|
|
- * 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
|
3133
|
3125
|
*
|
3134
|
3126
|
* You can then use one of the menu macros to present the edit interface:
|
3135
|
3127
|
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
|
|
@@ -3141,9 +3133,6 @@ void kill_screen(const char* lcd_msg) {
|
3141
|
3133
|
* Also: MENU_MULTIPLIER_ITEM_EDIT, MENU_ITEM_EDIT_CALLBACK, and MENU_MULTIPLIER_ITEM_EDIT_CALLBACK
|
3142
|
3134
|
*
|
3143
|
3135
|
* menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
3144
|
|
- *
|
3145
|
|
- * Values that are get/set via functions (As opposed to global variables) can use the accessor form:
|
3146
|
|
- * MENU_ITEM_EDIT_ACCESSOR(int3, MSG_SPEED, get_feedrate_percentage, set_feedrate_percentage, 10, 999)
|
3147
|
3136
|
*/
|
3148
|
3137
|
#define DEFINE_MENU_EDIT_TYPE(_type, _name, _strFunc, _scale) \
|
3149
|
3138
|
bool _menu_edit_ ## _name () { \
|
|
@@ -3156,8 +3145,6 @@ void kill_screen(const char* lcd_msg) {
|
3156
|
3145
|
_type value = ((_type)((int32_t)encoderPosition + minEditValue)) * (1.0 / _scale); \
|
3157
|
3146
|
if (editValue != NULL) \
|
3158
|
3147
|
*((_type*)editValue) = value; \
|
3159
|
|
- else if (editSetter != NULL) \
|
3160
|
|
- ((void (*)(_type))editSetter)(value); \
|
3161
|
3148
|
lcd_goto_previous_menu(); \
|
3162
|
3149
|
} \
|
3163
|
3150
|
return lcd_clicked; \
|
|
@@ -3171,7 +3158,6 @@ void kill_screen(const char* lcd_msg) {
|
3171
|
3158
|
\
|
3172
|
3159
|
editLabel = pstr; \
|
3173
|
3160
|
editValue = ptr; \
|
3174
|
|
- editSetter = NULL; \
|
3175
|
3161
|
minEditValue = minValue * _scale; \
|
3176
|
3162
|
maxEditValue = maxValue * _scale - minEditValue; \
|
3177
|
3163
|
encoderPosition = (*ptr) * _scale - minEditValue; \
|
|
@@ -3185,22 +3171,6 @@ void kill_screen(const char* lcd_msg) {
|
3185
|
3171
|
currentScreen = menu_edit_callback_ ## _name; \
|
3186
|
3172
|
callbackFunc = callback; \
|
3187
|
3173
|
} \
|
3188
|
|
- void _menu_action_setting_edit_accessor_ ## _name (const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue) { \
|
3189
|
|
- lcd_save_previous_screen(); \
|
3190
|
|
- \
|
3191
|
|
- lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; \
|
3192
|
|
- \
|
3193
|
|
- editLabel = pstr; \
|
3194
|
|
- editValue = NULL; \
|
3195
|
|
- editSetter = pset; \
|
3196
|
|
- minEditValue = minValue * _scale; \
|
3197
|
|
- maxEditValue = maxValue * _scale - minEditValue; \
|
3198
|
|
- encoderPosition = pget() * _scale - minEditValue; \
|
3199
|
|
- } \
|
3200
|
|
- void menu_action_setting_edit_accessor_ ## _name (const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue) { \
|
3201
|
|
- _menu_action_setting_edit_accessor_ ## _name(pstr, pget, pset, minValue, maxValue); \
|
3202
|
|
- currentScreen = menu_edit_ ## _name; \
|
3203
|
|
- } \
|
3204
|
3174
|
typedef void _name
|
3205
|
3175
|
|
3206
|
3176
|
DEFINE_MENU_EDIT_TYPE(int, int3, itostr3, 1);
|
|
@@ -3305,11 +3275,6 @@ void kill_screen(const char* lcd_msg) {
|
3305
|
3275
|
menu_action_setting_edit_bool(pstr, ptr);
|
3306
|
3276
|
(*callback)();
|
3307
|
3277
|
}
|
3308
|
|
- void menu_action_setting_edit_accessor_bool(const char* pstr, bool (*pget)(), void (*pset)(bool)) {
|
3309
|
|
- UNUSED(pstr);
|
3310
|
|
- pset(!pget());
|
3311
|
|
- lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
3312
|
|
- }
|
3313
|
3278
|
|
3314
|
3279
|
#endif // ULTIPANEL
|
3315
|
3280
|
|