Parcourir la source

Followup to float maths patch

Scott Lahteine il y a 7 ans
Parent
révision
63f4c9bdb9

+ 2
- 2
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h Voir le fichier

@@ -82,12 +82,12 @@ public:
82 82
   }
83 83
 
84 84
   static int8_t probe_index_x(const float &x) {
85
-    int8_t px = (x - (MESH_MIN_X) + 0.5 * (MESH_X_DIST)) * (1.0f / (MESH_X_DIST));
85
+    int8_t px = (x - (MESH_MIN_X) + 0.5f * (MESH_X_DIST)) * (1.0f / (MESH_X_DIST));
86 86
     return WITHIN(px, 0, GRID_MAX_POINTS_X - 1) ? px : -1;
87 87
   }
88 88
 
89 89
   static int8_t probe_index_y(const float &y) {
90
-    int8_t py = (y - (MESH_MIN_Y) + 0.5 * (MESH_Y_DIST)) * (1.0f / (MESH_Y_DIST));
90
+    int8_t py = (y - (MESH_MIN_Y) + 0.5f * (MESH_Y_DIST)) * (1.0f / (MESH_Y_DIST));
91 91
     return WITHIN(py, 0, GRID_MAX_POINTS_Y - 1) ? py : -1;
92 92
   }
93 93
 

+ 37
- 37
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp Voir le fichier

@@ -65,8 +65,8 @@
65 65
          unified_bed_leveling::g29_y_flag;
66 66
   float  unified_bed_leveling::g29_x_pos,
67 67
          unified_bed_leveling::g29_y_pos,
68
-         unified_bed_leveling::g29_card_thickness = 0.0,
69
-         unified_bed_leveling::g29_constant = 0.0;
68
+         unified_bed_leveling::g29_card_thickness = 0,
69
+         unified_bed_leveling::g29_constant = 0;
70 70
 
71 71
   #if HAS_BED_PROBE
72 72
     int  unified_bed_leveling::g29_grid_size;
@@ -346,23 +346,23 @@
346 346
         case 0:
347 347
           for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) {   // Create a bowl shape - similar to
348 348
             for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) { // a poorly calibrated Delta.
349
-              const float p1 = 0.5 * (GRID_MAX_POINTS_X) - x,
350
-                          p2 = 0.5 * (GRID_MAX_POINTS_Y) - y;
351
-              z_values[x][y] += 2.0 * HYPOT(p1, p2);
349
+              const float p1 = 0.5f * (GRID_MAX_POINTS_X) - x,
350
+                          p2 = 0.5f * (GRID_MAX_POINTS_Y) - y;
351
+              z_values[x][y] += 2.0f * HYPOT(p1, p2);
352 352
             }
353 353
           }
354 354
           break;
355 355
         case 1:
356 356
           for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) {  // Create a diagonal line several Mesh cells thick that is raised
357
-            z_values[x][x] += 9.999;
358
-            z_values[x][x + (x < GRID_MAX_POINTS_Y - 1) ? 1 : -1] += 9.999; // We want the altered line several mesh points thick
357
+            z_values[x][x] += 9.999f;
358
+            z_values[x][x + (x < GRID_MAX_POINTS_Y - 1) ? 1 : -1] += 9.999f; // We want the altered line several mesh points thick
359 359
           }
360 360
           break;
361 361
         case 2:
362 362
           // Allow the user to specify the height because 10mm is a little extreme in some cases.
363 363
           for (uint8_t x = (GRID_MAX_POINTS_X) / 3; x < 2 * (GRID_MAX_POINTS_X) / 3; x++)   // Create a rectangular raised area in
364 364
             for (uint8_t y = (GRID_MAX_POINTS_Y) / 3; y < 2 * (GRID_MAX_POINTS_Y) / 3; y++) // the center of the bed
365
-              z_values[x][y] += parser.seen('C') ? g29_constant : 9.99;
365
+              z_values[x][y] += parser.seen('C') ? g29_constant : 9.99f;
366 366
           break;
