From a9f8e518bf67190207fb318a353b2cab958a8e92 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 23 Jun 2017 14:48:02 -0500 Subject: [PATCH 1/6] Fix FILAMENT_WIDTH_SENSOR infinite loop issue Addressing #6992 and #5851 --- Marlin/Marlin.h | 6 +++--- Marlin/Marlin_main.cpp | 10 +++++----- Marlin/planner.cpp | 4 ++-- Marlin/temperature.cpp | 6 +++--- Marlin/temperature.h | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 6bb45698e..307dd370d 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -370,9 +370,9 @@ extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ]; extern bool filament_sensor; // Flag that filament sensor readings should control extrusion extern float filament_width_nominal, // Theoretical filament diameter i.e., 3.00 or 1.75 filament_width_meas; // Measured filament diameter - extern int8_t measurement_delay[]; // Ring buffer to delay measurement - extern int filwidth_delay_index[2]; // Ring buffer indexes. Used by planner, temperature, and main code - extern int meas_delay_cm; // Delay distance + extern uint8_t meas_delay_cm, // Delay distance + measurement_delay[]; // Ring buffer to delay measurement + extern int8_t filwidth_delay_index[2]; // Ring buffer indexes. Used by planner, temperature, and main code #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f30291f2e..d5c0cbf81 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -630,9 +630,9 @@ float cartes[XYZ] = { 0 }; bool filament_sensor = false; // M405 turns on filament sensor control. M406 turns it off. float filament_width_nominal = DEFAULT_NOMINAL_FILAMENT_DIA, // Nominal filament width. Change with M404. filament_width_meas = DEFAULT_MEASURED_FILAMENT_DIA; // Measured filament diameter - int8_t measurement_delay[MAX_MEASUREMENT_DELAY + 1]; // Ring buffer to delayed measurement. Store extruder factor after subtracting 100 - int filwidth_delay_index[2] = { 0, -1 }; // Indexes into ring buffer - int meas_delay_cm = MEASUREMENT_DELAY_CM; // Distance delay setting + uint8_t meas_delay_cm = MEASUREMENT_DELAY_CM, // Distance delay setting + measurement_delay[MAX_MEASUREMENT_DELAY + 1]; // Ring buffer to delayed measurement. Store extruder factor after subtracting 100 + int8_t filwidth_delay_index[2] = { 0, -1 }; // Indexes into ring buffer #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) @@ -8898,11 +8898,11 @@ inline void gcode_M400() { stepper.synchronize(); } inline void gcode_M405() { // This is technically a linear measurement, but since it's quantized to centimeters and is a different unit than // everything else, it uses parser.value_int() instead of parser.value_linear_units(). - if (parser.seen('D')) meas_delay_cm = parser.value_int(); + if (parser.seen('D')) meas_delay_cm = parser.value_byte(); NOMORE(meas_delay_cm, MAX_MEASUREMENT_DELAY); if (filwidth_delay_index[1] == -1) { // Initialize the ring buffer if not done since startup - const int temp_ratio = thermalManager.widthFil_to_size_ratio() - 100; // -100 to scale within a signed byte + const uint8_t temp_ratio = thermalManager.widthFil_to_size_ratio() - 100; // -100 to scale within a signed byte for (uint8_t i = 0; i < COUNT(measurement_delay); ++i) measurement_delay[i] = temp_ratio; diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 5897e4fe6..8cac74f14 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -1103,12 +1103,12 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const while (filwidth_delay_dist >= MMD_MM) filwidth_delay_dist -= MMD_MM; // Convert into an index into the measurement array - filwidth_delay_index[0] = (int)(filwidth_delay_dist * 0.1 + 0.0001); + filwidth_delay_index[0] = int8_t(filwidth_delay_dist * 0.1); // If the index has changed (must have gone forward)... if (filwidth_delay_index[0] != filwidth_delay_index[1]) { filwidth_e_count = 0; // Reset the E movement counter - const int8_t meas_sample = thermalManager.widthFil_to_size_ratio() - 100; // Subtract 100 to reduce magnitude - to store in a signed char + const uint8_t meas_sample = thermalManager.widthFil_to_size_ratio() - 100; // Subtract 100 to reduce magnitude - to store in a signed char do { filwidth_delay_index[1] = (filwidth_delay_index[1] + 1) % MMD_CM; // The next unused slot measurement_delay[filwidth_delay_index[1]] = meas_sample; // Store the measurement diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 99aec7f4d..6111bab44 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -180,7 +180,7 @@ int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TE #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) - int16_t Temperature::meas_shift_index; // Index of a delayed sample in buffer + int8_t Temperature::meas_shift_index; // Index of a delayed sample in buffer #endif #if HAS_AUTO_FAN @@ -196,7 +196,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS], #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) - int Temperature::current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only + uint16_t Temperature::current_raw_filwidth = 0; // Measured filament diameter - one extruder only #endif #if ENABLED(PROBING_HEATERS_OFF) @@ -957,7 +957,7 @@ void Temperature::updateTemperaturesFromRawValues() { // Convert raw Filament Width to millimeters float Temperature::analog2widthFil() { - return current_raw_filwidth / 16383.0 * 5.0; + return current_raw_filwidth * 5.0 * (1.0 / 16383.0); //return current_raw_filwidth; } diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 943768578..60a85684a 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -247,7 +247,7 @@ class Temperature { #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) - static int16_t meas_shift_index; // Index of a delayed sample in buffer + static int8_t meas_shift_index; // Index of a delayed sample in buffer #endif #if HAS_AUTO_FAN @@ -255,7 +255,7 @@ class Temperature { #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) - static int current_raw_filwidth; //Holds measured filament diameter - one extruder only + static uint16_t current_raw_filwidth; // Measured filament diameter - one extruder only #endif #if ENABLED(PROBING_HEATERS_OFF) From ee7163fd3ad355b5d4960ebf9ee3655e48a7ecc4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 15 Jun 2017 11:52:23 -0500 Subject: [PATCH 2/6] Fix pinsDebug compile errors --- Marlin/pinsDebug.h | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/Marlin/pinsDebug.h b/Marlin/pinsDebug.h index 8846dabf2..495513a89 100644 --- a/Marlin/pinsDebug.h +++ b/Marlin/pinsDebug.h @@ -41,7 +41,7 @@ bool endstop_monitor_flag = false; // first pass - put the name strings into FLASH -#define _ADD_PIN_2(PIN_NAME, ENTRY_NAME) static const unsigned char ENTRY_NAME[] PROGMEM = { PIN_NAME }; +#define _ADD_PIN_2(PIN_NAME, ENTRY_NAME) static const char ENTRY_NAME[] PROGMEM = { PIN_NAME }; #define _ADD_PIN(PIN_NAME, COUNTER) _ADD_PIN_2(PIN_NAME, entry_NAME_##COUNTER) #define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER) #define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER) @@ -64,12 +64,18 @@ bool endstop_monitor_flag = false; #undef REPORT_NAME_DIGITAL #undef REPORT_NAME_ANALOG -#define _ADD_PIN_2(ENTRY_NAME, NAME, IS_DIGITAL) { (const char*)ENTRY_NAME, (const char*)NAME, (const char*)IS_DIGITAL }, +#define _ADD_PIN_2(ENTRY_NAME, NAME, IS_DIGITAL) { ENTRY_NAME, NAME, IS_DIGITAL }, #define _ADD_PIN(NAME, COUNTER, IS_DIGITAL) _ADD_PIN_2(entry_NAME_##COUNTER, NAME, IS_DIGITAL) -#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(NAME, COUNTER, (uint8_t)1) -#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(analogInputToDigitalPin(NAME), COUNTER, 0) +#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(NAME, COUNTER, true) +#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(analogInputToDigitalPin(NAME), COUNTER, false) -const char* const pin_array[][3] PROGMEM = { +typedef struct { + const char * const name; + uint8_t pin; + bool is_digital; +} PinInfo; + +const PinInfo pin_array[] PROGMEM = { /** * [pin name] [pin number] [is digital or analog] 1 = digital, 0 = analog @@ -83,21 +89,19 @@ const char* const pin_array[][3] PROGMEM = { // manually add pins ... #if SERIAL_PORT == 0 #if AVR_ATmega2560_FAMILY - { RXD_NAME, 0, 1 }, - { TXD_NAME, 1, 1 }, + { RXD_NAME, 0, true }, + { TXD_NAME, 1, true }, #elif AVR_ATmega1284_FAMILY - { RXD_NAME, 8, 1 }, - { TXD_NAME, 9, 1 }, + { RXD_NAME, 8, true }, + { TXD_NAME, 9, true }, #endif #endif #include "pinsDebug_list.h" - #line 96 + #line 102 }; -#define n_array (sizeof(pin_array) / sizeof(char*)) / 3 - #define AVR_ATmega2560_FAMILY_PLUS_70 (MOTHERBOARD == BOARD_BQ_ZUM_MEGA_3D \ || MOTHERBOARD == BOARD_MIGHTYBOARD_REVE \ || MOTHERBOARD == BOARD_MINIRAMBO \ @@ -439,12 +443,12 @@ static void print_input_or_output(const bool isout) { } // pretty report with PWM info -inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = false,const char *start_string = "") { +inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = false, const char *start_string = "") { uint8_t temp_char; char *name_mem_pointer, buffer[30]; // for the sprintf statements bool found = false, multi_name_pin = false; - for (uint8_t x = 0; x < n_array; x++) { // scan entire array and report all instances of this pin - if (pgm_read_byte(&pin_array[x][1]) == pin) { + for (uint8_t x = 0; x < COUNT(pin_array); x++) { // scan entire array and report all instances of this pin + if (pgm_read_byte(&pin_array[x].pin) == pin) { if (found) multi_name_pin = true; found = true; if (!multi_name_pin) { // report digitial and analog pin number only on the first time through @@ -461,7 +465,7 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f SERIAL_CHAR('.'); SERIAL_ECHO_SP(26 + strlen(start_string)); // add padding if not the first instance found } - name_mem_pointer = (char*)pgm_read_word(&pin_array[x][0]); + name_mem_pointer = (char*)pgm_read_word(&pin_array[x].name); for (uint8_t y = 0; y < 28; y++) { // always print pin name temp_char = pgm_read_byte(name_mem_pointer + y); if (temp_char != 0) @@ -489,7 +493,7 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f else #endif { - if (!(pgm_read_byte(&pin_array[x][2]))) { + if (!(pgm_read_byte(&pin_array[x].is_digital))) { sprintf_P(buffer, PSTR("Analog in = %5d"), analogRead(pin - analogInputToDigitalPin(0))); SERIAL_ECHO(buffer); } From 786cdea124ab8dd5d2fa5b36bd7ed4696aafc81b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 22 Jun 2017 09:42:48 -0500 Subject: [PATCH 3/6] Ensure REPRAPWORLD_KEYPAD_MOVE_STEP is defined --- Marlin/Conditionals_LCD.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/Conditionals_LCD.h b/Marlin/Conditionals_LCD.h index bd6fc29de..ea998f2f1 100644 --- a/Marlin/Conditionals_LCD.h +++ b/Marlin/Conditionals_LCD.h @@ -108,6 +108,9 @@ #if ENABLED(REPRAPWORLD_KEYPAD) #define NEWPANEL + #if ENABLED(ULTIPANEL) && !defined(REPRAPWORLD_KEYPAD_MOVE_STEP) + #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 + #endif #endif #if ENABLED(RA_CONTROL_PANEL) From ed04d0b6be8666b661712746ee604defd714bae6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 22 Jun 2017 08:57:53 -0500 Subject: [PATCH 4/6] Label DualXMode enums --- Marlin/enum.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Marlin/enum.h b/Marlin/enum.h index 764e154cd..34c5bb68a 100644 --- a/Marlin/enum.h +++ b/Marlin/enum.h @@ -167,10 +167,13 @@ enum LCDViewAction { LCDVIEW_CALL_NO_REDRAW }; +/** + * Dual X Carriage modes. A Dual Nozzle can also do duplication. + */ #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) enum DualXMode { - DXC_FULL_CONTROL_MODE, - DXC_AUTO_PARK_MODE, + DXC_FULL_CONTROL_MODE, // DUAL_X_CARRIAGE only + DXC_AUTO_PARK_MODE, // DUAL_X_CARRIAGE only DXC_DUPLICATION_MODE }; #endif From 5fb0d401eb34984695bfb021fafd31ca6eef8727 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 22 Jun 2017 09:44:39 -0500 Subject: [PATCH 5/6] Formatting tweaks --- Marlin/Marlin_main.cpp | 8 +++++--- Marlin/ultralcd.cpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index d5c0cbf81..a2c0abdb7 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -73,7 +73,7 @@ * "M" Codes * * M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) - * M1 - Same as M0 + * M1 -> M0 * M3 - Turn laser/spindle on, set spindle/laser speed/power, set rotation to clockwise * M4 - Turn laser/spindle on, set spindle/laser speed/power, set rotation to counter-clockwise * M5 - Turn laser/spindle off @@ -3270,6 +3270,7 @@ inline void gcode_G0_G1( * G3 X20 Y12 R14 ; CCW circle with r=14 ending at X20 Y12 */ #if ENABLED(ARC_SUPPORT) + inline void gcode_G2_G3(bool clockwise) { if (IsRunning()) { @@ -3318,7 +3319,8 @@ inline void gcode_G0_G1( } } } -#endif + +#endif // ARC_SUPPORT /** * G4: Dwell S or P @@ -12201,7 +12203,7 @@ void prepare_move_to_destination() { #endif HOTEND_LOOP() max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e)); - bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led; + const bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led; if (new_led != red_led) { red_led = new_led; #if PIN_EXISTS(STAT_LED_RED) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 074923e1d..ed26888db 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -4001,7 +4001,7 @@ void kill_screen(const char* lcd_msg) { * */ #if ENABLED(REPRAPWORLD_KEYPAD) - void _reprapworld_keypad_move(AxisEnum axis, int16_t dir) { + void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) { move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; encoderPosition = dir; switch (axis) { From 80a232419d866c62c6cac4baf5204afdb352ba18 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 23 Jun 2017 14:28:28 -0500 Subject: [PATCH 6/6] CNC workspace planes and 'P' argument for G2/G3 --- .travis.yml | 4 +- Marlin/Configuration_adv.h | 14 +- Marlin/Marlin_main.cpp | 159 +++++++++++++----- Marlin/enum.h | 8 + .../Cartesio/Configuration_adv.h | 14 +- .../Felix/Configuration_adv.h | 14 +- .../FolgerTech-i3-2020/Configuration_adv.h | 14 +- .../Hephestos/Configuration_adv.h | 14 +- .../Hephestos_2/Configuration_adv.h | 14 +- .../K8200/Configuration_adv.h | 14 +- .../K8400/Configuration_adv.h | 14 +- .../M150/Configuration_adv.h | 14 +- .../RigidBot/Configuration_adv.h | 14 +- .../SCARA/Configuration_adv.h | 14 +- .../TAZ4/Configuration_adv.h | 14 +- .../TinyBoy2/Configuration_adv.h | 14 +- .../WITBOX/Configuration_adv.h | 14 +- .../FLSUN/auto_calibrate/Configuration_adv.h | 14 +- .../FLSUN/kossel_mini/Configuration_adv.h | 14 +- .../delta/generic/Configuration_adv.h | 14 +- .../delta/kossel_mini/Configuration_adv.h | 14 +- .../delta/kossel_pro/Configuration_adv.h | 14 +- .../delta/kossel_xl/Configuration_adv.h | 14 +- .../gCreate_gMax1.5+/Configuration_adv.h | 14 +- .../makibox/Configuration_adv.h | 14 +- .../tvrrug/Round2/Configuration_adv.h | 14 +- .../wt150/Configuration_adv.h | 14 +- 27 files changed, 370 insertions(+), 137 deletions(-) diff --git a/.travis.yml b/.travis.yml index 76edc5f87..d3ef785f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,14 +72,14 @@ script: - build_marlin # # Test 2 extruders (one MAX6675) and heated bed on basic RAMPS 1.4 - # plus a "Fix Mounted" Probe with Safe Homing + # plus a "Fix Mounted" Probe with Safe Homing and some arc options # - opt_set MOTHERBOARD BOARD_RAMPS_14_EEB - opt_set EXTRUDERS 2 - opt_set TEMP_SENSOR_0 -2 - opt_set TEMP_SENSOR_1 1 - opt_set TEMP_SENSOR_BED 1 - - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING + - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES - build_marlin # # ...with AUTO_BED_LEVELING_LINEAR, Z_MIN_PROBE_REPEATABILITY_TEST, and DEBUG_LEVELING_FEATURE diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 0ae9282f0..76ad8bec4 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -678,10 +678,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a2c0abdb7..de275d192 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -54,6 +54,9 @@ * G10 - Retract filament according to settings of M207 * G11 - Retract recover filament according to settings of M208 * G12 - Clean tool + * G17 - Select Plane XY (Requires CNC_WORKSPACE_PLANES) + * G18 - Select Plane ZX (Requires CNC_WORKSPACE_PLANES) + * G19 - Select Plane YZ (Requires CNC_WORKSPACE_PLANES) * G20 - Set input units to inches * G21 - Set input units to millimeters * G26 - Mesh Validation Pattern (Requires UBL_G26_MESH_VALIDATION) @@ -688,6 +691,10 @@ static bool send_ok[BUFSIZE]; millis_t lastUpdateMillis; #endif +#if ENABLED(CNC_WORKSPACE_PLANES) + static WorkspacePlane workspace_plane = PLANE_XY; +#endif + FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float_near(p); } FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); } @@ -3264,6 +3271,9 @@ inline void gcode_G0_G1( * X or Y must differ from the current XY. * Mixing R with I or J will throw an error. * + * - P specifies the number of full circles to do + * before the specified arc move. + * * Examples: * * G2 I10 ; CW circle centered at X+10 @@ -3288,27 +3298,39 @@ inline void gcode_G0_G1( float arc_offset[2] = { 0.0, 0.0 }; if (parser.seen('R')) { const float r = parser.value_linear_units(), - x1 = current_position[X_AXIS], y1 = current_position[Y_AXIS], - x2 = destination[X_AXIS], y2 = destination[Y_AXIS]; - if (r && (x2 != x1 || y2 != y1)) { + p1 = current_position[X_AXIS], q1 = current_position[Y_AXIS], + p2 = destination[X_AXIS], q2 = destination[Y_AXIS]; + if (r && (p2 != p1 || q2 != q1)) { const float e = clockwise ^ (r < 0) ? -1 : 1, // clockwise -1/1, counterclockwise 1/-1 - dx = x2 - x1, dy = y2 - y1, // X and Y differences + dx = p2 - p1, dy = q2 - q1, // X and Y differences d = HYPOT(dx, dy), // Linear distance between the points h = SQRT(sq(r) - sq(d * 0.5)), // Distance to the arc pivot-point - mx = (x1 + x2) * 0.5, my = (y1 + y2) * 0.5, // Point between the two points + mx = (p1 + p2) * 0.5, my = (q1 + q2) * 0.5, // Point between the two points sx = -dy / d, sy = dx / d, // Slope of the perpendicular bisector cx = mx + e * h * sx, cy = my + e * h * sy; // Pivot-point of the arc - arc_offset[X_AXIS] = cx - x1; - arc_offset[Y_AXIS] = cy - y1; + arc_offset[0] = cx - p1; + arc_offset[1] = cy - q1; } } else { - if (parser.seen('I')) arc_offset[X_AXIS] = parser.value_linear_units(); - if (parser.seen('J')) arc_offset[Y_AXIS] = parser.value_linear_units(); + if (parser.seen('I')) arc_offset[0] = parser.value_linear_units(); + if (parser.seen('J')) arc_offset[1] = parser.value_linear_units(); } if (arc_offset[0] || arc_offset[1]) { - // Send an arc to the planner + + #if ENABLED(ARC_P_CIRCLES) + // P indicates number of circles to do + int8_t circles_to_do = parser.seen('P') ? parser.value_byte() : 0; + if (!WITHIN(circles_to_do, 0, 100)) { + SERIAL_ERROR_START(); + SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS); + } + while (circles_to_do--) + plan_arc(current_position, arc_offset, clockwise); + #endif + + // Send the arc to the planner plan_arc(destination, arc_offset, clockwise); refresh_cmd_timeout(); } @@ -3408,6 +3430,25 @@ inline void gcode_G4() { } #endif +#if ENABLED(CNC_WORKSPACE_PLANES) + + void report_workspace_plane() { + SERIAL_ECHO_START(); + SERIAL_ECHOPGM("Workspace Plane "); + serialprintPGM(workspace_plane == PLANE_YZ ? PSTR("YZ\n") : workspace_plane == PLANE_ZX ? PSTR("ZX\n") : PSTR("XY\n")); + } + + /** + * G17: Select Plane XY + * G18: Select Plane ZX + * G19: Select Plane YZ + */ + inline void gcode_G17() { workspace_plane = PLANE_XY; } + inline void gcode_G18() { workspace_plane = PLANE_ZX; } + inline void gcode_G19() { workspace_plane = PLANE_YZ; } + +#endif // CNC_WORKSPACE_PLANES + #if ENABLED(INCH_MODE_SUPPORT) /** * G20: Set input mode to inches @@ -3722,6 +3763,10 @@ inline void gcode_G28(const bool always_home_all) { set_bed_leveling_enabled(false); #endif + #if ENABLED(CNC_WORKSPACE_PLANES) + workspace_plane = PLANE_XY; + #endif + // Always home with tool 0 active #if HOTENDS > 1 const uint8_t old_tool_index = active_extruder; @@ -10311,6 +10356,18 @@ void process_next_command() { break; #endif // NOZZLE_CLEAN_FEATURE + #if ENABLED(CNC_WORKSPACE_PLANES) + case 17: // G17: Select Plane XY + gcode_G17(); + break; + case 18: // G18: Select Plane ZX + gcode_G18(); + break; + case 19: // G19: Select Plane YZ + gcode_G19(); + break; + #endif // CNC_WORKSPACE_PLANES + #if ENABLED(INCH_MODE_SUPPORT) case 20: //G20: Inch Mode gcode_G20(); @@ -11922,6 +11979,12 @@ void prepare_move_to_destination() { } #if ENABLED(ARC_SUPPORT) + + #if N_ARC_CORRECTION < 1 + #undef N_ARC_CORRECTION + #define N_ARC_CORRECTION 1 + #endif + /** * Plan an arc in 2 dimensions * @@ -11936,26 +11999,36 @@ void prepare_move_to_destination() { float *offset, // Center of rotation relative to current_position uint8_t clockwise // Clockwise? ) { + #if ENABLED(CNC_WORKSPACE_PLANES) + AxisEnum p_axis, q_axis, l_axis; + switch (workspace_plane) { + case PLANE_XY: p_axis = X_AXIS; q_axis = Y_AXIS; l_axis = Z_AXIS; break; + case PLANE_ZX: p_axis = Z_AXIS; q_axis = X_AXIS; l_axis = Y_AXIS; break; + case PLANE_YZ: p_axis = Y_AXIS; q_axis = Z_AXIS; l_axis = X_AXIS; break; + } + #else + constexpr AxisEnum p_axis = X_AXIS, q_axis = Y_AXIS, l_axis = Z_AXIS; + #endif - float r_X = -offset[X_AXIS], // Radius vector from center to current location - r_Y = -offset[Y_AXIS]; + // Radius vector from center to current location + float r_P = -offset[0], r_Q = -offset[1]; - const float radius = HYPOT(r_X, r_Y), - center_X = current_position[X_AXIS] - r_X, - center_Y = current_position[Y_AXIS] - r_Y, - rt_X = logical[X_AXIS] - center_X, - rt_Y = logical[Y_AXIS] - center_Y, - linear_travel = logical[Z_AXIS] - current_position[Z_AXIS], + const float radius = HYPOT(r_P, r_Q), + center_P = current_position[p_axis] - r_P, + center_Q = current_position[q_axis] - r_Q, + rt_X = logical[p_axis] - center_P, + rt_Y = logical[q_axis] - center_Q, + linear_travel = logical[l_axis] - current_position[l_axis], extruder_travel = logical[E_AXIS] - current_position[E_AXIS]; // CCW angle of rotation between position and target from the circle center. Only one atan2() trig computation required. - float angular_travel = ATAN2(r_X * rt_Y - r_Y * rt_X, r_X * rt_X + r_Y * rt_Y); + float angular_travel = ATAN2(r_P * rt_Y - r_Q * rt_X, r_P * rt_X + r_Q * rt_Y); if (angular_travel < 0) angular_travel += RADIANS(360); if (clockwise) angular_travel -= RADIANS(360); - // Make a circle if the angular rotation is 0 - if (angular_travel == 0 && current_position[X_AXIS] == logical[X_AXIS] && current_position[Y_AXIS] == logical[Y_AXIS]) - angular_travel += RADIANS(360); + // Make a circle if the angular rotation is 0 and the target is current position + if (angular_travel == 0 && current_position[p_axis] == logical[p_axis] && current_position[q_axis] == logical[q_axis]) + angular_travel = RADIANS(360); const float mm_of_travel = HYPOT(angular_travel * radius, FABS(linear_travel)); if (mm_of_travel < 0.001) return; @@ -11998,7 +12071,7 @@ void prepare_move_to_destination() { cos_T = 1 - 0.5 * sq(theta_per_segment); // Small angle approximation // Initialize the linear axis - arc_target[Z_AXIS] = current_position[Z_AXIS]; + arc_target[l_axis] = current_position[l_axis]; // Initialize the extruder axis arc_target[E_AXIS] = current_position[E_AXIS]; @@ -12007,7 +12080,10 @@ void prepare_move_to_destination() { millis_t next_idle_ms = millis() + 200UL; - int8_t count = 0; + #if N_ARC_CORRECTION > 1 + int8_t count = N_ARC_CORRECTION; + #endif + for (uint16_t i = 1; i < segments; i++) { // Iterate (segments-1) times thermalManager.manage_heater(); @@ -12016,28 +12092,33 @@ void prepare_move_to_destination() { idle(); } - if (++count < N_ARC_CORRECTION) { - // Apply vector rotation matrix to previous r_X / 1 - const float r_new_Y = r_X * sin_T + r_Y * cos_T; - r_X = r_X * cos_T - r_Y * sin_T; - r_Y = r_new_Y; - } - else { + #if N_ARC_CORRECTION > 1 + if (--count) { + // Apply vector rotation matrix to previous r_P / 1 + const float r_new_Y = r_P * sin_T + r_Q * cos_T; + r_P = r_P * cos_T - r_Q * sin_T; + r_Q = r_new_Y; + } + else + #endif + { + #if N_ARC_CORRECTION > 1 + count = N_ARC_CORRECTION; + #endif + // Arc correction to radius vector. Computed only every N_ARC_CORRECTION increments. // Compute exact location by applying transformation matrix from initial radius vector(=-offset). // To reduce stuttering, the sin and cos could be computed at different times. // For now, compute both at the same time. - const float cos_Ti = cos(i * theta_per_segment), - sin_Ti = sin(i * theta_per_segment); - r_X = -offset[X_AXIS] * cos_Ti + offset[Y_AXIS] * sin_Ti; - r_Y = -offset[X_AXIS] * sin_Ti - offset[Y_AXIS] * cos_Ti; - count = 0; + const float cos_Ti = cos(i * theta_per_segment), sin_Ti = sin(i * theta_per_segment); + r_P = -offset[0] * cos_Ti + offset[1] * sin_Ti; + r_Q = -offset[0] * sin_Ti - offset[1] * cos_Ti; } // Update arc_target location - arc_target[X_AXIS] = center_X + r_X; - arc_target[Y_AXIS] = center_Y + r_Y; - arc_target[Z_AXIS] += linear_per_segment; + arc_target[p_axis] = center_P + r_P; + arc_target[q_axis] = center_Q + r_Q; + arc_target[l_axis] += linear_per_segment; arc_target[E_AXIS] += extruder_per_segment; clamp_to_software_endstops(arc_target); diff --git a/Marlin/enum.h b/Marlin/enum.h index 34c5bb68a..c3e9ad012 100644 --- a/Marlin/enum.h +++ b/Marlin/enum.h @@ -178,4 +178,12 @@ enum LCDViewAction { }; #endif +/** + * Workspace planes only apply to G2/G3 moves + * (and "canned cycles" - not a current feature) + */ +#if ENABLED(CNC_WORKSPACE_PLANES) + enum WorkspacePlane { PLANE_XY, PLANE_ZX, PLANE_YZ }; +#endif + #endif // __ENUM_H__ diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 7aee917f1..11bda31e5 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 0482c9152..d8fb3be6b 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h index d69e55e12..16912fc31 100644 --- a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h +++ b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h @@ -678,10 +678,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index ba118973c..c5c232d75 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index c786d941d..ee5ebd90a 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -654,10 +654,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 1b9907872..974b84802 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -684,10 +684,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index 81b5f8bfa..d0bed6cc4 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/M150/Configuration_adv.h b/Marlin/example_configurations/M150/Configuration_adv.h index f80078a3c..8be8497c1 100644 --- a/Marlin/example_configurations/M150/Configuration_adv.h +++ b/Marlin/example_configurations/M150/Configuration_adv.h @@ -678,10 +678,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index 8003884c4..8cfe7891c 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 252d47e1e..327fa817c 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index ce7846a7e..17e2f20f0 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h index e1d2342c1..fa05c07d7 100644 --- a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h +++ b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h @@ -674,10 +674,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index ba118973c..c5c232d75 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h index 219e1dc30..77a0756cf 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -676,10 +676,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h index b7af3e93a..e37422f91 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -676,10 +676,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 67e62445b..c6ec4183d 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -673,10 +673,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 67e62445b..c6ec4183d 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -673,10 +673,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 0cc65d57e..ed52679ee 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -678,10 +678,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index f7ea0949e..0f8eba536 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -673,10 +673,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h index 4481edd1f..8d46562d6 100644 --- a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h +++ b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h @@ -678,10 +678,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index d69b043d7..cef8ddd73 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 9f95e0d76..635c36394 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -671,10 +671,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT diff --git a/Marlin/example_configurations/wt150/Configuration_adv.h b/Marlin/example_configurations/wt150/Configuration_adv.h index 72f73f7bb..83c683f05 100644 --- a/Marlin/example_configurations/wt150/Configuration_adv.h +++ b/Marlin/example_configurations/wt150/Configuration_adv.h @@ -674,10 +674,16 @@ // @section extras -// Arc interpretation settings: -#define ARC_SUPPORT // Disabling this saves ~2738 bytes -#define MM_PER_ARC_SEGMENT 1 -#define N_ARC_CORRECTION 25 +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define BEZIER_CURVE_SUPPORT