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);
// Start with a nominal segment length
float seg_length = (
#ifdef ARC_SEGMENTS_PER_R
float seg_length = MM_PER_ARC_SEGMENT * radius;
LIMIT(seg_length, MM_PER_ARC_SEGMENT, ARC_SEGMENTS_PER_R);
constrain(MM_PER_ARC_SEGMENT * radius, 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);
_MAX(scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC), MM_PER_ARC_SEGMENT)
#else
constexpr float seg_length = MM_PER_ARC_SEGMENT;
MM_PER_ARC_SEGMENT
#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);
if (segments < min_segments) {
segments = min_segments; // No fewer than the minimum
seg_length = mm_of_travel / segments; // A new segment length
if (segments < min_segments) { // Too few segments?
segments = min_segments; // More segments
seg_length = mm_of_travel / segments; // but also shorter
}
/**