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