From b7f86bffd5debd04cfdf2450aa3e82343c4d0d5d Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 21 Jan 2020 00:53:26 -0800 Subject: [PATCH] Arc segment radius scaling (#16551) --- Marlin/Configuration_adv.h | 13 +++++++------ Marlin/src/gcode/motion/G2_G3.cpp | 5 ++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 081d4f96db..53e98a4976 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1567,14 +1567,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 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. diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 1487505e03..c915cc334e 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -105,7 +105,10 @@ 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; + 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); #else