From c78e1c0f235bcad97fc3adda0d7cfa96b145d2eb Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Thu, 15 Feb 2018 11:15:15 -0600 Subject: [PATCH] Fix G26 Circles... (#9641) * Fix G26 Circles... --- .../FolgerTech/i3-2020/Configuration.h | 26 ++++---- .../FolgerTech/i3-2020/Configuration_adv.h | 12 ++-- Marlin/src/gcode/bedlevel/G26.cpp | 59 +++++++------------ 3 files changed, 41 insertions(+), 56 deletions(-) diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h index 2fc6ee55f..113a3b653 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h @@ -132,13 +132,13 @@ // 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_RE_ARM_EFB // For people switching over to the Panucatt Re-ARM board -//#define MOTHERBOARD BOARD_RAMPS_14_EFB // For unmodified printers using Atmega-2560 and RAMPS boards. +//#define MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EFB // For people switching over to the Panucatt Re-ARM board + #define MOTHERBOARD BOARD_RAMPS_14_EFB // For unmodified printers using Atmega-2560 and RAMPS boards. #endif // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -#define CUSTOM_MACHINE_NAME "FT-2020 v5" +#define CUSTOM_MACHINE_NAME "FT-2020 v9" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -565,7 +565,7 @@ * Override with M203 * X, Y, Z, E0 [, E1[, E2[, E3[, E4]]]] */ -#define DEFAULT_MAX_FEEDRATE { 250, 250, 6, 17 } +#define DEFAULT_MAX_FEEDRATE { 250, 250, 2, 17 } /** * Default Max Acceleration (change/s) change = mm/s @@ -573,7 +573,7 @@ * Override with M201 * X, Y, Z, E0 [, E1[, E2[, E3[, E4]]]] */ -#define DEFAULT_MAX_ACCELERATION { 1000, 1000, 10, 750 } +#define DEFAULT_MAX_ACCELERATION { 1000, 1000, 4, 750 } /** * Default Acceleration (change/s) change = mm/s @@ -714,7 +714,7 @@ */ #define X_PROBE_OFFSET_FROM_EXTRUDER 38 // X offset: -left +right [of the nozzle] #define Y_PROBE_OFFSET_FROM_EXTRUDER -7 // Y offset: -front +behind [the nozzle] -#define Z_PROBE_OFFSET_FROM_EXTRUDER -10.4 // Z offset: -below +above [the nozzle] +#define Z_PROBE_OFFSET_FROM_EXTRUDER -10.35 // Z offset: -below +above [the nozzle] // X and Y axis travel speed (mm/m) between probes #define XY_PROBE_SPEED 7500 @@ -744,8 +744,8 @@ * Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle. * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle. */ -#define Z_CLEARANCE_DEPLOY_PROBE 5 // Z Clearance for Deploy/Stow -#define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points +#define Z_CLEARANCE_DEPLOY_PROBE 3 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 3 // Z Clearance between probe points // For M851 give a range for adjusting the Z probe offset #define Z_PROBE_OFFSET_RANGE_MIN -20 @@ -816,8 +816,8 @@ #define X_MIN_POS 6 #define Y_MIN_POS 3 #define Z_MIN_POS 0 -#define X_MAX_POS 212 -#define Y_MAX_POS 190 +#define X_MAX_POS 207 +#define Y_MAX_POS 182 #define Z_MAX_POS 175 /** @@ -920,7 +920,7 @@ // For Cartesian machines, instead of dividing moves on mesh boundaries, // split up moves into short segments like a Delta. This follows the // contours of the bed more closely than edge-to-edge straight moves. - #define SEGMENT_LEVELED_MOVES +//#define SEGMENT_LEVELED_MOVES #define LEVELED_SEGMENT_LENGTH 5.0 // (mm) Length of all segments (except the last one) /** @@ -1159,7 +1159,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage +#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1199,7 +1199,7 @@ // Specify a park position as { X, Y, Z } #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 } #define NOZZLE_PARK_XY_FEEDRATE 100 // X and Y axes feedrate in mm/s (also used for delta printers Z axis) - #define NOZZLE_PARK_Z_FEEDRATE 8 // Z axis feedrate in mm/s (not used for delta printers) + #define NOZZLE_PARK_Z_FEEDRATE 5 // Z axis feedrate in mm/s (not used for delta printers) #endif /** diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index f3ac9bd90..0ed00612d 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -1581,17 +1581,17 @@ */ #define MAX7219_DEBUG #if ENABLED(MAX7219_DEBUG) -//#define MAX7219_CLK_PIN 64 // on RAMPS // Configuration of the 3 pins to control the display -//#define MAX7219_DIN_PIN 57 // on RAMPS -//#define MAX7219_LOAD_PIN 44 // on RAMPS +#define MAX7219_CLK_PIN 64 // on RAMPS // Configuration of the 3 pins to control the display +#define MAX7219_DIN_PIN 57 // on RAMPS +#define MAX7219_LOAD_PIN 44 // on RAMPS //#define MAX7219_CLK_PIN 77 // on Re-ARM // Configuration of the 3 pins to control the display //#define MAX7219_DIN_PIN 78 // on Re-ARM //#define MAX7219_LOAD_PIN 79 // on Re-ARM - #define MAX7219_CLK_PIN 30 // for RAMPS E1 // Configuration of the 3 pins to control the display - #define MAX7219_DIN_PIN 34 // for RAMPS E1 - #define MAX7219_LOAD_PIN 36 // for RAMPS E1 +//#define MAX7219_CLK_PIN 30 // for RAMPS E1 // Configuration of the 3 pins to control the display +//#define MAX7219_DIN_PIN 34 // for RAMPS E1 +//#define MAX7219_LOAD_PIN 36 // for RAMPS E1 /** * Sample debug features diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 1eebbd75d..d52deccd2 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -586,8 +586,8 @@ void GcodeSuite::G26() { if (parser.seenval('B')) { g26_bed_temp = parser.value_celsius(); - if (!WITHIN(g26_bed_temp, 15, 140)) { - SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible."); + if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, 140)) { + SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible (40-140C)."); return; } } @@ -737,14 +737,15 @@ void GcodeSuite::G26() { /** * Pre-generate radius offset values at 30 degree intervals to reduce CPU load. - * All angles are offset by 15 degrees to allow for a smaller table. */ - #define A_CNT ((360 / 30) / 2) - #define _COS(A) (trig_table[((A + A_CNT * 8) % A_CNT)] * (A >= A_CNT ? -1 : 1)) + + #define A_CNT ((360 / 30) / 2) // must be a multiple of 2 for _COS() and _SIN() macro to work correctly! + #define NEGATION_of_COS_TABLE(A) (((A + A_CNT * 16) % (A_CNT * 2)) >= A_CNT ? -1 : 1) + #define _COS(A) (trig_table[(A + A_CNT * 16) % A_CNT] * NEGATION_of_COS_TABLE(A)) #define _SIN(A) (-_COS((A + A_CNT / 2) % (A_CNT * 2))) float trig_table[A_CNT]; for (uint8_t i = 0; i < A_CNT; i++) - trig_table[i] = INTERSECTION_CIRCLE_RADIUS * cos(RADIANS(i * 30 + 15)); + trig_table[i] = INTERSECTION_CIRCLE_RADIUS * cos(RADIANS(i * 30)); mesh_index_pair location; do { @@ -762,32 +763,26 @@ void GcodeSuite::G26() { // Determine where to start and end the circle, // which is always drawn counter-clockwise. const uint8_t xi = location.x_index, yi = location.y_index; - const bool f = yi == 0, r = xi == GRID_MAX_POINTS_X - 1, b = yi == GRID_MAX_POINTS_Y - 1; - int8_t start_ind = -2, end_ind = 10; // Assume a full circle (from 4:30 to 4:30) - if (xi == 0) { // Left edge? Just right half. - start_ind = f ? 0 : -3; // 05:30 (02:30 for front-left) - end_ind = b ? -1 : 2; // 12:30 (03:30 for back-left) + const bool f = yi == 0, r = xi >= GRID_MAX_POINTS_X - 1, b = yi >= GRID_MAX_POINTS_Y - 1; + int8_t start_ind = -2, end_ind = 9; // Assume a full circle (from 5:00 to 5:00) + if (xi == 0) { // Left edge? Just right half. + start_ind = f ? 0 : -3; // 03:00 to 12:00 for front-left + end_ind = b ? 0 : 2; // 06:00 to 03:00 for back-left } - else if (r) { // Right edge? Just left half. - start_ind = f ? 5 : 3; // 11:30 (09:30 for front-right) - end_ind = b ? 6 : 8; // 06:30 (08:30 for back-right) + else if (r) { // Right edge? Just left half. + start_ind = b ? 6 : 3; // 12:00 to 09:00 for front-right + end_ind = f ? 5 : 8; // 09:00 to 06:00 for back-right } - else if (f) { // Front edge? Just back half. - start_ind = 0; // 02:30 - end_ind = 5; // 09:30 + else if (f) { // Front edge? Just back half. + start_ind = 0; // 03:00 + end_ind = 5; // 09:00 } - else if (b) { // Back edge? Just front half. - start_ind = 6; // 08:30 - end_ind = 11; // 03:30 - } - if (g26_debug_flag) { - SERIAL_ECHOPAIR(" Doing circle at: (xi=", xi); - SERIAL_ECHOPAIR(", yi=", yi); - SERIAL_CHAR(')'); - SERIAL_EOL(); + else if (b) { // Back edge? Just front half. + start_ind = 6; // 09:00 + end_ind = 11; // 03:00 } - for (int8_t ind = start_ind; ind < end_ind; ind++) { + for (int8_t ind = start_ind; ind <= end_ind; ind++) { #if ENABLED(NEWPANEL) if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation @@ -808,16 +803,6 @@ void GcodeSuite::G26() { ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1); #endif - //if (g26_debug_flag) { - // char ccc, *cptr, seg_msg[50], seg_num[10]; - // strcpy(seg_msg, " segment: "); - // strcpy(seg_num, " \n"); - // cptr = (char*) "01234567890ABCDEF????????"; - // ccc = cptr[tmp_div_30]; - // seg_num[1] = ccc; - // strcat(seg_msg, seg_num); - // debug_current_and_destination(seg_msg); - //} print_line_from_here_to_there(rx, ry, g26_layer_height, xe, ye, g26_layer_height); MYSERIAL0.flush(); // Prevent host M105 buffer overrun.