@@ -1041,19 +1041,18 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
1041
1041
NOLESS (segments, 1U );
1042
1042
1043
1043
// The approximate length of each segment
1044
- const float inv_segments = 1 .0f / float (segments),
1045
- cartesian_segment_mm = cartesian_mm * inv_segments;
1044
+ const float inv_segments = 1 .0f / float (segments);
1046
1045
const xyze_float_t segment_distance = diff * inv_segments;
1047
1046
1048
- # if ENABLED(SCARA_FEEDRATE_SCALING)
1049
- const float inv_duration = scaled_fr_mm_s / cartesian_segment_mm ;
1050
- # endif
1047
+ // Add hints to help optimize the move
1048
+ PlannerHints hints (cartesian_mm * inv_segments) ;
1049
+ TERN_ (SCARA_FEEDRATE_SCALING, hints. inv_duration = scaled_fr_mm_s / hints. millimeters );
1051
1050
1052
1051
/*
1053
1052
SERIAL_ECHOPGM("mm=", cartesian_mm);
1054
1053
SERIAL_ECHOPGM(" seconds=", seconds);
1055
1054
SERIAL_ECHOPGM(" segments=", segments);
1056
- SERIAL_ECHOPGM(" segment_mm=", cartesian_segment_mm );
1055
+ SERIAL_ECHOPGM(" segment_mm=", hints.millimeters );
1057
1056
SERIAL_EOL();
1058
1057
//*/
1059
1058
@@ -1065,11 +1064,12 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
1065
1064
while (--segments) {
1066
1065
segment_idle (next_idle_ms);
1067
1066
raw += segment_distance;
1068
- if (!planner.buffer_line (raw, scaled_fr_mm_s, active_extruder, cartesian_segment_mm OPTARG (SCARA_FEEDRATE_SCALING, inv_duration))) break ;
1067
+ if (!planner.buffer_line (raw, scaled_fr_mm_s, active_extruder, hints))
1068
+ break ;
1069
1069
}
1070
1070
1071
1071
// Ensure last segment arrives at target location.
1072
- planner.buffer_line (destination, scaled_fr_mm_s, active_extruder, cartesian_segment_mm OPTARG (SCARA_FEEDRATE_SCALING, inv_duration) );
1072
+ planner.buffer_line (destination, scaled_fr_mm_s, active_extruder, hints );
1073
1073
1074
1074
return false ; // caller will update current_position
1075
1075
}
@@ -1108,17 +1108,16 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
1108
1108
NOLESS (segments, 1U );
1109
1109
1110
1110
// The approximate length of each segment
1111
- const float inv_segments = 1 .0f / float (segments),
1112
- cartesian_segment_mm = cartesian_mm * inv_segments;
1111
+ const float inv_segments = 1 .0f / float (segments);
1113
1112
const xyze_float_t segment_distance = diff * inv_segments;
1114
1113
1115
- # if ENABLED(SCARA_FEEDRATE_SCALING)
1116
- const float inv_duration = scaled_fr_mm_s / cartesian_segment_mm ;
1117
- # endif
1114
+ // Add hints to help optimize the move
1115
+ PlannerHints hints (cartesian_mm * inv_segments) ;
1116
+ TERN_ (SCARA_FEEDRATE_SCALING, hints. inv_duration = scaled_fr_mm_s / hints. millimeters );
1118
1117
1119
1118
// SERIAL_ECHOPGM("mm=", cartesian_mm);
1120
1119
// SERIAL_ECHOLNPGM(" segments=", segments);
1121
- // SERIAL_ECHOLNPGM(" segment_mm=", cartesian_segment_mm );
1120
+ // SERIAL_ECHOLNPGM(" segment_mm=", hints.millimeters );
1122
1121
1123
1122
// Get the raw current position as starting point
1124
1123
xyze_pos_t raw = current_position;
@@ -1128,12 +1127,13 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
1128
1127
while (--segments) {
1129
1128
segment_idle (next_idle_ms);
1130
1129
raw += segment_distance;
1131
- if (!planner.buffer_line (raw, fr_mm_s, active_extruder, cartesian_segment_mm OPTARG (SCARA_FEEDRATE_SCALING, inv_duration))) break ;
1130
+ if (!planner.buffer_line (raw, fr_mm_s, active_extruder, hints))
1131
+ break ;
1132
1132
}
1133
1133
1134
1134
// Since segment_distance is only approximate,
1135
1135
// the final move must be to the exact destination.
1136
- planner.buffer_line (destination, fr_mm_s, active_extruder, cartesian_segment_mm OPTARG (SCARA_FEEDRATE_SCALING, inv_duration) );
1136
+ planner.buffer_line (destination, fr_mm_s, active_extruder, hints );
1137
1137
}
1138
1138
1139
1139
#endif // SEGMENT_LEVELED_MOVES && !AUTO_BED_LEVELING_UBL
0 commit comments