From b116c096bda6784144e769d01ab9e13f9cc2d1b0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Jul 2015 13:43:03 -0700 Subject: [PATCH] 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 --- Marlin/Marlin_main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 67c204c32..a41ab26cc 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1096,12 +1096,13 @@ static void set_axis_is_at_home(AxisEnum axis) { */ inline void set_homing_bump_feedrate(AxisEnum axis) { const int homing_bump_divisor[] = HOMING_BUMP_DIVISOR; - if (homing_bump_divisor[axis] >= 1) - feedrate = homing_feedrate[axis] / homing_bump_divisor[axis]; - else { - feedrate = homing_feedrate[axis] / 10; - SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less than 1"); + int hbd = homing_bump_divisor[axis]; + if (hbd < 1) { + hbd = 10; + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1"); } + feedrate = homing_feedrate[axis] / hbd; } 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);