瀏覽代碼

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
Scott Lahteine 10 年之前
父節點
當前提交
b116c096bd
共有 1 個檔案被更改,包括 6 行新增5 行删除
  1. 6
    5
      Marlin/Marlin_main.cpp

+ 6
- 5
Marlin/Marlin_main.cpp 查看文件

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

Loading…
取消
儲存