Browse Source

Modify debug methods to take PSTR

Scott Lahteine 7 years ago
parent
commit
492bc536bf
3 changed files with 22 additions and 21 deletions
  1. 6
    6
      Marlin/Marlin_main.cpp
  2. 12
    12
      Marlin/vector_3.cpp
  3. 4
    3
      Marlin/vector_3.h

+ 6
- 6
Marlin/Marlin_main.cpp View File

@@ -4921,7 +4921,7 @@ void home_all_axes() { gcode_G28(); }
4921 4921
       // For LINEAR and 3POINT leveling correct the current position
4922 4922
 
4923 4923
       if (verbose_level > 0)
4924
-        planner.bed_level_matrix.debug("\n\nBed Level Correction Matrix:");
4924
+        planner.bed_level_matrix.debug(PSTR("\n\nBed Level Correction Matrix:"));
4925 4925
 
4926 4926
       if (!dryrun) {
4927 4927
         //
@@ -8362,7 +8362,7 @@ void quickstop_stepper() {
8362 8362
     // V to print the matrix or mesh
8363 8363
     if (code_seen('V')) {
8364 8364
       #if ABL_PLANAR
8365
-        planner.bed_level_matrix.debug("Bed Level Correction Matrix:");
8365
+        planner.bed_level_matrix.debug(PSTR("Bed Level Correction Matrix:"));
8366 8366
       #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
8367 8367
         if (bilinear_grid_spacing[X_AXIS]) {
8368 8368
           print_bilinear_leveling_grid();
@@ -9547,16 +9547,16 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
9547 9547
 
9548 9548
             #if ENABLED(DEBUG_LEVELING_FEATURE)
9549 9549
               if (DEBUGGING(LEVELING)) {
9550
-                tmp_offset_vec.debug("tmp_offset_vec");
9551
-                act_offset_vec.debug("act_offset_vec");
9552
-                offset_vec.debug("offset_vec (BEFORE)");
9550
+                tmp_offset_vec.debug(PSTR("tmp_offset_vec"));
9551
+                act_offset_vec.debug(PSTR("act_offset_vec"));
9552
+                offset_vec.debug(PSTR("offset_vec (BEFORE)"));
9553 9553
               }
9554 9554
             #endif
9555 9555
 
9556 9556
             offset_vec.apply_rotation(planner.bed_level_matrix.transpose(planner.bed_level_matrix));
9557 9557
 
9558 9558
             #if ENABLED(DEBUG_LEVELING_FEATURE)
9559
-              if (DEBUGGING(LEVELING)) offset_vec.debug("offset_vec (AFTER)");
9559
+              if (DEBUGGING(LEVELING)) offset_vec.debug(PSTR("offset_vec (AFTER)"));
9560 9560
             #endif
9561 9561
 
9562 9562
             // Adjustments to the current position

+ 12
- 12
Marlin/vector_3.cpp View File

@@ -81,8 +81,8 @@ void vector_3::apply_rotation(matrix_3x3 matrix) {
81 81
   z = resultZ;
82 82
 }
83 83
 
84
-void vector_3::debug(const char title[]) {
85
-  SERIAL_PROTOCOL(title);
84
+void vector_3::debug(const char * const title) {
85
+  serialprintPGM(title);
86 86
   SERIAL_PROTOCOLPGM(" x: ");
87 87
   SERIAL_PROTOCOL_F(x, 6);
88 88
   SERIAL_PROTOCOLPGM(" y: ");
@@ -101,14 +101,14 @@ void apply_rotation_xyz(matrix_3x3 matrix, float &x, float &y, float &z) {
101 101
 }
102 102
 
103 103
 matrix_3x3 matrix_3x3::create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2) {
104
-  //row_0.debug("row_0");
105
-  //row_1.debug("row_1");
106
-  //row_2.debug("row_2");
104
+  //row_0.debug(PSTR("row_0"));
105
+  //row_1.debug(PSTR("row_1"));
106
+  //row_2.debug(PSTR("row_2"));
107 107
   matrix_3x3 new_matrix;
108 108
   new_matrix.matrix[0] = row_0.x; new_matrix.matrix[1] = row_0.y; new_matrix.matrix[2] = row_0.z;
109 109
   new_matrix.matrix[3] = row_1.x; new_matrix.matrix[4] = row_1.y; new_matrix.matrix[5] = row_1.z;
110 110
   new_matrix.matrix[6] = row_2.x; new_matrix.matrix[7] = row_2.y; new_matrix.matrix[8] = row_2.z;
111
-  //new_matrix.debug("new_matrix");
111
+  //new_matrix.debug(PSTR("new_matrix"));
112 112
   return new_matrix;
113 113
 }
114 114
 
@@ -123,14 +123,14 @@ matrix_3x3 matrix_3x3::create_look_at(vector_3 target) {
123 123
   vector_3 x_row = vector_3(1, 0, -target.x / target.z).get_normal();
124 124
   vector_3 y_row = vector_3::cross(z_row, x_row).get_normal();
125 125
 
126
-  // x_row.debug("x_row");
127
-  // y_row.debug("y_row");
128
-  // z_row.debug("z_row");
126
+  // x_row.debug(PSTR("x_row"));
127
+  // y_row.debug(PSTR("y_row"));
128
+  // z_row.debug(PSTR("z_row"));
129 129
 
130 130
   // create the matrix already correctly transposed
131 131
   matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row);
132 132
 
133
-  // rot.debug("rot");
133
+  // rot.debug(PSTR("rot"));
134 134
   return rot;
135 135
 }
136 136
 
@@ -142,8 +142,8 @@ matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) {
142 142
   return new_matrix;
143 143
 }
144 144
 
145
-void matrix_3x3::debug(const char title[]) {
146
-  SERIAL_PROTOCOLLN(title);
145
+void matrix_3x3::debug(const char * const title) {
146
+  serialprintPGM(title);
147 147
   uint8_t count = 0;
148 148
   for (uint8_t i = 0; i < 3; i++) {
149 149
     for (uint8_t j = 0; j < 3; j++) {

+ 4
- 3
Marlin/vector_3.h View File

@@ -42,6 +42,7 @@
42 42
 #define VECTOR_3_H
43 43
 
44 44
 #if HAS_ABL
45
+
45 46
 class matrix_3x3;
46 47
 
47 48
 struct vector_3 {
@@ -58,7 +59,7 @@ struct vector_3 {
58 59
   float get_length();
59 60
   vector_3 get_normal();
60 61
 
61
-  void debug(const char title[]);
62
+  void debug(const char * const title);
62 63
 
63 64
   void apply_rotation(matrix_3x3 matrix);
64 65
 };
@@ -72,11 +73,11 @@ struct matrix_3x3 {
72 73
 
73 74
   void set_to_identity();
74 75
 
75
-  void debug(const char title[]);
76
+  void debug(const char * const title);
76 77
 };
77 78
 
78 79
 
79 80
 void apply_rotation_xyz(matrix_3x3 rotationMatrix, float& x, float& y, float& z);
80
-#endif // HAS_ABL
81 81
 
82
+#endif // HAS_ABL
82 83
 #endif // VECTOR_3_H

Loading…
Cancel
Save