Apply ternary macros

This commit is contained in:
Scott Lahteine 2020-04-25 17:53:06 -05:00
parent 967c1d8534
commit c536b8de62
13 changed files with 79 additions and 230 deletions

View file

@ -100,11 +100,9 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Give the response a chance to update its counter. // Give the response a chance to update its counter.
static inline void run() { static inline void run() {
if (enabled && !filament_ran_out && (printingIsActive() if ( enabled && !filament_ran_out
#if ENABLED(ADVANCED_PAUSE_FEATURE) && (printingIsActive() || TERN0(ADVANCED_PAUSE_FEATURE, did_pause_print))
|| did_pause_print ) {
#endif
)) {
#ifdef FILAMENT_RUNOUT_DISTANCE_MM #ifdef FILAMENT_RUNOUT_DISTANCE_MM
cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here
#endif #endif
@ -153,11 +151,7 @@ class FilamentSensorBase {
// Return a bitmask of runout flag states (1 bits always indicates runout) // Return a bitmask of runout flag states (1 bits always indicates runout)
static inline uint8_t poll_runout_states() { static inline uint8_t poll_runout_states() {
return (poll_runout_pins() return poll_runout_pins() ^ uint8_t(TERN0(FIL_RUNOUT_INVERTING, _BV(NUM_RUNOUT_SENSORS) - 1));
#if DISABLED(FIL_RUNOUT_INVERTING)
^ uint8_t(_BV(NUM_RUNOUT_SENSORS) - 1)
#endif
);
} }
#undef INIT_RUNOUT_PIN #undef INIT_RUNOUT_PIN
@ -217,26 +211,14 @@ class FilamentSensorBase {
private: private:
static inline bool poll_runout_state(const uint8_t extruder) { static inline bool poll_runout_state(const uint8_t extruder) {
const uint8_t runout_states = poll_runout_states(); const uint8_t runout_states = poll_runout_states();
#if NUM_RUNOUT_SENSORS == 1 #if NUM_RUNOUT_SENSORS == 1
UNUSED(extruder); UNUSED(extruder);
#endif
if (true
#if NUM_RUNOUT_SENSORS > 1
#if ENABLED(DUAL_X_CARRIAGE)
&& (dual_x_carriage_mode == DXC_DUPLICATION_MODE || dual_x_carriage_mode == DXC_MIRRORED_MODE)
#elif ENABLED(MULTI_NOZZLE_DUPLICATION)
&& extruder_duplication_enabled
#else #else
&& false if ( !TERN0(DUAL_X_CARRIAGE, dxc_is_duplicating())
#endif && !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
#endif ) return TEST(runout_states, extruder); // A specific extruder ran out
) return runout_states; // Any extruder
#if NUM_RUNOUT_SENSORS > 1
return TEST(runout_states, extruder); // Specific extruder
#endif #endif
return !!runout_states; // Any extruder ran out
} }
public: public:
@ -302,9 +284,7 @@ class FilamentSensorBase {
static inline void block_completed(const block_t* const b) { static inline void block_completed(const block_t* const b) {
if (b->steps.x || b->steps.y || b->steps.z if (b->steps.x || b->steps.y || b->steps.z
#if ENABLED(ADVANCED_PAUSE_FEATURE) || TERN0(ADVANCED_PAUSE_FEATURE, did_pause_print) // Allow pause purge move to re-trigger runout state
|| did_pause_print // Allow pause purge move to re-trigger runout state
#endif
) { ) {
// Only trigger on extrusion with XYZ movement to allow filament change and retract/recover. // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
const uint8_t e = b->extruder; const uint8_t e = b->extruder;
@ -338,11 +318,7 @@ class FilamentSensorBase {
typedef TFilamentMonitor< typedef TFilamentMonitor<
#ifdef FILAMENT_RUNOUT_DISTANCE_MM #ifdef FILAMENT_RUNOUT_DISTANCE_MM
RunoutResponseDelayed, RunoutResponseDelayed,
#if ENABLED(FILAMENT_MOTION_SENSOR) TERN(FILAMENT_MOTION_SENSOR, FilamentSensorEncoder, FilamentSensorSwitch)
FilamentSensorEncoder
#else
FilamentSensorSwitch
#endif
#else #else
RunoutResponseDebounced, FilamentSensorSwitch RunoutResponseDebounced, FilamentSensorSwitch
#endif #endif

View file

@ -103,12 +103,8 @@ void GcodeSuite::M600() {
#if EXTRUDERS > 1 #if EXTRUDERS > 1
// Change toolhead if specified // Change toolhead if specified
const uint8_t active_extruder_before_filament_change = active_extruder; const uint8_t active_extruder_before_filament_change = active_extruder;
if ( if (active_extruder != target_extruder && TERN1(DUAL_X_CARRIAGE, !dxc_is_duplicating()))
active_extruder != target_extruder tool_change(target_extruder, false);
#if ENABLED(DUAL_X_CARRIAGE)
&& dual_x_carriage_mode != DXC_DUPLICATION_MODE && dual_x_carriage_mode != DXC_MIRRORED_MODE
#endif
) tool_change(target_extruder, false);
#endif #endif
// Initial retract before move to filament change position // Initial retract before move to filament change position

View file

@ -87,11 +87,7 @@ void MarlinUI::save_previous_screen() {
screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items }; screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items };
} }
void MarlinUI::_goto_previous_screen( void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back/*=false*/)) {
#if ENABLED(TURBO_BACK_MENU_ITEM)
const bool is_back/*=false*/
#endif
) {
#if DISABLED(TURBO_BACK_MENU_ITEM) #if DISABLED(TURBO_BACK_MENU_ITEM)
constexpr bool is_back = false; constexpr bool is_back = false;
#endif #endif
@ -233,34 +229,16 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL; doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
} }
else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) { else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) {
if ( (ENABLED(BABYSTEP_WITHOUT_HOMING) || all_axes_known())
#if ENABLED(BABYSTEP_WITHOUT_HOMING) && (ENABLED(BABYSTEP_ALWAYS_AVAILABLE) || printer_busy()) )
constexpr bool can_babystep = true; screen = TERN(BABYSTEP_ZPROBE_OFFSET, lcd_babystep_zoffset, lcd_babystep_z);
#else
const bool can_babystep = all_axes_known();
#endif
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
constexpr bool should_babystep = true;
#else
const bool should_babystep = printer_busy();
#endif
if (should_babystep && can_babystep) {
screen =
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
lcd_babystep_zoffset
#else
lcd_babystep_z
#endif
;
}
#if ENABLED(MOVE_Z_WHEN_IDLE)
else { else {
#if ENABLED(MOVE_Z_WHEN_IDLE)
move_menu_scale = MOVE_Z_IDLE_MULTIPLICATOR; move_menu_scale = MOVE_Z_IDLE_MULTIPLICATOR;
screen = lcd_move_z; screen = lcd_move_z;
}
#endif #endif
} }
}
#endif #endif
currentScreen = screen; currentScreen = screen;
@ -277,11 +255,8 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
// Re-initialize custom characters that may be re-used // Re-initialize custom characters that may be re-used
#if HAS_CHARACTER_LCD #if HAS_CHARACTER_LCD
if (true if (TERN1(AUTO_BED_LEVELING_UBL, !ubl.lcd_map_control))
#if ENABLED(AUTO_BED_LEVELING_UBL) set_custom_characters(screen == status_screen ? CHARSET_INFO : CHARSET_MENU);
&& !ubl.lcd_map_control
#endif
) set_custom_characters(screen == status_screen ? CHARSET_INFO : CHARSET_MENU);
#endif #endif
refresh(LCDVIEW_CALL_REDRAW_NEXT); refresh(LCDVIEW_CALL_REDRAW_NEXT);
@ -377,13 +352,10 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment, const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
new_probe_offset = probe.offset.z + diff, new_probe_offset = probe.offset.z + diff,
new_offs = new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - diff
do_probe ? new_probe_offset : hotend_offset[active_extruder].z - diff , new_probe_offset
#else );
new_probe_offset
#endif
;
if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
babystep.add_steps(Z_AXIS, babystep_increment); babystep.add_steps(Z_AXIS, babystep_increment);
@ -397,30 +369,23 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
} }
} }
if (ui.should_draw()) { if (ui.should_draw()) {
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
if (!do_probe)
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_HOTEND_OFFSET_Z), ftostr54sign(hotend_offset[active_extruder].z));
#endif
if (do_probe) { if (do_probe) {
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z)); MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z));
TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(probe.offset.z)); TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(probe.offset.z));
} }
else {
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_HOTEND_OFFSET_Z), ftostr54sign(hotend_offset[active_extruder].z));
#endif
}
} }
} }
#endif // BABYSTEP_ZPROBE_OFFSET #endif // BABYSTEP_ZPROBE_OFFSET
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
void lcd_store_settings() { void lcd_store_settings() { ui.completion_feedback(settings.save()); }
const bool saved = settings.save(); void lcd_load_settings() { ui.completion_feedback(settings.load()); }
ui.completion_feedback(saved);
UNUSED(saved);
}
void lcd_load_settings() {
const bool loaded = settings.load();
ui.completion_feedback(loaded);
UNUSED(loaded);
}
#endif #endif
void _lcd_draw_homing() { void _lcd_draw_homing() {

View file

@ -132,13 +132,7 @@ void menu_cancelobject();
#endif #endif
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
constexpr float extrude_maxlength = constexpr float extrude_maxlength = TERN(PREVENT_LENGTHY_EXTRUDE, EXTRUDE_MAXLENGTH, 999);
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
EXTRUDE_MAXLENGTH
#else
999
#endif
;
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);
#if EXTRUDERS > 1 #if EXTRUDERS > 1

View file

@ -206,13 +206,7 @@ void menu_advanced_settings();
#if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU) #if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU)
void bltouch_report() { void bltouch_report() {
SERIAL_ECHOLNPAIR("EEPROM Last BLTouch Mode - ", (int)bltouch.last_written_mode); SERIAL_ECHOLNPAIR("EEPROM Last BLTouch Mode - ", (int)bltouch.last_written_mode);
SERIAL_ECHOLNPGM("Configuration BLTouch Mode - " SERIAL_ECHOLNPGM("Configuration BLTouch Mode - " TERN(BLTOUCH_SET_5V_MODE, "5V", "OD"));
#if ENABLED(BLTOUCH_SET_5V_MODE)
"5V"
#else
"OD"
#endif
);
char mess[21]; char mess[21];
strcpy_P(mess, PSTR("BLTouch Mode - ")); strcpy_P(mess, PSTR("BLTouch Mode - "));
strcpy_P(&mess[15], bltouch.last_written_mode ? PSTR("5V") : PSTR("OD")); strcpy_P(&mess[15], bltouch.last_written_mode ? PSTR("5V") : PSTR("OD"));
@ -411,11 +405,7 @@ void menu_configuration() {
// //
#if ENABLED(CASE_LIGHT_MENU) #if ENABLED(CASE_LIGHT_MENU)
#if DISABLED(CASE_LIGHT_NO_BRIGHTNESS) #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
if (true if (TERN1(CASE_LIGHT_USE_NEOPIXEL, PWM_PIN(CASE_LIGHT_PIN)))
#if DISABLED(CASE_LIGHT_USE_NEOPIXEL)
&& PWM_PIN(CASE_LIGHT_PIN)
#endif
)
SUBMENU(MSG_CASE_LIGHT, menu_case_light); SUBMENU(MSG_CASE_LIGHT, menu_case_light);
else else
#endif #endif

View file

@ -29,13 +29,7 @@
void menu_game() { void menu_game() {
START_MENU(); START_MENU();
BACK_ITEM( BACK_ITEM(TERN(LCD_INFO_MENU, MSG_INFO_MENU, MSG_MAIN));
#if ENABLED(LCD_INFO_MENU)
MSG_INFO_MENU
#else
MSG_MAIN
#endif
);
#if ENABLED(MARLIN_BRICKOUT) #if ENABLED(MARLIN_BRICKOUT)
SUBMENU(MSG_BRICKOUT, brickout.enter_game); SUBMENU(MSG_BRICKOUT, brickout.enter_game);
#endif #endif

View file

@ -51,6 +51,8 @@
printStatistics stats = print_job_timer.getStats(); printStatistics stats = print_job_timer.getStats();
char buffer[21];
START_SCREEN(); // 12345678901234567890 START_SCREEN(); // 12345678901234567890
VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT); // Print Count: 999 VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT); // Print Count: 999
VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT); // Completed : 666 VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT); // Completed : 666
@ -62,7 +64,10 @@
STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s
STATIC_ITEM(MSG_INFO_PRINT_FILAMENT, SS_LEFT); // Extruded total: STATIC_ITEM(MSG_INFO_PRINT_FILAMENT, SS_LEFT); // Extruded total:
sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10); sprintf_P(buffer, PSTR("%ld.%im")
, long(stats.filamentUsed / 1000)
, int16_t(stats.filamentUsed / 100) % 10
);
STATIC_ITEM_P(PSTR("> "), SS_LEFT, buffer); // > 125m STATIC_ITEM_P(PSTR("> "), SS_LEFT, buffer); // > 125m
#if SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0 #if SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0
@ -171,16 +176,7 @@ void menu_info_thermistors() {
#endif #endif
#if EXTRUDERS #if EXTRUDERS
{ STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
STATIC_ITEM(
#if WATCH_HOTENDS
MSG_INFO_RUNAWAY_ON
#else
MSG_INFO_RUNAWAY_OFF
#endif
, SS_LEFT
);
}
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -191,34 +187,17 @@ void menu_info_thermistors() {
STATIC_ITEM_P(PSTR("BED:" THERMISTOR_NAME), SS_INVERT); STATIC_ITEM_P(PSTR("BED:" THERMISTOR_NAME), SS_INVERT);
VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_LEFT); VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_LEFT);
VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_LEFT); VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_LEFT);
STATIC_ITEM( STATIC_ITEM(TERN(WATCH_BED, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
#if WATCH_BED
MSG_INFO_RUNAWAY_ON
#else
MSG_INFO_RUNAWAY_OFF
#endif
, SS_LEFT
);
}
#endif #endif
#if HAS_HEATED_CHAMBER #if HAS_HEATED_CHAMBER
{
#undef THERMISTOR_ID #undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_CHAMBER #define THERMISTOR_ID TEMP_SENSOR_CHAMBER
#include "../thermistornames.h" #include "../thermistornames.h"
STATIC_ITEM_P(PSTR("CHAM:" THERMISTOR_NAME), SS_INVERT); STATIC_ITEM_P(PSTR("CHAM:" THERMISTOR_NAME), SS_INVERT);
VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_LEFT); VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_LEFT);
VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_LEFT); VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_LEFT);
STATIC_ITEM( STATIC_ITEM(TERN(WATCH_CHAMBER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
#if WATCH_CHAMBER
MSG_INFO_RUNAWAY_ON
#else
MSG_INFO_RUNAWAY_OFF
#endif
, SS_LEFT
);
}
#endif #endif
END_SCREEN(); END_SCREEN();
@ -295,13 +274,7 @@ void menu_info() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_MAIN); BACK_ITEM(MSG_MAIN);
#if ENABLED(LCD_PRINTER_INFO_IS_BOOTSCREEN) #if ENABLED(LCD_PRINTER_INFO_IS_BOOTSCREEN)
SUBMENU(MSG_INFO_PRINTER_MENU, ( SUBMENU(MSG_INFO_PRINTER_MENU, TERN(SHOW_CUSTOM_BOOTSCREEN, menu_show_custom_bootscreen, menu_show_marlin_bootscreen));
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
menu_show_custom_bootscreen
#else
menu_show_marlin_bootscreen
#endif
));
#else #else
SUBMENU(MSG_INFO_PRINTER_MENU, menu_info_printer); // Printer Info > SUBMENU(MSG_INFO_PRINTER_MENU, menu_info_printer); // Printer Info >
SUBMENU(MSG_INFO_BOARD_MENU, menu_info_board); // Board Info > SUBMENU(MSG_INFO_BOARD_MENU, menu_info_board); // Board Info >

