Browse Source

Modify debug methods to take PSTR

pull/1/head
Scott Lahteine 8 years ago
parent
commit
492bc536bf
  1. 12
      Marlin/Marlin_main.cpp
  2. 24
      Marlin/vector_3.cpp
  3. 7
      Marlin/vector_3.h

12
Marlin/Marlin_main.cpp

@ -4921,7 +4921,7 @@ void home_all_axes() { gcode_G28(); }
// For LINEAR and 3POINT leveling correct the current position // For LINEAR and 3POINT leveling correct the current position
if (verbose_level > 0) 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) { if (!dryrun) {
// //
@ -8362,7 +8362,7 @@ void quickstop_stepper() {
// V to print the matrix or mesh // V to print the matrix or mesh
if (code_seen('V')) { if (code_seen('V')) {
#if ABL_PLANAR #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) #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
if (bilinear_grid_spacing[X_AXIS]) { if (bilinear_grid_spacing[X_AXIS]) {
print_bilinear_leveling_grid(); 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 ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
tmp_offset_vec.debug("tmp_offset_vec"); tmp_offset_vec.debug(PSTR("tmp_offset_vec"));
act_offset_vec.debug("act_offset_vec"); act_offset_vec.debug(PSTR("act_offset_vec"));
offset_vec.debug("offset_vec (BEFORE)"); offset_vec.debug(PSTR("offset_vec (BEFORE)"));
} }
#endif #endif
offset_vec.apply_rotation(planner.bed_level_matrix.transpose(planner.bed_level_matrix)); offset_vec.apply_rotation(planner.bed_level_matrix.transpose(planner.bed_level_matrix));
#if ENABLED(DEBUG_LEVELING_FEATURE) #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 #endif
// Adjustments to the current position // Adjustments to the current position

24
Marlin/vector_3.cpp

@ -81,8 +81,8 @@ void vector_3::apply_rotation(matrix_3x3 matrix) {
z = resultZ; z = resultZ;
} }
void vector_3::debug(const char title[]) { void vector_3::debug(const char * const title) {
SERIAL_PROTOCOL(title); serialprintPGM(title);
SERIAL_PROTOCOLPGM(" x: "); SERIAL_PROTOCOLPGM(" x: ");
SERIAL_PROTOCOL_F(x, 6); SERIAL_PROTOCOL_F(x, 6);
SERIAL_PROTOCOLPGM(" y: "); 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) { 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_0.debug(PSTR("row_0"));
//row_1.debug("row_1"); //row_1.debug(PSTR("row_1"));
//row_2.debug("row_2"); //row_2.debug(PSTR("row_2"));
matrix_3x3 new_matrix; 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[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[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.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; 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 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(); vector_3 y_row = vector_3::cross(z_row, x_row).get_normal();
// x_row.debug("x_row"); // x_row.debug(PSTR("x_row"));
// y_row.debug("y_row"); // y_row.debug(PSTR("y_row"));
// z_row.debug("z_row"); // z_row.debug(PSTR("z_row"));
// create the matrix already correctly transposed // create the matrix already correctly transposed
matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row); matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row);
// rot.debug("rot"); // rot.debug(PSTR("rot"));
return rot; return rot;
} }
@ -142,8 +142,8 @@ matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) {
return new_matrix; return new_matrix;
} }
void matrix_3x3::debug(const char title[]) { void matrix_3x3::debug(const char * const title) {
SERIAL_PROTOCOLLN(title); serialprintPGM(title);
uint8_t count = 0; uint8_t count = 0;
for (uint8_t i = 0; i < 3; i++) { for (uint8_t i = 0; i < 3; i++) {
for (uint8_t j = 0; j < 3; j++) { for (uint8_t j = 0; j < 3; j++) {

7
Marlin/vector_3.h

@ -42,6 +42,7 @@
#define VECTOR_3_H #define VECTOR_3_H
#if HAS_ABL #if HAS_ABL
class matrix_3x3; class matrix_3x3;
struct vector_3 { struct vector_3 {
@ -58,7 +59,7 @@ struct vector_3 {
float get_length(); float get_length();
vector_3 get_normal(); vector_3 get_normal();
void debug(const char title[]); void debug(const char * const title);
void apply_rotation(matrix_3x3 matrix); void apply_rotation(matrix_3x3 matrix);
}; };
@ -72,11 +73,11 @@ struct matrix_3x3 {
void set_to_identity(); 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); void apply_rotation_xyz(matrix_3x3 rotationMatrix, float& x, float& y, float& z);
#endif // HAS_ABL
#endif // HAS_ABL
#endif // VECTOR_3_H #endif // VECTOR_3_H

Loading…
Cancel
Save