Tweak lambdas

This commit is contained in:
Scott Lahteine 2019-11-02 00:05:05 -05:00
parent a7d7f36871
commit 23d21dd81c
13 changed files with 118 additions and 118 deletions

View file

@ -61,7 +61,7 @@ void menu_cancelobject();
LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i); LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i);
START_MENU(); START_MENU();
BACK_ITEM(MSG_ADVANCED_SETTINGS); BACK_ITEM(MSG_ADVANCED_SETTINGS);
#define EDIT_DAC_PERCENT(A) EDIT_ITEM(uint8, MSG_##A " " MSG_DAC_PERCENT, &driverPercent[_AXIS(A)], 0, 100, [](){ dac_current_set_percents(driverPercent); }) #define EDIT_DAC_PERCENT(A) EDIT_ITEM(uint8, MSG_##A " " MSG_DAC_PERCENT, &driverPercent[_AXIS(A)], 0, 100, []{ dac_current_set_percents(driverPercent); })
EDIT_DAC_PERCENT(X); EDIT_DAC_PERCENT(X);
EDIT_DAC_PERCENT(Y); EDIT_DAC_PERCENT(Y);
EDIT_DAC_PERCENT(Z); EDIT_DAC_PERCENT(Z);
@ -348,8 +348,8 @@ void menu_cancelobject();
raw_Ki = unscalePID_i(PID_PARAM(Ki, N)); \ raw_Ki = unscalePID_i(PID_PARAM(Ki, N)); \
raw_Kd = unscalePID_d(PID_PARAM(Kd, N)); \ raw_Kd = unscalePID_d(PID_PARAM(Kd, N)); \
EDIT_ITEM(float52sign, PID_LABEL(MSG_PID_P,N), &PID_PARAM(Kp, N), 1, 9990); \ EDIT_ITEM(float52sign, PID_LABEL(MSG_PID_P,N), &PID_PARAM(Kp, N), 1, 9990); \
EDIT_ITEM(float52sign, PID_LABEL(MSG_PID_I,N), &raw_Ki, 0.01f, 9990, [](){ copy_and_scalePID_i(N); }); \ EDIT_ITEM(float52sign, PID_LABEL(MSG_PID_I,N), &raw_Ki, 0.01f, 9990, []{ copy_and_scalePID_i(N); }); \
EDIT_ITEM(float52sign, PID_LABEL(MSG_PID_D,N), &raw_Kd, 1, 9990, [](){ copy_and_scalePID_d(N); }) EDIT_ITEM(float52sign, PID_LABEL(MSG_PID_D,N), &raw_Kd, 1, 9990, []{ copy_and_scalePID_d(N); })
#if ENABLED(PID_EXTRUSION_SCALING) #if ENABLED(PID_EXTRUSION_SCALING)
#define _PID_EDIT_MENU_ITEMS(N) \ #define _PID_EDIT_MENU_ITEMS(N) \
@ -368,7 +368,7 @@ void menu_cancelobject();
#if ENABLED(PID_AUTOTUNE_MENU) #if ENABLED(PID_AUTOTUNE_MENU)
#define PID_EDIT_MENU_ITEMS(N) \ #define PID_EDIT_MENU_ITEMS(N) \
_PID_EDIT_MENU_ITEMS(N); \ _PID_EDIT_MENU_ITEMS(N); \
EDIT_ITEM_FAST(int3, PID_LABEL(MSG_AUTOTUNE_PID,N), &autotune_temp[N], 150, heater_maxtemp[N] - 15, [](){ _lcd_autotune(N); }) EDIT_ITEM_FAST(int3, PID_LABEL(MSG_AUTOTUNE_PID,N), &autotune_temp[N], 150, heater_maxtemp[N] - 15, []{ _lcd_autotune(N); })
#else #else
#define PID_EDIT_MENU_ITEMS(N) _PID_EDIT_MENU_ITEMS(N) #define PID_EDIT_MENU_ITEMS(N) _PID_EDIT_MENU_ITEMS(N)
#endif #endif
@ -493,15 +493,15 @@ void menu_cancelobject();
const xyze_ulong_t &max_accel_edit_scaled = max_accel_edit; const xyze_ulong_t &max_accel_edit_scaled = max_accel_edit;
#endif #endif
#define EDIT_AMAX(Q,L) EDIT_ITEM_FAST(long5_25, MSG_AMAX_##Q, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], [](){ planner.reset_acceleration_rates(); }) #define EDIT_AMAX(Q,L) EDIT_ITEM_FAST(long5_25, MSG_AMAX_##Q, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], []{ planner.reset_acceleration_rates(); })
EDIT_AMAX(A,100); EDIT_AMAX(A,100);
EDIT_AMAX(B,100); EDIT_AMAX(B,100);
EDIT_AMAX(C, 10); EDIT_AMAX(C, 10);
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
#define EDIT_AMAX_E(N) EDIT_ITEM_FAST(long5_25, MSG_AMAX_E##N, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(N)], 100, max_accel_edit_scaled.e, [](){ _reset_e_acceleration_rate(N); }) #define EDIT_AMAX_E(N) EDIT_ITEM_FAST(long5_25, MSG_AMAX_E##N, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(N)], 100, max_accel_edit_scaled.e, []{ _reset_e_acceleration_rate(N); })
EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, [](){ planner.reset_acceleration_rates(); }); EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); });
EDIT_AMAX_E(0); EDIT_AMAX_E(0);
EDIT_AMAX_E(1); EDIT_AMAX_E(1);
#if E_STEPPERS > 2 #if E_STEPPERS > 2
@ -517,7 +517,7 @@ void menu_cancelobject();
#endif // E_STEPPERS > 3 #endif // E_STEPPERS > 3
#endif // E_STEPPERS > 2 #endif // E_STEPPERS > 2
#elif E_STEPPERS #elif E_STEPPERS
EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, [](){ planner.reset_acceleration_rates(); }); EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); });
#endif #endif
END_MENU(); END_MENU();
@ -566,14 +566,14 @@ void menu_cancelobject();
START_MENU(); START_MENU();
BACK_ITEM(MSG_ADVANCED_SETTINGS); BACK_ITEM(MSG_ADVANCED_SETTINGS);
#define EDIT_QSTEPS(Q) EDIT_ITEM_FAST(float51, MSG_##Q##_STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, [](){ planner.refresh_positioning(); }) #define EDIT_QSTEPS(Q) EDIT_ITEM_FAST(float51, MSG_##Q##_STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, []{ planner.refresh_positioning(); })
EDIT_QSTEPS(A); EDIT_QSTEPS(A);
EDIT_QSTEPS(B); EDIT_QSTEPS(B);
EDIT_QSTEPS(C); EDIT_QSTEPS(C);
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
#define EDIT_ESTEPS(N) EDIT_ITEM_FAST(float51, MSG_E##N##_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(N)], 5, 9999, [](){ _planner_refresh_e_positioning(N); }) #define EDIT_ESTEPS(N) EDIT_ITEM_FAST(float51, MSG_E##N##_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(N)], 5, 9999, []{ _planner_refresh_e_positioning(N); })
EDIT_ITEM_FAST(float51, MSG_E_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(active_extruder)], 5, 9999, [](){ planner.refresh_positioning(); }); EDIT_ITEM_FAST(float51, MSG_E_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(active_extruder)], 5, 9999, []{ planner.refresh_positioning(); });
EDIT_ESTEPS(0); EDIT_ESTEPS(0);
EDIT_ESTEPS(1); EDIT_ESTEPS(1);
#if E_STEPPERS > 2 #if E_STEPPERS > 2
@ -589,7 +589,7 @@ void menu_cancelobject();
#endif // E_STEPPERS > 3 #endif // E_STEPPERS > 3
#endif // E_STEPPERS > 2 #endif // E_STEPPERS > 2
#elif E_STEPPERS #elif E_STEPPERS
EDIT_ITEM_FAST(float51, MSG_E_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, [](){ planner.refresh_positioning(); }); EDIT_ITEM_FAST(float51, MSG_E_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, []{ planner.refresh_positioning(); });
#endif #endif
END_MENU(); END_MENU();
@ -631,7 +631,7 @@ void menu_advanced_settings() {
// //
// Set Home Offsets // Set Home Offsets
// //
ACTION_ITEM(MSG_SET_HOME_OFFSETS, [](){ queue.inject_P(PSTR("M428")); ui.return_to_status(); }); ACTION_ITEM(MSG_SET_HOME_OFFSETS, []{ queue.inject_P(PSTR("M428")); ui.return_to_status(); });
#endif #endif
// M203 / M205 - Feedrate items // M203 / M205 - Feedrate items
@ -654,7 +654,7 @@ void menu_advanced_settings() {
#endif #endif
#if ENABLED(CANCEL_OBJECTS) #if ENABLED(CANCEL_OBJECTS)
SUBMENU(MSG_CANCEL_OBJECT, [](){ editable.int8 = -1; ui.goto_screen(menu_cancelobject); }); SUBMENU(MSG_CANCEL_OBJECT, []{ editable.int8 = -1; ui.goto_screen(menu_cancelobject); });
#endif #endif
#if ENABLED(DAC_STEPPER_CURRENT) #if ENABLED(DAC_STEPPER_CURRENT)

View file

@ -268,7 +268,7 @@ void menu_bed_leveling() {
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
// Shadow for editing the fade height // Shadow for editing the fade height
editable.decimal = planner.z_fade_height; editable.decimal = planner.z_fade_height;
EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, [](){ set_z_fade_height(editable.decimal); }); EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); });
#endif #endif
// //