367 367
       }
368 368
     }
@@ -381,7 +381,7 @@
381 381
           tilt_mesh_based_on_probed_grid(true /* true says to do 3-Point leveling */ );
382 382
           restore_ubl_active_state_and_leave();
383 383
         }
384
-        do_blocking_move_to_xy(0.5 * (MESH_MAX_X - (MESH_MIN_X)), 0.5 * (MESH_MAX_Y - (MESH_MIN_Y)));
384
+        do_blocking_move_to_xy(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y)));
385 385
         report_current_position();
386 386
       }
387 387
 
@@ -453,7 +453,7 @@
453 453
 
454 454
             if (parser.seen('B')) {
455 455
               g29_card_thickness = parser.has_value() ? parser.value_float() : measure_business_card_thickness((float) Z_CLEARANCE_BETWEEN_PROBES);
456
-              if (ABS(g29_card_thickness) > 1.5) {
456
+              if (ABS(g29_card_thickness) > 1.5f) {
457 457
                 SERIAL_PROTOCOLLNPGM("?Error in Business Card measurement.");
458 458
                 return;
459 459
               }
@@ -509,7 +509,7 @@
509 509
           }
510 510
           else {
511 511
             const float cvf = parser.value_float();
512
-            switch ((int)truncf(cvf * 10.0) - 30) {   // 3.1 -> 1
512
+            switch ((int)truncf(cvf * 10.0f) - 30) {   // 3.1 -> 1
513 513
               #if ENABLED(UBL_G29_P31)
514 514
                 case 1: {
515 515
 
@@ -519,8 +519,8 @@
519 519
                   // P3.12 100X distance weighting
520 520
                   // P3.13 1000X distance weighting, approaches simple average of nearest points
521 521
 
522
-                  const float weight_power  = (cvf - 3.10) * 100.0,  // 3.12345 -> 2.345
523
-                              weight_factor = weight_power ? POW(10.0, weight_power) : 0;
522
+                  const float weight_power  = (cvf - 3.10f) * 100.0f,  // 3.12345 -> 2.345
523
+                              weight_factor = weight_power ? POW(10.0f, weight_power) : 0;
524 524
                   smart_fill_wlsf(weight_factor);
525 525
                 }
526 526
                 break;
@@ -634,7 +634,7 @@
634 634
   }
635 635
 
636 636
   void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const float value) {
637
-    float sum = 0.0;
637
+    float sum = 0;
638 638
     int n = 0;
639 639
     for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
640 640
       for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
@@ -648,7 +648,7 @@
648 648
     //
649 649
     // Sum the squares of difference from mean
650 650
     //
651
-    float sum_of_diff_squared = 0.0;
651
+    float sum_of_diff_squared = 0;
652 652
     for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
653 653
       for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
654 654
         if (!isnan(z_values[x][y]))
@@ -786,7 +786,7 @@
786 786
 
787 787
     float unified_bed_leveling::measure_point_with_encoder() {
788 788
       KEEPALIVE_STATE(PAUSED_FOR_USER);
789
-      move_z_with_encoder(0.01);
789
+      move_z_with_encoder(0.01f);
790 790
       KEEPALIVE_STATE(IN_HANDLER);
791 791
       return current_position[Z_AXIS];
792 792
     }
@@ -797,8 +797,8 @@
797 797
       lcd_external_control = true;
798 798
       save_ubl_active_state_and_disable();   // Disable bed level correction for probing
799 799
 
800
-      do_blocking_move_to(0.5 * (MESH_MAX_X - (MESH_MIN_X)), 0.5 * (MESH_MAX_Y - (MESH_MIN_Y)), in_height);
801
-        //, MIN(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]) / 2.0);
800
+      do_blocking_move_to(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y)), in_height);
801
+        //, MIN(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]) * 0.5f);
802 802
       planner.synchronize();
803 803
 
804 804
       SERIAL_PROTOCOLPGM("Place shim under nozzle");
@@ -874,7 +874,7 @@
874 874
 
875 875
         serialprintPGM(parser.seen('B') ? PSTR(MSG_UBL_BC_INSERT) : PSTR(MSG_UBL_BC_INSERT2));
876 876
 
877
-        const float z_step = 0.01;                          // existing behavior: 0.01mm per click, occasionally step
877
+        const float z_step = 0.01f;                         // existing behavior: 0.01mm per click, occasionally step
878 878
         //const float z_step = planner.steps_to_mm[Z_AXIS]; // approx one step each click
879 879
 
880 880
         move_z_with_encoder(z_step);
@@ -913,7 +913,7 @@
913 913
       lcd_quick_feedback(true);
914 914
     #endif
915 915
 
916
-    g29_constant = 0.0;
916
+    g29_constant = 0;
917 917
     g29_repetition_cnt = 0;
918 918
 
919 919
     g29_x_flag = parser.seenval('X');
@@ -1004,7 +1004,7 @@
1004 1004
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1005 1005
       if (parser.seenval('F')) {
1006 1006
         const float fh = parser.value_float();
1007
-        if (!WITHIN(fh, 0.0, 100.0)) {
1007
+        if (!WITHIN(fh, 0, 100)) {
1008 1008
           SERIAL_PROTOCOLLNPGM("?(F)ade height for Bed Level Correction not plausible.\n");
1009 1009
           return UBL_ERR;
1010 1010
         }
@@ -1226,7 +1226,7 @@
1226 1226
 
1227 1227
     mesh_index_pair out_mesh;
1228 1228
     out_mesh.x_index = out_mesh.y_index = -1;
1229
-    out_mesh.distance = -99999.99;
1229
+    out_mesh.distance = -99999.99f;
1230 1230
 
1231 1231
     for (int8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
1232 1232
       for (int8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
@@ -1242,7 +1242,7 @@
1242 1242
           found_a_NAN = true;
1243 1243
 
1244 1244
           int8_t closest_x = -1, closest_y = -1;
1245
-          float d1, d2 = 99999.9;
1245
+          float d1, d2 = 99999.9f;
1246 1246
           for (int8_t k = 0; k < GRID_MAX_POINTS_X; k++) {
1247 1247
             for (int8_t l = 0; l < GRID_MAX_POINTS_Y; l++) {
1248 1248
               if (!isnan(z_values[k][l])) {
@@ -1279,7 +1279,7 @@
1279 1279
     if (!found_a_real && found_a_NAN) {        // if the mesh is totally unpopulated, start the probing
1280 1280
       out_mesh.x_index = GRID_MAX_POINTS_X / 2;
1281 1281
       out_mesh.y_index = GRID_MAX_POINTS_Y / 2;
1282
-      out_mesh.distance = 1.0;
1282
+      out_mesh.distance = 1;
1283 1283
     }
1284 1284
     return out_mesh;
1285 1285
   }
@@ -1287,13 +1287,13 @@
1287 1287
   mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const MeshPointType type, const float &rx, const float &ry, const bool probe_as_reference, uint16_t bits[16]) {
1288 1288
     mesh_index_pair out_mesh;
1289 1289
     out_mesh.x_index = out_mesh.y_index = -1;
1290
-    out_mesh.distance = -99999.9;
1290
+    out_mesh.distance = -99999.9f;
1291 1291
 
1292 1292
     // Get our reference position. Either the nozzle or probe location.
1293 1293
     const float px = rx - (probe_as_reference == USE_PROBE_AS_REFERENCE ? X_PROBE_OFFSET_FROM_EXTRUDER : 0),
1294 1294
                 py = ry - (probe_as_reference == USE_PROBE_AS_REFERENCE ? Y_PROBE_OFFSET_FROM_EXTRUDER : 0);
1295 1295
 
1296
-    float best_so_far = 99999.99;
1296
+    float best_so_far = 99999.99f;
1297 1297
 
1298 1298
     for (int8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
1299 1299
       for (int8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
@@ -1320,7 +1320,7 @@
1320 1320
 
1321 1321
           // factor in the distance from the current location for the normal case
1322 1322
           // so the nozzle isn't running all over the bed.
1323
-          distance += HYPOT(current_position[X_AXIS] - mx, current_position[Y_AXIS] - my) * 0.1;
1323
+          distance += HYPOT(current_position[X_AXIS] - mx, current_position[Y_AXIS] - my) * 0.1f;
1324 1324
           if (distance < best_so_far) {
1325 1325
             best_so_far = distance;   // We found a closer location with
1326 1326
             out_mesh.x_index = i;     // the specified type of mesh value.
@@ -1401,8 +1401,8 @@
1401 1401
         lcd_refresh();
1402 1402
 
1403 1403
         float new_z = z_values[location.x_index][location.y_index];
1404
-        if (isnan(new_z)) new_z = 0.0;                              // Invalid points begin at 0
1405
-        new_z = FLOOR(new_z * 1000.0) * 0.001;                      // Chop off digits after the 1000ths place
1404
+        if (isnan(new_z)) new_z = 0;                                // Invalid points begin at 0
1405
+        new_z = FLOOR(new_z * 1000) * 0.001f;                       // Chop off digits after the 1000ths place
1406 1406
 
1407 1407
         lcd_mesh_edit_setup(new_z);
1408 1408
 
@@ -1461,7 +1461,7 @@
1461 1461
       if (z_values[x1][y1] < z_values[x2][y2])                  // Angled downward?
1462 1462
         z_values[x][y] = z_values[x1][y1];                      // Use nearest (maybe a little too high.)
1463 1463
       else
1464
-        z_values[x][y] = 2.0 * z_values[x1][y1] - z_values[x2][y2];   // Angled upward...
1464
+        z_values[x][y] = 2.0f * z_values[x1][y1] - z_values[x2][y2];   // Angled upward...
1465 1465
       return true;
1466 1466
     }
1467 1467
     return false;
@@ -1510,8 +1510,8 @@
1510 1510
 
1511 1511
       float measured_z;
1512 1512
 
1513
-      const float dx = float(x_max - x_min) / (g29_grid_size - 1.0),
1514
-                  dy = float(y_max - y_min) / (g29_grid_size - 1.0);
1513
+      const float dx = float(x_max - x_min) / (g29_grid_size - 1),
1514
+                  dy = float(y_max - y_min) / (g29_grid_size - 1);
1515 1515
 
1516 1516
       struct linear_fit_data lsf_results;
1517 1517
 
@@ -1634,7 +1634,7 @@
1634 1634
         return;
1635 1635
       }
1636 1636
 
1637
-      vector_3 normal = vector_3(lsf_results.A, lsf_results.B, 1.0000).get_normal();
1637
+      vector_3 normal = vector_3(lsf_results.A, lsf_results.B, 1).get_normal();
1638 1638
 
1639 1639
       if (g29_verbose_level > 2) {
1640 1640
         SERIAL_ECHOPGM("bed plane normal = [");
@@ -1713,7 +1713,7 @@
1713 1713
            * The only difference is just 3 points are used in the calculations.   That fact guarantees
1714 1714
            * each probed point should have an exact match when a get_z_correction() for that location
1715 1715
            * is calculated.  The Z error between the probed point locations and the get_z_correction()
1716
-           * numbers for those locations should be 0.000
1716
+           * numbers for those locations should be 0.
1717 1717
            */
1718 1718
           #if 0
1719 1719
           float t, t1, d;
@@ -1743,13 +1743,13 @@
1743 1743
           SERIAL_EOL();
1744 1744
 
1745 1745
           t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT);
1746
-          d = t + normal.z * 0.000;
1746
+          d = t + normal.z * 0;
1747 1747
           SERIAL_ECHOPGM("D from home location with Z=0 : ");
1748 1748
           SERIAL_ECHO_F(d, 6);
1749 1749
           SERIAL_EOL();
1750 1750
 
1751 1751
           t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT);
1752
-          d = t + get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT); // normal.z * 0.000;
1752
+          d = t + get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT); // normal.z * 0;
1753 1753
           SERIAL_ECHOPGM("D from home location using mesh value for Z: ");
1754 1754
           SERIAL_ECHO_F(d, 6);
1755 1755
 
@@ -1800,7 +1800,7 @@
1800 1800
                 if (TEST(bitmap[jx], jy)) {
1801 1801
                   const float ry = mesh_index_to_ypos(jy),
1802 1802
                               rz = z_values[jx][jy],
1803
-                              w  = 1.0 + weight_scaled / HYPOT((rx - px), (ry - py));
1803
+                              w  = 1 + weight_scaled / HYPOT((rx - px), (ry - py));
1804 1804
                   incremental_WLSF(&lsf_results, rx, ry, rz, w);
1805 1805
                 }
1806 1806
               }

+ 11
- 11
Marlin/src/module/configuration_store.cpp Voir le fichier

@@ -384,7 +384,7 @@ void MarlinSettings::postprocess() {
384 384
    * M500 - Store Configuration
385 385
    */
386 386
   bool MarlinSettings::save(PORTARG_SOLO) {
387
-    float dummy = 0.0f;
387
+    float dummy = 0;
388 388
     char ver[4] = "ERR";
389 389
 
390 390
     uint16_t working_crc = 0;
@@ -466,7 +466,7 @@ void MarlinSettings::postprocess() {
466 466
       EEPROM_WRITE(mesh_num_y);
467 467
       EEPROM_WRITE(mbl.z_values);
468 468
     #else // For disabled MBL write a default mesh
469
-      dummy = 0.0f;
469
+      dummy = 0;
470 470
       const uint8_t mesh_num_x = 3, mesh_num_y = 3;
471 471
       EEPROM_WRITE(dummy); // z_offset
472 472
       EEPROM_WRITE(mesh_num_x);
@@ -488,7 +488,7 @@ void MarlinSettings::postprocess() {
488 488
     #if ABL_PLANAR
489 489
       EEPROM_WRITE(planner.bed_level_matrix);
490 490
     #else
491
-      dummy = 0.0f;
491
+      dummy = 0;
492 492
       for (uint8_t q = 9; q--;) EEPROM_WRITE(dummy);
493 493
     #endif
494 494
 
@@ -512,7 +512,7 @@ void MarlinSettings::postprocess() {
512 512
       // For disabled Bilinear Grid write an empty 3x3 grid
513 513
       const uint8_t grid_max_x = 3, grid_max_y = 3;
514 514
       const int bilinear_start[2] = { 0 }, bilinear_grid_spacing[2] = { 0 };
515
-      dummy = 0.0f;
515
+      dummy = 0;
516 516
       EEPROM_WRITE(grid_max_x);
517 517
       EEPROM_WRITE(grid_max_y);
518 518
       EEPROM_WRITE(bilinear_grid_spacing);
@@ -550,7 +550,7 @@ void MarlinSettings::postprocess() {
550 550
       _FIELD_TEST(x_endstop_adj);
551 551
 
552 552
       // Write dual endstops in X, Y, Z order. Unused = 0.0
553
-      dummy = 0.0f;
553
+      dummy = 0;
554 554
       #if ENABLED(X_DUAL_ENDSTOPS)
555 555
         EEPROM_WRITE(endstops.x_endstop_adj);   // 1 float
556 556
       #else
@@ -602,7 +602,7 @@ void MarlinSettings::postprocess() {
602 602
         {
603 603
           dummy = DUMMY_PID_VALUE; // When read, will not change the existing value
604 604
           EEPROM_WRITE(dummy); // Kp
605
-          dummy = 0.0f;
605
+          dummy = 0;
606 606
           for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); // Ki, Kd, Kc
607 607
         }
608 608
 
@@ -848,7 +848,7 @@ void MarlinSettings::postprocess() {
848 848
     #if ENABLED(LIN_ADVANCE)
849 849
       EEPROM_WRITE(planner.extruder_advance_K);
850 850
     #else
851
-      dummy = 0.0f;
851
+      dummy = 0;
852 852
       EEPROM_WRITE(dummy);
853 853
     #endif
854 854
 
@@ -870,7 +870,7 @@ void MarlinSettings::postprocess() {
870 870
     #if ENABLED(CNC_COORDINATE_SYSTEMS)
871 871
       EEPROM_WRITE(gcode.coordinate_system); // 27 floats
872 872
     #else
873
-      dummy = 0.0f;
873
+      dummy = 0;
874 874
       for (uint8_t q = MAX_COORDINATE_SYSTEMS * XYZ; q--;) EEPROM_WRITE(dummy);
875 875
     #endif
876 876
 
@@ -885,7 +885,7 @@ void MarlinSettings::postprocess() {
885 885
       EEPROM_WRITE(planner.xz_skew_factor);
886 886
       EEPROM_WRITE(planner.yz_skew_factor);
887 887
     #else
888
-      dummy = 0.0f;
888
+      dummy = 0;
889 889
       for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
890 890
     #endif
891 891
 
@@ -905,7 +905,7 @@ void MarlinSettings::postprocess() {
905 905
         EEPROM_WRITE(dummy);
906 906
       }
907 907
     #else
908
-      dummy = 0.0f;
908
+      dummy = 0;
909 909
       for (uint8_t q = MAX_EXTRUDERS * 2; q--;) EEPROM_WRITE(dummy);
910 910
     #endif
911 911
 
@@ -974,7 +974,7 @@ void MarlinSettings::postprocess() {
974 974
       eeprom_error = true;
975 975
     }
976 976
     else {
977
-      float dummy = 0.0f;
977
+      float dummy = 0;
978 978
       #if DISABLED(AUTO_BED_LEVELING_UBL) || DISABLED(FWRETRACT) || ENABLED(NO_VOLUMETRICS)
979 979
         bool dummyb;
980 980
       #endif

+ 10
- 10
Marlin/src/module/delta.cpp Voir le fichier

@@ -157,22 +157,22 @@ float delta_safe_distance_from_top() {
157 157
  */
158 158
 void forward_kinematics_DELTA(const float &z1, const float &z2, const float &z3) {
159 159
   // Create a vector in old coordinates along x axis of new coordinate
160
-  const float p12[3] = { delta_tower[B_AXIS][X_AXIS] - delta_tower[A_AXIS][X_AXIS], delta_tower[B_AXIS][Y_AXIS] - delta_tower[A_AXIS][Y_AXIS], z2 - z1 };
160
+  const float p12[3] = { delta_tower[B_AXIS][X_AXIS] - delta_tower[A_AXIS][X_AXIS], delta_tower[B_AXIS][Y_AXIS] - delta_tower[A_AXIS][Y_AXIS], z2 - z1 },
161 161
 
162 162
   // Get the reciprocal of Magnitude of vector.
163
-  const float d2 = sq(p12[0]) + sq(p12[1]) + sq(p12[2]), inv_d = RSQRT(d2);
163
+  d2 = sq(p12[0]) + sq(p12[1]) + sq(p12[2]), inv_d = RSQRT(d2),
164 164
 
165 165
   // Create unit vector by multiplying by the inverse of the magnitude.
166
-  const float ex[3] = { p12[0] * inv_d, p12[1] * inv_d, p12[2] * inv_d };
166
+  ex[3] = { p12[0] * inv_d, p12[1] * inv_d, p12[2] * inv_d },
167 167
 
168 168
   // Get the vector from the origin of the new system to the third point.
169
-  const float p13[3] = { delta_tower[C_AXIS][X_AXIS] - delta_tower[A_AXIS][X_AXIS], delta_tower[C_AXIS][Y_AXIS] - delta_tower[A_AXIS][Y_AXIS], z3 - z1 };
169
+  p13[3] = { delta_tower[C_AXIS][X_AXIS] - delta_tower[A_AXIS][X_AXIS], delta_tower[C_AXIS][Y_AXIS] - delta_tower[A_AXIS][Y_AXIS], z3 - z1 },
170 170
 
171 171
   // Use the dot product to find the component of this vector on the X axis.
172
-  const float i = ex[0] * p13[0] + ex[1] * p13[1] + ex[2] * p13[2];
172
+  i = ex[0] * p13[0] + ex[1] * p13[1] + ex[2] * p13[2],
173 173
 
174 174
   // Create a vector along the x axis that represents the x component of p13.
175
-  const float iex[3] = { ex[0] * i, ex[1] * i, ex[2] * i };
175
+  iex[3] = { ex[0] * i, ex[1] * i, ex[2] * i };
176 176
 
177 177
   // Subtract the X component from the original vector leaving only Y. We use the
178 178
   // variable that will be the unit vector after we scale it.
@@ -190,13 +190,13 @@ void forward_kinematics_DELTA(const float &z1, const float &z2, const float &z3)
190 190
     ex[1] * ey[2] - ex[2] * ey[1],
191 191
     ex[2] * ey[0] - ex[0] * ey[2],
192 192
     ex[0] * ey[1] - ex[1] * ey[0]
193
-  };
193
+  },
194 194
 
195 195
   // We now have the d, i and j values defined in Wikipedia.
196 196
   // Plug them into the equations defined in Wikipedia for Xnew, Ynew and Znew
197
-  const float Xnew = (delta_diagonal_rod_2_tower[A_AXIS] - delta_diagonal_rod_2_tower[B_AXIS] + d2) * inv_d * 0.5,
198
-              Ynew = ((delta_diagonal_rod_2_tower[A_AXIS] - delta_diagonal_rod_2_tower[C_AXIS] + sq(i) + j2) * 0.5 - i * Xnew) * inv_j,
199
-              Znew = SQRT(delta_diagonal_rod_2_tower[A_AXIS] - HYPOT2(Xnew, Ynew));
197
+  Xnew = (delta_diagonal_rod_2_tower[A_AXIS] - delta_diagonal_rod_2_tower[B_AXIS] + d2) * inv_d * 0.5,
198
+  Ynew = ((delta_diagonal_rod_2_tower[A_AXIS] - delta_diagonal_rod_2_tower[C_AXIS] + sq(i) + j2) * 0.5 - i * Xnew) * inv_j,
199
+  Znew = SQRT(delta_diagonal_rod_2_tower[A_AXIS] - HYPOT2(Xnew, Ynew));
200 200
 
201 201
   // Start from the origin of the old coordinates and add vectors in the
202 202
   // old coords that represent the Xnew, Ynew and Znew to find the point

+ 1
- 1
Marlin/src/module/planner.cpp Voir le fichier

@@ -1317,7 +1317,7 @@ void Planner::check_axes_activity() {
1317 1317
    * Return 1.0 with volumetric off or a diameter of 0.0.
1318 1318
    */
1319 1319
   inline float calculate_volumetric_multiplier(const float &diameter) {
1320
-    return (parser.volumetric_enabled && diameter) ? RECIPROCAL(CIRCLE_AREA(diameter * 0.5f)) : 1;
1320
+    return (parser.volumetric_enabled && diameter) ? 1.0f / CIRCLE_AREA(diameter * 0.5f) : 1;
1321 1321
   }
1322 1322
 
1323 1323
   /**

Chargement…
Annuler
Enregistrer