Parcourir la source

Parity with 2.0.x bitmap functions

Based on #8565
Scott Lahteine il y a 6 ans
Parent
révision
1e84cded98
3 fichiers modifiés avec 13 ajouts et 13 suppressions
  1. 8
    8
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 3
    3
      Marlin/bitmap_flags.h
  3. 2
    2
      Marlin/ubl_G29.cpp

+ 8
- 8
Marlin/G26_Mesh_Validation_Tool.cpp Voir le fichier

@@ -327,7 +327,7 @@
327 327
 
328 328
     for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
329 329
       for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
330
-        if (!is_bit_set(circle_flags, i, j)) {
330
+        if (!is_bitmap_set(circle_flags, i, j)) {
331 331
           const float mx = _GET_MESH_X(i),  // We found a circle that needs to be printed
332 332
                       my = _GET_MESH_Y(j);
333 333
 
@@ -353,7 +353,7 @@
353 353
         }
354 354
       }
355 355
     }
356
-    bit_set(circle_flags, return_val.x_index, return_val.y_index);   // Mark this location as done.
356
+    bitmap_set(circle_flags, return_val.x_index, return_val.y_index);   // Mark this location as done.
357 357
     return return_val;
358 358
   }
359 359
 
@@ -418,8 +418,8 @@
418 418
         if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X.
419 419
                                      // This is already a half circle because we are at the edge of the bed.
420 420
 
421
-          if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i + 1, j)) { // check if we can do a line to the left
422
-            if (!is_bit_set(horizontal_mesh_line_flags, i, j)) {
421
+          if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i + 1, j)) { // check if we can do a line to the left
422
+            if (!is_bitmap_set(horizontal_mesh_line_flags, i, j)) {
423 423
 
424 424
               //
425 425
               // We found two circles that need a horizontal line to connect them
@@ -445,15 +445,15 @@
445 445
                 }
446 446
                 print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
447 447
               }
448
-              bit_set(horizontal_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if we skipped it
448
+              bitmap_set(horizontal_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if we skipped it
449 449
             }
450 450
           }
451 451
 
452 452
           if (j < GRID_MAX_POINTS_Y) { // We can't connect to anything further back than GRID_MAX_POINTS_Y.
453 453
                                            // This is already a half circle because we are at the edge  of the bed.
454 454
 
455
-            if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i, j + 1)) { // check if we can do a line straight down
456
-              if (!is_bit_set( vertical_mesh_line_flags, i, j)) {
455
+            if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i, j + 1)) { // check if we can do a line straight down
456
+              if (!is_bitmap_set( vertical_mesh_line_flags, i, j)) {
457 457
                 //
458 458
                 // We found two circles that need a vertical line to connect them
459 459
                 // Print it!
@@ -481,7 +481,7 @@
481 481
                   }
482 482
                   print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
483 483
                 }
484
-                bit_set(vertical_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if skipped
484
+                bitmap_set(vertical_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if skipped
485 485
               }
486 486
             }
487 487
           }

+ 3
- 3
Marlin/bitmap_flags.h Voir le fichier

@@ -31,8 +31,8 @@
31 31
  * to unsigned long will allow us to go to 32x32 if higher resolution meshes are needed
32 32
  * in the future.
33 33
  */
34
-FORCE_INLINE void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y) { CBI(bits[y], x); }
35
-FORCE_INLINE void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { SBI(bits[y], x); }
36
-FORCE_INLINE bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { return TEST(bits[y], x); }
34
+FORCE_INLINE void bitmap_clear(uint16_t bits[16], const uint8_t x, const uint8_t y) { CBI(bits[y], x); }
35
+FORCE_INLINE void bitmap_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { SBI(bits[y], x); }
36
+FORCE_INLINE bool is_bitmap_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { return TEST(bits[y], x); }
37 37
 
38 38
 #endif // _BITMAP_FLAGS_H_

+ 2
- 2
Marlin/ubl_G29.cpp Voir le fichier

@@ -1425,7 +1425,7 @@
1425 1425
 
1426 1426
         if ( (type == INVALID && isnan(z_values[i][j]))  // Check to see if this location holds the right thing
1427 1427
           || (type == REAL && !isnan(z_values[i][j]))
1428
-          || (type == SET_IN_BITMAP && is_bit_set(bits, i, j))
1428
+          || (type == SET_IN_BITMAP && is_bitmap_set(bits, i, j))
1429 1429
         ) {
1430 1430
           // We only get here if we found a Mesh Point of the specified type
1431 1431
 
@@ -1495,7 +1495,7 @@
1495 1495
 
1496 1496
         if (location.x_index < 0) break; // stop when we can't find any more reachable points.
1497 1497
 
1498
-        bit_clear(not_done, location.x_index, location.y_index);  // Mark this location as 'adjusted' so we will find a
1498
+        bitmap_clear(not_done, location.x_index, location.y_index);  // Mark this location as 'adjusted' so we will find a
1499 1499
                                                                   // different location the next time through the loop
1500 1500
 
1501 1501
         const float rawx = mesh_index_to_xpos(location.x_index),

Chargement…
Annuler
Enregistrer