View file

@ -399,7 +399,7 @@ void menu_configuration() {
#endif #endif
if (!busy) if (!busy)
ACTION_ITEM(MSG_RESTORE_FAILSAFE, [](){ ACTION_ITEM(MSG_RESTORE_FAILSAFE, []{
settings.reset(); settings.reset();
#if HAS_BUZZER #if HAS_BUZZER
ui.completion_feedback(); ui.completion_feedback();

View file

@ -51,19 +51,19 @@ void menu_user() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_MAIN); BACK_ITEM(MSG_MAIN);
#if defined(USER_DESC_1) && defined(USER_GCODE_1) #if defined(USER_DESC_1) && defined(USER_GCODE_1)
ACTION_ITEM_P(PSTR(USER_DESC_1), [](){ _lcd_user_gcode(PSTR(USER_GCODE_1 _DONE_SCRIPT)); }); ACTION_ITEM_P(PSTR(USER_DESC_1), []{ _lcd_user_gcode(PSTR(USER_GCODE_1 _DONE_SCRIPT)); });
#endif #endif
#if defined(USER_DESC_2) && defined(USER_GCODE_2) #if defined(USER_DESC_2) && defined(USER_GCODE_2)
ACTION_ITEM_P(PSTR(USER_DESC_2), [](){ _lcd_user_gcode(PSTR(USER_GCODE_2 _DONE_SCRIPT)); }); ACTION_ITEM_P(PSTR(USER_DESC_2), []{ _lcd_user_gcode(PSTR(USER_GCODE_2 _DONE_SCRIPT)); });
#endif #endif
#if defined(USER_DESC_3) && defined(USER_GCODE_3) #if defined(USER_DESC_3) && defined(USER_GCODE_3)
ACTION_ITEM_P(PSTR(USER_DESC_3), [](){ _lcd_user_gcode(PSTR(USER_GCODE_3 _DONE_SCRIPT)); }); ACTION_ITEM_P(PSTR(USER_DESC_3), []{ _lcd_user_gcode(PSTR(USER_GCODE_3 _DONE_SCRIPT)); });
#endif #endif
#if defined(USER_DESC_4) && defined(USER_GCODE_4) #if defined(USER_DESC_4) && defined(USER_GCODE_4)
ACTION_ITEM_P(PSTR(USER_DESC_4), [](){ _lcd_user_gcode(PSTR(USER_GCODE_4 _DONE_SCRIPT)); }); ACTION_ITEM_P(PSTR(USER_DESC_4), []{ _lcd_user_gcode(PSTR(USER_GCODE_4 _DONE_SCRIPT)); });
#endif #endif
#if defined(USER_DESC_5) && defined(USER_GCODE_5) #if defined(USER_DESC_5) && defined(USER_GCODE_5)
ACTION_ITEM_P(PSTR(USER_DESC_5), [](){ _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); }); ACTION_ITEM_P(PSTR(USER_DESC_5), []{ _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); });
#endif #endif
END_MENU(); END_MENU();
} }

View file

