From 8800793dd16b6ae51593275f3f5907517a0b3e05 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Sun, 4 Mar 2018 20:49:34 +0100 Subject: [PATCH] removing debug code --- Firmware/Marlin_main.cpp | 6 +++--- Firmware/mesh_bed_calibration.cpp | 22 ++++++++-------------- Firmware/mesh_bed_calibration.h | 1 - Firmware/stepper.cpp | 9 ++------- Firmware/stepper.h | 2 +- 5 files changed, 14 insertions(+), 26 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c553bada..c1e627f4 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1429,8 +1429,8 @@ void host_keepalive() { switch (busy_state) { case IN_HANDLER: case IN_PROCESS: - //SERIAL_ECHO_START; - //SERIAL_ECHOLNPGM("busy: processing"); + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM("busy: processing"); break; case PAUSED_FOR_USER: SERIAL_ECHO_START; @@ -4271,7 +4271,7 @@ void process_commands() KEEPALIVE_STATE(IN_HANDLER); break; -#if 1 +#if 0 case 48: // M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC. { // Disable the default update procedure of the display. We will do a modal dialog. diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 996839c7..9f6999bf 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -904,8 +904,12 @@ error: #define FIND_BED_INDUCTION_SENSOR_POINT_X_RADIUS (8.f) #define FIND_BED_INDUCTION_SENSOR_POINT_Y_RADIUS (4.f) #define FIND_BED_INDUCTION_SENSOR_POINT_XY_STEP (1.f) +#ifdef HEATBED_V2 #define FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP (2.f) #define FIND_BED_INDUCTION_SENSOR_POINT_MAX_Z_ERROR (0.01f) +#else //HEATBED_V2 +#define FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP (0.2f) +#endif //HEATBED_V2 #ifdef HEATBED_V2 inline bool find_bed_induction_sensor_point_xy(int verbosity_level) @@ -2107,7 +2111,7 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level #endif // SUPPORT_VERBOSITY if (!find_bed_induction_sensor_point_xy(verbosity_level)) return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; -#if 0 +#if 1 if (k == 0 || k == 1) { // Improve the position of the 1st row sensor points by a zig-zag movement. @@ -2387,9 +2391,6 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 // by a cross center method. // Use a zig-zag search for the first row of the points. found = improve_bed_induction_sensor_point3(verbosity_level); - //found = improve_bed_induction_sensor_point2(mesh_point < 2, verbosity_level); - SERIAL_ECHOPGM("ITER: "); - SERIAL_ECHO(iter); } else { switch (method) { case 0: found = improve_bed_induction_sensor_point(); break; @@ -2398,9 +2399,6 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8 } } if (found) { - lcd_show_fullscreen_message_and_wait_P(PSTR("found")); - lcd_update_enable(true); - if (iter > 3) { // Average the last 4 measurements. pts[mesh_point*2 ] += current_position[X_AXIS]; @@ -2720,10 +2718,6 @@ bool sample_mesh_and_store_reference() return true; } -void scan() { - scan_bed_induction_sensor_point(); -} - bool scan_bed_induction_points(int8_t verbosity_level) { // Don't let the manage_inactivity() function remove power from the motors. @@ -2752,7 +2746,7 @@ bool scan_bed_induction_points(int8_t verbosity_level) bool endstop_z_enabled = enable_z_endstop(false); // Collect a matrix of 9x9 points. - for (int8_t mesh_point = 2; mesh_point < 3; ++ mesh_point) { + for (int8_t mesh_point = 0; mesh_point < 9; ++ mesh_point) { // Don't let the manage_inactivity() function remove power from the motors. refresh_cmd_timeout(); @@ -2763,8 +2757,8 @@ bool scan_bed_induction_points(int8_t verbosity_level) go_to_current(homing_feedrate[Z_AXIS]/60); // Go to the measurement point. // Use the coorrected coordinate, which is a result of find_bed_offset_and_skew(). - current_position[X_AXIS] = vec_x[0] * pgm_read_float(bed_ref_points_4+mesh_point*2) + vec_y[0] * pgm_read_float(bed_ref_points_4+mesh_point*2+1) + cntr[0]; - current_position[Y_AXIS] = vec_x[1] * pgm_read_float(bed_ref_points_4+mesh_point*2) + vec_y[1] * pgm_read_float(bed_ref_points_4+mesh_point*2+1) + cntr[1]; + current_position[X_AXIS] = vec_x[0] * pgm_read_float(bed_ref_points+mesh_point*2) + vec_y[0] * pgm_read_float(bed_ref_points+mesh_point*2+1) + cntr[0]; + current_position[Y_AXIS] = vec_x[1] * pgm_read_float(bed_ref_points+mesh_point*2) + vec_y[1] * pgm_read_float(bed_ref_points+mesh_point*2+1) + cntr[1]; // The calibration points are very close to the min Y. if (current_position[Y_AXIS] < Y_MIN_POS_FOR_BED_CALIBRATION) current_position[Y_AXIS] = Y_MIN_POS_FOR_BED_CALIBRATION; diff --git a/Firmware/mesh_bed_calibration.h b/Firmware/mesh_bed_calibration.h index 0fa7d875..4f6ebd72 100644 --- a/Firmware/mesh_bed_calibration.h +++ b/Firmware/mesh_bed_calibration.h @@ -172,7 +172,6 @@ extern bool is_bed_z_jitter_data_valid(); // write the trigger coordinates to the serial line. // Useful for visualizing the behavior of the bed induction detector. extern bool scan_bed_induction_points(int8_t verbosity_level); -extern void scan(); // Load Z babystep value from the EEPROM into babystepLoadZ, // but don't apply it through the planner. This is useful on wake up diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 29d4c84c..27c20081 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -271,7 +271,6 @@ bool endstop_z_hit_on_purpose() { bool hit = endstop_z_hit; endstop_z_hit=false; - //if (hit == true) gcode_M114(); return hit; } @@ -290,13 +289,9 @@ bool enable_z_endstop(bool check) return old; } -bool enable_z_endstop(bool check, bool endstop_invert) +void invert_z_endstop(bool endstop_invert) { z_endstop_invert = endstop_invert; - bool old = check_z_endstop; - check_z_endstop = check; - endstop_z_hit=false; - return old; } // __________________________ @@ -614,7 +609,7 @@ void isr() { // Good for searching for the center of an induction target. #ifdef TMC2130_SG_HOMING // Stall guard homing turned on - z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING) || (READ(Z_TMC2130_DIAG) != 0); + z_min_endstop = (READ(Z_MIN_PIN) != z_endstop_invert) || (READ(Z_TMC2130_DIAG) != 0); #else z_min_endstop = (READ(Z_MIN_PIN) != z_endstop_invert); #endif //TMC2130_SG_HOMING diff --git a/Firmware/stepper.h b/Firmware/stepper.h index 915483fe..3c1e6ffe 100644 --- a/Firmware/stepper.h +++ b/Firmware/stepper.h @@ -93,7 +93,7 @@ bool endstop_z_hit_on_purpose(); bool enable_endstops(bool check); // Enable/disable endstop checking. Return the old value. bool enable_z_endstop(bool check); -bool enable_z_endstop(bool check, bool endstop_invert); +void invert_z_endstop(bool endstop_invert); void checkStepperErrors(); //Print errors detected by the stepper