From a4b3389dfac61b462198c4499bd269141619cae0 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 22 Feb 2018 10:38:46 +0100 Subject: [PATCH] M45 verbosity, steel sheet define, minor modifications in xyz cal --- Firmware/Configuration_prusa.h | 3 ++- Firmware/Marlin.h | 2 +- Firmware/Marlin_main.cpp | 25 +++++++++++++++++++------ Firmware/mesh_bed_calibration.cpp | 10 +++++----- Firmware/ultralcd.cpp | 6 +++--- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/Firmware/Configuration_prusa.h b/Firmware/Configuration_prusa.h index 0d0c1239..4ae801bc 100644 --- a/Firmware/Configuration_prusa.h +++ b/Firmware/Configuration_prusa.h @@ -55,7 +55,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define X_MAX_POS 255 #define X_MIN_POS 0 #define Y_MAX_POS 210 -#define Y_MIN_POS -4 //orig -4 +#define Y_MIN_POS -4 #define Z_MAX_POS 200 #define Z_MIN_POS 0.15 @@ -460,6 +460,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #endif #define HEATBED_V2 +#define STEEL_SHEET #define M600_TIMEOUT 600 //seconds diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 94181632..9e686bcb 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -444,7 +444,7 @@ void force_high_power_mode(bool start_high_power_section); #endif //TMC2130 // G-codes -bool gcode_M45(bool onlyZ); +bool gcode_M45(bool onlyZ, int8_t verbosity_level); void gcode_M701(); #define UVLO !(PINE & (1<<4)) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b1425192..33fa2815 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2075,7 +2075,7 @@ void force_high_power_mode(bool start_high_power_section) { } #endif //TMC2130 -bool gcode_M45(bool onlyZ) +bool gcode_M45(bool onlyZ, int8_t verbosity_level); { bool final_result = false; #ifdef TMC2130 @@ -2125,14 +2125,18 @@ bool gcode_M45(bool onlyZ) { #endif //TMC2130 refresh_cmd_timeout(); - //if (((degHotend(0) > MAX_HOTEND_TEMP_CALIBRATION) || (degBed() > MAX_BED_TEMP_CALIBRATION)) && (!onlyZ)) - //{ - // lcd_wait_for_cool_down(); - //} + #ifndef STEEL_SHEET + if (((degHotend(0) > MAX_HOTEND_TEMP_CALIBRATION) || (degBed() > MAX_BED_TEMP_CALIBRATION)) && (!onlyZ)) + { + lcd_wait_for_cool_down(); + } + #endif //STEEL_SHEET if(!onlyZ) { KEEPALIVE_STATE(PAUSED_FOR_USER); + #ifdef STEEL_SHEET bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_STEEL_SHEET_CHECK, false, false); + #endif //STEEL_SHEET if(result) lcd_show_fullscreen_message_and_wait_P(MSG_REMOVE_STEEL_SHEET); lcd_show_fullscreen_message_and_wait_P(MSG_CONFIRM_NOZZLE_CLEAN); lcd_show_fullscreen_message_and_wait_P(MSG_PAPER); @@ -4174,8 +4178,17 @@ void process_commands() case 45: // M45: Prusa3D: bed skew and offset with manual Z up { + int8_t verbosity_level = 0; bool only_Z = code_seen('Z'); - gcode_M45(only_Z); + #ifdef SUPPORT_VERBOSITY + if (code_seen('V')) + { + // Just 'V' without a number counts as V1. + char c = strchr_pointer[1]; + verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short(); + } + #endif //SUPPORT_VERBOSITY + gcode_M45(only_Z, verbosity_level); } break; diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index f330408b..15e4743b 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -902,7 +902,7 @@ error: // look for the induction sensor response. // Adjust the current_position[X,Y,Z] to the center of the target dot and its response Z coordinate. #define FIND_BED_INDUCTION_SENSOR_POINT_X_RADIUS (8.f) -#define FIND_BED_INDUCTION_SENSOR_POINT_Y_RADIUS (6.f) +#define FIND_BED_INDUCTION_SENSOR_POINT_Y_RADIUS (4.f) #define FIND_BED_INDUCTION_SENSOR_POINT_XY_STEP (1.f) #define FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP (0.2f) inline bool find_bed_induction_sensor_point_xy(int verbosity_level) @@ -957,7 +957,7 @@ inline bool find_bed_induction_sensor_point_xy(int verbosity_level) while (current_position[Z_AXIS] > -10.f) { // Do nsteps_y zig-zag movements. current_position[Y_AXIS] = y0; - for (i = 0; i < nsteps_y; current_position[Y_AXIS] += (y1 - y0) / float(nsteps_y - 1), ++ i) { + for (i = 0; i < (nsteps_y - 1); current_position[Y_AXIS] += (y1 - y0) / float(nsteps_y - 1), ++ i) { // Run with a slightly decreasing Z axis, zig-zag movement. Stop at the Z end-stop. current_position[Z_AXIS] -= FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP / float(nsteps_y); go_xyz(dir_positive ? x1 : x0, current_position[Y_AXIS], current_position[Z_AXIS], feedrate); @@ -965,7 +965,7 @@ inline bool find_bed_induction_sensor_point_xy(int verbosity_level) if (endstop_z_hit_on_purpose()) goto endloop; } - for (i = 0; i < nsteps_y; current_position[Y_AXIS] -= (y1 - y0) / float(nsteps_y - 1), ++ i) { + for (i = 0; i < (nsteps_y - 1); current_position[Y_AXIS] -= (y1 - y0) / float(nsteps_y - 1), ++ i) { // Run with a slightly decreasing Z axis, zig-zag movement. Stop at the Z end-stop. current_position[Z_AXIS] -= FIND_BED_INDUCTION_SENSOR_POINT_Z_STEP / float(nsteps_y); go_xyz(dir_positive ? x1 : x0, current_position[Y_AXIS], current_position[Z_AXIS], feedrate); @@ -996,7 +996,7 @@ inline bool find_bed_induction_sensor_point_xy(int verbosity_level) go_xy(x0, current_position[Y_AXIS], feedrate); enable_z_endstop(true); found = false; - for (i = 0, dir_positive = true; i < nsteps_y; current_position[Y_AXIS] += (y1 - y0) / float(nsteps_y - 1), ++ i, dir_positive = ! dir_positive) { + for (i = 0, dir_positive = true; i < (nsteps_y - 1); current_position[Y_AXIS] += (y1 - y0) / float(nsteps_y - 1), ++ i, dir_positive = ! dir_positive) { go_xy(dir_positive ? x1 : x0, current_position[Y_AXIS], feedrate); if (endstop_z_hit_on_purpose()) { found = true; @@ -1016,7 +1016,7 @@ inline bool find_bed_induction_sensor_point_xy(int verbosity_level) go_xy(x0, current_position[Y_AXIS], feedrate); enable_z_endstop(true); found = false; - for (i = 0, dir_positive = true; i < nsteps_y; current_position[Y_AXIS] -= (y1 - y0) / float(nsteps_y - 1), ++ i, dir_positive = ! dir_positive) { + for (i = 0, dir_positive = true; i < (nsteps_y - 1); current_position[Y_AXIS] -= (y1 - y0) / float(nsteps_y - 1), ++ i, dir_positive = ! dir_positive) { go_xy(dir_positive ? x1 : x0, current_position[Y_AXIS], feedrate); if (endstop_z_hit_on_purpose()) { found = true; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ff487e26..9c88257b 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2629,7 +2629,7 @@ calibrated: lcd_implementation_print_at(0, 3, 1); lcd_printPGM(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2); }else{ - lcd_show_fullscreen_message_and_wait_P(MSG_PAPER); + //lcd_show_fullscreen_message_and_wait_P(MSG_PAPER); lcd_display_message_fullscreen_P(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1); lcd_implementation_print_at(0, 2, 1); lcd_printPGM(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2); @@ -3728,7 +3728,7 @@ void lcd_wizard(int state) { break; case 3: //xyz cal. lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_XYZ_CAL); - wizard_event = gcode_M45(false); + wizard_event = gcode_M45(false, 0); if (wizard_event) state = 5; else end = true; break; @@ -3736,7 +3736,7 @@ void lcd_wizard(int state) { lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_Z_CAL); wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_STEEL_SHEET_CHECK, false, false); if (!wizard_event) lcd_show_fullscreen_message_and_wait_P(MSG_PLACE_STEEL_SHEET); - wizard_event = gcode_M45(true); + wizard_event = gcode_M45(true, 0); if (wizard_event) state = 11; //shipped, no need to set first layer, go to final message directly else end = true; break;