@ -84,9 +84,9 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
START_MENU(); START_MENU();
if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), SS_CENTER|SS_INVERT); if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), SS_CENTER|SS_INVERT);
BACK_ITEM(MSG_BACK); BACK_ITEM(MSG_BACK);
ACTION_ITEM(MSG_PREHEAT_1, [](){ _change_filament_temp(ui.preheat_hotend_temp[0]); }); ACTION_ITEM(MSG_PREHEAT_1, []{ _change_filament_temp(ui.preheat_hotend_temp[0]); });
ACTION_ITEM(MSG_PREHEAT_2, [](){ _change_filament_temp(ui.preheat_hotend_temp[1]); }); ACTION_ITEM(MSG_PREHEAT_2, []{ _change_filament_temp(ui.preheat_hotend_temp[1]); });
EDIT_ITEM_FAST(int3, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[_change_filament_temp_extruder].target, EXTRUDE_MINTEMP, heater_maxtemp[extruder] - 15, [](){ EDIT_ITEM_FAST(int3, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[_change_filament_temp_extruder].target, EXTRUDE_MINTEMP, heater_maxtemp[extruder] - 15, []{
_change_filament_temp(thermalManager.temp_hotend[_change_filament_temp_extruder].target); _change_filament_temp(thermalManager.temp_hotend[_change_filament_temp_extruder].target);
}); });
END_MENU(); END_MENU();
@ -109,42 +109,42 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
#if E_STEPPERS == 1 #if E_STEPPERS == 1
PGM_P const msg0 = GET_TEXT(MSG_FILAMENTCHANGE); PGM_P const msg0 = GET_TEXT(MSG_FILAMENTCHANGE);
if (thermalManager.targetTooColdToExtrude(active_extruder)) if (thermalManager.targetTooColdToExtrude(active_extruder))
MENU_ITEM_P(submenu, msg0, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 0); }); MENU_ITEM_P(submenu, msg0, []{ _menu_temp_filament_op(PauseMode(editable.int8), 0); });
else else
MENU_ITEM_P(gcode, msg0, PSTR("M600 B0")); MENU_ITEM_P(gcode, msg0, PSTR("M600 B0"));
#else #else
PGM_P const msg0 = GET_TEXT(MSG_FILAMENTCHANGE_E0); PGM_P const msg0 = GET_TEXT(MSG_FILAMENTCHANGE_E0);
PGM_P const msg1 = GET_TEXT(MSG_FILAMENTCHANGE_E1); PGM_P const msg1 = GET_TEXT(MSG_FILAMENTCHANGE_E1);
if (thermalManager.targetTooColdToExtrude(0)) if (thermalManager.targetTooColdToExtrude(0))
MENU_ITEM_P(submenu, msg0, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 0); }); MENU_ITEM_P(submenu, msg0, []{ _menu_temp_filament_op(PauseMode(editable.int8), 0); });
else else
MENU_ITEM_P(gcode, msg0, PSTR("M600 B0 T0")); MENU_ITEM_P(gcode, msg0, PSTR("M600 B0 T0"));
if (thermalManager.targetTooColdToExtrude(1)) if (thermalManager.targetTooColdToExtrude(1))
MENU_ITEM_P(submenu, msg1, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 1); }); MENU_ITEM_P(submenu, msg1, []{ _menu_temp_filament_op(PauseMode(editable.int8), 1); });
else else
MENU_ITEM_P(gcode, msg1, PSTR("M600 B0 T1")); MENU_ITEM_P(gcode, msg1, PSTR("M600 B0 T1"));
#if E_STEPPERS > 2 #if E_STEPPERS > 2
PGM_P const msg2 = GET_TEXT(MSG_FILAMENTCHANGE_E2); PGM_P const msg2 = GET_TEXT(MSG_FILAMENTCHANGE_E2);
if (thermalManager.targetTooColdToExtrude(2)) if (thermalManager.targetTooColdToExtrude(2))
MENU_ITEM_P(submenu, msg2, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 2); }); MENU_ITEM_P(submenu, msg2, []{ _menu_temp_filament_op(PauseMode(editable.int8), 2); });
else else
MENU_ITEM_P(gcode, msg2, PSTR("M600 B0 T2")); MENU_ITEM_P(gcode, msg2, PSTR("M600 B0 T2"));
#if E_STEPPERS > 3 #if E_STEPPERS > 3
PGM_P const msg3 = GET_TEXT(MSG_FILAMENTCHANGE_E3); PGM_P const msg3 = GET_TEXT(MSG_FILAMENTCHANGE_E3);
if (thermalManager.targetTooColdToExtrude(3)) if (thermalManager.targetTooColdToExtrude(3))
MENU_ITEM_P(submenu, msg3, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 3); }); MENU_ITEM_P(submenu, msg3, []{ _menu_temp_filament_op(PauseMode(editable.int8), 3); });
else else
MENU_ITEM_P(gcode, msg3, PSTR("M600 B0 T3")); MENU_ITEM_P(gcode, msg3, PSTR("M600 B0 T3"));
#if E_STEPPERS > 4 #if E_STEPPERS > 4
PGM_P const msg4 = GET_TEXT(MSG_FILAMENTCHANGE_E4); PGM_P const msg4 = GET_TEXT(MSG_FILAMENTCHANGE_E4);
if (thermalManager.targetTooColdToExtrude(4)) if (thermalManager.targetTooColdToExtrude(4))
MENU_ITEM_P(submenu, msg4, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 4); }); MENU_ITEM_P(submenu, msg4, []{ _menu_temp_filament_op(PauseMode(editable.int8), 4); });
else else
MENU_ITEM_P(gcode, msg4, PSTR("M600 B0 T4")); MENU_ITEM_P(gcode, msg4, PSTR("M600 B0 T4"));
#if E_STEPPERS > 5 #if E_STEPPERS > 5
PGM_P const msg5 = GET_TEXT(MSG_FILAMENTCHANGE_E5); PGM_P const msg5 = GET_TEXT(MSG_FILAMENTCHANGE_E5);
if (thermalManager.targetTooColdToExtrude(5)) if (thermalManager.targetTooColdToExtrude(5))
MENU_ITEM_P(submenu, msg5, [](){ _menu_temp_filament_op(PauseMode(editable.int8), 5); }); MENU_ITEM_P(submenu, msg5, []{ _menu_temp_filament_op(PauseMode(editable.int8), 5); });
else else
MENU_ITEM_P(gcode, msg5, PSTR("M600 B0 T5")); MENU_ITEM_P(gcode, msg5, PSTR("M600 B0 T5"));
#endif // E_STEPPERS > 5 #endif // E_STEPPERS > 5
@ -159,42 +159,42 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
#if E_STEPPERS == 1 #if E_STEPPERS == 1
PGM_P const msg0 = GET_TEXT(MSG_FILAMENTLOAD); PGM_P const msg0 = GET_TEXT(MSG_FILAMENTLOAD);
if (thermalManager.targetTooColdToExtrude(active_extruder)) if (thermalManager.targetTooColdToExtrude(active_extruder))
MENU_ITEM_P(submenu, msg0, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); }); MENU_ITEM_P(submenu, msg0, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); });
else else
MENU_ITEM_P(gcode, msg0, PSTR("M701")); MENU_ITEM_P(gcode, msg0, PSTR("M701"));
#else #else
PGM_P const msg0 = GET_TEXT(MSG_FILAMENTLOAD_E0); PGM_P const msg0 = GET_TEXT(MSG_FILAMENTLOAD_E0);
PGM_P const msg1 = GET_TEXT(MSG_FILAMENTLOAD_E1); PGM_P const msg1 = GET_TEXT(MSG_FILAMENTLOAD_E1);
if (thermalManager.targetTooColdToExtrude(0)) if (thermalManager.targetTooColdToExtrude(0))
MENU_ITEM_P(submenu, msg0, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); }); MENU_ITEM_P(submenu, msg0, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); });
else else
MENU_ITEM_P(gcode, msg0, PSTR("M701 T0")); MENU_ITEM_P(gcode, msg0, PSTR("M701 T0"));
if (thermalManager.targetTooColdToExtrude(1)) if (thermalManager.targetTooColdToExtrude(1))
MENU_ITEM_P(submenu, msg1, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 1); }); MENU_ITEM_P(submenu, msg1, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 1); });
else else
MENU_ITEM_P(gcode, msg1, PSTR("M701 T1")); MENU_ITEM_P(gcode, msg1, PSTR("M701 T1"));
#if E_STEPPERS > 2 #if E_STEPPERS > 2
PGM_P const msg2 = GET_TEXT(MSG_FILAMENTLOAD_E2); PGM_P const msg2 = GET_TEXT(MSG_FILAMENTLOAD_E2);
if (thermalManager.targetTooColdToExtrude(2)) if (thermalManager.targetTooColdToExtrude(2))
MENU_ITEM_P(submenu, msg2, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 2); }); MENU_ITEM_P(submenu, msg2, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 2); });
else else
MENU_ITEM_P(gcode, msg2, PSTR("M701 T2")); MENU_ITEM_P(gcode, msg2, PSTR("M701 T2"));
#if E_STEPPERS > 3 #if E_STEPPERS > 3
PGM_P const msg3 = GET_TEXT(MSG_FILAMENTLOAD_E3); PGM_P const msg3 = GET_TEXT(MSG_FILAMENTLOAD_E3);
if (thermalManager.targetTooColdToExtrude(3)) if (thermalManager.targetTooColdToExtrude(3))
MENU_ITEM_P(submenu, msg3, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 3); }); MENU_ITEM_P(submenu, msg3, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 3); });
else else
MENU_ITEM_P(gcode, msg3, PSTR("M701 T3")); MENU_ITEM_P(gcode, msg3, PSTR("M701 T3"));
#if E_STEPPERS > 4 #if E_STEPPERS > 4
PGM_P const msg4 = GET_TEXT(MSG_FILAMENTLOAD_E4); PGM_P const msg4 = GET_TEXT(MSG_FILAMENTLOAD_E4);
if (thermalManager.targetTooColdToExtrude(4)) if (thermalManager.targetTooColdToExtrude(4))
MENU_ITEM_P(submenu, msg4, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 4); }); MENU_ITEM_P(submenu, msg4, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 4); });
else else
MENU_ITEM_P(gcode, msg4, PSTR("M701 T4")); MENU_ITEM_P(gcode, msg4, PSTR("M701 T4"));
#if E_STEPPERS > 5 #if E_STEPPERS > 5
PGM_P const msg5 = GET_TEXT(MSG_FILAMENTLOAD_E5); PGM_P const msg5 = GET_TEXT(MSG_FILAMENTLOAD_E5);
if (thermalManager.targetTooColdToExtrude(5)) if (thermalManager.targetTooColdToExtrude(5))
MENU_ITEM_P(submenu, msg5, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 5); }); MENU_ITEM_P(submenu, msg5, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 5); });
else else
MENU_ITEM_P(gcode, msg5, PSTR("M701 T5")); MENU_ITEM_P(gcode, msg5, PSTR("M701 T5"));
#endif // E_STEPPERS > 5 #endif // E_STEPPERS > 5
@ -208,7 +208,7 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
if (thermalManager.targetHotEnoughToExtrude(active_extruder)) if (thermalManager.targetHotEnoughToExtrude(active_extruder))
GCODES_ITEM(MSG_FILAMENTUNLOAD, PSTR("M702")); GCODES_ITEM(MSG_FILAMENTUNLOAD, PSTR("M702"));
else else
SUBMENU(MSG_FILAMENTUNLOAD, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); }); SUBMENU(MSG_FILAMENTUNLOAD, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); });
#else #else
#if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
if (JOIN_N(E_STEPPERS, &&, if (JOIN_N(E_STEPPERS, &&,
@ -220,36 +220,36 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
thermalManager.targetHotEnoughToExtrude(5)) thermalManager.targetHotEnoughToExtrude(5))
) GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, PSTR("M702")); ) GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, PSTR("M702"));
else else
SUBMENU(MSG_FILAMENTUNLOAD_ALL, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, -1); }); SUBMENU(MSG_FILAMENTUNLOAD_ALL, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, -1); });
#endif #endif
if (thermalManager.targetHotEnoughToExtrude(0)) if (thermalManager.targetHotEnoughToExtrude(0))
GCODES_ITEM(MSG_FILAMENTUNLOAD_E0, PSTR("M702 T0")); GCODES_ITEM(MSG_FILAMENTUNLOAD_E0, PSTR("M702 T0"));
else else
SUBMENU(MSG_FILAMENTUNLOAD_E0, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); }); SUBMENU(MSG_FILAMENTUNLOAD_E0, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); });
if (thermalManager.targetHotEnoughToExtrude(1)) if (thermalManager.targetHotEnoughToExtrude(1))
GCODES_ITEM(MSG_FILAMENTUNLOAD_E1, PSTR("M702 T1")); GCODES_ITEM(MSG_FILAMENTUNLOAD_E1, PSTR("M702 T1"));
else else
SUBMENU(MSG_FILAMENTUNLOAD_E1, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 1); }); SUBMENU(MSG_FILAMENTUNLOAD_E1, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 1); });
#if E_STEPPERS > 2 #if E_STEPPERS > 2
if (thermalManager.targetHotEnoughToExtrude(2)) if (thermalManager.targetHotEnoughToExtrude(2))
GCODES_ITEM(MSG_FILAMENTUNLOAD_E2, PSTR("M702 T2")); GCODES_ITEM(MSG_FILAMENTUNLOAD_E2, PSTR("M702 T2"));
else else
SUBMENU(MSG_FILAMENTUNLOAD_E2, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 2); }); SUBMENU(MSG_FILAMENTUNLOAD_E2, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 2); });
#if E_STEPPERS > 3 #if E_STEPPERS > 3
if (thermalManager.targetHotEnoughToExtrude(3)) if (thermalManager.targetHotEnoughToExtrude(3))
GCODES_ITEM(MSG_FILAMENTUNLOAD_E3, PSTR("M702 T3")); GCODES_ITEM(MSG_FILAMENTUNLOAD_E3, PSTR("M702 T3"));
else else
SUBMENU(MSG_FILAMENTUNLOAD_E3, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 3); }); SUBMENU(MSG_FILAMENTUNLOAD_E3, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 3); });
#if E_STEPPERS > 4 #if E_STEPPERS > 4
if (thermalManager.targetHotEnoughToExtrude(4)) if (thermalManager.targetHotEnoughToExtrude(4))
GCODES_ITEM(MSG_FILAMENTUNLOAD_E4, PSTR("M702 T4")); GCODES_ITEM(MSG_FILAMENTUNLOAD_E4, PSTR("M702 T4"));
else else
SUBMENU(MSG_FILAMENTUNLOAD_E4, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 4); }); SUBMENU(MSG_FILAMENTUNLOAD_E4, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 4); });
#if E_STEPPERS > 5 #if E_STEPPERS > 5
if (thermalManager.targetHotEnoughToExtrude(5)) if (thermalManager.targetHotEnoughToExtrude(5))
GCODES_ITEM(MSG_FILAMENTUNLOAD_E5, PSTR("M702 T5")); GCODES_ITEM(MSG_FILAMENTUNLOAD_E5, PSTR("M702 T5"));
else else
SUBMENU(MSG_FILAMENTUNLOAD_E5, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 5); }); SUBMENU(MSG_FILAMENTUNLOAD_E5, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 5); });
#endif // E_STEPPERS > 5 #endif // E_STEPPERS > 5
#endif // E_STEPPERS > 4 #endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3 #endif // E_STEPPERS > 3
@ -298,13 +298,13 @@ void menu_pause_option() {
#if LCD_HEIGHT > 2 #if LCD_HEIGHT > 2
STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER); STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER);
#endif #endif
ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_PURGE, [](){ pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; }); ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_PURGE, []{ pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; });
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR
if (runout.filament_ran_out) if (runout.filament_ran_out)
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset); EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset);
else else
#endif #endif
ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_RESUME, [](){ pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; }); ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_RESUME, []{ pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; });
END_MENU(); END_MENU();
} }

