Use lambdas in menus, where possible (#15452)

This commit is contained in:
Scott Lahteine 2019-10-07 19:44:33 -05:00 committed by GitHub
parent cd791f1cba
commit cc822c1a05
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 396 additions and 968 deletions

View file

@ -275,6 +275,10 @@ void quickstop_stepper() {
sync_plan_position(); sync_plan_position();
} }
void enable_e_steppers() {
enable_E0(); enable_E1(); enable_E2(); enable_E3(); enable_E4(); enable_E5();
}
void enable_all_steppers() { void enable_all_steppers() {
#if ENABLED(AUTO_POWER_CONTROL) #if ENABLED(AUTO_POWER_CONTROL)
powerManager.power_on(); powerManager.power_on();
@ -282,30 +286,11 @@ void enable_all_steppers() {
enable_X(); enable_X();
enable_Y(); enable_Y();
enable_Z(); enable_Z();
enable_E0(); enable_e_steppers();
enable_E1();
enable_E2();
enable_E3();
enable_E4();
enable_E5();
}
void enable_e_steppers() {
enable_E0();
enable_E1();
enable_E2();
enable_E3();
enable_E4();
enable_E5();
} }
void disable_e_steppers() { void disable_e_steppers() {
disable_E0(); disable_E0(); disable_E1(); disable_E2(); disable_E3(); disable_E4(); disable_E5();
disable_E1();
disable_E2();
disable_E3();
disable_E4();
disable_E5();
} }
void disable_e_stepper(const uint8_t e) { void disable_e_stepper(const uint8_t e) {

View file

@ -337,36 +337,38 @@
#define MSG_Y2 "Y2" #define MSG_Y2 "Y2"
#define MSG_Z2 "Z2" #define MSG_Z2 "Z2"
#define MSG_Z3 "Z3" #define MSG_Z3 "Z3"
#define MSG_H1 "1"
#define MSG_H2 "2" /**
#define MSG_H3 "3" * Tool indexes for LCD display only
#define MSG_H4 "4" *
#define MSG_H5 "5" * By convention the LCD shows "E1" for the first extruder.
#define MSG_H6 "6" * However, internal to Marlin E0/T0 is the first tool, and
#define MSG_LCD_N0 " 1" * most board silkscreens say "E0." Zero-based labels will
#define MSG_LCD_N1 " 2" * make these indexes consistent but this defies expectation.
#define MSG_LCD_N2 " 3" *
#define MSG_LCD_N3 " 4" */
#define MSG_LCD_N4 " 5" #if ENABLED(NUMBER_TOOLS_FROM_0)
#define MSG_LCD_N5 " 6" #define LCD_STR_N0 "0"
#define MSG_E1 "E1" #define LCD_STR_N1 "1"
#define MSG_E2 "E2" #define LCD_STR_N2 "2"
#define MSG_E3 "E3" #define LCD_STR_N3 "3"
#define MSG_E4 "E4" #define LCD_STR_N4 "4"
#define MSG_E5 "E5" #define LCD_STR_N5 "5"
#define MSG_E6 "E6" #else
#define MSG_MOVE_E1 "1" #define LCD_STR_N0 "1"
#define MSG_MOVE_E2 "2" #define LCD_STR_N1 "2"
#define MSG_MOVE_E3 "3" #define LCD_STR_N2 "3"
#define MSG_MOVE_E4 "4" #define LCD_STR_N3 "4"
#define MSG_MOVE_E5 "5" #define LCD_STR_N4 "5"
#define MSG_MOVE_E6 "6" #define LCD_STR_N5 "6"
#define MSG_DIAM_E1 " 1" #endif
#define MSG_DIAM_E2 " 2"
#define MSG_DIAM_E3 " 3" #define LCD_STR_E0 "E" LCD_STR_N0
#define MSG_DIAM_E4 " 4" #define LCD_STR_E1 "E" LCD_STR_N1
#define MSG_DIAM_E5 " 5" #define LCD_STR_E2 "E" LCD_STR_N2
#define MSG_DIAM_E6 " 6" #define LCD_STR_E3 "E" LCD_STR_N3
#define LCD_STR_E4 "E" LCD_STR_N4
#define LCD_STR_E5 "E" LCD_STR_N5
#include INCLUDE_LANGUAGE #include INCLUDE_LANGUAGE
@ -383,8 +385,3 @@
#endif #endif
#include "../lcd/language/language_en.h" #include "../lcd/language/language_en.h"
#ifdef CUSTOM_USER_MENU_TITLE
#undef MSG_USER_MENU
#define MSG_USER_MENU CUSTOM_USER_MENU_TITLE
#endif

View file

@ -68,6 +68,7 @@ uint8_t screen_history_depth = 0;
bool screen_changed; bool screen_changed;
// Value Editing // Value Editing
chimera_t editable;
PGM_P MenuEditItemBase::editLabel; PGM_P MenuEditItemBase::editLabel;
void* MenuEditItemBase::editValue; void* MenuEditItemBase::editValue;
int32_t MenuEditItemBase::minEditValue, MenuEditItemBase::maxEditValue; int32_t MenuEditItemBase::minEditValue, MenuEditItemBase::maxEditValue;
@ -201,11 +202,6 @@ void MenuItem_bool::action(PGM_P pstr, bool *ptr, screenFunc_t callback) {
///////////////// Menu Tree //////////////// ///////////////// Menu Tree ////////////////
//////////////////////////////////////////// ////////////////////////////////////////////
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
float lcd_z_fade_height;
void _lcd_set_z_fade_height() { set_z_fade_height(lcd_z_fade_height); }
#endif
#include "../../Marlin.h" #include "../../Marlin.h"
bool printer_busy() { bool printer_busy() {
@ -222,11 +218,6 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
repeat_delay = BUTTON_DELAY_MENU; repeat_delay = BUTTON_DELAY_MENU;
#endif #endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
// Shadow for editing the fade height
lcd_z_fade_height = planner.z_fade_height;
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
progress_reset(); progress_reset();
#endif #endif

View file

@ -176,6 +176,24 @@ class MenuItem_function {
/////////// Menu Editing Actions /////////// /////////// Menu Editing Actions ///////////
//////////////////////////////////////////// ////////////////////////////////////////////
//
// The Menu Edit shadow value
// Only one edit value is needed at a time
//
typedef union {
bool state;
float decimal;
int8_t int8;
int16_t int16;
int32_t int32;
uint8_t uint8;
uint16_t uint16;
uint32_t uint32;
} chimera_t;
extern chimera_t editable;
// Edit items use long integer encoder units // Edit items use long integer encoder units
class MenuEditItemBase { class MenuEditItemBase {
private: private:
@ -407,11 +425,6 @@ void _lcd_draw_homing();
void _lcd_level_bed_corners(); void _lcd_level_bed_corners();
#endif #endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
extern float lcd_z_fade_height;
void _lcd_set_z_fade_height();
#endif
#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS)) #if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS))
void _lcd_toggle_bed_leveling(); void _lcd_toggle_bed_leveling();
#endif #endif

View file

@ -55,15 +55,12 @@ void menu_backlash();
#include "../../feature/dac/stepper_dac.h" #include "../../feature/dac/stepper_dac.h"
xyze_uint8_t driverPercent;
inline void dac_driver_getValues() { LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i); }
static void dac_driver_commit() { dac_current_set_percents(driverPercent); }
void menu_dac() { void menu_dac() {
dac_driver_getValues(); static xyze_uint8_t driverPercent;
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(N) EDIT_ITEM(uint8, MSG_##N " " MSG_DAC_PERCENT, &driverPercent[_AXIS(N)], 0, 100, dac_driver_commit) #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);
@ -96,16 +93,6 @@ void menu_backlash();
#endif #endif
#if HAS_M206_COMMAND
//
// Set the home offset based on the current_position
//
void _lcd_set_home_offsets() {
queue.inject_P(PSTR("M428"));
ui.return_to_status();
}
#endif
#if ENABLED(SD_FIRMWARE_UPDATE) #if ENABLED(SD_FIRMWARE_UPDATE)
#include "../../module/configuration_store.h" #include "../../module/configuration_store.h"
#endif #endif
@ -122,17 +109,17 @@ void menu_backlash();
#if EXTRUDERS == 1 #if EXTRUDERS == 1
EDIT_ITEM(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999); EDIT_ITEM(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
#elif EXTRUDERS > 1 #elif EXTRUDERS > 1
#define EDIT_ADVANCE_K(N) EDIT_ITEM(float52, MSG_ADVANCE_K MSG_E##N, &planner.extruder_advance_K[N-1], 0, 999) #define EDIT_ADVANCE_K(N) EDIT_ITEM(float52, MSG_ADVANCE_K LCD_STR_E##N, &planner.extruder_advance_K[N], 0, 999)
EDIT_ADVANCE_K(0);
EDIT_ADVANCE_K(1); EDIT_ADVANCE_K(1);
EDIT_ADVANCE_K(2);
#if EXTRUDERS > 2 #if EXTRUDERS > 2
EDIT_ADVANCE_K(3); EDIT_ADVANCE_K(2);
#if EXTRUDERS > 3 #if EXTRUDERS > 3
EDIT_ADVANCE_K(4); EDIT_ADVANCE_K(3);
#if EXTRUDERS > 4 #if EXTRUDERS > 4
EDIT_ADVANCE_K(5); EDIT_ADVANCE_K(4);
#if EXTRUDERS > 5 #if EXTRUDERS > 5
EDIT_ADVANCE_K(6); EDIT_ADVANCE_K(5);
#endif // EXTRUDERS > 5 #endif // EXTRUDERS > 5
#endif // EXTRUDERS > 4 #endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3 #endif // EXTRUDERS > 3
@ -147,18 +134,18 @@ void menu_backlash();
#if EXTRUDERS == 1 #if EXTRUDERS == 1
EDIT_ITEM_FAST(float43, MSG_FILAMENT_DIAM, &planner.filament_size[0], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); EDIT_ITEM_FAST(float43, MSG_FILAMENT_DIAM, &planner.filament_size[0], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
#else // EXTRUDERS > 1 #else // EXTRUDERS > 1
#define EDIT_FIL_DIAM(N) EDIT_ITEM_FAST(float43, MSG_FILAMENT_DIAM MSG_DIAM_E##N, &planner.filament_size[N-1], 1.5f, 3.25f, planner.calculate_volumetric_multipliers) #define EDIT_FIL_DIAM(N) EDIT_ITEM_FAST(float43, MSG_FILAMENT_DIAM LCD_STR_N##N, &planner.filament_size[N], 1.5f, 3.25f, planner.calculate_volumetric_multipliers)
EDIT_ITEM_FAST(float43, MSG_FILAMENT_DIAM, &planner.filament_size[active_extruder], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); EDIT_ITEM_FAST(float43, MSG_FILAMENT_DIAM, &planner.filament_size[active_extruder], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
EDIT_FIL_DIAM(0);
EDIT_FIL_DIAM(1); EDIT_FIL_DIAM(1);
EDIT_FIL_DIAM(2);
#if EXTRUDERS > 2 #if EXTRUDERS > 2
EDIT_FIL_DIAM(3); EDIT_FIL_DIAM(2);
#if EXTRUDERS > 3 #if EXTRUDERS > 3
EDIT_FIL_DIAM(4); EDIT_FIL_DIAM(3);
#if EXTRUDERS > 4 #if EXTRUDERS > 4
EDIT_FIL_DIAM(5); EDIT_FIL_DIAM(4);
#if EXTRUDERS > 5 #if EXTRUDERS > 5
EDIT_FIL_DIAM(6); EDIT_FIL_DIAM(5);
#endif // EXTRUDERS > 5 #endif // EXTRUDERS > 5
#endif // EXTRUDERS > 4 #endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3 #endif // EXTRUDERS > 3
@ -179,18 +166,18 @@ void menu_backlash();
#if EXTRUDERS == 1 #if EXTRUDERS == 1
EDIT_ITEM_FAST(float3, MSG_FILAMENT_UNLOAD, &fc_settings[0].unload_length, 0, extrude_maxlength); EDIT_ITEM_FAST(float3, MSG_FILAMENT_UNLOAD, &fc_settings[0].unload_length, 0, extrude_maxlength);
#elif EXTRUDERS > 1 #elif EXTRUDERS > 1
#define EDIT_FIL_UNLOAD(N) EDIT_ITEM_FAST(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E##N, &fc_settings[N-1].unload_length, 0, extrude_maxlength) #define EDIT_FIL_UNLOAD(N) EDIT_ITEM_FAST(float3, MSG_FILAMENT_UNLOAD LCD_STR_N##N, &fc_settings[N].unload_length, 0, extrude_maxlength)
EDIT_ITEM_FAST(float3, MSG_FILAMENT_UNLOAD, &fc_settings[active_extruder].unload_length, 0, extrude_maxlength); EDIT_ITEM_FAST(float3, MSG_FILAMENT_UNLOAD, &fc_settings[active_extruder].unload_length, 0, extrude_maxlength);
EDIT_FIL_UNLOAD(0);
EDIT_FIL_UNLOAD(1); EDIT_FIL_UNLOAD(1);
EDIT_FIL_UNLOAD(2);
#if EXTRUDERS > 2 #if EXTRUDERS > 2
EDIT_FIL_UNLOAD(3); EDIT_FIL_UNLOAD(2);
#if EXTRUDERS > 3 #if EXTRUDERS > 3
EDIT_FIL_UNLOAD(4); EDIT_FIL_UNLOAD(3);
#if EXTRUDERS > 4 #if EXTRUDERS > 4
EDIT_FIL_UNLOAD(5); EDIT_FIL_UNLOAD(4);
#if EXTRUDERS > 5 #if EXTRUDERS > 5
EDIT_FIL_UNLOAD(6); EDIT_FIL_UNLOAD(5);
#endif // EXTRUDERS > 5 #endif // EXTRUDERS > 5
#endif // EXTRUDERS > 4 #endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3 #endif // EXTRUDERS > 3
@ -200,18 +187,18 @@ void menu_backlash();
#if EXTRUDERS == 1 #if EXTRUDERS == 1
EDIT_ITEM_FAST(float3, MSG_FILAMENT_LOAD, &fc_settings[0].load_length, 0, extrude_maxlength); EDIT_ITEM_FAST(float3, MSG_FILAMENT_LOAD, &fc_settings[0].load_length, 0, extrude_maxlength);
#elif EXTRUDERS > 1 #elif EXTRUDERS > 1
#define EDIT_FIL_LOAD(N) EDIT_ITEM_FAST(float3, MSG_FILAMENT_LOAD MSG_DIAM_E##N, &fc_settings[N-1].load_length, 0, extrude_maxlength) #define EDIT_FIL_LOAD(N) EDIT_ITEM_FAST(float3, MSG_FILAMENT_LOAD LCD_STR_N##N, &fc_settings[N].load_length, 0, extrude_maxlength)
EDIT_ITEM_FAST(float3, MSG_FILAMENT_LOAD, &fc_settings[active_extruder].load_length, 0, extrude_maxlength); EDIT_ITEM_FAST(float3, MSG_FILAMENT_LOAD, &fc_settings[active_extruder].load_length, 0, extrude_maxlength);
EDIT_FIL_LOAD(0);
EDIT_FIL_LOAD(1); EDIT_FIL_LOAD(1);
EDIT_FIL_LOAD(2);
#if EXTRUDERS > 2 #if EXTRUDERS > 2
EDIT_FIL_LOAD(3); EDIT_FIL_LOAD(2);
#if EXTRUDERS > 3 #if EXTRUDERS > 3
EDIT_FIL_LOAD(4); EDIT_FIL_LOAD(3);
#if EXTRUDERS > 4 #if EXTRUDERS > 4
EDIT_FIL_LOAD(5); EDIT_FIL_LOAD(4);
#if EXTRUDERS > 5 #if EXTRUDERS > 5
EDIT_FIL_LOAD(6); EDIT_FIL_LOAD(5);
#endif // EXTRUDERS > 5 #endif // EXTRUDERS > 5
#endif // EXTRUDERS > 4 #endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3 #endif // EXTRUDERS > 3
@ -280,45 +267,9 @@ void menu_backlash();
PID_PARAM(Kd, e) = scalePID_d(raw_Kd); PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
thermalManager.updatePID(); thermalManager.updatePID();
} }
#define _DEFINE_PIDTEMP_BASE_FUNCS(N) \
void copy_and_scalePID_i_E ## N() { copy_and_scalePID_i(N); } \
void copy_and_scalePID_d_E ## N() { copy_and_scalePID_d(N); }
#else
#define _DEFINE_PIDTEMP_BASE_FUNCS(N) //
#endif #endif
#if ENABLED(PID_AUTOTUNE_MENU)
#define DEFINE_PIDTEMP_FUNCS(N) \
_DEFINE_PIDTEMP_BASE_FUNCS(N); \
void lcd_autotune_callback_E ## N() { _lcd_autotune(N); } //
#else
#define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N); //
#endif
#if HOTENDS
DEFINE_PIDTEMP_FUNCS(0);
#if ENABLED(PID_PARAMS_PER_HOTEND)
#if HOTENDS > 1
DEFINE_PIDTEMP_FUNCS(1);
#if HOTENDS > 2
DEFINE_PIDTEMP_FUNCS(2);
#if HOTENDS > 3
DEFINE_PIDTEMP_FUNCS(3);
#if HOTENDS > 4
DEFINE_PIDTEMP_FUNCS(4);
#if HOTENDS > 5
DEFINE_PIDTEMP_FUNCS(5);
#endif // HOTENDS > 5
#endif // HOTENDS > 4
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#endif // HOTENDS > 1
#endif // PID_PARAMS_PER_HOTEND
#endif // HOTENDS
#define SHOW_MENU_ADVANCED_TEMPERATURE ((ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND) || EITHER(PID_AUTOTUNE_MENU, PID_EDIT_MENU)) #define SHOW_MENU_ADVANCED_TEMPERATURE ((ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND) || EITHER(PID_AUTOTUNE_MENU, PID_EDIT_MENU))
// //
@ -353,8 +304,8 @@ void menu_backlash();
raw_Ki = unscalePID_i(PID_PARAM(Ki, eindex)); \ raw_Ki = unscalePID_i(PID_PARAM(Ki, eindex)); \
raw_Kd = unscalePID_d(PID_PARAM(Kd, eindex)); \ raw_Kd = unscalePID_d(PID_PARAM(Kd, eindex)); \
EDIT_ITEM(float52sign, MSG_PID_P ELABEL, &PID_PARAM(Kp, eindex), 1, 9990); \ EDIT_ITEM(float52sign, MSG_PID_P ELABEL, &PID_PARAM(Kp, eindex), 1, 9990); \
EDIT_ITEM(float52sign, MSG_PID_I ELABEL, &raw_Ki, 0.01f, 9990, copy_and_scalePID_i_E ## eindex); \ EDIT_ITEM(float52sign, MSG_PID_I ELABEL, &raw_Ki, 0.01f, 9990, [](){ copy_and_scalePID_i(eindex); }); \
EDIT_ITEM(float52sign, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex) EDIT_ITEM(float52sign, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, [](){ copy_and_scalePID_d(eindex); })
#if ENABLED(PID_EXTRUSION_SCALING) #if ENABLED(PID_EXTRUSION_SCALING)
#define _PID_EDIT_MENU_ITEMS(ELABEL, eindex) \ #define _PID_EDIT_MENU_ITEMS(ELABEL, eindex) \
@ -373,22 +324,22 @@ void menu_backlash();
#if ENABLED(PID_AUTOTUNE_MENU) #if ENABLED(PID_AUTOTUNE_MENU)
#define PID_EDIT_MENU_ITEMS(ELABEL, eindex) \ #define PID_EDIT_MENU_ITEMS(ELABEL, eindex) \
_PID_EDIT_MENU_ITEMS(ELABEL, eindex); \ _PID_EDIT_MENU_ITEMS(ELABEL, eindex); \
EDIT_ITEM_FAST(int3, MSG_PID_AUTOTUNE ELABEL, &autotune_temp[eindex], 150, heater_maxtemp[eindex] - 15, lcd_autotune_callback_E ## eindex) EDIT_ITEM_FAST(int3, MSG_PID_AUTOTUNE ELABEL, &autotune_temp[eindex], 150, heater_maxtemp[eindex] - 15, [](){ _lcd_autotune(eindex); })
#else #else
#define PID_EDIT_MENU_ITEMS(ELABEL, eindex) _PID_EDIT_MENU_ITEMS(ELABEL, eindex) #define PID_EDIT_MENU_ITEMS(ELABEL, eindex) _PID_EDIT_MENU_ITEMS(ELABEL, eindex)
#endif #endif
#if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
PID_EDIT_MENU_ITEMS(" " MSG_E1, 0); PID_EDIT_MENU_ITEMS(" " LCD_STR_E0, 0);
PID_EDIT_MENU_ITEMS(" " MSG_E2, 1); PID_EDIT_MENU_ITEMS(" " LCD_STR_E1, 1);
#if HOTENDS > 2 #if HOTENDS > 2
PID_EDIT_MENU_ITEMS(" " MSG_E3, 2); PID_EDIT_MENU_ITEMS(" " LCD_STR_E2, 2);
#if HOTENDS > 3 #if HOTENDS > 3
PID_EDIT_MENU_ITEMS(" " MSG_E4, 3); PID_EDIT_MENU_ITEMS(" " LCD_STR_E3, 3);
#if HOTENDS > 4 #if HOTENDS > 4
PID_EDIT_MENU_ITEMS(" " MSG_E5, 4); PID_EDIT_MENU_ITEMS(" " LCD_STR_E4, 4);
#if HOTENDS > 5 #if HOTENDS > 5
PID_EDIT_MENU_ITEMS(" " MSG_E6, 5); PID_EDIT_MENU_ITEMS(" " LCD_STR_E5, 5);
#endif // HOTENDS > 5 #endif // HOTENDS > 5
#endif // HOTENDS > 4 #endif // HOTENDS > 4
#endif // HOTENDS > 3 #endif // HOTENDS > 3
@ -404,47 +355,14 @@ void menu_backlash();
#if DISABLED(SLIM_LCD_MENUS) #if DISABLED(SLIM_LCD_MENUS)
void _reset_acceleration_rates() { planner.reset_acceleration_rates(); }
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
void _reset_e_acceleration_rate(const uint8_t e) { if (e == active_extruder) _reset_acceleration_rates(); } inline void _reset_e_acceleration_rate(const uint8_t e) { if (e == active_extruder) planner.reset_acceleration_rates(); }
void _reset_e0_acceleration_rate() { _reset_e_acceleration_rate(0); } inline void _planner_refresh_e_positioning(const uint8_t e) {
void _reset_e1_acceleration_rate() { _reset_e_acceleration_rate(1); }
#if E_STEPPERS > 2
void _reset_e2_acceleration_rate() { _reset_e_acceleration_rate(2); }
#if E_STEPPERS > 3
void _reset_e3_acceleration_rate() { _reset_e_acceleration_rate(3); }
#if E_STEPPERS > 4
void _reset_e4_acceleration_rate() { _reset_e_acceleration_rate(4); }
#if E_STEPPERS > 5
void _reset_e5_acceleration_rate() { _reset_e_acceleration_rate(5); }
#endif // E_STEPPERS > 5
#endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3
#endif // E_STEPPERS > 2
#endif
void _planner_refresh_positioning() { planner.refresh_positioning(); }
#if ENABLED(DISTINCT_E_FACTORS)
void _planner_refresh_e_positioning(const uint8_t e) {
if (e == active_extruder) if (e == active_extruder)
_planner_refresh_positioning(); planner.refresh_positioning();
else else
planner.steps_to_mm[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)]; planner.steps_to_mm[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)];
} }
void _planner_refresh_e0_positioning() { _planner_refresh_e_positioning(0); }
void _planner_refresh_e1_positioning() { _planner_refresh_e_positioning(1); }
#if E_STEPPERS > 2
void _planner_refresh_e2_positioning() { _planner_refresh_e_positioning(2); }
#if E_STEPPERS > 3
void _planner_refresh_e3_positioning() { _planner_refresh_e_positioning(3); }
#if E_STEPPERS > 4
void _planner_refresh_e4_positioning() { _planner_refresh_e_positioning(4); }
#if E_STEPPERS > 5
void _planner_refresh_e5_positioning() { _planner_refresh_e_positioning(5); }
#endif // E_STEPPERS > 5
#endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3
#endif // E_STEPPERS > 2
#endif #endif
// M203 / M205 Velocity options // M203 / M205 Velocity options
@ -473,18 +391,18 @@ void menu_backlash();
EDIT_VMAX(C); EDIT_VMAX(C);
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
#define EDIT_VMAX_E(N) EDIT_ITEM_FAST(float3, MSG_VMAX MSG_E##N, &planner.settings.max_feedrate_mm_s[E_AXIS_N(N-1)], 1, max_fr_edit_scaled.e) #define EDIT_VMAX_E(N) EDIT_ITEM_FAST(float3, MSG_VMAX LCD_STR_E##N, &planner.settings.max_feedrate_mm_s[E_AXIS_N(N)], 1, max_fr_edit_scaled.e)
EDIT_ITEM_FAST(float3, MSG_VMAX MSG_E, &planner.settings.max_feedrate_mm_s[E_AXIS_N(active_extruder)], 1, max_fr_edit_scaled.e); EDIT_ITEM_FAST(float3, MSG_VMAX MSG_E, &planner.settings.max_feedrate_mm_s[E_AXIS_N(active_extruder)], 1, max_fr_edit_scaled.e);
EDIT_VMAX_E(0);
EDIT_VMAX_E(1); EDIT_VMAX_E(1);
EDIT_VMAX_E(2);
#if E_STEPPERS > 2 #if E_STEPPERS > 2
EDIT_VMAX_E(3); EDIT_VMAX_E(2);
#if E_STEPPERS > 3 #if E_STEPPERS > 3
EDIT_VMAX_E(4); EDIT_VMAX_E(3);
#if E_STEPPERS > 4 #if E_STEPPERS > 4
EDIT_VMAX_E(5); EDIT_VMAX_E(4);
#if E_STEPPERS > 5 #if E_STEPPERS > 5
EDIT_VMAX_E(6); EDIT_VMAX_E(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
@ -533,31 +451,31 @@ void menu_backlash();
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 MSG_##Q, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], _reset_acceleration_rates) #define EDIT_AMAX(Q,L) EDIT_ITEM_FAST(long5_25, MSG_AMAX MSG_##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,E) EDIT_ITEM_FAST(long5_25, MSG_AMAX MSG_E##N, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(E)], 100, max_accel_edit_scaled.e, _reset_e##E##_acceleration_rate) #define EDIT_AMAX_E(N) EDIT_ITEM_FAST(long5_25, MSG_AMAX LCD_STR_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 MSG_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, _reset_acceleration_rates); EDIT_ITEM_FAST(long5_25, MSG_AMAX MSG_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(1,0); EDIT_AMAX_E(0);
EDIT_AMAX_E(2,1); EDIT_AMAX_E(1);
#if E_STEPPERS > 2 #if E_STEPPERS > 2
EDIT_AMAX_E(3,2); EDIT_AMAX_E(2);
#if E_STEPPERS > 3 #if E_STEPPERS > 3
EDIT_AMAX_E(4,3); EDIT_AMAX_E(3);
#if E_STEPPERS > 4 #if E_STEPPERS > 4
EDIT_AMAX_E(5,4); EDIT_AMAX_E(4);
#if E_STEPPERS > 5 #if E_STEPPERS > 5
EDIT_AMAX_E(6,5); EDIT_AMAX_E(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
#endif // E_STEPPERS > 2 #endif // E_STEPPERS > 2
#elif E_STEPPERS #elif E_STEPPERS
EDIT_ITEM_FAST(long5_25, MSG_AMAX MSG_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, _reset_acceleration_rates); EDIT_ITEM_FAST(long5_25, MSG_AMAX MSG_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();
@ -606,30 +524,30 @@ void menu_backlash();
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,E) EDIT_ITEM_FAST(float51, MSG_E##N##STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(E)], 5, 9999, _planner_refresh_e##E##_positioning) #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_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(active_extruder)], 5, 9999, _planner_refresh_positioning); EDIT_ITEM_FAST(float51, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(active_extruder)], 5, 9999, [](){ planner.refresh_positioning(); });
EDIT_ESTEPS(1,0); EDIT_ESTEPS(0);
EDIT_ESTEPS(2,1); EDIT_ESTEPS(1);
#if E_STEPPERS > 2 #if E_STEPPERS > 2
EDIT_ESTEPS(3,2); EDIT_ESTEPS(2);
#if E_STEPPERS > 3 #if E_STEPPERS > 3
EDIT_ESTEPS(4,3); EDIT_ESTEPS(3);
#if E_STEPPERS > 4 #if E_STEPPERS > 4
EDIT_ESTEPS(5,4); EDIT_ESTEPS(4);
#if E_STEPPERS > 5 #if E_STEPPERS > 5
EDIT_ESTEPS(6,5); EDIT_ESTEPS(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
#endif // E_STEPPERS > 2 #endif // E_STEPPERS > 2
#elif E_STEPPERS #elif E_STEPPERS
EDIT_ITEM_FAST(float51, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); EDIT_ITEM_FAST(float51, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, [](){ planner.refresh_positioning(); });
#endif #endif
END_MENU(); END_MENU();
@ -671,7 +589,7 @@ void menu_advanced_settings() {
// //
// Set Home Offsets // Set Home Offsets
// //
ACTION_ITEM(MSG_SET_HOME_OFFSETS, _lcd_set_home_offsets); 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
@ -714,17 +632,17 @@ void menu_advanced_settings() {
#if EXTRUDERS == 1 #if EXTRUDERS == 1
EDIT_ITEM(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999); EDIT_ITEM(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
#elif EXTRUDERS > 1 #elif EXTRUDERS > 1
#define EDIT_ADVANCE_K(N) EDIT_ITEM(float52, MSG_ADVANCE_K MSG_E##N, &planner.extruder_advance_K[N-1], 0, 999) #define EDIT_ADVANCE_K(N) EDIT_ITEM(float52, MSG_ADVANCE_K LCD_STR_E##N, &planner.extruder_advance_K[N], 0, 999)
EDIT_ADVANCE_K(0);
EDIT_ADVANCE_K(1); EDIT_ADVANCE_K(1);
EDIT_ADVANCE_K(2);
#if EXTRUDERS > 2 #if EXTRUDERS > 2
EDIT_ADVANCE_K(3); EDIT_ADVANCE_K(2);
#if EXTRUDERS > 3 #if EXTRUDERS > 3
EDIT_ADVANCE_K(4); EDIT_ADVANCE_K(3);
#if EXTRUDERS > 4 #if EXTRUDERS > 4
EDIT_ADVANCE_K(5); EDIT_ADVANCE_K(4);
#if EXTRUDERS > 5 #if EXTRUDERS > 5
EDIT_ADVANCE_K(6); EDIT_ADVANCE_K(5);
#endif // EXTRUDERS > 5 #endif // EXTRUDERS > 5
#endif // EXTRUDERS > 4 #endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3 #endif // EXTRUDERS > 3

View file

@ -260,13 +260,15 @@ void menu_bed_leveling() {
// Homed and leveling is valid? Then leveling can be toggled. // Homed and leveling is valid? Then leveling can be toggled.
if (is_homed && leveling_is_valid()) { if (is_homed && leveling_is_valid()) {
bool new_level_state = planner.leveling_active; bool show_state = planner.leveling_active;
EDIT_ITEM(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling); EDIT_ITEM(bool, MSG_BED_LEVELING, &show_state, _lcd_toggle_bed_leveling);
} }
// Z Fade Height // Z Fade Height
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &lcd_z_fade_height, 0, 100, _lcd_set_z_fade_height); // Shadow for editing the 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); });
#endif #endif
// //

View file

@ -54,13 +54,6 @@ void menu_advanced_settings();
void menu_delta_calibrate(); void menu_delta_calibrate();
#endif #endif
static void lcd_factory_settings() {
settings.reset();
#if HAS_BUZZER
ui.completion_feedback();
#endif
}
#if ENABLED(LCD_PROGRESS_BAR_TEST) #if ENABLED(LCD_PROGRESS_BAR_TEST)
#include "../lcdprint.h" #include "../lcdprint.h"
@ -166,12 +159,10 @@ static void lcd_factory_settings() {
GCODES_ITEM(MSG_IDEX_MODE_AUTOPARK, PSTR("M605 S1\nG28 X\nG1 X100")); GCODES_ITEM(MSG_IDEX_MODE_AUTOPARK, PSTR("M605 S1\nG28 X\nG1 X100"));
const bool need_g28 = !(TEST(axis_known_position, Y_AXIS) && TEST(axis_known_position, Z_AXIS)); const bool need_g28 = !(TEST(axis_known_position, Y_AXIS) && TEST(axis_known_position, Z_AXIS));
GCODES_ITEM(MSG_IDEX_MODE_DUPLICATE, need_g28 GCODES_ITEM(MSG_IDEX_MODE_DUPLICATE, need_g28
? PSTR("M605 S1\nT0\nG28\nM605 S2 X200\nG28 X\nG1 X100") // If Y or Z is not homed, do a full G28 first ? PSTR("M605 S1\nT0\nG28\nM605 S2 X200\nG28 X\nG1 X100") // If Y or Z is not homed, do a full G28 first
: PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100") : PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100")
); );
GCODES_ITEM(MSG_IDEX_MODE_MIRRORED_COPY, need_g28 GCODES_ITEM(MSG_IDEX_MODE_MIRRORED_COPY, need_g28
? PSTR("M605 S1\nT0\nG28\nM605 S2 X200\nG28 X\nG1 X100\nM605 S3 X200") // If Y or Z is not homed, do a full G28 first ? PSTR("M605 S1\nT0\nG28\nM605 S2 X200\nG28 X\nG1 X100\nM605 S3 X200") // If Y or Z is not homed, do a full G28 first
: PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100\nM605 S3 X200") : PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100\nM605 S3 X200")
@ -408,7 +399,12 @@ void menu_configuration() {
#endif #endif
if (!busy) if (!busy)
ACTION_ITEM(MSG_RESTORE_FAILSAFE, lcd_factory_settings); ACTION_ITEM(MSG_RESTORE_FAILSAFE, [](){
settings.reset();
#if HAS_BUZZER
ui.completion_feedback();
#endif
});
END_MENU(); END_MENU();
} }

View file

@ -47,39 +47,23 @@ void _lcd_user_gcode(PGM_P const cmd) {
#endif #endif
} }
#if defined(USER_DESC_1) && defined(USER_GCODE_1)
void lcd_user_gcode_1() { _lcd_user_gcode(PSTR(USER_GCODE_1 _DONE_SCRIPT)); }
#endif
#if defined(USER_DESC_2) && defined(USER_GCODE_2)
void lcd_user_gcode_2() { _lcd_user_gcode(PSTR(USER_GCODE_2 _DONE_SCRIPT)); }
#endif
#if defined(USER_DESC_3) && defined(USER_GCODE_3)
void lcd_user_gcode_3() { _lcd_user_gcode(PSTR(USER_GCODE_3 _DONE_SCRIPT)); }
#endif
#if defined(USER_DESC_4) && defined(USER_GCODE_4)
void lcd_user_gcode_4() { _lcd_user_gcode(PSTR(USER_GCODE_4 _DONE_SCRIPT)); }
#endif
#if defined(USER_DESC_5) && defined(USER_GCODE_5)
void lcd_user_gcode_5() { _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); }
#endif
void menu_user() { 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(USER_DESC_1, lcd_user_gcode_1); ACTION_ITEM(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(USER_DESC_2, lcd_user_gcode_2); ACTION_ITEM(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(USER_DESC_3, lcd_user_gcode_3); ACTION_ITEM(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(USER_DESC_4, lcd_user_gcode_4); ACTION_ITEM(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(USER_DESC_5, lcd_user_gcode_5); ACTION_ITEM(USER_DESC_5, [](){ _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); });
#endif #endif
END_MENU(); END_MENU();
} }

View file

@ -94,14 +94,13 @@ void _man_probe_pt(const xy_pos_t &xy) {
#endif #endif
void _recalc_delta_settings() {
#if HAS_LEVELING
reset_bed_level(); // After changing kinematics bed-level data is no longer valid
#endif
recalc_delta_settings();
}
void lcd_delta_settings() { void lcd_delta_settings() {
auto _recalc_delta_settings = []() {
#if HAS_LEVELING
reset_bed_level(); // After changing kinematics bed-level data is no longer valid
#endif
recalc_delta_settings();
};
START_MENU(); START_MENU();
BACK_ITEM(MSG_DELTA_CALIBRATE); BACK_ITEM(MSG_DELTA_CALIBRATE);
EDIT_ITEM(float52sign, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10, delta_height + 10, _recalc_delta_settings); EDIT_ITEM(float52sign, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10, delta_height + 10, _recalc_delta_settings);

View file

@ -55,17 +55,19 @@ inline PGM_P _change_filament_temp_command() {
return PSTR(MSG_FILAMENTCHANGE); return PSTR(MSG_FILAMENTCHANGE);
} }
// Initiate Filament Load/Unload/Change at the specified temperature
static void _change_filament_temp(const uint16_t temperature) { static void _change_filament_temp(const uint16_t temperature) {
char cmd[11]; char cmd[11];
sprintf_P(cmd, _change_filament_temp_command(), _change_filament_temp_extruder); sprintf_P(cmd, _change_filament_temp_command(), _change_filament_temp_extruder);
thermalManager.setTargetHotend(temperature, _change_filament_temp_extruder); thermalManager.setTargetHotend(temperature, _change_filament_temp_extruder);
lcd_enqueue_one_now(cmd); lcd_enqueue_one_now(cmd);
} }
inline void _lcd_change_filament_temp_1_func() { _change_filament_temp(ui.preheat_hotend_temp[0]); }
inline void _lcd_change_filament_temp_2_func() { _change_filament_temp(ui.preheat_hotend_temp[1]); }
inline void _lcd_change_filament_temp_custom_cb() { _change_filament_temp(thermalManager.temp_hotend[_change_filament_temp_extruder].target); }
static PGM_P change_filament_header(const PauseMode mode) { //
// Menu to choose the temperature and start Filament Change
//
inline PGM_P change_filament_header(const PauseMode mode) {
switch (mode) { switch (mode) {
case PAUSE_MODE_LOAD_FILAMENT: case PAUSE_MODE_LOAD_FILAMENT:
return PSTR(MSG_FILAMENTLOAD); return PSTR(MSG_FILAMENTLOAD);
@ -76,66 +78,19 @@ static PGM_P change_filament_header(const PauseMode mode) {
return PSTR(MSG_FILAMENTCHANGE); return PSTR(MSG_FILAMENTCHANGE);
} }
void _menu_temp_filament_op(const PauseMode inMode, const int8_t extruder) { void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
// If no print is active, just label as "filament change"
const PauseMode mode = (inMode != PAUSE_MODE_PAUSE_PRINT || printingIsPaused()) ? inMode : PAUSE_MODE_CHANGE_FILAMENT;
_change_filament_temp_mode = mode; _change_filament_temp_mode = mode;
_change_filament_temp_extruder = extruder; _change_filament_temp_extruder = 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, _lcd_change_filament_temp_1_func); ACTION_ITEM(MSG_PREHEAT_1, [](){ _change_filament_temp(ui.preheat_hotend_temp[0]); });
ACTION_ITEM(MSG_PREHEAT_2, _lcd_change_filament_temp_2_func); ACTION_ITEM(MSG_PREHEAT_2, [](){ _change_filament_temp(ui.preheat_hotend_temp[1]); });
uint16_t max_temp; EDIT_ITEM_FAST(int3, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[_change_filament_temp_extruder].target, EXTRUDE_MINTEMP, heater_maxtemp[extruder] - 15, [](){
switch (extruder) { _change_filament_temp(thermalManager.temp_hotend[_change_filament_temp_extruder].target);
default: max_temp = HEATER_0_MAXTEMP; });
#if HOTENDS > 1
case 1: max_temp = HEATER_1_MAXTEMP; break;
#if HOTENDS > 2
case 2: max_temp = HEATER_2_MAXTEMP; break;
#if HOTENDS > 3
case 3: max_temp = HEATER_3_MAXTEMP; break;
#if HOTENDS > 4
case 4: max_temp = HEATER_4_MAXTEMP; break;
#if HOTENDS > 5
case 5: max_temp = HEATER_5_MAXTEMP; break;
#endif
#endif
#endif
#endif
#endif
}
EDIT_ITEM_FAST(int3, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[_change_filament_temp_extruder].target, EXTRUDE_MINTEMP, max_temp - 15, _lcd_change_filament_temp_custom_cb);
END_MENU(); END_MENU();
} }
#if E_STEPPERS
void menu_temp_e0_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 0); }
void menu_temp_e0_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); }
void menu_temp_e0_filament_unload() { _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); }
#if E_STEPPERS > 1
void menu_temp_e1_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 1); }
void menu_temp_e1_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 1); }
void menu_temp_e1_filament_unload() { _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 1); }
#if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
void menu_unload_filament_all_temp() { _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, -1); }
#endif
#if E_STEPPERS > 2
void menu_temp_e2_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 2); }
void menu_temp_e2_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 2); }
void menu_temp_e2_filament_unload() { _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 2); }
#if E_STEPPERS > 3
void menu_temp_e3_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 3); }
void menu_temp_e3_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 3); }
void menu_temp_e3_filament_unload() { _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 3); }
#if E_STEPPERS > 4
void menu_temp_e4_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 4); }
void menu_temp_e4_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 4); }
void menu_temp_e4_filament_unload() { _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 4); }
#endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3
#endif // E_STEPPERS > 2
#endif // E_STEPPERS > 1
#endif // E_STEPPERS
/** /**
* *
@ -147,46 +102,49 @@ void _menu_temp_filament_op(const PauseMode inMode, const int8_t extruder) {
START_MENU(); START_MENU();
BACK_ITEM(MSG_MAIN); BACK_ITEM(MSG_MAIN);
// Say "filament change" when no print is active
editable.int8 = printingIsPaused() ? PAUSE_MODE_PAUSE_PRINT : PAUSE_MODE_CHANGE_FILAMENT;
// Change filament // Change filament
#if E_STEPPERS == 1 #if E_STEPPERS == 1
PGM_P msg0 = PSTR(MSG_FILAMENTCHANGE); PGM_P const msg0 = PSTR(MSG_FILAMENTCHANGE);
if (thermalManager.targetTooColdToExtrude(active_extruder)) if (thermalManager.targetTooColdToExtrude(active_extruder))
MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_change); 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 msg0 = PSTR(MSG_FILAMENTCHANGE " " MSG_E1); PGM_P const msg0 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E0);
PGM_P msg1 = PSTR(MSG_FILAMENTCHANGE " " MSG_E2); PGM_P const msg1 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E1);
if (thermalManager.targetTooColdToExtrude(0)) if (thermalManager.targetTooColdToExtrude(0))
MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_change); 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_e1_filament_change); 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 msg2 = PSTR(MSG_FILAMENTCHANGE " " MSG_E3); PGM_P const msg2 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E2);
if (thermalManager.targetTooColdToExtrude(2)) if (thermalManager.targetTooColdToExtrude(2))
MENU_ITEM_P(submenu, msg2, menu_temp_e2_filament_change); 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 msg3 = PSTR(MSG_FILAMENTCHANGE " " MSG_E4); PGM_P const msg3 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E3);
if (thermalManager.targetTooColdToExtrude(3)) if (thermalManager.targetTooColdToExtrude(3))
MENU_ITEM_P(submenu, msg3, menu_temp_e3_filament_change); 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 msg4 = PSTR(MSG_FILAMENTCHANGE " " MSG_E5); PGM_P const msg4 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E4);
if (thermalManager.targetTooColdToExtrude(4)) if (thermalManager.targetTooColdToExtrude(4))
MENU_ITEM_P(submenu, msg4, menu_temp_e4_filament_change); 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 msg5 = PSTR(MSG_FILAMENTCHANGE " " MSG_E6); PGM_P const msg5 = PSTR(MSG_FILAMENTCHANGE " " LCD_STR_E5);
if (thermalManager.targetTooColdToExtrude(5)) if (thermalManager.targetTooColdToExtrude(5))
MENU_ITEM_P(submenu, msg5, menu_temp_e5_filament_change); 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
@ -199,44 +157,44 @@ void _menu_temp_filament_op(const PauseMode inMode, const int8_t extruder) {
if (!printer_busy()) { if (!printer_busy()) {
// Load filament // Load filament
#if E_STEPPERS == 1 #if E_STEPPERS == 1
PGM_P msg0 = PSTR(MSG_FILAMENTLOAD); PGM_P const msg0 = PSTR(MSG_FILAMENTLOAD);
if (thermalManager.targetTooColdToExtrude(active_extruder)) if (thermalManager.targetTooColdToExtrude(active_extruder))
MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_load); 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 msg0 = PSTR(MSG_FILAMENTLOAD " " MSG_E1); PGM_P const msg0 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E0);
PGM_P msg1 = PSTR(MSG_FILAMENTLOAD " " MSG_E2); PGM_P const msg1 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E1);
if (thermalManager.targetTooColdToExtrude(0)) if (thermalManager.targetTooColdToExtrude(0))
MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_load); 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_e1_filament_load); 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 msg2 = PSTR(MSG_FILAMENTLOAD " " MSG_E3); PGM_P const msg2 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E2);
if (thermalManager.targetTooColdToExtrude(2)) if (thermalManager.targetTooColdToExtrude(2))
MENU_ITEM_P(submenu, msg2, menu_temp_e2_filament_load); 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 msg3 = PSTR(MSG_FILAMENTLOAD " " MSG_E4); PGM_P const msg3 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E3);
if (thermalManager.targetTooColdToExtrude(3)) if (thermalManager.targetTooColdToExtrude(3))
MENU_ITEM_P(submenu, msg3, menu_temp_e3_filament_load); 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 msg4 = PSTR(MSG_FILAMENTLOAD " " MSG_E5); PGM_P const msg4 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E4);
if (thermalManager.targetTooColdToExtrude(4)) if (thermalManager.targetTooColdToExtrude(4))
MENU_ITEM_P(submenu, msg4, menu_temp_e4_filament_load); 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 msg5 = PSTR(MSG_FILAMENTLOAD " " MSG_E6); PGM_P const msg5 = PSTR(MSG_FILAMENTLOAD " " LCD_STR_E5);
if (thermalManager.targetTooColdToExtrude(5)) if (thermalManager.targetTooColdToExtrude(5))
MENU_ITEM_P(submenu, msg5, menu_temp_e5_filament_load); 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
@ -250,7 +208,7 @@ void _menu_temp_filament_op(const PauseMode inMode, 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_e0_filament_unload); 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, &&,
@ -262,36 +220,36 @@ void _menu_temp_filament_op(const PauseMode inMode, 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_unload_filament_all_temp); 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 " " MSG_E1, PSTR("M702 T0")); GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E0, PSTR("M702 T0"));
else else
SUBMENU(MSG_FILAMENTUNLOAD " " MSG_E1, menu_temp_e0_filament_unload); SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_E0, [](){ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); });
if (thermalManager.targetHotEnoughToExtrude(1)) if (thermalManager.targetHotEnoughToExtrude(1))
GCODES_ITEM(MSG_FILAMENTUNLOAD " " MSG_E2, PSTR("M702 T1")); GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E1, PSTR("M702 T1"));
else else
SUBMENU(MSG_FILAMENTUNLOAD " " MSG_E2, menu_temp_e1_filament_unload); SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_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 " " MSG_E3, PSTR("M702 T2")); GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E2, PSTR("M702 T2"));
else else
SUBMENU(MSG_FILAMENTUNLOAD " " MSG_E3, menu_temp_e2_filament_unload); SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_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 " " MSG_E4, PSTR("M702 T3")); GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E3, PSTR("M702 T3"));
else else
SUBMENU(MSG_FILAMENTUNLOAD " " MSG_E4, menu_temp_e3_filament_unload); SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_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 " " MSG_E5, PSTR("M702 T4")); GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E4, PSTR("M702 T4"));
else else
SUBMENU(MSG_FILAMENTUNLOAD " " MSG_E5, menu_temp_e4_filament_unload); SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_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 " " MSG_E6, PSTR("M702 T5")); GCODES_ITEM(MSG_FILAMENTUNLOAD " " LCD_STR_E5, PSTR("M702 T5"));
else else
SUBMENU(MSG_FILAMENTUNLOAD " " MSG_E6, menu_temp_e5_filament_unload); SUBMENU(MSG_FILAMENTUNLOAD " " LCD_STR_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
@ -336,26 +294,18 @@ static PGM_P pause_header() {
++_thisItemNr; \ ++_thisItemNr; \
}while(0) }while(0)
void lcd_pause_resume_print() {
pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT;
}
void lcd_pause_extrude_more() {
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE;
}
void menu_pause_option() { void menu_pause_option() {
START_MENU(); START_MENU();
#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, lcd_pause_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, lcd_pause_resume_print); ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_RESUME, [](){ pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; });
END_MENU(); END_MENU();
} }

View file

@ -62,7 +62,7 @@ void menu_configuration();
#endif #endif
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
void menu_temp_e0_filament_change(); void _menu_temp_filament_op(const PauseMode, const int8_t);
void menu_change_filament(); void menu_change_filament();
#endif #endif
@ -170,6 +170,10 @@ void menu_main() {
SUBMENU(MSG_CONFIGURATION, menu_configuration); SUBMENU(MSG_CONFIGURATION, menu_configuration);
#if ENABLED(CUSTOM_USER_MENUS) #if ENABLED(CUSTOM_USER_MENUS)
#ifdef CUSTOM_USER_MENU_TITLE
#undef MSG_USER_MENU
#define MSG_USER_MENU CUSTOM_USER_MENU_TITLE
#endif
SUBMENU(MSG_USER_MENU, menu_user); SUBMENU(MSG_USER_MENU, menu_user);
#endif #endif
@ -178,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_e0_filament_change); SUBMENU(MSG_FILAMENTCHANGE, [](){ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); });
#else #else
SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament); SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament);
#endif #endif

View file

@ -31,13 +31,6 @@
#include "menu.h" #include "menu.h"
#include "../../sd/cardreader.h" #include "../../sd/cardreader.h"
#if !PIN_EXISTS(SD_DETECT)
void lcd_sd_refresh() {
encoderTopLine = 0;
card.mount();
}
#endif
void lcd_sd_updir() { void lcd_sd_updir() {
ui.encoderPosition = card.cdup() ? ENCODER_STEPS_PER_MENU_ITEM : 0; ui.encoderPosition = card.cdup() ? ENCODER_STEPS_PER_MENU_ITEM : 0;
encoderTopLine = 0; encoderTopLine = 0;
@ -141,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(LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh); ACTION_ITEM(LCD_STR_REFRESH MSG_REFRESH, [](){ encoderTopLine = 0; card.mount(); });
#endif #endif
} }
else if (card.isMounted()) else if (card.isMounted())

View file

@ -42,15 +42,10 @@ void _mmu2_load_filamentToNozzle(uint8_t index) {
if (mmu2.load_filament_to_nozzle(index)) ui.reset_status(); if (mmu2.load_filament_to_nozzle(index)) ui.reset_status();
} }
inline void action_mmu2_load_filament_to_nozzl_e(const uint8_t tool) { inline void action_mmu2_load_filament_to_nozzle(const uint8_t tool) {
_mmu2_load_filamentToNozzle(tool); _mmu2_load_filamentToNozzle(tool);
ui.return_to_status(); ui.return_to_status();
} }
inline void action_mmu2_load_filament_to_nozzle_0() { action_mmu2_load_filament_to_nozzl_e(0); }
inline void action_mmu2_load_filament_to_nozzle_1() { action_mmu2_load_filament_to_nozzl_e(1); }
inline void action_mmu2_load_filament_to_nozzle_2() { action_mmu2_load_filament_to_nozzl_e(2); }
inline void action_mmu2_load_filament_to_nozzle_3() { action_mmu2_load_filament_to_nozzl_e(3); }
inline void action_mmu2_load_filament_to_nozzle_4() { action_mmu2_load_filament_to_nozzl_e(4); }
void _mmu2_load_filament(uint8_t index) { void _mmu2_load_filament(uint8_t index) {
ui.return_to_status(); ui.return_to_status();
@ -63,32 +58,27 @@ void action_mmu2_load_all() {
_mmu2_load_filament(i); _mmu2_load_filament(i);
ui.return_to_status(); ui.return_to_status();
} }
inline void action_mmu2_load_filament_0() { _mmu2_load_filament(0); }
inline void action_mmu2_load_filament_1() { _mmu2_load_filament(1); }
inline void action_mmu2_load_filament_2() { _mmu2_load_filament(2); }
inline void action_mmu2_load_filament_3() { _mmu2_load_filament(3); }
inline void action_mmu2_load_filament_4() { _mmu2_load_filament(4); }
void menu_mmu2_load_filament() { 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, action_mmu2_load_filament_0); ACTION_ITEM(MSG_MMU2_FILAMENT0, [](){ _mmu2_load_filament(0); });
ACTION_ITEM(MSG_MMU2_FILAMENT1, action_mmu2_load_filament_1); ACTION_ITEM(MSG_MMU2_FILAMENT1, [](){ _mmu2_load_filament(1); });
ACTION_ITEM(MSG_MMU2_FILAMENT2, action_mmu2_load_filament_2); ACTION_ITEM(MSG_MMU2_FILAMENT2, [](){ _mmu2_load_filament(2); });
ACTION_ITEM(MSG_MMU2_FILAMENT3, action_mmu2_load_filament_3); ACTION_ITEM(MSG_MMU2_FILAMENT3, [](){ _mmu2_load_filament(3); });
ACTION_ITEM(MSG_MMU2_FILAMENT4, action_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();
} }
@ -102,11 +92,6 @@ void _mmu2_eject_filament(uint8_t index) {
ui.status_printf_P(0, PSTR(MSG_MMU2_EJECTING_FILAMENT), int(index + 1)); ui.status_printf_P(0, PSTR(MSG_MMU2_EJECTING_FILAMENT), int(index + 1));
if (mmu2.eject_filament(index, true)) ui.reset_status(); if (mmu2.eject_filament(index, true)) ui.reset_status();
} }
inline void action_mmu2_eject_filament_0() { _mmu2_eject_filament(0); }
inline void action_mmu2_eject_filament_1() { _mmu2_eject_filament(1); }
inline void action_mmu2_eject_filament_2() { _mmu2_eject_filament(2); }
inline void action_mmu2_eject_filament_3() { _mmu2_eject_filament(3); }
inline void action_mmu2_eject_filament_4() { _mmu2_eject_filament(4); }
void action_mmu2_unload_filament() { void action_mmu2_unload_filament() {
ui.reset_status(); ui.reset_status();
@ -119,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, action_mmu2_eject_filament_0); ACTION_ITEM(MSG_MMU2_FILAMENT0, [](){ _mmu2_eject_filament(0); });
ACTION_ITEM(MSG_MMU2_FILAMENT1, action_mmu2_eject_filament_1); ACTION_ITEM(MSG_MMU2_FILAMENT1, [](){ _mmu2_eject_filament(1); });
ACTION_ITEM(MSG_MMU2_FILAMENT2, action_mmu2_eject_filament_2); ACTION_ITEM(MSG_MMU2_FILAMENT2, [](){ _mmu2_eject_filament(2); });
ACTION_ITEM(MSG_MMU2_FILAMENT3, action_mmu2_eject_filament_3); ACTION_ITEM(MSG_MMU2_FILAMENT3, [](){ _mmu2_eject_filament(3); });
ACTION_ITEM(MSG_MMU2_FILAMENT4, action_mmu2_eject_filament_4); ACTION_ITEM(MSG_MMU2_FILAMENT4, [](){ _mmu2_eject_filament(4); });
END_MENU(); END_MENU();
} }
@ -155,22 +140,17 @@ inline void action_mmu2_choose(const uint8_t tool) {
currentTool = tool; currentTool = tool;
mmuMenuWait = false; mmuMenuWait = false;
} }
inline void action_mmu2_choose0() { action_mmu2_choose(0); }
inline void action_mmu2_choose1() { action_mmu2_choose(1); }
inline void action_mmu2_choose2() { action_mmu2_choose(2); }
inline void action_mmu2_choose3() { action_mmu2_choose(3); }
inline void action_mmu2_choose4() { action_mmu2_choose(4); }
void menu_mmu2_choose_filament() { void menu_mmu2_choose_filament() {
START_MENU(); START_MENU();
#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_choose0); ACTION_ITEM(MSG_MMU2_FILAMENT0, [](){ action_mmu2_choose(0); });
ACTION_ITEM(MSG_MMU2_FILAMENT1, action_mmu2_choose1); ACTION_ITEM(MSG_MMU2_FILAMENT1, [](){ action_mmu2_choose(1); });
ACTION_ITEM(MSG_MMU2_FILAMENT2, action_mmu2_choose2); ACTION_ITEM(MSG_MMU2_FILAMENT2, [](){ action_mmu2_choose(2); });
ACTION_ITEM(MSG_MMU2_FILAMENT3, action_mmu2_choose3); ACTION_ITEM(MSG_MMU2_FILAMENT3, [](){ action_mmu2_choose(3); });
ACTION_ITEM(MSG_MMU2_FILAMENT4, action_mmu2_choose4); ACTION_ITEM(MSG_MMU2_FILAMENT4, [](){ action_mmu2_choose(4); });
END_MENU(); END_MENU();
} }
@ -178,21 +158,16 @@ void menu_mmu2_choose_filament() {
// MMU2 Filament Runout // MMU2 Filament Runout
// //
inline void action_mmu2_M600_load_current_filament() { mmu2.load_filament(currentTool); }
inline void action_mmu2_M600_load_current_filament_to_nozzle() { mmu2.load_filament_to_nozzle(currentTool); }
inline void action_mmu2_M600_unload_filament() { mmu2.unload(); }
inline void action_mmu2_M600_resume() { mmuMenuWait = false; }
void menu_mmu2_pause() { void menu_mmu2_pause() {
currentTool = mmu2.get_current_tool(); currentTool = mmu2.get_current_tool();
START_MENU(); START_MENU();
#if LCD_HEIGHT > 2 #if LCD_HEIGHT > 2
STATIC_ITEM(MSG_MMU2_FILAMENT_CHANGE_HEADER, SS_CENTER|SS_INVERT); STATIC_ITEM(MSG_MMU2_FILAMENT_CHANGE_HEADER, SS_CENTER|SS_INVERT);
#endif #endif
ACTION_ITEM(MSG_MMU2_RESUME, action_mmu2_M600_resume); ACTION_ITEM(MSG_MMU2_RESUME, [](){ mmuMenuWait = false; });
ACTION_ITEM(MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_M600_unload_filament); ACTION_ITEM(MSG_MMU2_UNLOAD_FILAMENT, [](){ mmu2.unload(); });
ACTION_ITEM(MSG_MMU2_LOAD_FILAMENT, action_mmu2_M600_load_current_filament); ACTION_ITEM(MSG_MMU2_LOAD_FILAMENT, [](){ mmu2.load_filament(currentTool); });
ACTION_ITEM(MSG_MMU2_LOAD_TO_NOZZLE, action_mmu2_M600_load_current_filament_to_nozzle); ACTION_ITEM(MSG_MMU2_LOAD_TO_NOZZLE, [](){ mmu2.load_filament_to_nozzle(currentTool); });
END_MENU(); END_MENU();
} }

View file

@ -161,7 +161,7 @@ void lcd_move_z() { _lcd_move_xyz(PSTR(MSG_MOVE_Z), Z_AXIS); }
#if E_MANUAL #if E_MANUAL
static void _lcd_move_e( static void lcd_move_e(
#if E_MANUAL > 1 #if E_MANUAL > 1
const int8_t eindex=-1 const int8_t eindex=-1
#endif #endif
@ -190,16 +190,16 @@ void lcd_move_z() { _lcd_move_xyz(PSTR(MSG_MOVE_Z), Z_AXIS); }
pos_label = PSTR(MSG_MOVE_E); pos_label = PSTR(MSG_MOVE_E);
#else #else
switch (eindex) { switch (eindex) {
default: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E1); break; default: pos_label = PSTR(MSG_MOVE_E LCD_STR_N0); break;
case 1: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E2); break; case 1: pos_label = PSTR(MSG_MOVE_E LCD_STR_N1); break;
#if E_MANUAL > 2 #if E_MANUAL > 2
case 2: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E3); break; case 2: pos_label = PSTR(MSG_MOVE_E LCD_STR_N2); break;
#if E_MANUAL > 3 #if E_MANUAL > 3
case 3: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E4); break; case 3: pos_label = PSTR(MSG_MOVE_E LCD_STR_N3); break;
#if E_MANUAL > 4 #if E_MANUAL > 4
case 4: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E5); break; case 4: pos_label = PSTR(MSG_MOVE_E LCD_STR_N4); break;
#if E_MANUAL > 5 #if E_MANUAL > 5
case 5: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E6); break; case 5: pos_label = PSTR(MSG_MOVE_E LCD_STR_N5); break;
#endif // E_MANUAL > 5 #endif // E_MANUAL > 5
#endif // E_MANUAL > 4 #endif // E_MANUAL > 4
#endif // E_MANUAL > 3 #endif // E_MANUAL > 3
@ -218,24 +218,6 @@ void lcd_move_z() { _lcd_move_xyz(PSTR(MSG_MOVE_Z), Z_AXIS); }
} }
} }
inline void lcd_move_e() { _lcd_move_e(); }
#if E_MANUAL > 1
inline void lcd_move_e0() { _lcd_move_e(0); }
inline void lcd_move_e1() { _lcd_move_e(1); }
#if E_MANUAL > 2
inline void lcd_move_e2() { _lcd_move_e(2); }
#if E_MANUAL > 3
inline void lcd_move_e3() { _lcd_move_e(3); }
#if E_MANUAL > 4
inline void lcd_move_e4() { _lcd_move_e(4); }
#if E_MANUAL > 5
inline void lcd_move_e5() { _lcd_move_e(5); }
#endif // E_MANUAL > 5
#endif // E_MANUAL > 4
#endif // E_MANUAL > 3
#endif // E_MANUAL > 2
#endif // E_MANUAL > 1
#endif // E_MANUAL #endif // E_MANUAL
// //
@ -253,9 +235,6 @@ void _goto_manual_move(const float scale) {
move_menu_scale = scale; move_menu_scale = scale;
ui.goto_screen(_manual_move_func_ptr); ui.goto_screen(_manual_move_func_ptr);
} }
void menu_move_10mm() { _goto_manual_move(10); }
void menu_move_1mm() { _goto_manual_move( 1); }
void menu_move_01mm() { _goto_manual_move( 0.1f); }
void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int8_t eindex=-1) { void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int8_t eindex=-1) {
_manual_move_func_ptr = func; _manual_move_func_ptr = func;
@ -280,9 +259,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, menu_move_10mm); SUBMENU(MSG_MOVE_10MM, [](){ _goto_manual_move(10); });
SUBMENU(MSG_MOVE_1MM, menu_move_1mm); SUBMENU(MSG_MOVE_1MM, [](){ _goto_manual_move( 1); });
SUBMENU(MSG_MOVE_01MM, menu_move_01mm); 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("", []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); }); SUBMENU("", []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); });
MENU_ITEM_ADDON_START(1); MENU_ITEM_ADDON_START(1);
@ -297,36 +276,6 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
} }
END_MENU(); END_MENU();
} }
void lcd_move_get_x_amount() { _menu_move_distance(X_AXIS, lcd_move_x); }
void lcd_move_get_y_amount() { _menu_move_distance(Y_AXIS, lcd_move_y); }
void lcd_move_get_z_amount() { _menu_move_distance(Z_AXIS, lcd_move_z); }
#if E_MANUAL
void lcd_move_get_e_amount() { _menu_move_distance(E_AXIS, lcd_move_e, -1); }
#if E_MANUAL > 1
void lcd_move_get_e0_amount() { _menu_move_distance(E_AXIS, lcd_move_e0, 0); }
void lcd_move_get_e1_amount() { _menu_move_distance(E_AXIS, lcd_move_e1, 1); }
#if E_MANUAL > 2
void lcd_move_get_e2_amount() { _menu_move_distance(E_AXIS, lcd_move_e2, 2); }
#if E_MANUAL > 3
void lcd_move_get_e3_amount() { _menu_move_distance(E_AXIS, lcd_move_e3, 3); }
#if E_MANUAL > 4
void lcd_move_get_e4_amount() { _menu_move_distance(E_AXIS, lcd_move_e4, 4); }
#if E_MANUAL > 5
void lcd_move_get_e5_amount() { _menu_move_distance(E_AXIS, lcd_move_e5, 5); }
#endif // E_MANUAL > 5
#endif // E_MANUAL > 4
#endif // E_MANUAL > 3
#endif // E_MANUAL > 2
#endif // E_MANUAL > 1
#endif // E_MANUAL
#if ENABLED(DELTA)
void lcd_lower_z_to_clip_height() {
line_to_z(delta_clip_start_height);
ui.synchronize();
}
#endif
void menu_move() { void menu_move() {
START_MENU(); START_MENU();
@ -350,88 +299,85 @@ void menu_move() {
true true
#endif #endif
) { ) {
SUBMENU(MSG_MOVE_X, lcd_move_get_x_amount); SUBMENU(MSG_MOVE_X, [](){ _menu_move_distance(X_AXIS, lcd_move_x); });
SUBMENU(MSG_MOVE_Y, lcd_move_get_y_amount); 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, lcd_lower_z_to_clip_height); ACTION_ITEM(MSG_FREE_XY, [](){ line_to_z(delta_clip_start_height); ui.synchronize(); });
#endif #endif
SUBMENU(MSG_MOVE_Z, lcd_move_get_z_amount); SUBMENU(MSG_MOVE_Z, [](){ _menu_move_distance(Y_AXIS, lcd_move_y); });
} }
else else
GCODES_ITEM(MSG_AUTO_HOME, PSTR("G28")); GCODES_ITEM(MSG_AUTO_HOME, PSTR("G28"));
#if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, MAGNETIC_SWITCHING_TOOLHEAD) #if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, MAGNETIC_SWITCHING_TOOLHEAD)
#if EXTRUDERS == 6 #if EXTRUDERS >= 4
switch (active_extruder) { switch (active_extruder) {
case 0: GCODES_ITEM(MSG_SELECT " " MSG_E2, PSTR("T1")); break; case 0: GCODES_ITEM(MSG_SELECT " " LCD_STR_E1, PSTR("T1")); break;
case 1: GCODES_ITEM(MSG_SELECT " " MSG_E1, PSTR("T0")); break; case 1: GCODES_ITEM(MSG_SELECT " " LCD_STR_E0, PSTR("T0")); break;
case 2: GCODES_ITEM(MSG_SELECT " " MSG_E4, PSTR("T3")); break; case 2: GCODES_ITEM(MSG_SELECT " " LCD_STR_E3, PSTR("T3")); break;
case 3: GCODES_ITEM(MSG_SELECT " " MSG_E3, PSTR("T2")); break; case 3: GCODES_ITEM(MSG_SELECT " " LCD_STR_E2, PSTR("T2")); break;
case 4: GCODES_ITEM(MSG_SELECT " " MSG_E6, PSTR("T5")); break; #if EXTRUDERS == 6
case 5: GCODES_ITEM(MSG_SELECT " " MSG_E5, PSTR("T4")); break; case 4: GCODES_ITEM(MSG_SELECT " " LCD_STR_E5, PSTR("T5")); break;
} case 5: GCODES_ITEM(MSG_SELECT " " LCD_STR_E4, PSTR("T4")); break;
#elif EXTRUDERS == 5 || EXTRUDERS == 4 #endif
switch (active_extruder) {
case 0: GCODES_ITEM(MSG_SELECT " " MSG_E2, PSTR("T1")); break;
case 1: GCODES_ITEM(MSG_SELECT " " MSG_E1, PSTR("T0")); break;
case 2: GCODES_ITEM(MSG_SELECT " " MSG_E4, PSTR("T3")); break;
case 3: GCODES_ITEM(MSG_SELECT " " MSG_E3, PSTR("T2")); break;
} }
#elif EXTRUDERS == 3 #elif EXTRUDERS == 3
if (active_extruder < 2) { if (active_extruder < 2) {
if (active_extruder) if (active_extruder)
GCODES_ITEM(MSG_SELECT " " MSG_E1, PSTR("T0")); GCODES_ITEM(MSG_SELECT " " LCD_STR_E0, PSTR("T0"));
else else
GCODES_ITEM(MSG_SELECT " " MSG_E2, PSTR("T1")); GCODES_ITEM(MSG_SELECT " " LCD_STR_E1, PSTR("T1"));
} }
#else #else
if (active_extruder) if (active_extruder)
GCODES_ITEM(MSG_SELECT " " MSG_E1, PSTR("T0")); GCODES_ITEM(MSG_SELECT " " LCD_STR_E0, PSTR("T0"));
else else
GCODES_ITEM(MSG_SELECT " " MSG_E2, PSTR("T1")); GCODES_ITEM(MSG_SELECT " " LCD_STR_E1, PSTR("T1"));
#endif #endif
#elif ENABLED(DUAL_X_CARRIAGE) #elif ENABLED(DUAL_X_CARRIAGE)
if (active_extruder) if (active_extruder)
GCODES_ITEM(MSG_SELECT " " MSG_E1, PSTR("T0")); GCODES_ITEM(MSG_SELECT " " LCD_STR_E0, PSTR("T0"));
else else
GCODES_ITEM(MSG_SELECT " " MSG_E2, PSTR("T1")); GCODES_ITEM(MSG_SELECT " " LCD_STR_E1, PSTR("T1"));
#endif #endif
#if E_MANUAL #if E_MANUAL
// The current extruder
SUBMENU(MSG_MOVE_E, [](){ _menu_move_distance(E_AXIS, [](){ lcd_move_e(); }, -1); });
#define SUBMENU_MOVE_E(N) SUBMENU(MSG_MOVE_E LCD_STR_N##N, [](){ _menu_move_distance(E_AXIS, [](){ lcd_move_e(N); }, N); });
#if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE) #if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE)
// Only the current...
SUBMENU(MSG_MOVE_E, lcd_move_get_e_amount);
// ...and the non-switching // ...and the non-switching
#if E_MANUAL == 5 #if E_MANUAL == 5
SUBMENU(MSG_MOVE_E MSG_MOVE_E5, lcd_move_get_e4_amount); SUBMENU_MOVE_E(4);
#elif E_MANUAL == 3 #elif E_MANUAL == 3
SUBMENU(MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount); SUBMENU_MOVE_E(2);
#endif #endif
#else #else
// Independent extruders with one E-stepper per hotend // Independent extruders with one E-stepper per hotend
SUBMENU(MSG_MOVE_E, lcd_move_get_e_amount);
#if E_MANUAL > 1 #if E_MANUAL > 1
SUBMENU(MSG_MOVE_E MSG_MOVE_E1, lcd_move_get_e0_amount); SUBMENU_MOVE_E(0);
SUBMENU(MSG_MOVE_E MSG_MOVE_E2, lcd_move_get_e1_amount); SUBMENU_MOVE_E(1);
#if E_MANUAL > 2 #if E_MANUAL > 2
SUBMENU(MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount); SUBMENU_MOVE_E(2);
#if E_MANUAL > 3 #if E_MANUAL > 3
SUBMENU(MSG_MOVE_E MSG_MOVE_E4, lcd_move_get_e3_amount); SUBMENU_MOVE_E(3);
#if E_MANUAL > 4 #if E_MANUAL > 4
SUBMENU(MSG_MOVE_E MSG_MOVE_E5, lcd_move_get_e4_amount); SUBMENU_MOVE_E(4);
#if E_MANUAL > 5 #if E_MANUAL > 5
SUBMENU(MSG_MOVE_E MSG_MOVE_E6, lcd_move_get_e5_amount); SUBMENU_MOVE_E(5);
#endif // E_MANUAL > 5 #endif // E_MANUAL > 5
#endif // E_MANUAL > 4 #endif // E_MANUAL > 4
#endif // E_MANUAL > 3 #endif // E_MANUAL > 3
@ -501,11 +447,12 @@ void menu_motion() {
GCODES_ITEM(MSG_LEVEL_BED, PSTR("G28\nG29")); GCODES_ITEM(MSG_LEVEL_BED, PSTR("G28\nG29"));
#endif #endif
if (all_axes_homed() && leveling_is_valid()) { if (all_axes_homed() && leveling_is_valid()) {
bool new_level_state = planner.leveling_active; bool show_state = planner.leveling_active;
EDIT_ITEM(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling); EDIT_ITEM(bool, MSG_BED_LEVELING, &show_state, _lcd_toggle_bed_leveling);
} }
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &lcd_z_fade_height, 0, 100, _lcd_set_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); });
#endif #endif
#endif #endif

View file

@ -68,117 +68,33 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
ui.return_to_status(); ui.return_to_status();
} }
#if HOTENDS > 1 #if HAS_TEMP_HOTEND
inline void _preheat_end(const uint8_t m, const uint8_t e) {
void lcd_preheat_m1_e1_only() { _lcd_preheat(1, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); } _lcd_preheat(e, ui.preheat_hotend_temp[m], -1, ui.preheat_fan_speed[m]);
void lcd_preheat_m2_e1_only() { _lcd_preheat(1, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); }
#if HAS_HEATED_BED
void lcd_preheat_m1_e1() { _lcd_preheat(1, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_e1() { _lcd_preheat(1, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); }
#endif
#if HOTENDS > 2
void lcd_preheat_m1_e2_only() { _lcd_preheat(2, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_e2_only() { _lcd_preheat(2, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); }
#if HAS_HEATED_BED
void lcd_preheat_m1_e2() { _lcd_preheat(2, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_e2() { _lcd_preheat(2, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); }
#endif
#if HOTENDS > 3
void lcd_preheat_m1_e3_only() { _lcd_preheat(3, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_e3_only() { _lcd_preheat(3, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); }
#if HAS_HEATED_BED
void lcd_preheat_m1_e3() { _lcd_preheat(3, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_e3() { _lcd_preheat(3, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); }
#endif
#if HOTENDS > 4
void lcd_preheat_m1_e4_only() { _lcd_preheat(4, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_e4_only() { _lcd_preheat(4, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); }
#if HAS_HEATED_BED
void lcd_preheat_m1_e4() { _lcd_preheat(4, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_e4() { _lcd_preheat(4, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); }
#endif
#if HOTENDS > 5
void lcd_preheat_m1_e5_only() { _lcd_preheat(5, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_e5_only() { _lcd_preheat(5, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); }
#if HAS_HEATED_BED
void lcd_preheat_m1_e5() { _lcd_preheat(5, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_e5() { _lcd_preheat(5, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); }
#endif
#endif // HOTENDS > 5
#endif // HOTENDS > 4
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#if HAS_HEATED_BED
void lcd_preheat_m1_e0();
void lcd_preheat_m2_e0();
#else
void lcd_preheat_m1_e0_only();
void lcd_preheat_m2_e0_only();
#endif
void lcd_preheat_m1_all() {
#if HOTENDS > 1
thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 1);
#if HOTENDS > 2
thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 2);
#if HOTENDS > 3
thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 3);
#if HOTENDS > 4
thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 4);
#if HOTENDS > 5
thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 5);
#endif // HOTENDS > 5
#endif // HOTENDS > 4
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#endif // HOTENDS > 1
#if HAS_HEATED_BED
lcd_preheat_m1_e0();
#else
lcd_preheat_m1_e0_only();
#endif
} }
#if HAS_HEATED_BED
void lcd_preheat_m2_all() { inline void _preheat_both(const uint8_t m, const uint8_t e) {
#if HOTENDS > 1 _lcd_preheat(e, ui.preheat_hotend_temp[m], ui.preheat_bed_temp[m], ui.preheat_fan_speed[m]);
thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 1); }
#if HOTENDS > 2 #endif
thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 2); #endif
#if HOTENDS > 3 #if HAS_HEATED_BED
thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 3); inline void _preheat_bed(const uint8_t m) {
#if HOTENDS > 4 _lcd_preheat(0, 0, ui.preheat_bed_temp[m], ui.preheat_fan_speed[m]);
thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 4);
#if HOTENDS > 5
thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 5);
#endif // HOTENDS > 5
#endif // HOTENDS > 4
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#endif // HOTENDS > 1
#if HAS_HEATED_BED
lcd_preheat_m2_e0();
#else
lcd_preheat_m2_e0_only();
#endif
} }
#endif
#endif // HOTENDS > 1
#if HAS_TEMP_HOTEND || HAS_HEATED_BED #if HAS_TEMP_HOTEND || HAS_HEATED_BED
#if HOTENDS #define _PREHEAT_ITEMS(M,N) do{ \
void lcd_preheat_m1_e0_only() { _lcd_preheat(0, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); } ACTION_ITEM(MSG_PREHEAT_##M##_N LCD_STR_N##N, [](){ _preheat_both(M-1, N); }); \
void lcd_preheat_m2_e0_only() { _lcd_preheat(0, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); } ACTION_ITEM(MSG_PREHEAT_##M##_END " " LCD_STR_E##N, [](){ _preheat_end(M-1, N); }); \
#endif }while(0)
#if HAS_HEATED_BED #if HAS_HEATED_BED
#if HOTENDS #define PREHEAT_ITEMS(M,N) _PREHEAT_ITEMS(M,N)
void lcd_preheat_m1_e0() { _lcd_preheat(0, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); } #else
void lcd_preheat_m2_e0() { _lcd_preheat(0, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); } #define PREHEAT_ITEMS(M,N) \
#endif ACTION_ITEM(MSG_PREHEAT_##M##_N LCD_STR_N##N, [](){ _preheat_end(M-1, N); })
void lcd_preheat_m1_bedonly() { _lcd_preheat(0, 0, ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); }
void lcd_preheat_m2_bedonly() { _lcd_preheat(0, 0, ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); }
#endif #endif
void menu_preheat_m1() { void menu_preheat_m1() {
@ -186,57 +102,37 @@ 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, lcd_preheat_m1_e0); ACTION_ITEM(MSG_PREHEAT_1, [](){ _preheat_both(0, 0); });
ACTION_ITEM(MSG_PREHEAT_1_END, lcd_preheat_m1_e0_only); ACTION_ITEM(MSG_PREHEAT_1_END, [](){ _preheat_end(0, 0); });
#else #else
ACTION_ITEM(MSG_PREHEAT_1, lcd_preheat_m1_e0_only); 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
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0); _PREHEAT_ITEMS(1,0);
ACTION_ITEM(MSG_PREHEAT_1_END " " MSG_E1, lcd_preheat_m1_e0_only);
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1);
ACTION_ITEM(MSG_PREHEAT_1_END " " MSG_E2, lcd_preheat_m1_e1_only);
#else
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0_only);
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1_only);
#endif #endif
PREHEAT_ITEMS(1,1);
#if HOTENDS > 2 #if HOTENDS > 2
#if HAS_HEATED_BED PREHEAT_ITEMS(1,2);
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2);
ACTION_ITEM(MSG_PREHEAT_1_END " " MSG_E3, lcd_preheat_m1_e2_only);
#else
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2_only);
#endif
#if HOTENDS > 3 #if HOTENDS > 3
#if HAS_HEATED_BED PREHEAT_ITEMS(1,3);
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3);
ACTION_ITEM(MSG_PREHEAT_1_END " " MSG_E4, lcd_preheat_m1_e3_only);
#else
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3_only);
#endif
#if HOTENDS > 4 #if HOTENDS > 4
#if HAS_HEATED_BED PREHEAT_ITEMS(1,4);
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4);
ACTION_ITEM(MSG_PREHEAT_1_END " " MSG_E5, lcd_preheat_m1_e4_only);
#else
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4_only);
#endif
#if HOTENDS > 5 #if HOTENDS > 5
#if HAS_HEATED_BED PREHEAT_ITEMS(1,5);
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5);
ACTION_ITEM(MSG_PREHEAT_1_END " " MSG_E6, lcd_preheat_m1_e5_only);
#else
ACTION_ITEM(MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5_only);
#endif
#endif // HOTENDS > 5 #endif // HOTENDS > 5
#endif // HOTENDS > 4 #endif // HOTENDS > 4
#endif // HOTENDS > 3 #endif // HOTENDS > 3
#endif // HOTENDS > 2 #endif // HOTENDS > 2
ACTION_ITEM(MSG_PREHEAT_1_ALL, lcd_preheat_m1_all); ACTION_ITEM(MSG_PREHEAT_1_ALL, []() {
#if HAS_HEATED_BED
_preheat_bed(0);
#endif
HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], e);
});
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATED_BED #if HAS_HEATED_BED
ACTION_ITEM(MSG_PREHEAT_1_BEDONLY, lcd_preheat_m1_bedonly); ACTION_ITEM(MSG_PREHEAT_1_BEDONLY, [](){ _preheat_bed(0); });
#endif #endif
END_MENU(); END_MENU();
} }
@ -246,57 +142,37 @@ 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, lcd_preheat_m2_e0); ACTION_ITEM(MSG_PREHEAT_2, [](){ _preheat_both(1, 0); });
ACTION_ITEM(MSG_PREHEAT_2_END, lcd_preheat_m2_e0_only); ACTION_ITEM(MSG_PREHEAT_2_END, [](){ _preheat_end(1, 0); });
#else #else
ACTION_ITEM(MSG_PREHEAT_2, lcd_preheat_m2_e0_only); 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
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0); _PREHEAT_ITEMS(2,0);
ACTION_ITEM(MSG_PREHEAT_2_END " " MSG_E1, lcd_preheat_m2_e0_only);
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1);
ACTION_ITEM(MSG_PREHEAT_2_END " " MSG_E2, lcd_preheat_m2_e1_only);
#else
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0_only);
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1_only);
#endif #endif
PREHEAT_ITEMS(2,1);
#if HOTENDS > 2 #if HOTENDS > 2
#if HAS_HEATED_BED PREHEAT_ITEMS(2,2);
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2);
ACTION_ITEM(MSG_PREHEAT_2_END " " MSG_E3, lcd_preheat_m2_e2_only);
#else
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2_only);
#endif
#if HOTENDS > 3 #if HOTENDS > 3
#if HAS_HEATED_BED PREHEAT_ITEMS(2,3);
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3);
ACTION_ITEM(MSG_PREHEAT_2_END " " MSG_E4, lcd_preheat_m2_e3_only);
#else
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3_only);
#endif
#if HOTENDS > 4 #if HOTENDS > 4
#if HAS_HEATED_BED PREHEAT_ITEMS(2,4);
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4);
ACTION_ITEM(MSG_PREHEAT_2_END " " MSG_E5, lcd_preheat_m2_e4_only);
#else
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4_only);
#endif
#if HOTENDS > 5 #if HOTENDS > 5
#if HAS_HEATED_BED PREHEAT_ITEMS(2,5);
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5);
ACTION_ITEM(MSG_PREHEAT_2_END " " MSG_E6, lcd_preheat_m2_e5_only);
#else
ACTION_ITEM(MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5_only);
#endif
#endif // HOTENDS > 5 #endif // HOTENDS > 5
#endif // HOTENDS > 4 #endif // HOTENDS > 4
#endif // HOTENDS > 3 #endif // HOTENDS > 3
#endif // HOTENDS > 2 #endif // HOTENDS > 2
ACTION_ITEM(MSG_PREHEAT_2_ALL, lcd_preheat_m2_all); ACTION_ITEM(MSG_PREHEAT_2_ALL, []() {
#if HAS_HEATED_BED
_preheat_bed(1);
#endif
HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], e);
});
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATED_BED #if HAS_HEATED_BED
ACTION_ITEM(MSG_PREHEAT_2_BEDONLY, lcd_preheat_m2_bedonly); ACTION_ITEM(MSG_PREHEAT_2_BEDONLY, [](){ _preheat_bed(1); });
#endif #endif
END_MENU(); END_MENU();
} }
@ -318,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_E0); 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 MSG_LCD_N##N, &thermalManager.temp_hotend[N].target, 0, HEATER_##N##_MAXTEMP - 15, thermalManager.start_watching_E##N) #define EDIT_TARGET(N) EDIT_ITEM_FAST(int3, MSG_NOZZLE LCD_STR_N##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
@ -360,19 +236,22 @@ void menu_temperature() {
// //
#if FAN_COUNT > 0 #if FAN_COUNT > 0
#if HAS_FAN0 #if HAS_FAN0
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.lcd_tmpfan_speed[0], 0, 255, thermalManager.lcd_setFanSpeed0); editable.uint8 = thermalManager.fan_speed[0];
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &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_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255); EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255);
#endif #endif
#endif #endif
#if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1) #if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1)
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED " 2", &thermalManager.lcd_tmpfan_speed[1], 0, 255, thermalManager.lcd_setFanSpeed1); 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); });
#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 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2) #if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2)
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED " 3", &thermalManager.lcd_tmpfan_speed[2], 0, 255, thermalManager.lcd_setFanSpeed2); 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); });
#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
@ -388,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, lcd_preheat_m1_e0_only); ACTION_ITEM(MSG_PREHEAT_1, [](){ _preheat_end(0, 0); });
ACTION_ITEM(MSG_PREHEAT_2, lcd_preheat_m2_e0_only); ACTION_ITEM(MSG_PREHEAT_2, [](){ _preheat_end(1, 0); });
#endif #endif
// //

View file

@ -32,47 +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(uint16_4, MSG, &stepper##ST.val_mA, 100, 3000, refresh_stepper_current_##ST) #define TMC_EDIT_STORED_I_RMS(ST,MSG) EDIT_ITEM(uint16_4, MSG, &stepper##ST.val_mA, 100, 3000, [](){ stepper##ST.refresh_stepper_current(); })
#if AXIS_IS_TMC(X)
void refresh_stepper_current_X() { stepperX.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Y)
void refresh_stepper_current_Y() { stepperY.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Z)
void refresh_stepper_current_Z() { stepperZ.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(X2)
void refresh_stepper_current_X2() { stepperX2.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Y2)
void refresh_stepper_current_Y2() { stepperY2.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Z2)
void refresh_stepper_current_Z2() { stepperZ2.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Z3)
void refresh_stepper_current_Z3() { stepperZ3.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E0)
void refresh_stepper_current_E0() { stepperE0.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E1)
void refresh_stepper_current_E1() { stepperE1.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E2)
void refresh_stepper_current_E2() { stepperE2.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E3)
void refresh_stepper_current_E3() { stepperE3.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E4)
void refresh_stepper_current_E4() { stepperE4.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E5)
void refresh_stepper_current_E5() { stepperE5.refresh_stepper_current(); }
#endif
void menu_tmc_current() { void menu_tmc_current() {
START_MENU(); START_MENU();
@ -99,69 +59,29 @@ void menu_tmc_current() {
TMC_EDIT_STORED_I_RMS(Z3, MSG_Z3); TMC_EDIT_STORED_I_RMS(Z3, MSG_Z3);
#endif #endif
#if AXIS_IS_TMC(E0) #if AXIS_IS_TMC(E0)
TMC_EDIT_STORED_I_RMS(E0, MSG_E1); TMC_EDIT_STORED_I_RMS(E0, LCD_STR_E0);
#endif #endif
#if AXIS_IS_TMC(E1) #if AXIS_IS_TMC(E1)
TMC_EDIT_STORED_I_RMS(E1, MSG_E2); TMC_EDIT_STORED_I_RMS(E1, LCD_STR_E1);
#endif #endif
#if AXIS_IS_TMC(E2) #if AXIS_IS_TMC(E2)
TMC_EDIT_STORED_I_RMS(E2, MSG_E3); TMC_EDIT_STORED_I_RMS(E2, LCD_STR_E2);
#endif #endif
#if AXIS_IS_TMC(E3) #if AXIS_IS_TMC(E3)
TMC_EDIT_STORED_I_RMS(E3, MSG_E4); TMC_EDIT_STORED_I_RMS(E3, LCD_STR_E3);
#endif #endif
#if AXIS_IS_TMC(E4) #if AXIS_IS_TMC(E4)
TMC_EDIT_STORED_I_RMS(E4, MSG_E5); TMC_EDIT_STORED_I_RMS(E4, LCD_STR_E4);
#endif #endif
#if AXIS_IS_TMC(E5) #if AXIS_IS_TMC(E5)
TMC_EDIT_STORED_I_RMS(E5, MSG_E6); TMC_EDIT_STORED_I_RMS(E5, LCD_STR_E5);
#endif #endif
END_MENU(); END_MENU();
} }
#if ENABLED(HYBRID_THRESHOLD) #if ENABLED(HYBRID_THRESHOLD)
#define TMC_EDIT_STORED_HYBRID_THRS(ST, MSG) EDIT_ITEM(uint8, MSG, &stepper##ST.stored.hybrid_thrs, 0, 255, refresh_hybrid_thrs_##ST); #define TMC_EDIT_STORED_HYBRID_THRS(ST, MSG) EDIT_ITEM(uint8, MSG, &stepper##ST.stored.hybrid_thrs, 0, 255, [](){ stepper##ST.refresh_hybrid_thrs(); });
#if AXIS_HAS_STEALTHCHOP(X)
void refresh_hybrid_thrs_X() { stepperX.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
void refresh_hybrid_thrs_Y() { stepperY.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
void refresh_hybrid_thrs_Z() { stepperZ.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
void refresh_hybrid_thrs_X2() { stepperX2.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
void refresh_hybrid_thrs_Y2() { stepperY2.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
void refresh_hybrid_thrs_Z2() { stepperZ2.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
void refresh_hybrid_thrs_Z3() { stepperZ3.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
void refresh_hybrid_thrs_E0() { stepperE0.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
void refresh_hybrid_thrs_E1() { stepperE1.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
void refresh_hybrid_thrs_E2() { stepperE2.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
void refresh_hybrid_thrs_E3() { stepperE3.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
void refresh_hybrid_thrs_E4() { stepperE4.refresh_hybrid_thrs(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
void refresh_hybrid_thrs_E5() { stepperE5.refresh_hybrid_thrs(); }
#endif
void menu_tmc_hybrid_thrs() { void menu_tmc_hybrid_thrs() {
START_MENU(); START_MENU();
@ -188,22 +108,22 @@ void menu_tmc_current() {
TMC_EDIT_STORED_HYBRID_THRS(Z3, MSG_Z3); TMC_EDIT_STORED_HYBRID_THRS(Z3, MSG_Z3);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E0) #if AXIS_HAS_STEALTHCHOP(E0)
TMC_EDIT_STORED_HYBRID_THRS(E0, MSG_E1); TMC_EDIT_STORED_HYBRID_THRS(E0, LCD_STR_E0);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E1) #if AXIS_HAS_STEALTHCHOP(E1)
TMC_EDIT_STORED_HYBRID_THRS(E1, MSG_E2); TMC_EDIT_STORED_HYBRID_THRS(E1, LCD_STR_E1);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E2) #if AXIS_HAS_STEALTHCHOP(E2)
TMC_EDIT_STORED_HYBRID_THRS(E2, MSG_E3); TMC_EDIT_STORED_HYBRID_THRS(E2, LCD_STR_E2);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E3) #if AXIS_HAS_STEALTHCHOP(E3)
TMC_EDIT_STORED_HYBRID_THRS(E3, MSG_E4); TMC_EDIT_STORED_HYBRID_THRS(E3, LCD_STR_E3);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E4) #if AXIS_HAS_STEALTHCHOP(E4)
TMC_EDIT_STORED_HYBRID_THRS(E4, MSG_E5); TMC_EDIT_STORED_HYBRID_THRS(E4, LCD_STR_E4);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E5) #if AXIS_HAS_STEALTHCHOP(E5)
TMC_EDIT_STORED_HYBRID_THRS(E5, MSG_E6); TMC_EDIT_STORED_HYBRID_THRS(E5, LCD_STR_E5);
#endif #endif
END_MENU(); END_MENU();
} }
@ -212,20 +132,7 @@ void menu_tmc_current() {
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define TMC_EDIT_STORED_SGT(ST) EDIT_ITEM(int4, MSG_##ST, &stepper##ST.stored.homing_thrs, stepper##ST.sgt_min, stepper##ST.sgt_max, refresh_homing_thrs_##ST); #define TMC_EDIT_STORED_SGT(ST) EDIT_ITEM(int4, MSG_##ST, &stepper##ST.stored.homing_thrs, stepper##ST.sgt_min, stepper##ST.sgt_max, [](){ stepper##ST.refresh_homing_thrs(); });
#if X_SENSORLESS
void refresh_homing_thrs_X() { stepperX.refresh_homing_thrs(); }
#endif
#if X2_SENSORLESS
void refresh_homing_thrs_X2() { stepperX2.refresh_homing_thrs(); }
#endif
#if Y_SENSORLESS
void refresh_homing_thrs_Y() { stepperY.refresh_homing_thrs(); }
#endif
#if Z_SENSORLESS
void refresh_homing_thrs_Z() { stepperZ.refresh_homing_thrs(); }
#endif
void menu_tmc_homing_thrs() { void menu_tmc_homing_thrs() {
START_MENU(); START_MENU();
@ -249,47 +156,7 @@ void menu_tmc_current() {
#if HAS_STEALTHCHOP #if HAS_STEALTHCHOP
#define TMC_EDIT_STEP_MODE(ST, MSG) EDIT_ITEM(bool, MSG, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST) #define TMC_EDIT_STEP_MODE(ST, MSG) EDIT_ITEM(bool, MSG, &stepper##ST.stored.stealthChop_enabled, [](){ stepper##ST.refresh_stepping_mode(); })
#if AXIS_HAS_STEALTHCHOP(X)
void refresh_stepping_mode_X() { stepperX.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
void refresh_stepping_mode_Y() { stepperY.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
void refresh_stepping_mode_Z() { stepperZ.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
void refresh_stepping_mode_X2() { stepperX2.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
void refresh_stepping_mode_Y2() { stepperY2.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
void refresh_stepping_mode_Z2() { stepperZ2.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
void refresh_stepping_mode_Z3() { stepperZ3.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
void refresh_stepping_mode_E0() { stepperE0.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
void refresh_stepping_mode_E1() { stepperE1.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
void refresh_stepping_mode_E2() { stepperE2.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
void refresh_stepping_mode_E3() { stepperE3.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
void refresh_stepping_mode_E4() { stepperE4.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
void refresh_stepping_mode_E5() { stepperE5.refresh_stepping_mode(); }
#endif
void menu_tmc_step_mode() { void menu_tmc_step_mode() {
START_MENU(); START_MENU();
@ -317,22 +184,22 @@ void menu_tmc_current() {
TMC_EDIT_STEP_MODE(Z3, MSG_Z3); TMC_EDIT_STEP_MODE(Z3, MSG_Z3);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E0) #if AXIS_HAS_STEALTHCHOP(E0)
TMC_EDIT_STEP_MODE(E0, MSG_E1); TMC_EDIT_STEP_MODE(E0, LCD_STR_E0);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E1) #if AXIS_HAS_STEALTHCHOP(E1)
TMC_EDIT_STEP_MODE(E1, MSG_E2); TMC_EDIT_STEP_MODE(E1, LCD_STR_E1);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E2) #if AXIS_HAS_STEALTHCHOP(E2)
TMC_EDIT_STEP_MODE(E2, MSG_E3); TMC_EDIT_STEP_MODE(E2, LCD_STR_E2);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E3) #if AXIS_HAS_STEALTHCHOP(E3)
TMC_EDIT_STEP_MODE(E3, MSG_E4); TMC_EDIT_STEP_MODE(E3, LCD_STR_E3);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E4) #if AXIS_HAS_STEALTHCHOP(E4)
TMC_EDIT_STEP_MODE(E4, MSG_E5); TMC_EDIT_STEP_MODE(E4, LCD_STR_E4);
#endif #endif
#if AXIS_HAS_STEALTHCHOP(E5) #if AXIS_HAS_STEALTHCHOP(E5)
TMC_EDIT_STEP_MODE(E5, MSG_E6); TMC_EDIT_STEP_MODE(E5, LCD_STR_E5);
#endif #endif
END_MENU(); END_MENU();
} }

View file

@ -42,27 +42,6 @@
#include "../../module/tool_change.h" #include "../../module/tool_change.h"
#endif #endif
// Refresh the E factor after changing flow
#if EXTRUDERS
void _lcd_refresh_e_factor_0() { planner.refresh_e_factor(0); }
#if EXTRUDERS > 1
void _lcd_refresh_e_factor() { planner.refresh_e_factor(active_extruder); }
void _lcd_refresh_e_factor_1() { planner.refresh_e_factor(1); }
#if EXTRUDERS > 2
void _lcd_refresh_e_factor_2() { planner.refresh_e_factor(2); }
#if EXTRUDERS > 3
void _lcd_refresh_e_factor_3() { planner.refresh_e_factor(3); }
#if EXTRUDERS > 4
void _lcd_refresh_e_factor_4() { planner.refresh_e_factor(4); }
#if EXTRUDERS > 5
void _lcd_refresh_e_factor_5() { planner.refresh_e_factor(5); }
#endif // EXTRUDERS > 5
#endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1
#endif // EXTRUDERS
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#include "../../feature/babystep.h" #include "../../feature/babystep.h"
@ -111,13 +90,11 @@
#if ENABLED(BABYSTEP_XY) #if ENABLED(BABYSTEP_XY)
void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEP_X)); } void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEP_X)); }
void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEP_Y)); } void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEP_Y)); }
void lcd_babystep_x() { _lcd_babystep_go(_lcd_babystep_x); }
void lcd_babystep_y() { _lcd_babystep_go(_lcd_babystep_y); }
#endif #endif
#if DISABLED(BABYSTEP_ZPROBE_OFFSET) #if DISABLED(BABYSTEP_ZPROBE_OFFSET)
void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); } void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); }
void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); } void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); }
#endif #endif
#endif // BABYSTEPPING #endif // BABYSTEPPING
@ -143,9 +120,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_E0); 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 MSG_LCD_N##N, &thermalManager.temp_hotend[N].target, 0, HEATER_##N##_MAXTEMP - 15, thermalManager.start_watching_E##N) #define EDIT_NOZZLE(N) EDIT_ITEM_FAST(int3, MSG_NOZZLE LCD_STR_N##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
@ -178,19 +155,22 @@ void menu_tune() {
// //
#if FAN_COUNT > 0 #if FAN_COUNT > 0
#if HAS_FAN0 #if HAS_FAN0
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.lcd_tmpfan_speed[0], 0, 255, thermalManager.lcd_setFanSpeed0); editable.uint8 = thermalManager.fan_speed[0];
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &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_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255); EDIT_ITEM_FAST(percent, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255);
#endif #endif
#endif #endif
#if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1) #if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1)
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED " 2", &thermalManager.lcd_tmpfan_speed[1], 0, 255, thermalManager.lcd_setFanSpeed1); 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); });
#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 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2) #if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2)
EDIT_ITEM_FAST(percent, MSG_FAN_SPEED " 3", &thermalManager.lcd_tmpfan_speed[2], 0, 255, thermalManager.lcd_setFanSpeed2); 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); });
#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
@ -202,10 +182,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, _lcd_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, _lcd_refresh_e_factor); 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 MSG_LCD_N##N, &planner.flow_percentage[N], 10, 999, _lcd_refresh_e_factor_##N) #define EDIT_FLOW(N) EDIT_ITEM(int3, MSG_FLOW LCD_STR_N##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
@ -229,8 +209,8 @@ void menu_tune() {
// //
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#if ENABLED(BABYSTEP_XY) #if ENABLED(BABYSTEP_XY)
SUBMENU(MSG_BABYSTEP_X, lcd_babystep_x); SUBMENU(MSG_BABYSTEP_X, [](){ _lcd_babystep_go(_lcd_babystep_x); });
SUBMENU(MSG_BABYSTEP_Y, 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

@ -223,15 +223,6 @@ void _lcd_ubl_validate_mesh() {
END_MENU(); END_MENU();
} }
/**
* UBL Grid Leveling Command
*/
void _lcd_ubl_grid_level_cmd() {
char ubl_lcd_gcode[12];
sprintf_P(ubl_lcd_gcode, PSTR("G29 J%i"), side_points);
lcd_enqueue_one_now(ubl_lcd_gcode);
}
/** /**
* UBL Grid Leveling submenu * UBL Grid Leveling submenu
* *
@ -243,7 +234,11 @@ 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, _lcd_ubl_grid_level_cmd); ACTION_ITEM(MSG_UBL_MESH_LEVEL, [](){
char ubl_lcd_gcode[12];
sprintf_P(ubl_lcd_gcode, PSTR("G29 J%i"), side_points);
lcd_enqueue_one_now(ubl_lcd_gcode);
});
END_MENU(); END_MENU();
} }
@ -621,7 +616,8 @@ void _lcd_ubl_level_bed() {
SUBMENU(MSG_UBL_TOOLS, _menu_ubl_tools); SUBMENU(MSG_UBL_TOOLS, _menu_ubl_tools);
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)
EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &lcd_z_fade_height, 0, 100, _lcd_set_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); });
#endif #endif
END_MENU(); END_MENU();
} }

View file

@ -103,8 +103,8 @@ Temperature thermalManager;
#else #else
#define _CHAMBER_PSTR(M,E) #define _CHAMBER_PSTR(M,E)
#endif #endif
#define _E_PSTR(M,E,N) ((HOTENDS) >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) : #define _E_PSTR(M,E,N) ((HOTENDS) > (N) && (E) == (N)) ? PSTR(LCD_STR_E##N " " M) :
#define TEMP_ERR_PSTR(M,E) _BED_PSTR(M##_BED,E) _CHAMBER_PSTR(M##_CHAMBER,E) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) _E_PSTR(M,E,6) PSTR(MSG_E1 " " M) #define TEMP_ERR_PSTR(M,E) _BED_PSTR(M##_BED,E) _CHAMBER_PSTR(M##_CHAMBER,E) _E_PSTR(M,E,1) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) PSTR(LCD_STR_E0 " " M)
// public: // public:
@ -157,18 +157,6 @@ Temperature thermalManager;
uint8_t Temperature::fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128); uint8_t Temperature::fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128);
#endif #endif
#if HAS_LCD_MENU
uint8_t Temperature::lcd_tmpfan_speed[
#if ENABLED(SINGLENOZZLE)
_MAX(EXTRUDERS, FAN_COUNT)
#else
FAN_COUNT
#endif
]; // = { 0 }
#endif
/** /**
* Set the print fan speed for a target extruder * Set the print fan speed for a target extruder
*/ */
@ -187,9 +175,6 @@ Temperature thermalManager;
if (target >= FAN_COUNT) return; if (target >= FAN_COUNT) return;
fan_speed[target] = speed; fan_speed[target] = speed;
#if HAS_LCD_MENU
lcd_tmpfan_speed[target] = speed;
#endif
} }
#if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)

