diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 322b5a93c..0b3f3b529 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4921,7 +4921,7 @@ void home_all_axes() { gcode_G28(); } // For LINEAR and 3POINT leveling correct the current position if (verbose_level > 0) - planner.bed_level_matrix.debug("\n\nBed Level Correction Matrix:"); + planner.bed_level_matrix.debug(PSTR("\n\nBed Level Correction Matrix:")); if (!dryrun) { // @@ -8362,7 +8362,7 @@ void quickstop_stepper() { // V to print the matrix or mesh if (code_seen('V')) { #if ABL_PLANAR - planner.bed_level_matrix.debug("Bed Level Correction Matrix:"); + planner.bed_level_matrix.debug(PSTR("Bed Level Correction Matrix:")); #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) if (bilinear_grid_spacing[X_AXIS]) { 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 #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - tmp_offset_vec.debug("tmp_offset_vec"); - act_offset_vec.debug("act_offset_vec"); - offset_vec.debug("offset_vec (BEFORE)"); + tmp_offset_vec.debug(PSTR("tmp_offset_vec")); + act_offset_vec.debug(PSTR("act_offset_vec")); + offset_vec.debug(PSTR("offset_vec (BEFORE)")); } #endif offset_vec.apply_rotation(planner.bed_level_matrix.transpose(planner.bed_level_matrix)); #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) offset_vec.debug("offset_vec (AFTER)"); + if (DEBUGGING(LEVELING)) offset_vec.debug(PSTR("offset_vec (AFTER)")); #endif // Adjustments to the current position diff --git a/Marlin/vector_3.cpp b/Marlin/vector_3.cpp index 731aff813..f5aa4576d 100644 --- a/Marlin/vector_3.cpp +++ b/Marlin/vector_3.cpp @@ -81,8 +81,8 @@ void vector_3::apply_rotation(matrix_3x3 matrix) { z = resultZ; } -void vector_3::debug(const char title[]) { - SERIAL_PROTOCOL(title); +void vector_3::debug(const char * const title) { + serialprintPGM(title); SERIAL_PROTOCOLPGM(" x: "); SERIAL_PROTOCOL_F(x, 6); SERIAL_PROTOCOLPGM(" y: "); @@ -101,14 +101,14 @@ void apply_rotation_xyz(matrix_3x3 matrix, float &x, float &y, float &z) { } matrix_3x3 matrix_3x3::create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2) { - //row_0.debug("row_0"); - //row_1.debug("row_1"); - //row_2.debug("row_2"); + //row_0.debug(PSTR("row_0")); + //row_1.debug(PSTR("row_1")); + //row_2.debug(PSTR("row_2")); matrix_3x3 new_matrix; new_matrix.matrix[0] = row_0.x; new_matrix.matrix[1] = row_0.y; new_matrix.matrix[2] = row_0.z; new_matrix.matrix[3] = row_1.x; new_matrix.matrix[4] = row_1.y; new_matrix.matrix[5] = row_1.z; new_matrix.matrix[6] = row_2.x; new_matrix.matrix[7] = row_2.y; new_matrix.matrix[8] = row_2.z; - //new_matrix.debug("new_matrix"); + //new_matrix.debug(PSTR("new_matrix")); return new_matrix; } @@ -123,14 +123,14 @@ matrix_3x3 matrix_3x3::create_look_at(vector_3 target) { vector_3 x_row = vector_3(1, 0, -target.x / target.z).get_normal(); vector_3 y_row = vector_3::cross(z_row, x_row).get_normal(); - // x_row.debug("x_row"); - // y_row.debug("y_row"); - // z_row.debug("z_row"); + // x_row.debug(PSTR("x_row")); + // y_row.debug(PSTR("y_row")); + // z_row.debug(PSTR("z_row")); // create the matrix already correctly transposed matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row); - // rot.debug("rot"); + // rot.debug(PSTR("rot")); return rot; } @@ -142,8 +142,8 @@ matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) { return new_matrix; } -void matrix_3x3::debug(const char title[]) { - SERIAL_PROTOCOLLN(title); +void matrix_3x3::debug(const char * const title) { + serialprintPGM(title); uint8_t count = 0; for (uint8_t i = 0; i < 3; i++) { for (uint8_t j = 0; j < 3; j++) { diff --git a/Marlin/vector_3.h b/Marlin/vector_3.h index efc0132fe..23ef745a1 100644 --- a/Marlin/vector_3.h +++ b/Marlin/vector_3.h @@ -42,6 +42,7 @@ #define VECTOR_3_H #if HAS_ABL + class matrix_3x3; struct vector_3 { @@ -58,7 +59,7 @@ struct vector_3 { float get_length(); vector_3 get_normal(); - void debug(const char title[]); + void debug(const char * const title); void apply_rotation(matrix_3x3 matrix); }; @@ -72,11 +73,11 @@ struct matrix_3x3 { void set_to_identity(); - void debug(const char title[]); + void debug(const char * const title); }; void apply_rotation_xyz(matrix_3x3 rotationMatrix, float& x, float& y, float& z); -#endif // HAS_ABL +#endif // HAS_ABL #endif // VECTOR_3_H