View file

@ -182,7 +182,7 @@ void menu_main() {
if (thermalManager.targetHotEnoughToExtrude(active_extruder)) if (thermalManager.targetHotEnoughToExtrude(active_extruder))
GCODES_ITEM(MSG_FILAMENTCHANGE, PSTR("M600 B0")); GCODES_ITEM(MSG_FILAMENTCHANGE, PSTR("M600 B0"));
else else
SUBMENU(MSG_FILAMENTCHANGE, [](){ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); }); SUBMENU(MSG_FILAMENTCHANGE, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); });
#else #else
SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament); SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament);
#endif #endif

View file

@ -134,7 +134,7 @@ void menu_media() {
BACK_ITEM(MSG_MAIN); BACK_ITEM(MSG_MAIN);
if (card.flag.workDirIsRoot) { if (card.flag.workDirIsRoot) {
#if !PIN_EXISTS(SD_DETECT) #if !PIN_EXISTS(SD_DETECT)
ACTION_ITEM(MSG_REFRESH, [](){ encoderTopLine = 0; card.mount(); }); ACTION_ITEM(MSG_REFRESH, []{ encoderTopLine = 0; card.mount(); });
#endif #endif
} }
else if (card.isMounted()) else if (card.isMounted())

View file

@ -63,22 +63,22 @@ void menu_mmu2_load_filament() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_MMU2_MENU); BACK_ITEM(MSG_MMU2_MENU);
ACTION_ITEM(MSG_MMU2_ALL, action_mmu2_load_all); ACTION_ITEM(MSG_MMU2_ALL, action_mmu2_load_all);
ACTION_ITEM(MSG_MMU2_FILAMENT0, [](){ _mmu2_load_filament(0); }); ACTION_ITEM(MSG_MMU2_FILAMENT0, []{ _mmu2_load_filament(0); });
ACTION_ITEM(MSG_MMU2_FILAMENT1, [](){ _mmu2_load_filament(1); }); ACTION_ITEM(MSG_MMU2_FILAMENT1, []{ _mmu2_load_filament(1); });
ACTION_ITEM(MSG_MMU2_FILAMENT2, [](){ _mmu2_load_filament(2); }); ACTION_ITEM(MSG_MMU2_FILAMENT2, []{ _mmu2_load_filament(2); });
ACTION_ITEM(MSG_MMU2_FILAMENT3, [](){ _mmu2_load_filament(3); }); ACTION_ITEM(MSG_MMU2_FILAMENT3, []{ _mmu2_load_filament(3); });
ACTION_ITEM(MSG_MMU2_FILAMENT4, [](){ _mmu2_load_filament(4); }); ACTION_ITEM(MSG_MMU2_FILAMENT4, []{ _mmu2_load_filament(4); });
END_MENU(); END_MENU();
} }
void menu_mmu2_load_to_nozzle() { void menu_mmu2_load_to_nozzle() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_MMU2_MENU); BACK_ITEM(MSG_MMU2_MENU);
ACTION_ITEM(MSG_MMU2_FILAMENT0, [](){ action_mmu2_load_filament_to_nozzle(0); }); ACTION_ITEM(MSG_MMU2_FILAMENT0, []{ action_mmu2_load_filament_to_nozzle(0); });
ACTION_ITEM(MSG_MMU2_FILAMENT1, [](){ action_mmu2_load_filament_to_nozzle(1); }); ACTION_ITEM(MSG_MMU2_FILAMENT1, []{ action_mmu2_load_filament_to_nozzle(1); });
ACTION_ITEM(MSG_MMU2_FILAMENT2, [](){ action_mmu2_load_filament_to_nozzle(2); }); ACTION_ITEM(MSG_MMU2_FILAMENT2, []{ action_mmu2_load_filament_to_nozzle(2); });
ACTION_ITEM(MSG_MMU2_FILAMENT3, [](){ action_mmu2_load_filament_to_nozzle(3); }); ACTION_ITEM(MSG_MMU2_FILAMENT3, []{ action_mmu2_load_filament_to_nozzle(3); });
ACTION_ITEM(MSG_MMU2_FILAMENT4, [](){ action_mmu2_load_filament_to_nozzle(4); }); ACTION_ITEM(MSG_MMU2_FILAMENT4, []{ action_mmu2_load_filament_to_nozzle(4); });
END_MENU(); END_MENU();
} }
@ -104,11 +104,11 @@ void action_mmu2_unload_filament() {
void menu_mmu2_eject_filament() { void menu_mmu2_eject_filament() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_MMU2_MENU); BACK_ITEM(MSG_MMU2_MENU);
ACTION_ITEM(MSG_MMU2_FILAMENT0, [](){ _mmu2_eject_filament(0); }); ACTION_ITEM(MSG_MMU2_FILAMENT0, []{ _mmu2_eject_filament(0); });
ACTION_ITEM(MSG_MMU2_FILAMENT1, [](){ _mmu2_eject_filament(1); }); ACTION_ITEM(MSG_MMU2_FILAMENT1, []{ _mmu2_eject_filament(1); });
ACTION_ITEM(MSG_MMU2_FILAMENT2, [](){ _mmu2_eject_filament(2); }); ACTION_ITEM(MSG_MMU2_FILAMENT2, []{ _mmu2_eject_filament(2); });
ACTION_ITEM(MSG_MMU2_FILAMENT3, [](){ _mmu2_eject_filament(3); }); ACTION_ITEM(MSG_MMU2_FILAMENT3, []{ _mmu2_eject_filament(3); });
ACTION_ITEM(MSG_MMU2_FILAMENT4, [](){ _mmu2_eject_filament(4); }); ACTION_ITEM(MSG_MMU2_FILAMENT4, []{ _mmu2_eject_filament(4); });
END_MENU(); END_MENU();
} }
@ -146,11 +146,11 @@ void menu_mmu2_choose_filament() {
#if LCD_HEIGHT > 2 #if LCD_HEIGHT > 2
STATIC_ITEM(MSG_MMU2_CHOOSE_FILAMENT_HEADER, SS_CENTER|SS_INVERT); STATIC_ITEM(MSG_MMU2_CHOOSE_FILAMENT_HEADER, SS_CENTER|SS_INVERT);
#endif #endif
ACTION_ITEM(MSG_MMU2_FILAMENT0, [](){ action_mmu2_choose(0); }); ACTION_ITEM(MSG_MMU2_FILAMENT0, []{ action_mmu2_choose(0); });
ACTION_ITEM(MSG_MMU2_FILAMENT1, [](){ action_mmu2_choose(1); }); ACTION_ITEM(MSG_MMU2_FILAMENT1, []{ action_mmu2_choose(1); });
ACTION_ITEM(MSG_MMU2_FILAMENT2, [](){ action_mmu2_choose(2); }); ACTION_ITEM(MSG_MMU2_FILAMENT2, []{ action_mmu2_choose(2); });
ACTION_ITEM(MSG_MMU2_FILAMENT3, [](){ action_mmu2_choose(3); }); ACTION_ITEM(MSG_MMU2_FILAMENT3, []{ action_mmu2_choose(3); });
ACTION_ITEM(MSG_MMU2_FILAMENT4, [](){ action_mmu2_choose(4); }); ACTION_ITEM(MSG_MMU2_FILAMENT4, []{ action_mmu2_choose(4); });
END_MENU(); END_MENU();
} }
@ -164,10 +164,10 @@ void menu_mmu2_pause() {
#if LCD_HEIGHT > 2 #if LCD_HEIGHT > 2
STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, SS_CENTER|SS_INVERT); STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, SS_CENTER|SS_INVERT);
#endif #endif
ACTION_ITEM(MSG_MMU2_RESUME, [](){ mmuMenuWait = false; }); ACTION_ITEM(MSG_MMU2_RESUME, []{ mmuMenuWait = false; });
ACTION_ITEM(MSG_MMU2_UNLOAD_FILAMENT, [](){ mmu2.unload(); }); ACTION_ITEM(MSG_MMU2_UNLOAD_FILAMENT, []{ mmu2.unload(); });
ACTION_ITEM(MSG_MMU2_LOAD_FILAMENT, [](){ mmu2.load_filament(currentTool); }); ACTION_ITEM(MSG_MMU2_LOAD_FILAMENT, []{ mmu2.load_filament(currentTool); });
ACTION_ITEM(MSG_MMU2_LOAD_TO_NOZZLE, [](){ mmu2.load_filament_to_nozzle(currentTool); }); ACTION_ITEM(MSG_MMU2_LOAD_TO_NOZZLE, []{ mmu2.load_filament_to_nozzle(currentTool); });
END_MENU(); END_MENU();
} }