View file

@ -237,11 +237,7 @@ void menu_mixer() {
BACK_ITEM(MSG_MAIN); BACK_ITEM(MSG_MAIN);
v_index = mixer.get_current_vtool(); v_index = mixer.get_current_vtool();
EDIT_ITEM(uint8, MSG_ACTIVE_VTOOL, &v_index, 0, MIXING_VIRTUAL_TOOLS - 1, _lcd_mixer_select_vtool EDIT_ITEM(uint8, MSG_ACTIVE_VTOOL, &v_index, 0, MIXING_VIRTUAL_TOOLS - 1, _lcd_mixer_select_vtool, ENABLED(HAS_DUAL_MIXING));
#if HAS_DUAL_MIXING
, true
#endif
);
#if HAS_DUAL_MIXING #if HAS_DUAL_MIXING
{ {

View file

@ -54,8 +54,7 @@ void _mmu2_load_filament(uint8_t index) {
ui.reset_status(); ui.reset_status();
} }
void action_mmu2_load_all() { void action_mmu2_load_all() {
LOOP_L_N(i, EXTRUDERS) LOOP_L_N(i, EXTRUDERS) _mmu2_load_filament(i);
_mmu2_load_filament(i);
ui.return_to_status(); ui.return_to_status();
} }

View file

@ -59,11 +59,11 @@ extern int8_t manual_move_axis;
// Tell ui.update() to start a move to current_position" after a short delay. // Tell ui.update() to start a move to current_position" after a short delay.
// //
inline void manual_move_to_current(AxisEnum axis inline void manual_move_to_current(AxisEnum axis
#if E_MANUAL > 1 #if MULTI_MANUAL
, const int8_t eindex=-1 , const int8_t eindex=-1
#endif #endif
) { ) {
#if E_MANUAL > 1 #if MULTI_MANUAL
if (axis == E_AXIS) ui.manual_move_e_index = eindex >= 0 ? eindex : active_extruder; if (axis == E_AXIS) ui.manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
#endif #endif
manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
@ -144,22 +144,14 @@ void lcd_move_z() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_Z), Z_AXIS); }
#if E_MANUAL #if E_MANUAL
static void lcd_move_e( static void lcd_move_e(TERN_(MULTI_MANUAL, const int8_t eindex=-1)) {
#if E_MANUAL > 1
const int8_t eindex=-1
#endif
) {
if (ui.use_click()) return ui.goto_previous_screen_no_defer(); if (ui.use_click()) return ui.goto_previous_screen_no_defer();
if (ui.encoderPosition) { if (ui.encoderPosition) {
if (!ui.processing_manual_move) { if (!ui.processing_manual_move) {
const float diff = float(int32_t(ui.encoderPosition)) * move_menu_scale; const float diff = float(int32_t(ui.encoderPosition)) * move_menu_scale;
#if IS_KINEMATIC TERN(IS_KINEMATIC, manual_move_offset, current_position.e) += diff;
manual_move_offset += diff;
#else
current_position.e += diff;
#endif
manual_move_to_current(E_AXIS manual_move_to_current(E_AXIS
#if E_MANUAL > 1 #if MULTI_MANUAL
, eindex , eindex
#endif #endif
); );
@ -168,24 +160,14 @@ void lcd_move_z() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_Z), Z_AXIS); }
ui.encoderPosition = 0; ui.encoderPosition = 0;
} }
if (ui.should_draw()) { if (ui.should_draw()) {
#if E_MANUAL > 1 #if MULTI_MANUAL
MenuItemBase::init(eindex); MenuItemBase::init(eindex);
#endif #endif
MenuEditItemBase::draw_edit_screen( MenuEditItemBase::draw_edit_screen(
GET_TEXT( GET_TEXT(TERN(MULTI_MANUAL, MSG_MOVE_EN, MSG_MOVE_E)),
#if E_MANUAL > 1
MSG_MOVE_EN
#else
MSG_MOVE_E
#endif
),
ftostr41sign(current_position.e ftostr41sign(current_position.e
#if IS_KINEMATIC + TERN0(IS_KINEMATIC, manual_move_offset)
+ manual_move_offset - TERN0(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin)
#endif
#if ENABLED(MANUAL_E_MOVES_RELATIVE)
- manual_move_e_origin
#endif
) )
); );
} // should_draw } // should_draw
@ -261,11 +243,7 @@ void menu_move() {
EDIT_ITEM(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstops_enabled); EDIT_ITEM(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstops_enabled);
#endif #endif
if (true if (NONE(IS_KINEMATIC, NO_MOTION_BEFORE_HOMING) || all_axes_homed()) {
#if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
&& all_axes_homed()
#endif
) {
if (TERN1(DELTA, current_position.z <= delta_clip_start_height)) { if (TERN1(DELTA, current_position.z <= delta_clip_start_height)) {
SUBMENU(MSG_MOVE_X, []{ _menu_move_distance(X_AXIS, lcd_move_x); }); SUBMENU(MSG_MOVE_X, []{ _menu_move_distance(X_AXIS, lcd_move_x); });
SUBMENU(MSG_MOVE_Y, []{ _menu_move_distance(Y_AXIS, lcd_move_y); }); SUBMENU(MSG_MOVE_Y, []{ _menu_move_distance(Y_AXIS, lcd_move_y); });
@ -332,7 +310,7 @@ void menu_move() {
SUBMENU_MOVE_E(2); SUBMENU_MOVE_E(2);
#endif #endif
#elif E_MANUAL > 1 #elif MULTI_MANUAL
// Independent extruders with one E-stepper per hotend // Independent extruders with one E-stepper per hotend
LOOP_L_N(n, E_MANUAL) SUBMENU_MOVE_E(n); LOOP_L_N(n, E_MANUAL) SUBMENU_MOVE_E(n);

View file

@ -638,7 +638,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
float manual_move_offset = 0; float manual_move_offset = 0;
#endif #endif
#if E_MANUAL > 1 #if MULTI_MANUAL
int8_t MarlinUI::manual_move_e_index = 0; int8_t MarlinUI::manual_move_e_index = 0;
#endif #endif

View file

@ -45,6 +45,10 @@
#define HAS_SLOW_BUTTONS 1 #define HAS_SLOW_BUTTONS 1
#endif #endif
#if E_MANUAL > 1
#define MULTI_MANUAL 1
#endif
#if HAS_SPI_LCD #if HAS_SPI_LCD
#include "../MarlinCore.h" #include "../MarlinCore.h"
@ -491,15 +495,9 @@ public:
static void save_previous_screen(); static void save_previous_screen();
// goto_previous_screen and go_back may also be used as menu item callbacks // goto_previous_screen and go_back may also be used as menu item callbacks
#if ENABLED(TURBO_BACK_MENU_ITEM) static void _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back));
static void _goto_previous_screen(const bool is_back); static inline void goto_previous_screen() { _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, false)); }
static inline void goto_previous_screen() { _goto_previous_screen(false); } static inline void go_back() { _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, true)); }
static inline void go_back() { _goto_previous_screen(true); }
#else
static void _goto_previous_screen();
FORCE_INLINE static void goto_previous_screen() { _goto_previous_screen(); }
FORCE_INLINE static void go_back() { _goto_previous_screen(); }
#endif
static void return_to_status(); static void return_to_status();
static inline bool on_status_screen() { return currentScreen == status_screen; } static inline bool on_status_screen() { return currentScreen == status_screen; }
@ -510,11 +508,7 @@ public:
#endif #endif
FORCE_INLINE static void defer_status_screen(const bool defer=true) { FORCE_INLINE static void defer_status_screen(const bool defer=true) {
#if LCD_TIMEOUT_TO_STATUS TERN(LCD_TIMEOUT_TO_STATUS, defer_return_to_status = defer, UNUSED(defer));
defer_return_to_status = defer;
#else
UNUSED(defer);
#endif
} }
static inline void goto_previous_screen_no_defer() { static inline void goto_previous_screen_no_defer() {
@ -582,11 +576,7 @@ public:
static uint32_t encoderPosition; static uint32_t encoderPosition;
#if ENABLED(REVERSE_ENCODER_DIRECTION) #define ENCODERBASE (TERN(REVERSE_ENCODER_DIRECTION, -1, +1))
#define ENCODERBASE -1
#else
#define ENCODERBASE +1
#endif
#if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION) #if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION)
static int8_t encoderDirection; static int8_t encoderDirection;

View file

@ -137,9 +137,7 @@ typedef struct block_t {
static constexpr uint8_t extruder = 0; static constexpr uint8_t extruder = 0;
#endif #endif
#if ENABLED(MIXING_EXTRUDER) TERN_(MIXING_EXTRUDER, MIXER_BLOCK_FIELD); // Normalized color for the mixing steppers
MIXER_BLOCK_FIELD; // Normalized color for the mixing steppers
#endif
// Settings for the trapezoid generator // Settings for the trapezoid generator
uint32_t accelerate_until, // The index of the step event on which to stop acceleration uint32_t accelerate_until, // The index of the step event on which to stop acceleration