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

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