View file

@ -252,9 +252,9 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
#endif #endif
{ {
BACK_ITEM(MSG_MOVE_AXIS); BACK_ITEM(MSG_MOVE_AXIS);
SUBMENU(MSG_MOVE_10MM, [](){ _goto_manual_move(10); }); SUBMENU(MSG_MOVE_10MM, []{ _goto_manual_move(10); });
SUBMENU(MSG_MOVE_1MM, [](){ _goto_manual_move( 1); }); SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); });
SUBMENU(MSG_MOVE_01MM, [](){ _goto_manual_move( 0.1f); }); SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); });
if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) { if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) {
SUBMENU_P(PSTR(""), []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); }); SUBMENU_P(PSTR(""), []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); });
MENU_ITEM_ADDON_START(0); MENU_ITEM_ADDON_START(0);
@ -292,15 +292,15 @@ void menu_move() {
true true
#endif #endif
) { ) {
SUBMENU(MSG_MOVE_X, [](){ _menu_move_distance(X_AXIS, lcd_move_x); }); SUBMENU(MSG_MOVE_X, []{ _menu_move_distance(X_AXIS, lcd_move_x); });
SUBMENU(MSG_MOVE_Y, [](){ _menu_move_distance(Y_AXIS, lcd_move_y); }); SUBMENU(MSG_MOVE_Y, []{ _menu_move_distance(Y_AXIS, lcd_move_y); });
} }
#if ENABLED(DELTA) #if ENABLED(DELTA)
else else
ACTION_ITEM(MSG_FREE_XY, [](){ line_to_z(delta_clip_start_height); ui.synchronize(); }); ACTION_ITEM(MSG_FREE_XY, []{ line_to_z(delta_clip_start_height); ui.synchronize(); });
#endif #endif
SUBMENU(MSG_MOVE_Z, [](){ _menu_move_distance(Z_AXIS, lcd_move_z); }); SUBMENU(MSG_MOVE_Z, []{ _menu_move_distance(Z_AXIS, lcd_move_z); });
} }
else else
GCODES_ITEM(MSG_AUTO_HOME, PSTR("G28")); GCODES_ITEM(MSG_AUTO_HOME, PSTR("G28"));
@ -344,9 +344,9 @@ void menu_move() {
#if E_MANUAL #if E_MANUAL
// The current extruder // The current extruder
SUBMENU(MSG_MOVE_E, [](){ _menu_move_distance(E_AXIS, [](){ lcd_move_e(); }, -1); }); SUBMENU(MSG_MOVE_E, []{ _menu_move_distance(E_AXIS, []{ lcd_move_e(); }, -1); });
#define SUBMENU_MOVE_E(N) SUBMENU(MSG_MOVE_E##N, [](){ _menu_move_distance(E_AXIS, [](){ lcd_move_e(N); }, N); }); #define SUBMENU_MOVE_E(N) SUBMENU(MSG_MOVE_E##N, []{ _menu_move_distance(E_AXIS, []{ lcd_move_e(N); }, N); });
#if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE) #if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE)
@ -445,7 +445,7 @@ void menu_motion() {
} }
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
editable.decimal = planner.z_fade_height; editable.decimal = planner.z_fade_height;
EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, [](){ set_z_fade_height(editable.decimal); }); EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); });
#endif #endif
#endif #endif

