From 432a756019b91a90af6be887e494cb4f1c07a297 Mon Sep 17 00:00:00 2001 From: allted Date: Sat, 11 Jan 2020 17:43:16 -0800 Subject: [PATCH 1/3] Arc segment size scaled by radius. --- Marlin/Configuration_adv.h | 1 + Marlin/src/gcode/motion/G2_G3.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 95fae1ec260a..1b972326267a 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1530,6 +1530,7 @@ #define ARC_SUPPORT // Disable this feature to save ~3226 bytes #if ENABLED(ARC_SUPPORT) #define MM_PER_ARC_SEGMENT 1 // (mm) Length (or minimum length) of each arc segment + //#define ARC_SEGMENTS_PER_R 1 //Max segment length, MM_PER = Min #define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle //#define ARC_SEGMENTS_PER_SEC 50 // Use feedrate to choose segment length (with MM_PER_ARC_SEGMENT as the minimum) #define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 1487505e0350..197817f75f7a 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -105,7 +105,11 @@ void plan_arc( const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s); - #ifdef ARC_SEGMENTS_PER_SEC + #ifdef ARC_SEGMENTS_PER_R + float seg_length = MM_PER_ARC_SEGMENT * radius; + NOLESS(seg_length, MM_PER_ARC_SEGMENT); + NOMORE(seg_length, ARC_SEGMENTS_PER_R); + #elif ARC_SEGMENTS_PER_SEC float seg_length = scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC); NOLESS(seg_length, MM_PER_ARC_SEGMENT); #else From 44912bcdf4f4ae43c9d42a5065cc9cc99d6df8eb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 20 Jan 2020 01:17:57 -0600 Subject: [PATCH 2/3] Update Configuration_adv.h --- Marlin/Configuration_adv.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 1b972326267a..b23540623f39 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1527,15 +1527,15 @@ // // G2/G3 Arc Support // -#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes #if ENABLED(ARC_SUPPORT) - #define MM_PER_ARC_SEGMENT 1 // (mm) Length (or minimum length) of each arc segment - //#define ARC_SEGMENTS_PER_R 1 //Max segment length, MM_PER = Min - #define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define MM_PER_ARC_SEGMENT 1 // (mm) Length (or minimum length) of each arc segment + //#define ARC_SEGMENTS_PER_R 1 // Max segment length, MM_PER = Min + #define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle //#define ARC_SEGMENTS_PER_SEC 50 // Use feedrate to choose segment length (with MM_PER_ARC_SEGMENT as the minimum) - #define N_ARC_CORRECTION 25 // Number of interpolated 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 + #define N_ARC_CORRECTION 25 // Number of interpolated 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. From 45417df33090502207a66b1c9c985d489ebe6728 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 20 Jan 2020 01:21:13 -0600 Subject: [PATCH 3/3] Use LIMIT macro --- Marlin/src/gcode/motion/G2_G3.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 197817f75f7a..c915cc334e40 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -107,8 +107,7 @@ void plan_arc( #ifdef ARC_SEGMENTS_PER_R float seg_length = MM_PER_ARC_SEGMENT * radius; - NOLESS(seg_length, MM_PER_ARC_SEGMENT); - NOMORE(seg_length, ARC_SEGMENTS_PER_R); + LIMIT(seg_length, MM_PER_ARC_SEGMENT, ARC_SEGMENTS_PER_R); #elif ARC_SEGMENTS_PER_SEC float seg_length = scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC); NOLESS(seg_length, MM_PER_ARC_SEGMENT);