From 66370006bbfdbc3d09be16214a4375e22a1e8e89 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Wed, 14 Feb 2018 17:31:25 -0600 Subject: [PATCH] Fix G26 Circles... (#9638) Will get this duplicated in bugfix_2.0.0 tomorrow... --- Marlin/G26_Mesh_Validation_Tool.cpp | 68 ++++++++----------- .../FolgerTech/i3-2020/Configuration.h | 51 ++++++++++---- .../FolgerTech/i3-2020/Configuration_adv.h | 15 ++-- 3 files changed, 70 insertions(+), 64 deletions(-) diff --git a/Marlin/G26_Mesh_Validation_Tool.cpp b/Marlin/G26_Mesh_Validation_Tool.cpp index 2de3b4f3c5..e5a71eccc5 100644 --- a/Marlin/G26_Mesh_Validation_Tool.cpp +++ b/Marlin/G26_Mesh_Validation_Tool.cpp @@ -141,7 +141,7 @@ // Private functions static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16]; - float g26_e_axis_feedrate = 0.020, + float g26_e_axis_feedrate = 0.025, random_deviation = 0.0; static bool g26_retracted = false; // Track the retracted state of the nozzle so mismatched @@ -589,8 +589,8 @@ 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; } } @@ -736,18 +736,19 @@ lcd_external_control = true; #endif - //debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern.")); +// debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern.")); /** * 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 { @@ -765,32 +766,26 @@ // 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 @@ -811,19 +806,10 @@ 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. + MYSERIAL0.flush(); // G26 takes a long time to complete. PronterFace can + // over run the serial character buffer with M105's without + // this fix } if (look_for_lines_to_connect()) goto LEAVE; diff --git a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration.h b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration.h index 6fd7ff7f32..d6f704eaf5 100644 --- a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration.h @@ -59,14 +59,14 @@ //============================= DELTA Printer =============================== //=========================================================================== // For a Delta printer start with one of the configuration files in the -// example_configurations/delta directory and customize for your machine. +// config/examples/delta directory and customize for your machine. // //=========================================================================== //============================= SCARA Printer =============================== //=========================================================================== // For a SCARA printer start with the configuration files in -// example_configurations/SCARA and customize for your machine. +// config/examples/SCARA and customize for your machine. // // @section info @@ -100,12 +100,21 @@ /** * Select the serial port on the board to use for communication with the host. * This allows the connection of wireless adapters (for instance) to non-default port pins. - * Serial port 0 is always used by the Arduino bootloader regardless of this setting. + * Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader. * - * :[0, 1, 2, 3, 4, 5, 6, 7] + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] */ #define SERIAL_PORT 0 +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if avaialble. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +#define SERIAL_PORT_2 -1 + /** * This setting determines the communication speed of the printer. * @@ -128,7 +137,7 @@ // 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) @@ -555,7 +564,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 @@ -563,7 +572,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 @@ -704,7 +713,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.30 // Z offset: -below +above [the nozzle] // X and Y axis travel speed (mm/m) between probes #define XY_PROBE_SPEED 7500 @@ -734,8 +743,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 @@ -806,8 +815,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 /** @@ -910,7 +919,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) /** @@ -1149,7 +1158,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 @@ -1189,7 +1198,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 /** @@ -1438,6 +1447,12 @@ // Enable one of the following options to specify your controller. // +// +// Original RADDS LCD Display+Encoder+SDCardReader +// http://doku.radds.org/dokumentation/lcd-display/ +// +//#define RADDS_DISPLAY + // // ULTIMAKER Controller. // @@ -1666,6 +1681,12 @@ //#define MKS_12864OLED // Uses the SH1106 controller (default) //#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller +// +// AZSMZ 12864 LCD with SD +// https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html +// +//#define AZSMZ_12864 + // Silvergate GLCD controller // http://github.com/android444/Silvergate // diff --git a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h index c76c2c3b0d..56668eb8d8 100644 --- a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h @@ -458,8 +458,7 @@ //#define DIGIPOT_MCP4018 // Requires library from https://github.com/stawel/SlowSoftI2CMaster #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 -// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS. -// These correspond to the physical drivers, so be mindful if the order is changed. +// Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS #define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO //=========================================================================== @@ -1581,17 +1580,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