View file

@ -87,14 +87,14 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
#if HAS_TEMP_HOTEND || HAS_HEATED_BED #if HAS_TEMP_HOTEND || HAS_HEATED_BED
#define _PREHEAT_ITEMS(M,N) do{ \ #define _PREHEAT_ITEMS(M,N) do{ \
ACTION_ITEM(MSG_PREHEAT_##M##_H##N, [](){ _preheat_both(M-1, N); }); \ ACTION_ITEM(MSG_PREHEAT_##M##_H##N, []{ _preheat_both(M-1, N); }); \
ACTION_ITEM(MSG_PREHEAT_##M##_END_E##N, [](){ _preheat_end(M-1, N); }); \ ACTION_ITEM(MSG_PREHEAT_##M##_END_E##N, []{ _preheat_end(M-1, N); }); \
}while(0) }while(0)
#if HAS_HEATED_BED #if HAS_HEATED_BED
#define PREHEAT_ITEMS(M,N) _PREHEAT_ITEMS(M,N) #define PREHEAT_ITEMS(M,N) _PREHEAT_ITEMS(M,N)
#else #else
#define PREHEAT_ITEMS(M,N) \ #define PREHEAT_ITEMS(M,N) \
ACTION_ITEM(MSG_PREHEAT_##M##_H##N, [](){ _preheat_end(M-1, N); }) ACTION_ITEM(MSG_PREHEAT_##M##_H##N, []{ _preheat_end(M-1, N); })
#endif #endif
void menu_preheat_m1() { void menu_preheat_m1() {
@ -102,10 +102,10 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
BACK_ITEM(MSG_TEMPERATURE); BACK_ITEM(MSG_TEMPERATURE);
#if HOTENDS == 1 #if HOTENDS == 1
#if HAS_HEATED_BED #if HAS_HEATED_BED
ACTION_ITEM(MSG_PREHEAT_1, [](){ _preheat_both(0, 0); }); ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_both(0, 0); });
ACTION_ITEM(MSG_PREHEAT_1_END, [](){ _preheat_end(0, 0); }); ACTION_ITEM(MSG_PREHEAT_1_END, []{ _preheat_end(0, 0); });
#else #else
ACTION_ITEM(MSG_PREHEAT_1, [](){ _preheat_end(0, 0); }); ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_end(0, 0); });
#endif #endif
#elif HOTENDS > 1 #elif HOTENDS > 1
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -132,7 +132,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
}); });
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATED_BED #if HAS_HEATED_BED
ACTION_ITEM(MSG_PREHEAT_1_BEDONLY, [](){ _preheat_bed(0); }); ACTION_ITEM(MSG_PREHEAT_1_BEDONLY, []{ _preheat_bed(0); });
#endif #endif
END_MENU(); END_MENU();
} }
@ -142,10 +142,10 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
BACK_ITEM(MSG_TEMPERATURE); BACK_ITEM(MSG_TEMPERATURE);
#if HOTENDS == 1 #if HOTENDS == 1
#if HAS_HEATED_BED #if HAS_HEATED_BED
ACTION_ITEM(MSG_PREHEAT_2, [](){ _preheat_both(1, 0); }); ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_both(1, 0); });
ACTION_ITEM(MSG_PREHEAT_2_END, [](){ _preheat_end(1, 0); }); ACTION_ITEM(MSG_PREHEAT_2_END, []{ _preheat_end(1, 0); });
#else #else
ACTION_ITEM(MSG_PREHEAT_2, [](){ _preheat_end(1, 0); }); ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_end(1, 0); });
#endif #endif
#elif HOTENDS > 1 #elif HOTENDS > 1
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -172,7 +172,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
}); });
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATED_BED #if HAS_HEATED_BED
ACTION_ITEM(MSG_PREHEAT_2_BEDONLY, [](){ _preheat_bed(1); }); ACTION_ITEM(MSG_PREHEAT_2_BEDONLY, []{ _preheat_bed(1); });
#endif #endif
END_MENU(); END_MENU();
} }
@ -194,9 +194,9 @@ void menu_temperature() {
// Nozzle [1-5]: // Nozzle [1-5]:
// //
#if HOTENDS == 1 #if HOTENDS == 1
EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, [](){ thermalManager.start_watching_hotend(0); }); EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, []{ thermalManager.start_watching_hotend(0); });
#elif HOTENDS > 1 #elif HOTENDS > 1
#define EDIT_TARGET(N) EDIT_ITEM_FAST(int3, MSG_NOZZLE_##N, &thermalManager.temp_hotend[N].target, 0, HEATER_##N##_MAXTEMP - 15, [](){ thermalManager.start_watching_hotend(N); }) #define EDIT_TARGET(N) EDIT_ITEM_FAST(int3, MSG_NOZZLE_##N, &thermalManager.temp_hotend[N].target, 0, HEATER_##N##_MAXTEMP - 15, []{ thermalManager.start_watching_hotend(N); })
EDIT_TARGET(0); EDIT_TARGET(0);
EDIT_TARGET(1); EDIT_TARGET(1);
#if HOTENDS > 2 #if HOTENDS > 2
@ -237,21 +237,21 @@ void menu_temperature() {
#if FAN_COUNT > 0 #if FAN_COUNT > 0
#if HAS_FAN0 #if HAS_FAN0
editable.uint8 = thermalManager.fan_speed[0]; editable.uint8 = thermalManager.fan_speed[0];
EDIT_ITEM_FAST(percent, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, [](){ thermalManager.set_fan_speed(0, editable.uint8); }); EDIT_ITEM_FAST(percent, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, []{ thermalManager.set_fan_speed(0, editable.uint8); });
#if ENABLED(EXTRA_FAN_SPEED) #if ENABLED(EXTRA_FAN_SPEED)
EDIT_ITEM_FAST(percent, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255); EDIT_ITEM_FAST(percent, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255);
#endif #endif
#endif #endif
#if HAS_FAN1 #if HAS_FAN1
editable.uint8 = thermalManager.fan_speed[1]; editable.uint8 = thermalManager.fan_speed[1];
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED_2, &editable.uint8, 0, 255, [](){ thermalManager.set_fan_speed(1, editable.uint8); }); EDIT_ITEM_FAST(percent, MSG_FAN_SPEED_2, &editable.uint8, 0, 255, []{ thermalManager.set_fan_speed(1, editable.uint8); });
#if ENABLED(EXTRA_FAN_SPEED) #if ENABLED(EXTRA_FAN_SPEED)
EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED_2, &thermalManager.new_fan_speed[1], 3, 255); EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED_2, &thermalManager.new_fan_speed[1], 3, 255);
#endif #endif
#endif #endif
#if HAS_FAN2 #if HAS_FAN2
editable.uint8 = thermalManager.fan_speed[2]; editable.uint8 = thermalManager.fan_speed[2];
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED_3, &editable.uint8, 0, 255, [](){ thermalManager.set_fan_speed(2, editable.uint8); }); EDIT_ITEM_FAST(percent, MSG_FAN_SPEED_3, &editable.uint8, 0, 255, []{ thermalManager.set_fan_speed(2, editable.uint8); });
#if ENABLED(EXTRA_FAN_SPEED) #if ENABLED(EXTRA_FAN_SPEED)
EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED_3, &thermalManager.new_fan_speed[2], 3, 255); EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED_3, &thermalManager.new_fan_speed[2], 3, 255);
#endif #endif
@ -267,8 +267,8 @@ void menu_temperature() {
SUBMENU(MSG_PREHEAT_1, menu_preheat_m1); SUBMENU(MSG_PREHEAT_1, menu_preheat_m1);
SUBMENU(MSG_PREHEAT_2, menu_preheat_m2); SUBMENU(MSG_PREHEAT_2, menu_preheat_m2);
#else #else
ACTION_ITEM(MSG_PREHEAT_1, [](){ _preheat_end(0, 0); }); ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_end(0, 0); });
ACTION_ITEM(MSG_PREHEAT_2, [](){ _preheat_end(1, 0); }); ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_end(1, 0); });
#endif #endif
// //

