Reduce set_homing_bump_feedrate, save 42 bytes (PR#2512)

Updates to `set_homing_bump_feedrate`:
- Move the string into Program Memory, reduce length by 31 bytes
- Use an auto to get the divisor, adjust it on error
- Set feedrate once, at the end
2.0.x
Scott Lahteine 9 years ago committed by Richard Wackerbarth
parent f7e7862588
commit b116c096bd

@ -1096,12 +1096,13 @@ static void set_axis_is_at_home(AxisEnum axis) {
*/ */
inline void set_homing_bump_feedrate(AxisEnum axis) { inline void set_homing_bump_feedrate(AxisEnum axis) {
const int homing_bump_divisor[] = HOMING_BUMP_DIVISOR; const int homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
if (homing_bump_divisor[axis] >= 1) int hbd = homing_bump_divisor[axis];
feedrate = homing_feedrate[axis] / homing_bump_divisor[axis]; if (hbd < 1) {
else { hbd = 10;
feedrate = homing_feedrate[axis] / 10; SERIAL_ECHO_START;
SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less than 1"); SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1");
} }
feedrate = homing_feedrate[axis] / hbd;
} }
inline void line_to_current_position() { inline void line_to_current_position() {
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder);

Loading…
Cancel
Save