View file

@ -493,30 +493,6 @@ class Temperature {
static void set_temp_fan_speed(const uint8_t fan, const uint16_t tmp_temp); static void set_temp_fan_speed(const uint8_t fan, const uint16_t tmp_temp);
#endif #endif
#if HAS_LCD_MENU
static uint8_t lcd_tmpfan_speed[
#if ENABLED(SINGLENOZZLE)
_MAX(EXTRUDERS, FAN_COUNT)
#else
FAN_COUNT
#endif
];
static inline void lcd_setFanSpeed(const uint8_t target) { set_fan_speed(target, lcd_tmpfan_speed[target]); }
#if HAS_FAN0
FORCE_INLINE static void lcd_setFanSpeed0() { lcd_setFanSpeed(0); }
#endif
#if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1)
FORCE_INLINE static void lcd_setFanSpeed1() { lcd_setFanSpeed(1); }
#endif
#if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2)
FORCE_INLINE static void lcd_setFanSpeed2() { lcd_setFanSpeed(2); }
#endif
#endif // HAS_LCD_MENU
#if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
void set_fans_paused(const bool p); void set_fans_paused(const bool p);
#endif #endif
@ -595,15 +571,6 @@ class Temperature {
#if HOTENDS #if HOTENDS
#if HAS_LCD_MENU
static inline void start_watching_E0() { start_watching_hotend(0); }
static inline void start_watching_E1() { start_watching_hotend(1); }
static inline void start_watching_E2() { start_watching_hotend(2); }
static inline void start_watching_E3() { start_watching_hotend(3); }
static inline void start_watching_E4() { start_watching_hotend(4); }
static inline void start_watching_E5() { start_watching_hotend(5); }
#endif
static void setTargetHotend(const int16_t celsius, const uint8_t E_NAME) { static void setTargetHotend(const int16_t celsius, const uint8_t E_NAME) {
const uint8_t ee = HOTEND_INDEX; const uint8_t ee = HOTEND_INDEX;
#ifdef MILLISECONDS_PREHEAT_TIME #ifdef MILLISECONDS_PREHEAT_TIME