浏览代码

Code cleanup for G33

Scott Lahteine 7 年前
父节点
当前提交
699aa35df6
共有 1 个文件被更改,包括 31 次插入53 次删除
  1. 31
    53
      Marlin/Marlin_main.cpp

+ 31
- 53
Marlin/Marlin_main.cpp 查看文件

@@ -3529,7 +3529,7 @@ inline void gcode_G4() {
3529 3529
       if (leveling_is_active()) {
3530 3530
         SERIAL_ECHOLNPGM(" (enabled)");
3531 3531
         #if ABL_PLANAR
3532
-          float diff[XYZ] = {
3532
+          const float diff[XYZ] = {
3533 3533
             stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS],
3534 3534
             stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS],
3535 3535
             stepper.get_axis_position_mm(Z_AXIS) - current_position[Z_AXIS]
@@ -5094,6 +5094,15 @@ void home_all_axes() { gcode_G28(true); }
5094 5094
      *
5095 5095
      *   E   Engage the probe for each point
5096 5096
      */
5097
+
5098
+    void print_signed_float(const char * const prefix, const float &f) {
5099
+      SERIAL_PROTOCOLPGM("  ");
5100
+      serialprintPGM(prefix);
5101
+      SERIAL_PROTOCOLCHAR(':');
5102
+      if (f >= 0) SERIAL_CHAR('+');
5103
+      SERIAL_PROTOCOL_F(f, 2);
5104
+    }
5105
+
5097 5106
     inline void gcode_G33() {
5098 5107
 
5099 5108
       const int8_t probe_points = parser.seen('P') ? parser.value_int() : DELTA_CALIBRATION_DEFAULT_POINTS;
@@ -5115,7 +5124,7 @@ void home_all_axes() { gcode_G28(true); }
5115 5124
       }
5116 5125
 
5117 5126
       const bool towers_set = !parser.seen('T'),
5118
-                 stow_after_each = parser.seen('E'),
5127
+                 stow_after_each      = parser.seen('E') && parser.value_bool(),
5119 5128
                  _1p_calibration      = probe_points == 1,
5120 5129
                  _4p_calibration      = probe_points == 2,
5121 5130
                  _4p_towers_points    = _4p_calibration && towers_set,
@@ -5183,25 +5192,16 @@ void home_all_axes() { gcode_G28(true); }
5183 5192
 
5184 5193
       SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
5185 5194
       if (!_1p_calibration) {
5186
-        SERIAL_PROTOCOLPGM("    Ex:");
5187
-        if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+');
5188
-        SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2);
5189
-        SERIAL_PROTOCOLPGM("  Ey:");
5190
-        if (endstop_adj[B_AXIS] >= 0) SERIAL_CHAR('+');
5191
-        SERIAL_PROTOCOL_F(endstop_adj[B_AXIS], 2);
5192
-        SERIAL_PROTOCOLPGM("  Ez:");
5193
-        if (endstop_adj[C_AXIS] >= 0) SERIAL_CHAR('+');
5194
-        SERIAL_PROTOCOL_F(endstop_adj[C_AXIS], 2);
5195
+        print_signed_float(PSTR("  Ex"), endstop_adj[A_AXIS]);
5196
+        print_signed_float(PSTR("Ey"), endstop_adj[B_AXIS]);
5197
+        print_signed_float(PSTR("Ez"), endstop_adj[C_AXIS]);
5195 5198
         SERIAL_PROTOCOLPAIR("    Radius:", delta_radius);
5196 5199
       }
5197 5200
       SERIAL_EOL();
5198 5201
       if (_7p_calibration && towers_set) {
5199
-        SERIAL_PROTOCOLPGM(".Tower angle :    Tx:");
5200
-        if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+');
5201
-        SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2);
5202
-        SERIAL_PROTOCOLPGM("  Ty:");
5203
-        if (delta_tower_angle_trim[B_AXIS] >= 0) SERIAL_CHAR('+');
5204
-        SERIAL_PROTOCOL_F(delta_tower_angle_trim[B_AXIS], 2);
5202
+        SERIAL_PROTOCOLPGM(".Tower angle :  ");
5203
+        print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
5204
+        print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_AXIS]);
5205 5205
         SERIAL_PROTOCOLPGM("  Tz:+0.00");
5206 5206
         SERIAL_EOL();
5207 5207
       }
@@ -5351,19 +5351,12 @@ void home_all_axes() { gcode_G28(true); }
5351 5351
          // print report
5352 5352
 
