@@ -1049,19 +1049,18 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
1049
1049
NOLESS (segments, 1U );
1050
1050
1051
1051
// The approximate length of each segment
1052
- const float inv_segments = 1 .0f / float (segments),
1053
- cartesian_segment_mm = cartesian_mm * inv_segments;
1052
+ const float inv_segments = 1 .0f / float (segments);
1054
1053
const xyze_float_t segment_distance = diff * inv_segments;
1055
1054
1056
- # if ENABLED(SCARA_FEEDRATE_SCALING)
1057
- const float inv_duration = scaled_fr_mm_s / cartesian_segment_mm ;
1058
- # endif
1055
+ // Add hints to help optimize the move
1056
+ PlannerHints hints (cartesian_mm * inv_segments) ;
1057
+ TERN_ (SCARA_FEEDRATE_SCALING, hints. inv_duration = scaled_fr_mm_s / hints. millimeters );
1059
1058
1060
1059
/*
1061
1060
SERIAL_ECHOPGM("mm=", cartesian_mm);
1062
1061
SERIAL_ECHOPGM(" seconds=", seconds);
1063
1062
SERIAL_ECHOPGM(" segments=", segments);
1064
- SERIAL_ECHOPGM(" segment_mm=", cartesian_segment_mm );
1063
+ SERIAL_ECHOPGM(" segment_mm=", hints.millimeters );
1065
1064
SERIAL_EOL();
1066
1065
//*/
1067
1066
@@ -1073,11 +1072,12 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
1073
1072
while (--segments) {
1074
1073
segment_idle (next_idle_ms);
1075
1074
raw += segment_distance;
1076
- if (!planner.buffer_line (raw, scaled_fr_mm_s, active_extruder, cartesian_segment_mm OPTARG (SCARA_FEEDRATE_SCALING, inv_duration))) break ;
1075
+ if (!planner.buffer_line (raw, scaled_fr_mm_s, active_extruder, hints))
1076
+ break ;
1077
1077
}
1078
1078
1079
1079
// Ensure last segment arrives at target location.
1080
- planner.buffer_line (destination, scaled_fr_mm_s, active_extruder, cartesian_segment_mm OPTARG (SCARA_FEEDRATE_SCALING, inv_duration) );
1080
+ planner.buffer_line (destination, scaled_fr_mm_s, active_extruder, hints );
1081
1081
1082
1082
return false ; // caller will update current_position
1083
1083
}
@@ -1116,17 +1116,16 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
1116
1116
NOLESS (segments, 1U );
1117
1117
1118
1118
// The approximate length of each segment
1119
- const float inv_segments = 1 .0f / float (segments),
1120
- cartesian_segment_mm = cartesian_mm * inv_segments;
1119
+ const float inv_segments = 1 .0f / float (segments);
1121
1120
const xyze_float_t segment_distance = diff * inv_segments;
1122
1121
1123
- # if ENABLED(SCARA_FEEDRATE_SCALING)
1124
- const float inv_duration = scaled_fr_mm_s / cartesian_segment_mm ;
1125
- # endif
1122
+ // Add hints to help optimize the move
1123
+ PlannerHints hints (cartesian_mm * inv_segments) ;
1124
+ TERN_ (SCARA_FEEDRATE_SCALING, hints. inv_duration = scaled_fr_mm_s / hints. millimeters );
1126
1125
1127
1126
// SERIAL_ECHOPGM("mm=", cartesian_mm);
1128
1127
// SERIAL_ECHOLNPGM(" segments=", segments);
1129
- // SERIAL_ECHOLNPGM(" segment_mm=", cartesian_segment_mm );
1128
+ // SERIAL_ECHOLNPGM(" segment_mm=", hints.millimeters );
1130
1129
1131
1130
// Get the raw current position as starting point
1132
1131
xyze_pos_t raw = current_position;
@@ -1136,12 +1135,13 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
1136
1135
while (--segments) {
1137
1136
segment_idle (next_idle_ms);
1138
1137
raw += segment_distance;
1139
- if (!planner.buffer_line (raw, fr_mm_s, active_extruder, cartesian_segment_mm OPTARG (SCARA_FEEDRATE_SCALING, inv_duration))) break ;
1138
+ if (!planner.buffer_line (raw, fr_mm_s, active_extruder, hints))
1139
+ break ;
1140
1140
}
1141
1141
1142
1142
// Since segment_distance is only approximate,
1143
1143
// the final move must be to the exact destination.
1144
- planner.buffer_line (destination, fr_mm_s, active_extruder, cartesian_segment_mm OPTARG (SCARA_FEEDRATE_SCALING, inv_duration) );
1144
+ planner.buffer_line (destination, fr_mm_s, active_extruder, hints );
1145
1145
}
1146
1146
1147
1147
#endif // SEGMENT_LEVELED_MOVES && !AUTO_BED_LEVELING_UBL
0 commit comments