Tempted by the const of a seg_length

This commit is contained in:
Scott Lahteine 2020-05-10 03:42:48 -05:00
parent 8d3caa9944
commit 32dc874928

View File

@ -103,21 +103,21 @@ void plan_arc(
const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s); const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
#ifdef ARC_SEGMENTS_PER_R // Start with a nominal segment length
float seg_length = MM_PER_ARC_SEGMENT * radius; float seg_length = (
LIMIT(seg_length, MM_PER_ARC_SEGMENT, ARC_SEGMENTS_PER_R); #ifdef ARC_SEGMENTS_PER_R
#elif ARC_SEGMENTS_PER_SEC constrain(MM_PER_ARC_SEGMENT * radius, MM_PER_ARC_SEGMENT, ARC_SEGMENTS_PER_R)
float seg_length = scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC); #elif ARC_SEGMENTS_PER_SEC
NOLESS(seg_length, MM_PER_ARC_SEGMENT); _MAX(scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC), MM_PER_ARC_SEGMENT)
#else #else
constexpr float seg_length = MM_PER_ARC_SEGMENT; MM_PER_ARC_SEGMENT
#endif #endif
);
// Length divided by segment size gives segment count // Divide total travel by nominal segment length
uint16_t segments = FLOOR(mm_of_travel / seg_length); uint16_t segments = FLOOR(mm_of_travel / seg_length);
if (segments < min_segments) { if (segments < min_segments) { // Too few segments?
segments = min_segments; // No fewer than the minimum segments = min_segments; // More segments
seg_length = mm_of_travel / segments; // A new segment length seg_length = mm_of_travel / segments; // but also shorter
} }
/** /**