5353 5353
         if (verbose_level != 1) {
5354
-          SERIAL_PROTOCOLPGM(".      c:");
5355
-          if (z_at_pt[0] > 0) SERIAL_CHAR('+');
5356
-          SERIAL_PROTOCOL_F(z_at_pt[0], 2);
5354
+          SERIAL_PROTOCOLPGM(".    ");
5355
+          print_signed_float(PSTR("c"), z_at_pt[0]);
5357 5356
           if (_4p_towers_points || _7p_calibration) {
5358
-            SERIAL_PROTOCOLPGM("     x:");
5359
-            if (z_at_pt[1] >= 0) SERIAL_CHAR('+');
5360
-            SERIAL_PROTOCOL_F(z_at_pt[1], 2);
5361
-            SERIAL_PROTOCOLPGM("   y:");
5362
-            if (z_at_pt[5] >= 0) SERIAL_CHAR('+');
5363
-            SERIAL_PROTOCOL_F(z_at_pt[5], 2);
5364
-            SERIAL_PROTOCOLPGM("   z:");
5365
-            if (z_at_pt[9] >= 0) SERIAL_CHAR('+');
5366
-            SERIAL_PROTOCOL_F(z_at_pt[9], 2);
5357
+            print_signed_float(PSTR("   x"), z_at_pt[1]);
5358
+            print_signed_float(PSTR(" y"), z_at_pt[5]);
5359
+            print_signed_float(PSTR(" z"), z_at_pt[9]);
5367 5360
           }
5368 5361
           if (!_4p_opposite_points) SERIAL_EOL();
5369 5362
           if ((_4p_opposite_points) || _7p_calibration) {
@@ -5371,15 +5364,9 @@ void home_all_axes() { gcode_G28(true); }
5371 5364
               SERIAL_CHAR('.');
5372 5365
               SERIAL_PROTOCOL_SP(13);
5373 5366
             }
5374
-            SERIAL_PROTOCOLPGM("    yz:");
5375
-            if (z_at_pt[7] >= 0) SERIAL_CHAR('+');
5376
-            SERIAL_PROTOCOL_F(z_at_pt[7], 2);
5377
-            SERIAL_PROTOCOLPGM("  zx:");
5378
-            if (z_at_pt[11] >= 0) SERIAL_CHAR('+');
5379
-            SERIAL_PROTOCOL_F(z_at_pt[11], 2);
5380
-            SERIAL_PROTOCOLPGM("  xy:");
5381
-            if (z_at_pt[3] >= 0) SERIAL_CHAR('+');
5382
-            SERIAL_PROTOCOL_F(z_at_pt[3], 2);
5367
+            print_signed_float(PSTR("  yz"), z_at_pt[7]);
5368
+            print_signed_float(PSTR("zx"), z_at_pt[11]);
5369
+            print_signed_float(PSTR("xy"), z_at_pt[3]);
5383 5370
             SERIAL_EOL();
5384 5371
           }
5385 5372
         }
@@ -5409,25 +5396,16 @@ void home_all_axes() { gcode_G28(true); }
5409 5396
           }
5410 5397
           SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
5411 5398
           if (!_1p_calibration) {
5412
-            SERIAL_PROTOCOLPGM("    Ex:");
5413
-            if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+');
5414
-            SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2);
5415
-            SERIAL_PROTOCOLPGM("  Ey:");
5416
-            if (endstop_adj[B_AXIS] >= 0) SERIAL_CHAR('+');
5417
-            SERIAL_PROTOCOL_F(endstop_adj[B_AXIS], 2);
5418
-            SERIAL_PROTOCOLPGM("  Ez:");
5419
-            if (endstop_adj[C_AXIS] >= 0) SERIAL_CHAR('+');
5420
-            SERIAL_PROTOCOL_F(endstop_adj[C_AXIS], 2);
5399
+            print_signed_float(PSTR("  Ex"), endstop_adj[A_AXIS]);
5400
+            print_signed_float(PSTR("Ey"), endstop_adj[B_AXIS]);
5401
+            print_signed_float(PSTR("Ez"), endstop_adj[C_AXIS]);
5421 5402
             SERIAL_PROTOCOLPAIR("    Radius:", delta_radius);
5422 5403
           }
5423 5404
           SERIAL_EOL();
5424 5405
           if (_7p_calibration && towers_set) {
5425
-            SERIAL_PROTOCOLPGM(".Tower angle :    Tx:");
5426
-            if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+');
5427
-            SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2);
5428
-            SERIAL_PROTOCOLPGM("  Ty:");
5429
-            if (delta_tower_angle_trim[B_AXIS] >= 0) SERIAL_CHAR('+');
5430
-            SERIAL_PROTOCOL_F(delta_tower_angle_trim[B_AXIS], 2);
5406
+            SERIAL_PROTOCOLPGM(".Tower angle :  ");
5407
+            print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
5408
+            print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_AXIS]);
5431 5409
             SERIAL_PROTOCOLPGM("  Tz:+0.00");
5432 5410
             SERIAL_EOL();
5433 5411
           }

正在加载...
取消
保存