Browse Source

Tempted by the const of a seg_length

vanilla_fb_2.0.x
Scott Lahteine 5 years ago
parent
commit
32dc874928
  1. 28
      Marlin/src/gcode/motion/G2_G3.cpp

28
Marlin/src/gcode/motion/G2_G3.cpp

@ -103,21 +103,21 @@ void plan_arc(
const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
#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
constexpr float seg_length = MM_PER_ARC_SEGMENT;
#endif
// Length divided by segment size gives segment count
// Start with a nominal segment length
float seg_length = (
#ifdef ARC_SEGMENTS_PER_R
constrain(MM_PER_ARC_SEGMENT * radius, MM_PER_ARC_SEGMENT, ARC_SEGMENTS_PER_R)
#elif ARC_SEGMENTS_PER_SEC
_MAX(scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC), MM_PER_ARC_SEGMENT)
#else
MM_PER_ARC_SEGMENT
#endif
);
// 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
}
/**

Loading…
Cancel
Save