View file

@ -32,7 +32,7 @@
#include "../../module/stepper/indirection.h" #include "../../module/stepper/indirection.h"
#include "../../feature/tmc_util.h" #include "../../feature/tmc_util.h"
#define TMC_EDIT_STORED_I_RMS(ST,MSG) EDIT_ITEM_P(uint16_4, PSTR(MSG), &stepper##ST.val_mA, 100, 3000, [](){ stepper##ST.refresh_stepper_current(); }) #define TMC_EDIT_STORED_I_RMS(ST,MSG) EDIT_ITEM_P(uint16_4, PSTR(MSG), &stepper##ST.val_mA, 100, 3000, []{ stepper##ST.refresh_stepper_current(); })
void menu_tmc_current() { void menu_tmc_current() {
START_MENU(); START_MENU();
@ -81,7 +81,7 @@ void menu_tmc_current() {
#if ENABLED(HYBRID_THRESHOLD) #if ENABLED(HYBRID_THRESHOLD)
#define TMC_EDIT_STORED_HYBRID_THRS(ST, MSG) EDIT_ITEM_P(uint8, PSTR(MSG), &stepper##ST.stored.hybrid_thrs, 0, 255, [](){ stepper##ST.refresh_hybrid_thrs(); }); #define TMC_EDIT_STORED_HYBRID_THRS(ST, MSG) EDIT_ITEM_P(uint8, PSTR(MSG), &stepper##ST.stored.hybrid_thrs, 0, 255, []{ stepper##ST.refresh_hybrid_thrs(); });
void menu_tmc_hybrid_thrs() { void menu_tmc_hybrid_thrs() {
START_MENU(); START_MENU();
@ -132,7 +132,7 @@ void menu_tmc_current() {
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define TMC_EDIT_STORED_SGT(ST) EDIT_ITEM_P(int4, PSTR(MSG_##ST), &stepper##ST.stored.homing_thrs, stepper##ST.sgt_min, stepper##ST.sgt_max, [](){ stepper##ST.refresh_homing_thrs(); }); #define TMC_EDIT_STORED_SGT(ST) EDIT_ITEM_P(int4, PSTR(MSG_##ST), &stepper##ST.stored.homing_thrs, stepper##ST.sgt_min, stepper##ST.sgt_max, []{ stepper##ST.refresh_homing_thrs(); });
void menu_tmc_homing_thrs() { void menu_tmc_homing_thrs() {
START_MENU(); START_MENU();
@ -156,7 +156,7 @@ void menu_tmc_current() {
#if HAS_STEALTHCHOP #if HAS_STEALTHCHOP
#define TMC_EDIT_STEP_MODE(ST, MSG) EDIT_ITEM_P(bool, PSTR(MSG), &stepper##ST.stored.stealthChop_enabled, [](){ stepper##ST.refresh_stepping_mode(); }) #define TMC_EDIT_STEP_MODE(ST, MSG) EDIT_ITEM_P(bool, PSTR(MSG), &stepper##ST.stored.stealthChop_enabled, []{ stepper##ST.refresh_stepping_mode(); })
void menu_tmc_step_mode() { void menu_tmc_step_mode() {
START_MENU(); START_MENU();

View file

@ -126,9 +126,9 @@ void menu_tune() {
// Nozzle [1-4]: // Nozzle [1-4]:
// //
#if HOTENDS == 1 #if HOTENDS == 1
EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, [](){ thermalManager.start_watching_hotend(0); }); EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, []{ thermalManager.start_watching_hotend(0); });
#elif HOTENDS > 1 #elif HOTENDS > 1
#define EDIT_NOZZLE(N) EDIT_ITEM_FAST(int3, MSG_NOZZLE_##N, &thermalManager.temp_hotend[N].target, 0, HEATER_##N##_MAXTEMP - 15, [](){ thermalManager.start_watching_hotend(N); }) #define EDIT_NOZZLE(N) EDIT_ITEM_FAST(int3, MSG_NOZZLE_##N, &thermalManager.temp_hotend[N].target, 0, HEATER_##N##_MAXTEMP - 15, []{ thermalManager.start_watching_hotend(N); })
EDIT_NOZZLE(0); EDIT_NOZZLE(0);
EDIT_NOZZLE(1); EDIT_NOZZLE(1);
#if HOTENDS > 2 #if HOTENDS > 2
@ -162,21 +162,21 @@ void menu_tune() {
#if FAN_COUNT > 0 #if FAN_COUNT > 0
#if HAS_FAN0 #if HAS_FAN0
editable.uint8 = thermalManager.fan_speed[0]; editable.uint8 = thermalManager.fan_speed[0];
EDIT_ITEM_FAST(percent, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, [](){ thermalManager.set_fan_speed(0, editable.uint8); }); EDIT_ITEM_FAST(percent, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, []{ thermalManager.set_fan_speed(0, editable.uint8); });
#if ENABLED(EXTRA_FAN_SPEED) #if ENABLED(EXTRA_FAN_SPEED)
EDIT_ITEM_FAST(percent, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255); EDIT_ITEM_FAST(percent, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255);
#endif #endif
#endif #endif
#if HAS_FAN1 #if HAS_FAN1
editable.uint8 = thermalManager.fan_speed[1]; editable.uint8 = thermalManager.fan_speed[1];
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED_2, &editable.uint8, 0, 255, [](){ thermalManager.set_fan_speed(1, editable.uint8); }); EDIT_ITEM_FAST(percent, MSG_FAN_SPEED_2, &editable.uint8, 0, 255, []{ thermalManager.set_fan_speed(1, editable.uint8); });
#if ENABLED(EXTRA_FAN_SPEED) #if ENABLED(EXTRA_FAN_SPEED)
EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED_2, &thermalManager.new_fan_speed[1], 3, 255); EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED_2, &thermalManager.new_fan_speed[1], 3, 255);
#endif #endif
#endif #endif
#if HAS_FAN2 #if HAS_FAN2
editable.uint8 = thermalManager.fan_speed[2]; editable.uint8 = thermalManager.fan_speed[2];
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED_3, &editable.uint8, 0, 255, [](){ thermalManager.set_fan_speed(2, editable.uint8); }); EDIT_ITEM_FAST(percent, MSG_FAN_SPEED_3, &editable.uint8, 0, 255, []{ thermalManager.set_fan_speed(2, editable.uint8); });
#if ENABLED(EXTRA_FAN_SPEED) #if ENABLED(EXTRA_FAN_SPEED)
EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED_3, &thermalManager.new_fan_speed[2], 3, 255); EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED_3, &thermalManager.new_fan_speed[2], 3, 255);
#endif #endif
@ -188,10 +188,10 @@ void menu_tune() {
// Flow [1-5]: // Flow [1-5]:
// //
#if EXTRUDERS == 1 #if EXTRUDERS == 1
EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[0], 10, 999, [](){ planner.refresh_e_factor(0); }); EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[0], 10, 999, []{ planner.refresh_e_factor(0); });
#elif EXTRUDERS #elif EXTRUDERS
EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, [](){ planner.refresh_e_factor(active_extruder); }); EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, []{ planner.refresh_e_factor(active_extruder); });
#define EDIT_FLOW(N) EDIT_ITEM(int3, MSG_FLOW_##N, &planner.flow_percentage[N], 10, 999, [](){ planner.refresh_e_factor(N); }) #define EDIT_FLOW(N) EDIT_ITEM(int3, MSG_FLOW_##N, &planner.flow_percentage[N], 10, 999, []{ planner.refresh_e_factor(N); })
EDIT_FLOW(0); EDIT_FLOW(0);
EDIT_FLOW(1); EDIT_FLOW(1);
#if EXTRUDERS > 2 #if EXTRUDERS > 2
@ -215,8 +215,8 @@ void menu_tune() {
// //
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#if ENABLED(BABYSTEP_XY) #if ENABLED(BABYSTEP_XY)
SUBMENU(MSG_BABYSTEP_X, [](){ _lcd_babystep_go(_lcd_babystep_x); }); SUBMENU(MSG_BABYSTEP_X, []{ _lcd_babystep_go(_lcd_babystep_x); });
SUBMENU(MSG_BABYSTEP_Y, [](){ _lcd_babystep_go(_lcd_babystep_y); }); SUBMENU(MSG_BABYSTEP_Y, []{ _lcd_babystep_go(_lcd_babystep_y); });
#endif #endif
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);

View file

@ -234,7 +234,7 @@ void _lcd_ubl_grid_level() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_UBL_TOOLS); BACK_ITEM(MSG_UBL_TOOLS);
EDIT_ITEM(int3, MSG_UBL_SIDE_POINTS, &side_points, 2, 6); EDIT_ITEM(int3, MSG_UBL_SIDE_POINTS, &side_points, 2, 6);
ACTION_ITEM(MSG_UBL_MESH_LEVEL, [](){ ACTION_ITEM(MSG_UBL_MESH_LEVEL, []{
char ubl_lcd_gcode[12]; char ubl_lcd_gcode[12];
sprintf_P(ubl_lcd_gcode, PSTR("G29 J%i"), side_points); sprintf_P(ubl_lcd_gcode, PSTR("G29 J%i"), side_points);
lcd_enqueue_one_now(ubl_lcd_gcode); lcd_enqueue_one_now(ubl_lcd_gcode);
@ -617,7 +617,7 @@ void _lcd_ubl_level_bed() {
GCODES_ITEM(MSG_UBL_INFO_UBL, PSTR("G29 W")); GCODES_ITEM(MSG_UBL_INFO_UBL, PSTR("G29 W"));
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
editable.decimal = planner.z_fade_height; editable.decimal = planner.z_fade_height;
EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, [](){ set_z_fade_height(editable.decimal); }); EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); });
#endif #endif
END_MENU(); END_MENU();
} }