From 8020069371f08eb1c6ffde9f9dfe96be86edb939 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 15:43:06 -0500 Subject: [PATCH 1/8] Apply coding standards for indentation --- Marlin/Marlin_main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a894c63aac..33ee27d0f8 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2110,7 +2110,7 @@ static void clean_up_after_endstop_or_probe_move() { void set_bltouch_deployed(const bool deploy) { #if ENABLED(BLTOUCH_HEATERS_OFF) - turn_heaters_on_or_off_for_bltouch(deploy); + turn_heaters_on_or_off_for_bltouch(deploy); #endif if (deploy && TEST_BLTOUCH()) { // If BL-Touch says it's triggered bltouch_command(BLTOUCH_RESET); // try to reset it. @@ -2146,10 +2146,8 @@ static void clean_up_after_endstop_or_probe_move() { } #endif - #if ENABLED(BLTOUCH) - #if ENABLED(BLTOUCH_HEATERS_OFF) + #if ENABLED(BLTOUCH) && ENABLED(BLTOUCH_HEATERS_OFF) turn_heaters_on_or_off_for_bltouch(deploy); - #endif #endif if (endstops.z_probe_enabled == deploy) return false; From a35c68145365f1ce56aeeb99839e7c00aa2189ea Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 17:33:28 -0500 Subject: [PATCH 2/8] Clean up least_squares_fit --- Marlin/least_squares_fit.cpp | 84 ++++++++++++++++-------------------- Marlin/least_squares_fit.h | 14 +++--- 2 files changed, 43 insertions(+), 55 deletions(-) diff --git a/Marlin/least_squares_fit.cpp b/Marlin/least_squares_fit.cpp index ee9d7cc9e9..e6f684e77e 100644 --- a/Marlin/least_squares_fit.cpp +++ b/Marlin/least_squares_fit.cpp @@ -21,13 +21,13 @@ */ /** - * Least Squares Best Fit By Roxy and Ed Williams + * Least Squares Best Fit by Roxy and Ed Williams * * This algorithm is high speed and has a very small code footprint. * Its results are identical to both the Iterative Least-Squares published * earlier by Roxy and the QR_SOLVE solution. If used in place of QR_SOLVE - * it saves roughly 10K of program memory. It also does not require all of - * coordinates to be present during the calculations. Each point can be + * it saves roughly 10K of program memory. It also does not require all of + * coordinates to be present during the calculations. Each point can be * probed and then discarded. * */ @@ -41,56 +41,44 @@ #include "least_squares_fit.h" -void incremental_LSF_reset(struct linear_fit_data *lsf) { - lsf->n = 0; - lsf->A = 0.0; // probably a memset() can be done to zero - lsf->B = 0.0; // this whole structure - lsf->D = 0.0; - lsf->xbar = lsf->ybar = lsf->zbar = 0.0; - lsf->x2bar = lsf->y2bar = lsf->z2bar = 0.0; - lsf->xybar = lsf->xzbar = lsf->yzbar = 0.0; - lsf->max_absx = lsf->max_absy = 0.0; - } +void incremental_LSF_reset(struct linear_fit_data *lsf) { ZERO(lsf); } void incremental_LSF(struct linear_fit_data *lsf, float x, float y, float z) { - lsf->xbar += x; - lsf->ybar += y; - lsf->zbar += z; - lsf->x2bar += x*x; - lsf->y2bar += y*y; - lsf->z2bar += z*z; - lsf->xybar += x*y; - lsf->xzbar += x*z; - lsf->yzbar += y*z; - lsf->max_absx = (fabs(x) > lsf->max_absx) ? fabs(x) : lsf->max_absx; - lsf->max_absy = (fabs(y) > lsf->max_absy) ? fabs(y) : lsf->max_absy; - lsf->n++; - return; - } + lsf->xbar += x; + lsf->ybar += y; + lsf->zbar += z; + lsf->x2bar += sq(x); + lsf->y2bar += sq(y); + lsf->z2bar += sq(z); + lsf->xybar += sq(x); + lsf->xzbar += sq(x); + lsf->yzbar += sq(y); + lsf->max_absx = max(fabs(x), lsf->max_absx); + lsf->max_absy = max(fabs(y), lsf->max_absy); + lsf->n++; +} int finish_incremental_LSF(struct linear_fit_data *lsf) { - float DD, N; + const float N = (float)lsf->n; - N = (float) lsf->n; - lsf->xbar /= N; - lsf->ybar /= N; - lsf->zbar /= N; - lsf->x2bar = lsf->x2bar/N - lsf->xbar*lsf->xbar; - lsf->y2bar = lsf->y2bar/N - lsf->ybar*lsf->ybar; - lsf->z2bar = lsf->z2bar/N - lsf->zbar*lsf->zbar; - lsf->xybar = lsf->xybar/N - lsf->xbar*lsf->ybar; - lsf->yzbar = lsf->yzbar/N - lsf->ybar*lsf->zbar; - lsf->xzbar = lsf->xzbar/N - lsf->xbar*lsf->zbar; + lsf->xbar /= N; + lsf->ybar /= N; + lsf->zbar /= N; + lsf->x2bar = lsf->x2bar / N - lsf->xbar * lsf->xbar; + lsf->y2bar = lsf->y2bar / N - lsf->ybar * lsf->ybar; + lsf->z2bar = lsf->z2bar / N - lsf->zbar * lsf->zbar; + lsf->xybar = lsf->xybar / N - lsf->xbar * lsf->ybar; + lsf->yzbar = lsf->yzbar / N - lsf->ybar * lsf->zbar; + lsf->xzbar = lsf->xzbar / N - lsf->xbar * lsf->zbar; - DD = lsf->x2bar*lsf->y2bar - lsf->xybar*lsf->xybar; - if (fabs(DD) <= 1e-10*(lsf->max_absx+lsf->max_absy)) - return -1; - - lsf->A = (lsf->yzbar*lsf->xybar - lsf->xzbar*lsf->y2bar) / DD; - lsf->B = (lsf->xzbar*lsf->xybar - lsf->yzbar*lsf->x2bar) / DD; - lsf->D = -(lsf->zbar + lsf->A*lsf->xbar + lsf->B*lsf->ybar); - return 0; + const float DD = lsf->x2bar * lsf->y2bar - sq(lsf->xybar); + if (fabs(DD) <= 1e-10 * (lsf->max_absx + lsf->max_absy)) + return -1; + + lsf->A = (lsf->yzbar * lsf->xybar - lsf->xzbar * lsf->y2bar) / DD; + lsf->B = (lsf->xzbar * lsf->xybar - lsf->yzbar * lsf->x2bar) / DD; + lsf->D = -(lsf->zbar + lsf->A * lsf->xbar + lsf->B * lsf->ybar); + return 0; } -#endif - +#endif // AUTO_BED_LEVELING_UBL diff --git a/Marlin/least_squares_fit.h b/Marlin/least_squares_fit.h index 41a5741cfc..ec863080bd 100644 --- a/Marlin/least_squares_fit.h +++ b/Marlin/least_squares_fit.h @@ -27,7 +27,7 @@ * Its results are identical to both the Iterative Least-Squares published * earlier by Roxy and the QR_SOLVE solution. If used in place of QR_SOLVE * it saves roughly 10K of program memory. And even better... the data - * fed into the algorithm does not need to all be present at the same time. + * fed into the algorithm does not need to all be present at the same time. * A point can be probed and its values fed into the algorithm and then discarded. * */ @@ -42,14 +42,14 @@ struct linear_fit_data { int n; - float xbar, ybar, zbar; - float x2bar, y2bar, z2bar; - float xybar, xzbar, yzbar; - float max_absx, max_absy; - float A, B, D; + float xbar, ybar, zbar, + x2bar, y2bar, z2bar, + xybar, xzbar, yzbar, + max_absx, max_absy, + A, B, D; }; -void incremental_LSF_reset(struct linear_fit_data *); +void incremental_LSF_reset(struct linear_fit_data *); void incremental_LSF(struct linear_fit_data *, float x, float y, float z); int finish_incremental_LSF(struct linear_fit_data *); From 0a8e09c723eb0f4de97745fca6fc36ad8bcb7a9d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 17:36:31 -0500 Subject: [PATCH 3/8] Clean up excess whitespace, comment formatting --- Marlin/Marlin_main.cpp | 56 ++++++++-------- .../FolgerTech-i3-2020/Configuration.h | 5 +- .../gCreate_gMax1.5+/Configuration.h | 14 ++-- Marlin/language_tr.h | 2 +- Marlin/softspi.h | 12 ++-- Marlin/ubl_G29.cpp | 65 +++++++++---------- Marlin/ultralcd_impl_HD44780.h | 2 +- Marlin/utility.cpp | 2 +- 8 files changed, 78 insertions(+), 80 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 33ee27d0f8..f802a8fc35 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2065,7 +2065,7 @@ static void clean_up_after_endstop_or_probe_move() { safe_delay(BLTOUCH_DELAY); } - // + // // The BL-Touch probes have a HAL effect sensor. The high currents switching // on and off cause big magnetic fields that can affect the repeatability of the // sensor. So, for BL-Touch probes, we turn off the heaters during the actual probe. @@ -2075,7 +2075,7 @@ static void clean_up_after_endstop_or_probe_move() { void turn_heaters_on_or_off_for_bltouch(const bool deploy) { static int8_t bltouch_recursion_cnt=0; static millis_t last_emi_protection=0; - static float temps_at_entry[HOTENDS]; + static float temps_at_entry[HOTENDS]; #if HAS_TEMP_BED static float bed_temp_at_entry; #endif @@ -2088,19 +2088,19 @@ static void clean_up_after_endstop_or_probe_move() { if (deploy) { bltouch_recursion_cnt++; last_emi_protection = millis(); - HOTEND_LOOP() temps_at_entry[e] = thermalManager.degTargetHotend(e); // save the current target temperatures + HOTEND_LOOP() temps_at_entry[e] = thermalManager.degTargetHotend(e); // save the current target temperatures HOTEND_LOOP() thermalManager.setTargetHotend(0, e); // so we know what to restore them to. #if HAS_TEMP_BED bed_temp_at_entry = thermalManager.degTargetBed(); thermalManager.setTargetBed(0.0); #endif - } + } else { bltouch_recursion_cnt--; // the heaters are only turned back on if (bltouch_recursion_cnt==0 && ((last_emi_protection+20000L)>millis())) { // if everything is perfect. It is expected - HOTEND_LOOP() thermalManager.setTargetHotend(temps_at_entry[e], e); // that the bltouch_recursion_cnt is zero and - #if HAS_TEMP_BED // that the heaters were shut off less than + HOTEND_LOOP() thermalManager.setTargetHotend(temps_at_entry[e], e); // that the bltouch_recursion_cnt is zero and + #if HAS_TEMP_BED // that the heaters were shut off less than thermalManager.setTargetBed(bed_temp_at_entry); // 20 seconds ago #endif } @@ -2113,12 +2113,12 @@ static void clean_up_after_endstop_or_probe_move() { turn_heaters_on_or_off_for_bltouch(deploy); #endif if (deploy && TEST_BLTOUCH()) { // If BL-Touch says it's triggered - bltouch_command(BLTOUCH_RESET); // try to reset it. + bltouch_command(BLTOUCH_RESET); // try to reset it. bltouch_command(BLTOUCH_DEPLOY); // Also needs to deploy and stow to - bltouch_command(BLTOUCH_STOW); // clear the triggered condition. - safe_delay(1500); // wait for internal self test to complete - // measured completion time was 0.65 seconds - // after reset, deploy & stow sequence + bltouch_command(BLTOUCH_STOW); // clear the triggered condition. + safe_delay(1500); // Wait for internal self-test to complete. + // (Measured completion time was 0.65 seconds + // after reset, deploy, and stow sequence) if (TEST_BLTOUCH()) { // If it still claims to be triggered... SERIAL_ERROR_START; SERIAL_ERRORLNPGM(MSG_STOP_BLTOUCH); @@ -2328,15 +2328,15 @@ static void clean_up_after_endstop_or_probe_move() { return current_position[Z_AXIS] + zprobe_zoffset; } - // - // - Move to the given XY - // - Deploy the probe, if not already deployed - // - Probe the bed, get the Z position - // - Depending on the 'stow' flag - // - Stow the probe, or - // - Raise to the BETWEEN height - // - Return the probed Z position - // + /** + * - Move to the given XY + * - Deploy the probe, if not already deployed + * - Probe the bed, get the Z position + * - Depending on the 'stow' flag + * - Stow the probe, or + * - Raise to the BETWEEN height + * - Return the probed Z position + */ float probe_pt(const float x, const float y, const bool stow/*=true*/, const int verbose_level/*=1*/) { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { @@ -2505,14 +2505,14 @@ static void clean_up_after_endstop_or_probe_move() { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING) - // - // Enable if you prefer your output in JSON format - // suitable for SCAD or JavaScript mesh visualizers. - // - // Visualize meshes in OpenSCAD using the included script. - // - // buildroot/shared/scripts/MarlinMesh.scad - // + /** + * Enable to produce output in JSON format suitable + * for SCAD or JavaScript mesh visualizers. + * + * Visualize meshes in OpenSCAD using the included script. + * + * buildroot/shared/scripts/MarlinMesh.scad + */ //#define SCAD_MESH_OUTPUT /** diff --git a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h index 105592b68f..b60926111d 100644 --- a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h +++ b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h @@ -316,8 +316,7 @@ #define K1 0.95 //smoothing factor within the PID // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it - - + // FolgerTech i3-2020 #define DEFAULT_Kp 11.50 #define DEFAULT_Ki 0.50 @@ -921,7 +920,7 @@ #define UBL_MESH_INSET 1 // Mesh inset margin on print area #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. #define GRID_MAX_POINTS_Y 10 - #define UBL_PROBE_PT_1_X 45 // These set the probe locations for when UBL does a 3-Point leveling + #define UBL_PROBE_PT_1_X 45 // These set the probe locations for when UBL does a 3-Point leveling #define UBL_PROBE_PT_1_Y 170 // of the mesh. #define UBL_PROBE_PT_2_X 45 #define UBL_PROBE_PT_2_Y 25 diff --git a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h index 2fcd20debe..a499c79ba9 100644 --- a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h +++ b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h @@ -133,8 +133,8 @@ //#define MOTHERBOARD BOARD_RAMPS_14_EEF #define MOTHERBOARD BOARD_RAMPS_14_EFB // gMax users please note: This is a Roxy modification. I print on glass and // I use Marlin to control the bed's temperature. So, if you have a single nozzle - // machine, this will work fine for you. You just set the - // #define TEMP_SENSOR_BED 75 to 0 down below so Marlin doesn't mess with the bed + // machine, this will work fine for you. You just set the + // #define TEMP_SENSOR_BED 75 to 0 down below so Marlin doesn't mess with the bed // temp. #endif @@ -261,8 +261,8 @@ #define TEMP_SENSOR_3 0 #define TEMP_SENSOR_4 0 #define TEMP_SENSOR_BED 75 // gMax-1.5+ users please note: This is a Roxy modification to the printer. I want - // to print on glass. And I'm using a 400mm x 400mm silicon heat pad powered through - // a Fortek SSR to do it. If you are using an unaltered gCreate machine, this needs + // to print on glass. And I'm using a 400mm x 400mm silicon heat pad powered through + // a Fortek SSR to do it. If you are using an unaltered gCreate machine, this needs // to be set to 0 // Dummy thermistor constant temperature readings, for use with 998 and 999 @@ -325,12 +325,12 @@ #define K1 0.95 //smoothing factor within the PID // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it - + // gMax J-Head #define DEFAULT_Kp 15.35 #define DEFAULT_Ki 0.85 #define DEFAULT_Kd 69.45 - + // Ultimaker // #define DEFAULT_Kp 22.2 // #define DEFAULT_Ki 1.08 @@ -793,7 +793,7 @@ #define Y_MIN_POS 0 #define Z_MIN_POS 0 #define X_MAX_POS 420 // These numbers are not accurate for an unaltered gMax 1.5+ printer. My print bed -#define Y_MAX_POS 420 // is inset a noticable amount from the edge of the bed. Combined with the inset, +#define Y_MAX_POS 420 // is inset a noticable amount from the edge of the bed. Combined with the inset, // the nozzle can reach all cordinates of the mesh. #define Z_MAX_POS 500 diff --git a/Marlin/language_tr.h b/Marlin/language_tr.h index 23b8959e38..3dd7af19dc 100644 --- a/Marlin/language_tr.h +++ b/Marlin/language_tr.h @@ -233,7 +233,7 @@ #define MSG_FILAMENT_CHANGE_OPTION_EXTRUDE _UxGT("Daha Akıt") // Daha Akıt #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Baskıyı sürdür") // Baskıyı sürdür #define MSG_FILAMENT_CHANGE_MINTEMP _UxGT("Min. Sıcaklık") // Min. Sıcaklık: -#define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Nozül: ") // Nozül: +#define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Nozül: ") // Nozül: #if LCD_HEIGHT >= 4 // Up to 3 lines allowed diff --git a/Marlin/softspi.h b/Marlin/softspi.h index 2edd45ae57..24ee33fed1 100644 --- a/Marlin/softspi.h +++ b/Marlin/softspi.h @@ -19,11 +19,11 @@ bool fastDigitalRead(uint8_t pin) { */ static inline __attribute__((always_inline)) void fastDigitalWrite(uint8_t pin, bool value) { - if (value) { - *portSetRegister(pin) = 1; - } else { - *portClearRegister(pin) = 1; - } + if (value) { + *portSetRegister(pin) = 1; + } else { + *portClearRegister(pin) = 1; + } } #else // CORE_TEENSY //------------------------------------------------------------------------------ @@ -574,7 +574,7 @@ class DigitalPin { /** Parenthesis operator * @return Pin's level */ - inline operator bool () const __attribute__((always_inline)) { + inline operator bool () const __attribute__((always_inline)) { return read(); } //---------------------------------------------------------------------------- diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index a7071ae6de..0e0ed70c20 100755 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -50,11 +50,10 @@ extern bool code_has_value(); extern float probe_pt(float x, float y, bool, int); extern bool set_probe_deployed(bool); - void smart_fill_mesh(); + void smart_fill_mesh(); bool ProbeStay = true; - #define SIZE_OF_LITTLE_RAISE 0 #define BIG_RAISE_NOT_NEEDED 0 extern void lcd_quick_feedback(); @@ -189,13 +188,13 @@ * P3 Phase 3 Fill the unpopulated regions of the Mesh with a fixed value. There are two different paths the * user can go down. If the user specifies the value using the C parameter, the closest invalid * mesh points to the nozzle will be filled. The user can specify a repeat count using the R - * parameter with the C version of the command. + * parameter with the C version of the command. * - * A second version of the fill command is available if no C constant is specified. Not + * A second version of the fill command is available if no C constant is specified. Not * specifying a C constant will invoke the 'Smart Fill' algorithm. The G29 P3 command will search * from the edges of the mesh inward looking for invalid mesh points. It will look at the next * several mesh points to determine if the print bed is sloped up or down. If the bed is sloped - * upward from the invalid mesh point, it will be replaced with the value of the nearest mesh point. + * upward from the invalid mesh point, it will be replaced with the value of the nearest mesh point. * If the bed is sloped downward from the invalid mesh point, it will be replaced with a value that * puts all three points in a line. The second version of the G29 P3 command is a quick, easy and * usually safe way to populate the unprobed regions of your mesh so you can continue to the G26 @@ -336,7 +335,7 @@ repetition_cnt = code_has_value() ? code_value_int() : 1; while (repetition_cnt--) { if (cnt > 20) { cnt = 0; idle(); } - const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, x_pos, y_pos, USE_NOZZLE_AS_REFERENCE, NULL, false); + const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, x_pos, y_pos, USE_NOZZLE_AS_REFERENCE, NULL, false); if (location.x_index < 0) { SERIAL_PROTOCOLLNPGM("Entire Mesh invalidated.\n"); break; // No more invalid Mesh Points to populate @@ -460,7 +459,7 @@ case 3: { // - // Populate invalid Mesh areas. Two choices are available to the user. The user can + // Populate invalid Mesh areas. Two choices are available to the user. The user can // specify the constant to be used with a C # paramter. Or the user can allow the G29 P3 command to // apply a 'reasonable' constant to the invalid mesh point. Some caution and scrutiny should be used // on either of these paths! @@ -811,9 +810,9 @@ * Z is negative, we need to invert the sign of all components of the vector */ if ( normal.z < 0.0 ) { - normal.x = -normal.x; - normal.y = -normal.y; - normal.z = -normal.z; + normal.x = -normal.x; + normal.y = -normal.y; + normal.z = -normal.z; } rotation = matrix_3x3::create_look_at( vector_3( normal.x, normal.y, 1)); @@ -863,7 +862,7 @@ for (i = 0; i < GRID_MAX_POINTS_X; i++) { for (j = 0; j < GRID_MAX_POINTS_Y; j++) { float x_tmp, y_tmp, z_tmp; - x_tmp = pgm_read_float(ubl.mesh_index_to_xpos[i]); + x_tmp = pgm_read_float(ubl.mesh_index_to_xpos[i]); y_tmp = pgm_read_float(ubl.mesh_index_to_ypos[j]); z_tmp = ubl.z_values[i][j]; #if ENABLED(DEBUG_LEVELING_FEATURE) @@ -947,7 +946,7 @@ float last_x = -9999.99, last_y = -9999.99; mesh_index_pair location; do { - location = find_closest_mesh_point_of_type(INVALID, lx, ly, USE_NOZZLE_AS_REFERENCE, NULL, false); + location = find_closest_mesh_point_of_type(INVALID, lx, ly, USE_NOZZLE_AS_REFERENCE, NULL, false); // It doesn't matter if the probe can't reach the NAN location. This is a manual probe. if (location.x_index < 0 && location.y_index < 0) continue; @@ -1415,7 +1414,7 @@ do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); do_blocking_move_to_xy(lx, ly); do { - location = find_closest_mesh_point_of_type(SET_IN_BITMAP, lx, ly, USE_NOZZLE_AS_REFERENCE, not_done, false); + location = find_closest_mesh_point_of_type(SET_IN_BITMAP, lx, ly, USE_NOZZLE_AS_REFERENCE, not_done, false); // It doesn't matter if the probe can not reach this // location. This is a manual edit of the Mesh Point. if (location.x_index < 0 && location.y_index < 0) continue; // abort if we can't find any more points. @@ -1500,7 +1499,7 @@ } // - // The routine provides the 'Smart Fill' capability. It scans from the + // The routine provides the 'Smart Fill' capability. It scans from the // outward edges of the mesh towards the center. If it finds an invalid // location, it uses the next two points (assumming they are valid) to // calculate a 'reasonable' value for the unprobed mesh point. @@ -1510,14 +1509,14 @@ for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) { // Bottom of the mesh looking up for (uint8_t y = 0; y < GRID_MAX_POINTS_Y-2; y++) { if (isnan(ubl.z_values[x][y])) { - if (isnan(ubl.z_values[x][y+1])) // we only deal with the first NAN next to a block of + if (isnan(ubl.z_values[x][y+1])) // we only deal with the first NAN next to a block of continue; // good numbers. we want 2 good numbers to extrapolate off of. - if (isnan(ubl.z_values[x][y+2])) - continue; + if (isnan(ubl.z_values[x][y+2])) + continue; if (ubl.z_values[x][y+1] < ubl.z_values[x][y+2]) // The bed is angled down near this edge. So to be safe, we ubl.z_values[x][y] = ubl.z_values[x][y+1]; // use the closest value, which is probably a little too high else { - diff = ubl.z_values[x][y+1] - ubl.z_values[x][y+2]; // The bed is angled up near this edge. So we will use the closest + diff = ubl.z_values[x][y+1] - ubl.z_values[x][y+2]; // The bed is angled up near this edge. So we will use the closest ubl.z_values[x][y] = ubl.z_values[x][y+1] + diff; // height and add in the difference between that and the next point } break; @@ -1527,14 +1526,14 @@ for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) { // Top of the mesh looking down for (uint8_t y=GRID_MAX_POINTS_Y-1; y>=1; y--) { if (isnan(ubl.z_values[x][y])) { - if (isnan(ubl.z_values[x][y-1])) // we only deal with the first NAN next to a block of + if (isnan(ubl.z_values[x][y-1])) // we only deal with the first NAN next to a block of continue; // good numbers. we want 2 good numbers to extrapolate off of. - if (isnan(ubl.z_values[x][y-2])) - continue; + if (isnan(ubl.z_values[x][y-2])) + continue; if (ubl.z_values[x][y-1] < ubl.z_values[x][y-2]) // The bed is angled down near this edge. So to be safe, we ubl.z_values[x][y] = ubl.z_values[x][y-1]; // use the closest value, which is probably a little too high else { - diff = ubl.z_values[x][y-1] - ubl.z_values[x][y-2]; // The bed is angled up near this edge. So we will use the closest + diff = ubl.z_values[x][y-1] - ubl.z_values[x][y-2]; // The bed is angled up near this edge. So we will use the closest ubl.z_values[x][y] = ubl.z_values[x][y-1] + diff; // height and add in the difference between that and the next point } break; @@ -1544,14 +1543,14 @@ for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) { for (uint8_t x = 0; x < GRID_MAX_POINTS_X-2; x++) { // Left side of the mesh looking right if (isnan(ubl.z_values[x][y])) { - if (isnan(ubl.z_values[x+1][y])) // we only deal with the first NAN next to a block of + if (isnan(ubl.z_values[x+1][y])) // we only deal with the first NAN next to a block of continue; // good numbers. we want 2 good numbers to extrapolate off of. - if (isnan(ubl.z_values[x+2][y])) - continue; + if (isnan(ubl.z_values[x+2][y])) + continue; if (ubl.z_values[x+1][y] < ubl.z_values[x+2][y]) // The bed is angled down near this edge. So to be safe, we ubl.z_values[x][y] = ubl.z_values[x][y+1]; // use the closest value, which is probably a little too high else { - diff = ubl.z_values[x+1][y] - ubl.z_values[x+2][y]; // The bed is angled up near this edge. So we will use the closest + diff = ubl.z_values[x+1][y] - ubl.z_values[x+2][y]; // The bed is angled up near this edge. So we will use the closest ubl.z_values[x][y] = ubl.z_values[x+1][y] + diff; // height and add in the difference between that and the next point } break; @@ -1561,18 +1560,18 @@ for (uint8_t y=0; y < GRID_MAX_POINTS_Y; y++) { for (uint8_t x=GRID_MAX_POINTS_X-1; x>=1; x--) { // Right side of the mesh looking left if (isnan(ubl.z_values[x][y])) { - if (isnan(ubl.z_values[x-1][y])) // we only deal with the first NAN next to a block of + if (isnan(ubl.z_values[x-1][y])) // we only deal with the first NAN next to a block of continue; // good numbers. we want 2 good numbers to extrapolate off of. - if (isnan(ubl.z_values[x-2][y])) - continue; + if (isnan(ubl.z_values[x-2][y])) + continue; if (ubl.z_values[x-1][y] < ubl.z_values[x-2][y]) // The bed is angled down near this edge. So to be safe, we ubl.z_values[x][y] = ubl.z_values[x-1][y]; // use the closest value, which is probably a little too high else { - diff = ubl.z_values[x-1][y] - ubl.z_values[x-2][y]; // The bed is angled up near this edge. So we will use the closest + diff = ubl.z_values[x-1][y] - ubl.z_values[x-2][y]; // The bed is angled up near this edge. So we will use the closest ubl.z_values[x][y] = ubl.z_values[x-1][y] + diff; // height and add in the difference between that and the next point } break; - } + } } } } @@ -1599,7 +1598,7 @@ for(ix=0; ix Date: Fri, 28 Apr 2017 17:37:41 -0500 Subject: [PATCH 4/8] Fix up formatting in ubl.h --- Marlin/ubl.h | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Marlin/ubl.h b/Marlin/ubl.h index b02411c2ca..62a2db5866 100755 --- a/Marlin/ubl.h +++ b/Marlin/ubl.h @@ -134,25 +134,27 @@ // 15 is the maximum nubmer of grid points supported + 1 safety margin for now, // until determinism prevails - constexpr static float mesh_index_to_xpos[16] PROGMEM = { UBL_MESH_MIN_X+0*(MESH_X_DIST), - UBL_MESH_MIN_X+1*(MESH_X_DIST), UBL_MESH_MIN_X+2*(MESH_X_DIST), - UBL_MESH_MIN_X+3*(MESH_X_DIST), UBL_MESH_MIN_X+4*(MESH_X_DIST), - UBL_MESH_MIN_X+5*(MESH_X_DIST), UBL_MESH_MIN_X+6*(MESH_X_DIST), - UBL_MESH_MIN_X+7*(MESH_X_DIST), UBL_MESH_MIN_X+8*(MESH_X_DIST), - UBL_MESH_MIN_X+9*(MESH_X_DIST), UBL_MESH_MIN_X+10*(MESH_X_DIST), - UBL_MESH_MIN_X+11*(MESH_X_DIST), UBL_MESH_MIN_X+12*(MESH_X_DIST), - UBL_MESH_MIN_X+13*(MESH_X_DIST), UBL_MESH_MIN_X+14*(MESH_X_DIST), - UBL_MESH_MIN_X+15*(MESH_X_DIST) }; + constexpr static float mesh_index_to_xpos[16] PROGMEM = { + UBL_MESH_MIN_X + 0 * (MESH_X_DIST), UBL_MESH_MIN_X + 1 * (MESH_X_DIST), + UBL_MESH_MIN_X + 2 * (MESH_X_DIST), UBL_MESH_MIN_X + 3 * (MESH_X_DIST), + UBL_MESH_MIN_X + 4 * (MESH_X_DIST), UBL_MESH_MIN_X + 5 * (MESH_X_DIST), + UBL_MESH_MIN_X + 6 * (MESH_X_DIST), UBL_MESH_MIN_X + 7 * (MESH_X_DIST), + UBL_MESH_MIN_X + 8 * (MESH_X_DIST), UBL_MESH_MIN_X + 9 * (MESH_X_DIST), + UBL_MESH_MIN_X + 10 * (MESH_X_DIST), UBL_MESH_MIN_X + 11 * (MESH_X_DIST), + UBL_MESH_MIN_X + 12 * (MESH_X_DIST), UBL_MESH_MIN_X + 13 * (MESH_X_DIST), + UBL_MESH_MIN_X + 14 * (MESH_X_DIST), UBL_MESH_MIN_X + 15 * (MESH_X_DIST) + }; - constexpr static float mesh_index_to_ypos[16] PROGMEM = { UBL_MESH_MIN_Y+0*(MESH_Y_DIST), - UBL_MESH_MIN_Y+1*(MESH_Y_DIST), UBL_MESH_MIN_Y+2*(MESH_Y_DIST), - UBL_MESH_MIN_Y+3*(MESH_Y_DIST), UBL_MESH_MIN_Y+4*(MESH_Y_DIST), - UBL_MESH_MIN_Y+5*(MESH_Y_DIST), UBL_MESH_MIN_Y+6*(MESH_Y_DIST), - UBL_MESH_MIN_Y+7*(MESH_Y_DIST), UBL_MESH_MIN_Y+8*(MESH_Y_DIST), - UBL_MESH_MIN_Y+9*(MESH_Y_DIST), UBL_MESH_MIN_Y+10*(MESH_Y_DIST), - UBL_MESH_MIN_Y+11*(MESH_Y_DIST), UBL_MESH_MIN_Y+12*(MESH_Y_DIST), - UBL_MESH_MIN_Y+13*(MESH_Y_DIST), UBL_MESH_MIN_Y+14*(MESH_Y_DIST), - UBL_MESH_MIN_Y+15*(MESH_Y_DIST) }; + constexpr static float mesh_index_to_ypos[16] PROGMEM = { + UBL_MESH_MIN_Y + 0 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 1 * (MESH_Y_DIST), + UBL_MESH_MIN_Y + 2 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 3 * (MESH_Y_DIST), + UBL_MESH_MIN_Y + 4 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 5 * (MESH_Y_DIST), + UBL_MESH_MIN_Y + 6 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 7 * (MESH_Y_DIST), + UBL_MESH_MIN_Y + 8 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 9 * (MESH_Y_DIST), + UBL_MESH_MIN_Y + 10 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 11 * (MESH_Y_DIST), + UBL_MESH_MIN_Y + 12 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 13 * (MESH_Y_DIST), + UBL_MESH_MIN_Y + 14 * (MESH_Y_DIST), UBL_MESH_MIN_Y + 15 * (MESH_Y_DIST) + }; static bool g26_debug_flag, has_control_of_lcd_panel; From 8bf3a3fcdb2e8465bd88d64c0ccbf90048a25b4b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 17:38:03 -0500 Subject: [PATCH 5/8] Remove inaccurate comments from ubl.h --- Marlin/ubl.h | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/Marlin/ubl.h b/Marlin/ubl.h index 62a2db5866..843c9d98a3 100755 --- a/Marlin/ubl.h +++ b/Marlin/ubl.h @@ -91,11 +91,6 @@ public: -// -// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that. -// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of -// functions that call STATIC functions. -// void find_mean_mesh_height(); void shift_mesh_height(); void probe_entire_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map, const bool stow_probe, bool do_furthest); @@ -104,23 +99,13 @@ void manually_probe_remaining_mesh(const float &lx, const float &ly, const float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map); void save_ubl_active_state_and_disable(); void restore_ubl_active_state_and_leave(); - void g29_what_command(); -// -// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that. -// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of -// functions that call STATIC functions. -// + void g29_what_command(); void g29_eeprom_dump() ; void g29_compare_current_mesh_to_stored_mesh(); void fine_tune_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map); void smart_fill_mesh(); void display_map(const int); void reset(); -// -// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that. -// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of -// functions that call STATIC functions. -// void invalidate(); void store_state(); void load_state(); @@ -165,11 +150,6 @@ unified_bed_leveling(); -// -// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that. -// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of -// functions that call STATIC functions. -// FORCE_INLINE void set_z(const int8_t px, const int8_t py, const float &z) { z_values[px][py] = z; } int8_t get_cell_index_x(const float &x) { const int8_t cx = (x - (UBL_MESH_MIN_X)) * (1.0 / (MESH_X_DIST)); @@ -186,11 +166,6 @@ // that is OK because something else should be keeping that from // happening and should not be worried about at this level. -// -// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that. -// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of -// functions that call STATIC functions. -// int8_t find_closest_x_index(const float &x) { const int8_t px = (x - (UBL_MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0 / (MESH_X_DIST)); return WITHIN(px, 0, GRID_MAX_POINTS_X - 1) ? px : -1; @@ -219,11 +194,6 @@ FORCE_INLINE float calc_z0(const float &a0, const float &a1, const float &z1, const float &a2, const float &z2) { return z1 + (z2 - z1) * (a0 - a1) / (a2 - a1); } -// -// Please do not put STATIC qualifiers in front of ANYTHING in this file. You WILL cause problems by doing that. -// The GCC optimizer inlines static functions and this DRAMATICALLY increases the size of the stack frame of -// functions that call STATIC functions. -// /** * z_correction_for_x_on_horizontal_mesh_line is an optimization for From 7db805930a8ffa46f199951d98858fa02ef5777a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 17:49:18 -0500 Subject: [PATCH 6/8] Cleanup configurations --- Marlin/Configuration.h | 2 +- .../FolgerTech-i3-2020/Configuration.h | 41 +++--- .../FolgerTech-i3-2020/Configuration_adv.h | 12 +- .../gCreate_gMax1.5+/Configuration.h | 36 +++-- .../gCreate_gMax1.5+/Configuration_adv.h | 2 +- .../gCreate_gMax1.5+/_Bootscreen.h | 130 +++++++++--------- 6 files changed, 109 insertions(+), 114 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ef6c3ff52e..603627fc04 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -534,7 +534,7 @@ * =========================================================================== * ============================= Z Probe Options ============================= * =========================================================================== - * @section probes + * @section probes * * * Probe Type diff --git a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h index b60926111d..fcca1e01b9 100644 --- a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h +++ b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h @@ -293,6 +293,7 @@ #define HEATER_1_MAXTEMP 245 #define HEATER_2_MAXTEMP 245 #define HEATER_3_MAXTEMP 245 +#define HEATER_4_MAXTEMP 245 #define BED_MAXTEMP 115 //=========================================================================== @@ -322,6 +323,11 @@ #define DEFAULT_Ki 0.50 #define DEFAULT_Kd 60.00 + // Ultimaker + //#define DEFAULT_Kp 22.2 + //#define DEFAULT_Ki 1.08 + //#define DEFAULT_Kd 114 + // MakerGear //#define DEFAULT_Kp 7.0 //#define DEFAULT_Ki 0.1 @@ -562,7 +568,6 @@ */ //#define FIX_MOUNTED_PROBE - /** * Z Servo Probe, such as an endstop switch on a rotating arm. * NUM_SERVOS also needs to be set. This is found later in this file. Set it to @@ -578,7 +583,7 @@ * with the possible exception of Z_ENDSTOP_SERVO_NR. */ //#define BLTOUCH -//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed +//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed //#define BLTOUCH_HEATERS_OFF // if defined the printer's heaters are turned off during probe event /** @@ -601,7 +606,7 @@ // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED -//#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +//#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. /** * Z Probe to nozzle (X,Y) offset, relative to (0, 0). @@ -630,8 +635,10 @@ #define XY_PROBE_SPEED 7500 // Speed for the first approach when double-probing (with PROBE_DOUBLE_TOUCH) #define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z + // Speed for the "accurate" probe of each point #define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2) + // Use double touch for probing //#define PROBE_DOUBLE_TOUCH @@ -693,7 +700,6 @@ */ //#define Z_MIN_PROBE_ENDSTOP - #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN // Enable Z Probe Repeatability test to see how accurate your probe is @@ -770,7 +776,6 @@ #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 - // @section machine // Travel limits after homing (units are in mm) @@ -803,7 +808,6 @@ //=========================================================================== //=============================== Bed Leveling ============================== //=========================================================================== - // @section bedlevel /** @@ -850,7 +854,6 @@ #define AUTO_BED_LEVELING_UBL //#define MESH_BED_LEVELING - /** * Enable detailed logging of G28, G29, M48, etc. * Turn on with the command 'M111 S32'. @@ -901,7 +904,6 @@ // 3 arbitrary points to probe. // A simple cross-product is used to estimate the plane of the bed. - #define ABL_PROBE_PT_1_X 39 #define ABL_PROBE_PT_1_Y 170 #define ABL_PROBE_PT_2_X 39 @@ -917,16 +919,17 @@ //========================= Unified Bed Leveling ============================ //=========================================================================== - #define UBL_MESH_INSET 1 // Mesh inset margin on print area - #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. - #define GRID_MAX_POINTS_Y 10 - #define UBL_PROBE_PT_1_X 45 // These set the probe locations for when UBL does a 3-Point leveling - #define UBL_PROBE_PT_1_Y 170 // of the mesh. - #define UBL_PROBE_PT_2_X 45 - #define UBL_PROBE_PT_2_Y 25 - #define UBL_PROBE_PT_3_X 180 - #define UBL_PROBE_PT_3_Y 25 - #define UBL_G26_MESH_EDITING // Enable G26 mesh editing + #define UBL_MESH_INSET 1 // Mesh inset margin on print area + #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y 10 + #define UBL_PROBE_PT_1_X 45 // These set the probe locations for when UBL does a 3-Point leveling + #define UBL_PROBE_PT_1_Y 170 // of the mesh. + #define UBL_PROBE_PT_2_X 45 + #define UBL_PROBE_PT_2_Y 25 + #define UBL_PROBE_PT_3_X 180 + #define UBL_PROBE_PT_3_Y 25 + #define UBL_G26_MESH_EDITING // Enable G26 mesh editing + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== @@ -1606,7 +1609,7 @@ */ //#define FILAMENT_WIDTH_SENSOR -#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 // (mm) Diameter of the filament generally used (3.0 or 1.75mm), also used in the slicer. Used to validate sensor reading. #if ENABLED(FILAMENT_WIDTH_SENSOR) #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor (0,1,2,3) diff --git a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h index a2cb2cbe07..2225b761a1 100644 --- a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h +++ b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h @@ -327,7 +327,7 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE // Activate a solenoid on the active extruder with M380. Disable all with M381. // Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. @@ -419,7 +419,6 @@ * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 */ //#define PWM_MOTOR_CURRENT {1300, 1300, 1250} // Values in milliamps - //#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) //#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis @@ -587,10 +586,9 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - #define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions - //not implemented for deltabots! - #define BABYSTEP_INVERT_Z false //true for inverse movements in Z - #define BABYSTEP_MULTIPLICATOR 2 //faster movements + #define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 2 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. @@ -1034,7 +1032,6 @@ * (https://github.com/ameyer/Arduino-L6470) */ - //#define HAVE_L6470DRIVER #if ENABLED(HAVE_L6470DRIVER) @@ -1155,7 +1152,6 @@ */ //#define EXTENDED_CAPABILITIES_REPORT - /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h index a499c79ba9..ca1a4f7a7e 100644 --- a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h +++ b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration.h @@ -130,7 +130,7 @@ // The following define selects which electronics board you have. // Please choose the name from boards.h that matches your setup #ifndef MOTHERBOARD -//#define MOTHERBOARD BOARD_RAMPS_14_EEF + //#define MOTHERBOARD BOARD_RAMPS_14_EEF #define MOTHERBOARD BOARD_RAMPS_14_EFB // gMax users please note: This is a Roxy modification. I print on glass and // I use Marlin to control the bed's temperature. So, if you have a single nozzle // machine, this will work fine for you. You just set the @@ -327,14 +327,14 @@ // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // gMax J-Head - #define DEFAULT_Kp 15.35 - #define DEFAULT_Ki 0.85 - #define DEFAULT_Kd 69.45 + #define DEFAULT_Kp 15.35 + #define DEFAULT_Ki 0.85 + #define DEFAULT_Kd 69.45 // Ultimaker -// #define DEFAULT_Kp 22.2 -// #define DEFAULT_Ki 1.08 -// #define DEFAULT_Kd 114 + //#define DEFAULT_Kp 22.2 + //#define DEFAULT_Ki 1.08 + //#define DEFAULT_Kd 114 // MakerGear //#define DEFAULT_Kp 7.0 @@ -474,7 +474,7 @@ #define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. -#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe. // Enable this feature if all enabled endstop pins are interrupt-capable. // This will remove the need to poll the interrupt pins, saving many CPU cycles. @@ -548,7 +548,7 @@ * =========================================================================== * ============================= Z Probe Options ============================= * =========================================================================== - * @section probes + * @section probes * * * Probe Type @@ -730,8 +730,6 @@ #define Z_CLEARANCE_DEPLOY_PROBE 15 // Z Clearance for Deploy/Stow #define Z_CLEARANCE_BETWEEN_PROBES 6 // Z Clearance between probe points -// - // For M851 give a range for adjusting the Z probe offset #define Z_PROBE_OFFSET_RANGE_MIN -20 #define Z_PROBE_OFFSET_RANGE_MAX 20 @@ -792,9 +790,9 @@ #define X_MIN_POS 0 #define Y_MIN_POS 0 #define Z_MIN_POS 0 -#define X_MAX_POS 420 // These numbers are not accurate for an unaltered gMax 1.5+ printer. My print bed -#define Y_MAX_POS 420 // is inset a noticable amount from the edge of the bed. Combined with the inset, - // the nozzle can reach all cordinates of the mesh. +#define X_MAX_POS 420 // These numbers are not accurate for an unaltered gMax 1.5+ printer. My print bed +#define Y_MAX_POS 420 // is inset a noticable amount from the edge of the bed. Combined with the inset, + // the nozzle can reach all cordinates of the mesh. #define Z_MAX_POS 500 // If enabled, axes won't move below MIN_POS in response to movement commands. @@ -994,8 +992,8 @@ #define Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING) - #define Z_SAFE_HOMING_X_POINT (((X_MIN_POS+X_MAX_POS)/2)-4) // X point for Z homing when homing all axis (G28). - #define Z_SAFE_HOMING_Y_POINT (((Y_MIN_POS+Y_MAX_POS)/2)+4) // Y point for Z homing when homing all axis (G28). + #define Z_SAFE_HOMING_X_POINT (((X_MIN_POS + X_MAX_POS) / 2) - 4) // X point for Z homing when homing all axis (G28). + #define Z_SAFE_HOMING_Y_POINT (((Y_MIN_POS + Y_MAX_POS) / 2) + 4) // Y point for Z homing when homing all axis (G28). #endif // Homing speeds (mm/m) @@ -1035,7 +1033,7 @@ // // M100 Free Memory Watcher // -#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose // // G20/G21 Inch mode support @@ -1619,7 +1617,7 @@ */ //#define FILAMENT_WIDTH_SENSOR -#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 // (mm) Diameter of the filament generally used (3.0 or 1.75mm), also used in the slicer. Used to validate sensor reading. #if ENABLED(FILAMENT_WIDTH_SENSOR) #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor (0,1,2,3) @@ -1633,6 +1631,6 @@ // Display filament width on the LCD status line. Status messages will expire after 5 seconds. //#define FILAMENT_LCD_DISPLAY -#endif //FILAMENT_WIDTH_SENSOR +#endif #endif // CONFIGURATION_H diff --git a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h index 5b091eed3d..e1677111ad 100644 --- a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h +++ b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h @@ -361,7 +361,7 @@ // Default stepper release if idle. Set to 0 to deactivate. // Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true. // Time can be set by M18 and M84. -#define DEFAULT_STEPPER_DEACTIVE_TIME 0 // usually is set to 120 seconds +#define DEFAULT_STEPPER_DEACTIVE_TIME 0 // usually set to 120 seconds #define DISABLE_INACTIVE_X true #define DISABLE_INACTIVE_Y true #define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. diff --git a/Marlin/example_configurations/gCreate_gMax1.5+/_Bootscreen.h b/Marlin/example_configurations/gCreate_gMax1.5+/_Bootscreen.h index 0e1f559c50..b691e81687 100644 --- a/Marlin/example_configurations/gCreate_gMax1.5+/_Bootscreen.h +++ b/Marlin/example_configurations/gCreate_gMax1.5+/_Bootscreen.h @@ -39,72 +39,70 @@ // Width: 112, Height: 64 const unsigned char custom_start_bmp[896] PROGMEM = { - 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x00, 0x00, 0x01, 0xf9, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x01, 0xc0, 0x01, - 0x80, 0x00, 0x00, 0x06, 0x4d, 0x00, 0x00, 0x07, 0x38, 0x00, 0x00, 0x01, 0xc0, 0x01, - 0x80, 0x00, 0x00, 0x0c, 0x26, 0x00, 0x0e, 0xe7, 0x39, 0xd3, 0xe1, 0xf3, 0xe7, 0xc1, - 0x80, 0x00, 0x00, 0x19, 0x12, 0x00, 0x0f, 0xe7, 0x39, 0xf7, 0xf3, 0xfb, 0xef, 0xe1, - 0x80, 0x00, 0x00, 0x37, 0xce, 0x00, 0x0e, 0xe7, 0x01, 0xf7, 0x73, 0xb9, 0xce, 0xe1, - 0x80, 0x00, 0x00, 0x64, 0x66, 0x00, 0x0e, 0xe7, 0x01, 0xc7, 0xf3, 0xb9, 0xcf, 0xe1, - 0x80, 0x00, 0x00, 0x4b, 0xa6, 0x00, 0x0e, 0xe7, 0x39, 0xc7, 0xf0, 0xf9, 0xcf, 0xe1, - 0x80, 0x00, 0x00, 0xca, 0xb4, 0x00, 0x0f, 0xe7, 0x39, 0xc7, 0x03, 0xf9, 0xce, 0x01, - 0x80, 0x00, 0x00, 0xcd, 0xa4, 0x00, 0x06, 0xe7, 0x39, 0xc7, 0x73, 0xb9, 0xce, 0xe1, - 0x80, 0x00, 0x03, 0xa6, 0x6c, 0x00, 0x00, 0xe7, 0x39, 0xc7, 0x73, 0xb9, 0xce, 0xe1, - 0x80, 0x00, 0xff, 0x13, 0xd8, 0x00, 0x0e, 0xe3, 0xf1, 0xc7, 0xf3, 0xf9, 0xef, 0xe1, - 0x80, 0x01, 0x21, 0x88, 0x18, 0x00, 0x0f, 0xe1, 0xe1, 0xc3, 0xe1, 0xb9, 0xe7, 0xc1, - 0x80, 0x06, 0x61, 0x16, 0x30, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x04, 0x41, 0x23, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x04, 0xfe, 0x41, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x0b, 0x86, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x1f, 0x80, 0x00, 0x00, 0x01, - 0x80, 0x1e, 0x01, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x1f, 0x80, 0x00, 0x00, 0x01, - 0x80, 0x1c, 0x07, 0x22, 0x00, 0x00, 0x07, 0xbc, 0x3f, 0x9f, 0x81, 0xf8, 0xf1, 0xe1, - 0x80, 0x08, 0x1f, 0xe2, 0x00, 0x00, 0x0f, 0xfc, 0x3f, 0xbf, 0x87, 0xfe, 0x71, 0xc1, - 0x80, 0x00, 0x33, 0x62, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xb7, 0x87, 0x9e, 0x7b, 0xc1, - 0x80, 0x00, 0xc2, 0x22, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xb7, 0x87, 0x9e, 0x7b, 0xc1, - 0x80, 0x00, 0xc2, 0x3e, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xf7, 0x80, 0x7e, 0x3b, 0x81, - 0x80, 0x01, 0xe6, 0x1e, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xf7, 0x83, 0xfe, 0x3f, 0x81, - 0x80, 0x01, 0x3c, 0x12, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xf7, 0x87, 0x9e, 0x3b, 0x81, - 0x80, 0x01, 0x1c, 0x26, 0x00, 0x00, 0x0f, 0xfc, 0x3d, 0xf7, 0x87, 0x9e, 0x7b, 0xc1, - 0x80, 0x01, 0x70, 0x64, 0x00, 0x00, 0x07, 0xbc, 0x3c, 0xe7, 0x87, 0x9e, 0x7b, 0xc1, - 0x80, 0x03, 0xc0, 0x58, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0xe7, 0x87, 0xfe, 0x71, 0xc1, - 0x80, 0x0d, 0x80, 0xf0, 0x00, 0x00, 0x0f, 0x3c, 0x3c, 0xe7, 0x83, 0xde, 0xf1, 0xe1, - 0x80, 0x1a, 0x00, 0xe0, 0x00, 0x00, 0x0f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x26, 0x00, 0x40, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x80, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x00, 0x00, 0x01, 0xf9, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x01, 0xc0, 0x01, + 0x80, 0x00, 0x00, 0x06, 0x4d, 0x00, 0x00, 0x07, 0x38, 0x00, 0x00, 0x01, 0xc0, 0x01, + 0x80, 0x00, 0x00, 0x0c, 0x26, 0x00, 0x0e, 0xe7, 0x39, 0xd3, 0xe1, 0xf3, 0xe7, 0xc1, + 0x80, 0x00, 0x00, 0x19, 0x12, 0x00, 0x0f, 0xe7, 0x39, 0xf7, 0xf3, 0xfb, 0xef, 0xe1, + 0x80, 0x00, 0x00, 0x37, 0xce, 0x00, 0x0e, 0xe7, 0x01, 0xf7, 0x73, 0xb9, 0xce, 0xe1, + 0x80, 0x00, 0x00, 0x64, 0x66, 0x00, 0x0e, 0xe7, 0x01, 0xc7, 0xf3, 0xb9, 0xcf, 0xe1, + 0x80, 0x00, 0x00, 0x4b, 0xa6, 0x00, 0x0e, 0xe7, 0x39, 0xc7, 0xf0, 0xf9, 0xcf, 0xe1, + 0x80, 0x00, 0x00, 0xca, 0xb4, 0x00, 0x0f, 0xe7, 0x39, 0xc7, 0x03, 0xf9, 0xce, 0x01, + 0x80, 0x00, 0x00, 0xcd, 0xa4, 0x00, 0x06, 0xe7, 0x39, 0xc7, 0x73, 0xb9, 0xce, 0xe1, + 0x80, 0x00, 0x03, 0xa6, 0x6c, 0x00, 0x00, 0xe7, 0x39, 0xc7, 0x73, 0xb9, 0xce, 0xe1, + 0x80, 0x00, 0xff, 0x13, 0xd8, 0x00, 0x0e, 0xe3, 0xf1, 0xc7, 0xf3, 0xf9, 0xef, 0xe1, + 0x80, 0x01, 0x21, 0x88, 0x18, 0x00, 0x0f, 0xe1, 0xe1, 0xc3, 0xe1, 0xb9, 0xe7, 0xc1, + 0x80, 0x06, 0x61, 0x16, 0x30, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x04, 0x41, 0x23, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x04, 0xfe, 0x41, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x0b, 0x86, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x1f, 0x80, 0x00, 0x00, 0x01, + 0x80, 0x1e, 0x01, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x1f, 0x80, 0x00, 0x00, 0x01, + 0x80, 0x1c, 0x07, 0x22, 0x00, 0x00, 0x07, 0xbc, 0x3f, 0x9f, 0x81, 0xf8, 0xf1, 0xe1, + 0x80, 0x08, 0x1f, 0xe2, 0x00, 0x00, 0x0f, 0xfc, 0x3f, 0xbf, 0x87, 0xfe, 0x71, 0xc1, + 0x80, 0x00, 0x33, 0x62, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xb7, 0x87, 0x9e, 0x7b, 0xc1, + 0x80, 0x00, 0xc2, 0x22, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xb7, 0x87, 0x9e, 0x7b, 0xc1, + 0x80, 0x00, 0xc2, 0x3e, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xf7, 0x80, 0x7e, 0x3b, 0x81, + 0x80, 0x01, 0xe6, 0x1e, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xf7, 0x83, 0xfe, 0x3f, 0x81, + 0x80, 0x01, 0x3c, 0x12, 0x00, 0x00, 0x0f, 0x3c, 0x3d, 0xf7, 0x87, 0x9e, 0x3b, 0x81, + 0x80, 0x01, 0x1c, 0x26, 0x00, 0x00, 0x0f, 0xfc, 0x3d, 0xf7, 0x87, 0x9e, 0x7b, 0xc1, + 0x80, 0x01, 0x70, 0x64, 0x00, 0x00, 0x07, 0xbc, 0x3c, 0xe7, 0x87, 0x9e, 0x7b, 0xc1, + 0x80, 0x03, 0xc0, 0x58, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0xe7, 0x87, 0xfe, 0x71, 0xc1, + 0x80, 0x0d, 0x80, 0xf0, 0x00, 0x00, 0x0f, 0x3c, 0x3c, 0xe7, 0x83, 0xde, 0xf1, 0xe1, + 0x80, 0x1a, 0x00, 0xe0, 0x00, 0x00, 0x0f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x26, 0x00, 0x40, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x80, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1c, 0x03, 0xc0, 0x20, 0x10, 0x00, 0x01, - 0x83, 0x24, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92, 0x02, 0x20, 0x00, 0x10, 0x00, 0x01, - 0x02, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x02, 0x23, 0x27, 0x39, 0x8c, 0xe1, - 0x06, 0x38, 0x00, 0x00, 0x00, 0x00, 0x03, 0x11, 0x03, 0xc2, 0x24, 0x92, 0x49, 0x01, - 0x04, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x02, 0x02, 0x24, 0x93, 0xc8, 0xc1, - 0x0d, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92, 0x02, 0x02, 0x24, 0x92, 0x08, 0x21, - 0x08, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1c, 0x02, 0x02, 0x24, 0x99, 0xc9, 0xc1, - 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1c, 0x03, 0xc0, 0x20, 0x10, 0x00, 0x01, + 0x83, 0x24, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92, 0x02, 0x20, 0x00, 0x10, 0x00, 0x01, + 0x02, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x02, 0x23, 0x27, 0x39, 0x8c, 0xe1, + 0x06, 0x38, 0x00, 0x00, 0x00, 0x00, 0x03, 0x11, 0x03, 0xc2, 0x24, 0x92, 0x49, 0x01, + 0x04, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x02, 0x02, 0x24, 0x93, 0xc8, 0xc1, + 0x0d, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92, 0x02, 0x02, 0x24, 0x92, 0x08, 0x21, + 0x08, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1c, 0x02, 0x02, 0x24, 0x99, 0xc9, 0xc1, + 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x10, 0x30, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x0f, 0xe0, 0x0f, 0x00, 0x01, - 0x30, 0x20, 0x00, 0x37, 0x00, 0x00, 0x00, 0x12, 0x24, 0x08, 0x10, 0x09, 0x00, 0x01, - 0x20, 0x30, 0x00, 0x6d, 0x80, 0x00, 0x00, 0x12, 0x24, 0x09, 0x88, 0x09, 0x00, 0x01, - 0x10, 0x18, 0x1f, 0x60, 0xc0, 0x00, 0x00, 0x12, 0x24, 0x09, 0x48, 0x09, 0x00, 0x01, - 0x30, 0x0c, 0x39, 0xe0, 0x60, 0x00, 0x00, 0x12, 0x24, 0x09, 0x90, 0x09, 0x00, 0x01, - 0x30, 0x07, 0x90, 0x70, 0x60, 0x00, 0x00, 0x12, 0x24, 0x08, 0x60, 0x09, 0x00, 0x01, - 0x10, 0x16, 0xf0, 0x18, 0x20, 0x00, 0x00, 0x12, 0x24, 0x08, 0x10, 0x09, 0x00, 0x01, - 0x1a, 0x10, 0x60, 0x08, 0x30, 0x00, 0x00, 0x12, 0x24, 0x09, 0xc8, 0x09, 0x00, 0x01, - 0x0b, 0x09, 0x80, 0x00, 0x30, 0x00, 0x00, 0x12, 0x24, 0x09, 0x24, 0x09, 0x00, 0x01, - 0x0e, 0x07, 0x80, 0x00, 0x10, 0x00, 0x00, 0x13, 0xe4, 0x89, 0xc4, 0x89, 0xf9, 0x01, - 0x06, 0x1e, 0x40, 0x10, 0x10, 0x00, 0x00, 0x10, 0x05, 0xc8, 0x09, 0xc8, 0x0b, 0x81, - 0x06, 0x00, 0x40, 0x20, 0x10, 0x00, 0x00, 0x0f, 0xf8, 0x8f, 0xf0, 0x8f, 0xf9, 0x01, - 0x03, 0x80, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x01, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x10, 0x30, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x0f, 0xe0, 0x0f, 0x00, 0x01, + 0x30, 0x20, 0x00, 0x37, 0x00, 0x00, 0x00, 0x12, 0x24, 0x08, 0x10, 0x09, 0x00, 0x01, + 0x20, 0x30, 0x00, 0x6d, 0x80, 0x00, 0x00, 0x12, 0x24, 0x09, 0x88, 0x09, 0x00, 0x01, + 0x10, 0x18, 0x1f, 0x60, 0xc0, 0x00, 0x00, 0x12, 0x24, 0x09, 0x48, 0x09, 0x00, 0x01, + 0x30, 0x0c, 0x39, 0xe0, 0x60, 0x00, 0x00, 0x12, 0x24, 0x09, 0x90, 0x09, 0x00, 0x01, + 0x30, 0x07, 0x90, 0x70, 0x60, 0x00, 0x00, 0x12, 0x24, 0x08, 0x60, 0x09, 0x00, 0x01, + 0x10, 0x16, 0xf0, 0x18, 0x20, 0x00, 0x00, 0x12, 0x24, 0x08, 0x10, 0x09, 0x00, 0x01, + 0x1a, 0x10, 0x60, 0x08, 0x30, 0x00, 0x00, 0x12, 0x24, 0x09, 0xc8, 0x09, 0x00, 0x01, + 0x0b, 0x09, 0x80, 0x00, 0x30, 0x00, 0x00, 0x12, 0x24, 0x09, 0x24, 0x09, 0x00, 0x01, + 0x0e, 0x07, 0x80, 0x00, 0x10, 0x00, 0x00, 0x13, 0xe4, 0x89, 0xc4, 0x89, 0xf9, 0x01, + 0x06, 0x1e, 0x40, 0x10, 0x10, 0x00, 0x00, 0x10, 0x05, 0xc8, 0x09, 0xc8, 0x0b, 0x81, + 0x06, 0x00, 0x40, 0x20, 0x10, 0x00, 0x00, 0x0f, 0xf8, 0x8f, 0xf0, 0x8f, 0xf9, 0x01, + 0x03, 0x80, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; - - From 1a111180de9fcf3e0699a267c52a7ccc1d8e4463 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 18:22:31 -0500 Subject: [PATCH 7/8] Clean up set_heaters_for_bltouch --- Marlin/Marlin_main.cpp | 78 ++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f802a8fc35..1721bd19f8 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2060,57 +2060,58 @@ static void clean_up_after_endstop_or_probe_move() { #endif #if ENABLED(BLTOUCH) + void bltouch_command(int angle) { servo[Z_ENDSTOP_SERVO_NR].move(angle); // Give the BL-Touch the command and wait safe_delay(BLTOUCH_DELAY); } - // - // The BL-Touch probes have a HAL effect sensor. The high currents switching - // on and off cause big magnetic fields that can affect the repeatability of the - // sensor. So, for BL-Touch probes, we turn off the heaters during the actual probe. - // And then we quickly turn them back on after we have sampled the point - // - #if ENABLED(BLTOUCH_HEATERS_OFF) - void turn_heaters_on_or_off_for_bltouch(const bool deploy) { - static int8_t bltouch_recursion_cnt=0; - static millis_t last_emi_protection=0; - static float temps_at_entry[HOTENDS]; - #if HAS_TEMP_BED - static float bed_temp_at_entry; - #endif + /** + * BLTouch probes have a Hall effect sensor. The high currents switching + * on and off cause a magnetic field that can affect the repeatability of the + * sensor. So for BLTouch probes, heaters are turned off during the probe, + * then quickly turned back on after the point is sampled. + */ + #if ENABLED(BLTOUCH_HEATERS_OFF) - if (deploy && bltouch_recursion_cnt>0) // if already in the correct state, we don't need to do anything - return; // with the heaters. - if (!deploy && bltouch_recursion_cnt<1) // if already in the correct state, we don't need to do anything - return; // with the heaters. - - if (deploy) { - bltouch_recursion_cnt++; - last_emi_protection = millis(); - HOTEND_LOOP() temps_at_entry[e] = thermalManager.degTargetHotend(e); // save the current target temperatures - HOTEND_LOOP() thermalManager.setTargetHotend(0, e); // so we know what to restore them to. + bool set_heaters_for_bltouch(const bool deploy) { + static bool heaters_were_disabled = false; + static millis_t next_emi_protection; + static float temps_at_entry[HOTENDS]; #if HAS_TEMP_BED - bed_temp_at_entry = thermalManager.degTargetBed(); - thermalManager.setTargetBed(0.0); + static float bed_temp_at_entry; #endif - } - else { - bltouch_recursion_cnt--; // the heaters are only turned back on - if (bltouch_recursion_cnt==0 && ((last_emi_protection+20000L)>millis())) { // if everything is perfect. It is expected - HOTEND_LOOP() thermalManager.setTargetHotend(temps_at_entry[e], e); // that the bltouch_recursion_cnt is zero and - #if HAS_TEMP_BED // that the heaters were shut off less than - thermalManager.setTargetBed(bed_temp_at_entry); // 20 seconds ago + + // If called out of order or far apart something is seriously wrong + if (deploy == heaters_were_disabled + || (next_emi_protection && ELAPSED(millis(), next_emi_protection))) + kill(PSTR(MSG_KILLED)); + + if (deploy) { + next_emi_protection = millis() + 20 * 1000UL; + HOTEND_LOOP() { + temps_at_entry[e] = thermalManager.degTargetHotend(e); + thermalManager.setTargetHotend(0, e); + } + #if HAS_TEMP_BED + bed_temp_at_entry = thermalManager.degTargetBed(); + thermalManager.setTargetBed(0); + #endif + } + else { + HOTEND_LOOP() thermalManager.setTargetHotend(temps_at_entry[e], e); + #if HAS_TEMP_BED + thermalManager.setTargetBed(bed_temp_at_entry); #endif } } - } - #endif + + #endif // BLTOUCH_HEATERS_OFF void set_bltouch_deployed(const bool deploy) { #if ENABLED(BLTOUCH_HEATERS_OFF) - turn_heaters_on_or_off_for_bltouch(deploy); + set_heaters_for_bltouch(deploy); #endif if (deploy && TEST_BLTOUCH()) { // If BL-Touch says it's triggered bltouch_command(BLTOUCH_RESET); // try to reset it. @@ -2134,7 +2135,8 @@ static void clean_up_after_endstop_or_probe_move() { } #endif } - #endif + + #endif // BLTOUCH // returns false for ok and true for failure bool set_probe_deployed(bool deploy) { @@ -2147,7 +2149,7 @@ static void clean_up_after_endstop_or_probe_move() { #endif #if ENABLED(BLTOUCH) && ENABLED(BLTOUCH_HEATERS_OFF) - turn_heaters_on_or_off_for_bltouch(deploy); + set_heaters_for_bltouch(deploy); #endif if (endstops.z_probe_enabled == deploy) return false; From 2cc9774f34e39802be01542dc2d6c9a8dc650a0e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 18:41:18 -0500 Subject: [PATCH 8/8] Apply bltouch_menu As proffered in #6252 --- Marlin/language_en.h | 3 +++ Marlin/ultralcd.cpp | 29 +++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Marlin/language_en.h b/Marlin/language_en.h index cbc54d9544..35a0cbb891 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -408,6 +408,9 @@ #ifndef MSG_ZPROBE_OUT #define MSG_ZPROBE_OUT _UxGT("Z probe out. bed") #endif +#ifndef MSG_BLTOUCH + #define MSG_BLTOUCH _UxGT("BLTouch") +#endif #ifndef MSG_BLTOUCH_SELFTEST #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Self-Test") #endif diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 608dab5c63..39536abf0c 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -34,10 +34,6 @@ #include "buzzer.h" #endif -#if ENABLED(BLTOUCH) - #include "endstops.h" -#endif - #if ENABLED(PRINTCOUNTER) #include "printcounter.h" #include "duration_t.h" @@ -723,6 +719,28 @@ void kill_screen(const char* lcd_msg) { #endif // MENU_ITEM_CASE_LIGHT + #if ENABLED(BLTOUCH) + + /** + * + * "BLTouch" submenu + * + */ + static void bltouch_menu() { + START_MENU(); + // + // ^ Main + // + MENU_BACK(MSG_MAIN); + MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET))); + MENU_ITEM(gcode, MSG_BLTOUCH_SELFTEST, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_SELFTEST))); + MENU_ITEM(gcode, MSG_BLTOUCH_DEPLOY, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_DEPLOY))); + MENU_ITEM(gcode, MSG_BLTOUCH_STOW, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_STOW))); + END_MENU(); + } + + #endif // BLTOUCH + #if ENABLED(LCD_PROGRESS_BAR_TEST) static void progress_bar_test() { @@ -792,8 +810,7 @@ void kill_screen(const char* lcd_msg) { #endif #if ENABLED(BLTOUCH) - if (!endstops.z_probe_enabled && TEST_BLTOUCH()) - MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET))); + MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu); #endif if (planner.movesplanned() || IS_SD_PRINTING) {