Apply TERN to compact code (#17619)
This commit is contained in:
@ -42,9 +42,7 @@ Nozzle nozzle;
|
||||
* @param strokes number of strokes to execute
|
||||
*/
|
||||
void Nozzle::stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) {
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
const xyz_pos_t oldpos = current_position;
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t oldpos = current_position);
|
||||
|
||||
// Move to the starting point
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
@ -59,9 +57,7 @@ Nozzle nozzle;
|
||||
do_blocking_move_to_xy(start);
|
||||
}
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
do_blocking_move_to(oldpos);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, do_blocking_move_to(oldpos));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,9 +73,7 @@ Nozzle nozzle;
|
||||
const xy_pos_t diff = end - start;
|
||||
if (!diff.x || !diff.y) return;
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
const xyz_pos_t back = current_position;
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position);
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
do_blocking_move_to_xy(start);
|
||||
@ -108,9 +102,7 @@ Nozzle nozzle;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
do_blocking_move_to(back);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, do_blocking_move_to(back));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,15 +116,8 @@ Nozzle nozzle;
|
||||
void Nozzle::circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const float &radius) {
|
||||
if (strokes == 0) return;
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
const xyz_pos_t back = current_position;
|
||||
#endif
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
do_blocking_move_to_xy(start);
|
||||
#else
|
||||
do_blocking_move_to(start);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position);
|
||||
TERN(NOZZLE_CLEAN_NO_Z, do_blocking_move_to_xy, do_blocking_move_to)(start);
|
||||
|
||||
LOOP_L_N(s, strokes)
|
||||
LOOP_L_N(i, NOZZLE_CLEAN_CIRCLE_FN)
|
||||
@ -144,9 +129,7 @@ Nozzle nozzle;
|
||||
// Let's be safe
|
||||
do_blocking_move_to_xy(start);
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
do_blocking_move_to(back);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, do_blocking_move_to(back));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user