|
@@ -2328,9 +2328,9 @@ void kill_screen(const char* lcd_msg) {
|
2328
|
2328
|
* bool _menu_edit_int3();
|
2329
|
2329
|
* void menu_edit_int3(); // edit int (interactively)
|
2330
|
2330
|
* void menu_edit_callback_int3(); // edit int (interactively) with callback on completion
|
2331
|
|
- * void _menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
|
2332
|
|
- * void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
|
2333
|
|
- * void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callback); // edit int with callback
|
|
2331
|
+ * void _menu_action_setting_edit_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue);
|
|
2332
|
+ * void menu_action_setting_edit_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue);
|
|
2333
|
+ * 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
|
2334
|
2334
|
*
|
2335
|
2335
|
* You can then use one of the menu macros to present the edit interface:
|
2336
|
2336
|
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
|
|
@@ -2343,51 +2343,52 @@ void kill_screen(const char* lcd_msg) {
|
2343
|
2343
|
*
|
2344
|
2344
|
* menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
|
2345
|
2345
|
*/
|
2346
|
|
- #define menu_edit_type(_type, _name, _strFunc, scale) \
|
|
2346
|
+ #define menu_edit_type(_type, _name, _strFunc, _scale) \
|
2347
|
2347
|
bool _menu_edit_ ## _name () { \
|
2348
|
2348
|
ENCODER_DIRECTION_NORMAL(); \
|
2349
|
2349
|
if ((int32_t)encoderPosition < 0) encoderPosition = 0; \
|
2350
|
2350
|
if ((int32_t)encoderPosition > maxEditValue) encoderPosition = maxEditValue; \
|
2351
|
2351
|
if (lcdDrawUpdate) \
|
2352
|
|
- lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
|
|
2352
|
+ lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) * (1.0 / _scale))); \
|
2353
|
2353
|
if (lcd_clicked) { \
|
2354
|
|
- *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
|
|
2354
|
+ *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) * (1.0 / _scale); \
|
2355
|
2355
|
lcd_goto_previous_menu(); \
|
2356
|
2356
|
} \
|
2357
|
2357
|
return lcd_clicked; \
|
2358
|
2358
|
} \
|
2359
|
2359
|
void menu_edit_ ## _name () { _menu_edit_ ## _name(); } \
|
2360
|
2360
|
void menu_edit_callback_ ## _name () { if (_menu_edit_ ## _name ()) (*callbackFunc)(); } \
|
2361
|
|
- void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
|
|
2361
|
+ void _menu_action_setting_edit_ ## _name (const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue) { \
|
2362
|
2362
|
lcd_save_previous_screen(); \
|
2363
|
2363
|
\
|
2364
|
2364
|
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; \
|
2365
|
2365
|
\
|
2366
|
2366
|
editLabel = pstr; \
|
2367
|
2367
|
editValue = ptr; \
|
2368
|
|
- minEditValue = minValue * scale; \
|
2369
|
|
- maxEditValue = maxValue * scale - minEditValue; \
|
2370
|
|
- encoderPosition = (*ptr) * scale - minEditValue; \
|
|
2368
|
+ minEditValue = minValue * _scale; \
|
|
2369
|
+ maxEditValue = maxValue * _scale - minEditValue; \
|
|
2370
|
+ encoderPosition = (*ptr) * _scale - minEditValue; \
|
2371
|
2371
|
} \
|
2372
|
|
- void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
|
|
2372
|
+ void menu_action_setting_edit_ ## _name (const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue) { \
|
2373
|
2373
|
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
|
2374
|
2374
|
currentScreen = menu_edit_ ## _name; \
|
2375
|
2375
|
}\
|
2376
|
|
- void menu_action_setting_edit_callback_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue, screenFunc_t callback) { \
|
|
2376
|
+ void menu_action_setting_edit_callback_ ## _name (const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback) { \
|
2377
|
2377
|
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
|
2378
|
2378
|
currentScreen = menu_edit_callback_ ## _name; \
|
2379
|
2379
|
callbackFunc = callback; \
|
2380
|
|
- }
|
2381
|
|
-
|
2382
|
|
- menu_edit_type(int, int3, itostr3, 1)
|
2383
|
|
- menu_edit_type(float, float3, ftostr3, 1)
|
2384
|
|
- menu_edit_type(float, float32, ftostr32, 100)
|
2385
|
|
- menu_edit_type(float, float43, ftostr43sign, 1000)
|
2386
|
|
- menu_edit_type(float, float5, ftostr5rj, 0.01)
|
2387
|
|
- menu_edit_type(float, float51, ftostr51sign, 10)
|
2388
|
|
- menu_edit_type(float, float52, ftostr52sign, 100)
|
2389
|
|
- menu_edit_type(float, float62, ftostr62sign, 100)
|
2390
|
|
- menu_edit_type(unsigned long, long5, ftostr5rj, 0.01)
|
|
2380
|
+ } \
|
|
2381
|
+ typedef void _name
|
|
2382
|
+
|
|
2383
|
+ menu_edit_type(int, int3, itostr3, 1);
|
|
2384
|
+ menu_edit_type(float, float3, ftostr3, 1.0);
|
|
2385
|
+ menu_edit_type(float, float32, ftostr32, 100.0);
|
|
2386
|
+ menu_edit_type(float, float43, ftostr43sign, 1000.0);
|
|
2387
|
+ menu_edit_type(float, float5, ftostr5rj, 0.01);
|
|
2388
|
+ menu_edit_type(float, float51, ftostr51sign, 10.0);
|
|
2389
|
+ menu_edit_type(float, float52, ftostr52sign, 100.0);
|
|
2390
|
+ menu_edit_type(float, float62, ftostr62sign, 100.0);
|
|
2391
|
+ menu_edit_type(unsigned long, long5, ftostr5rj, 0.01);
|
2391
|
2392
|
|
2392
|
2393
|
/**
|
2393
|
2394
|
*
|