Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 14, 2023
1 parent a804e59 commit b0a54f2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 42 deletions.
3 changes: 1 addition & 2 deletions Marlin/src/feature/mmu/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
resume_hotend_temp = thermalManager.degTargetHotend(active_extruder);
resume_position = current_position;

if (move_axes && all_axes_homed())
nozzle.park(0, park_point /*= NOZZLE_PARK_POINT*/);
if (move_axes && all_axes_homed()) nozzle.park(0, park_point);

if (turn_off_nozzle) thermalManager.setTargetHotend(0, active_extruder);

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1148,11 +1148,11 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS

#if ENABLED(NOZZLE_PARK_FEATURE)
constexpr float npp[] = NOZZLE_PARK_POINT;
static_assert(COUNT(npp) == NUM_AXES, "NOZZLE_PARK_POINT requires X, Y, and Z values.");
static_assert(COUNT(npp) == _MIN(NUM_AXES, XYZ), "NOZZLE_PARK_POINT requires coordinates for enabled axes, but only up to X,Y,Z.");
constexpr xyz_pos_t npp_xyz = NOZZLE_PARK_POINT;
static_assert(WITHIN(npp_xyz.x, X_MIN_POS, X_MAX_POS), "NOZZLE_PARK_POINT.X is out of bounds (X_MIN_POS, X_MAX_POS).");
static_assert(WITHIN(npp_xyz.y, Y_MIN_POS, Y_MAX_POS), "NOZZLE_PARK_POINT.Y is out of bounds (Y_MIN_POS, Y_MAX_POS).");
static_assert(TERN1(HAS_Z_AXIS,WITHIN(npp_xyz.z, Z_MIN_POS, Z_MAX_POS)), "NOZZLE_PARK_POINT.Z is out of bounds (Z_MIN_POS, Z_MAX_POS).");
static_assert(TERN1(HAS_Y_AXIS, WITHIN(npp_xyz.y, Y_MIN_POS, Y_MAX_POS)), "NOZZLE_PARK_POINT.Y is out of bounds (Y_MIN_POS, Y_MAX_POS).");
static_assert(TERN1(HAS_Z_AXIS, WITHIN(npp_xyz.z, Z_MIN_POS, Z_MAX_POS)), "NOZZLE_PARK_POINT.Z is out of bounds (Z_MIN_POS, Z_MAX_POS).");
#endif

/**
Expand Down
11 changes: 5 additions & 6 deletions Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,12 +999,11 @@ void MarlinUI::draw_status_screen() {
#endif // LCD_WIDTH >= 20

#if HAS_Z_AXIS
lcd_moveto(LCD_WIDTH - 8, 1);
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
#endif

#if HAS_LEVELING && !HAS_HEATED_BED
lcd_put_lchar(planner.leveling_active || blink ? '_' : ' ');
lcd_moveto(LCD_WIDTH - 8, 1);
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
#if HAS_LEVELING && !HAS_HEATED_BED
lcd_put_lchar(planner.leveling_active || blink ? '_' : ' ');
#endif
#endif

#endif // LCD_HEIGHT > 2
Expand Down
52 changes: 26 additions & 26 deletions Marlin/src/libs/nozzle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,42 +226,42 @@ Nozzle nozzle;
#if ENABLED(NOZZLE_PARK_FEATURE)

#if HAS_Z_AXIS
float Nozzle::park_mode_0_height(const_float_t park_z) {
// Apply a minimum raise, if specified. Use park.z as a minimum height instead.
return _MAX(park_z, // Minimum height over 0 based on input
_MIN(Z_MAX_POS, // Maximum height is fixed
#ifdef NOZZLE_PARK_Z_RAISE_MIN
NOZZLE_PARK_Z_RAISE_MIN + // Minimum raise...
#endif
current_position.z // ...over current position
)
);
}
#endif
float Nozzle::park_mode_0_height(const_float_t park_z) {
// Apply a minimum raise, if specified. Use park.z as a minimum height instead.
return _MAX(park_z, // Minimum height over 0 based on input
_MIN(Z_MAX_POS, // Maximum height is fixed
#ifdef NOZZLE_PARK_Z_RAISE_MIN
NOZZLE_PARK_Z_RAISE_MIN + // Minimum raise...
#endif
current_position.z // ...over current position
)
);
}
#endif // HAS_Z_AXIS

void Nozzle::park(const uint8_t z_action, const xyz_pos_t &park/*=NOZZLE_PARK_POINT*/) {
constexpr feedRate_t fr_xy = NOZZLE_PARK_XY_FEEDRATE;
#if HAS_Z_AXIS
constexpr feedRate_t fr_z = NOZZLE_PARK_Z_FEEDRATE;
constexpr feedRate_t fr_z = NOZZLE_PARK_Z_FEEDRATE;

switch (z_action) {
case 1: // Go to Z-park height
do_blocking_move_to_z(park.z, fr_z);
break;
switch (z_action) {
case 1: // Go to Z-park height
do_blocking_move_to_z(park.z, fr_z);
break;

case 2: // Raise by Z-park height
do_blocking_move_to_z(_MIN(current_position.z + park.z, Z_MAX_POS), fr_z);
break;
case 2: // Raise by Z-park height
do_blocking_move_to_z(_MIN(current_position.z + park.z, Z_MAX_POS), fr_z);
break;

default: // Raise by NOZZLE_PARK_Z_RAISE_MIN, use park.z as a minimum height
do_blocking_move_to_z(park_mode_0_height(park.z), fr_z);
break;
}
#endif
default: // Raise by NOZZLE_PARK_Z_RAISE_MIN, use park.z as a minimum height
do_blocking_move_to_z(park_mode_0_height(park.z), fr_z);
break;
}
#endif // HAS_Z_AXIS

#ifndef NOZZLE_PARK_MOVE
#define NOZZLE_PARK_MOVE 0
#endif
constexpr feedRate_t fr_xy = NOZZLE_PARK_XY_FEEDRATE;
switch (NOZZLE_PARK_MOVE) {
case 0: do_blocking_move_to_xy(park, fr_xy); break;
case 1: do_blocking_move_to_x(park.x, fr_xy); break;
Expand Down
6 changes: 1 addition & 5 deletions Marlin/src/module/polargraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ xy_pos_t draw_area_min, draw_area_max;

void inverse_kinematics(const xyz_pos_t &raw) {
const float x1 = raw.x - draw_area_min.x, x2 = draw_area_max.x - raw.x, y = raw.y - draw_area_max.y;
#if HAS_Z_AXIS
delta.set(HYPOT(x1, y), HYPOT(x2, y), raw.z);
#else
delta.set(HYPOT(x1, y), HYPOT(x2, y));
#endif
delta.set(HYPOT(x1, y), HYPOT(x2, y) OPTARG(HAS_Z_AXIS, raw.z));
}

#endif // POLARGRAPH

0 comments on commit b0a54f2

Please sign in to comment.