The Move class calls this function to find what to do next. It takes its own copy of the move because it adjusts the coordinates. Returns true if a new move was copied to 'm'.
| 3165 | // The Move class calls this function to find what to do next. It takes its own copy of the move because it adjusts the coordinates. |
| 3166 | // Returns true if a new move was copied to 'm'. |
| 3167 | bool GCodes::ReadMove(MovementSystemNumber queueNumber, RawMove& m) noexcept |
| 3168 | { |
| 3169 | MovementState& ms = moveStates[queueNumber]; |
| 3170 | if (ms.segmentsLeft == 0) |
| 3171 | { |
| 3172 | return false; |
| 3173 | } |
| 3174 | |
| 3175 | while (true) // loop while we skip move segments |
| 3176 | { |
| 3177 | #if SUPPORT_LASER |
| 3178 | // If it's a straight move in laser mode, sort out the laser power |
| 3179 | if (machineType == MachineType::laser) |
| 3180 | { |
| 3181 | ms.laserPwmOrIoBits.laserPwm = (ms.isCoordinated && ms.segmentsLeft < ms.laserPixelData.numPixels && !ms.doingArcMove) |
| 3182 | ? ms.laserPixelData.pixelPwm[ms.laserPixelData.numPixels - ms.segmentsLeft] |
| 3183 | : (ms.isCoordinated && ms.laserPixelData.numPixels == 1) |
| 3184 | ? ms.laserPixelData.pixelPwm[0] |
| 3185 | : 0u; |
| 3186 | } |
| 3187 | #endif |
| 3188 | m = ms; |
| 3189 | |
| 3190 | if (ms.segmentsLeft == 1) |
| 3191 | { |
| 3192 | // If there is just 1 segment left, it doesn't matter if it is an arc move or not, just move to the end position |
| 3193 | if (ms.segmentsLeftToStartAt == 1 && ms.firstSegmentFractionToSkip != 0.0) // if this is the segment we are starting at and we need to skip some of it |
| 3194 | { |
| 3195 | // Reduce the extrusion by the amount to be skipped |
| 3196 | for (size_t extruder = 0; extruder < numExtruders; ++extruder) |
| 3197 | { |
| 3198 | m.coords[ExtruderToLogicalDrive(extruder)] *= (1.0 - ms.firstSegmentFractionToSkip); |
| 3199 | } |
| 3200 | } |
| 3201 | m.proportionDone = 1.0; |
| 3202 | if (ms.doingArcMove) |
| 3203 | { |
| 3204 | m.canPauseAfter = true; // we can pause after the final segment of an arc move |
| 3205 | } |
| 3206 | ms.ClearMove(); |
| 3207 | } |
| 3208 | else |
| 3209 | { |
| 3210 | // This move needs to be divided into 2 or more segments |
| 3211 | // Do the axes |
| 3212 | AxesBitmap axisMap0, axisMap1; |
| 3213 | if (ms.doingArcMove) |
| 3214 | { |
| 3215 | ms.arcCurrentAngle += ms.arcAngleIncrement; |
| 3216 | if (ms.segmentsTillNextFullCalc == 0) |
| 3217 | { |
| 3218 | // Do the full calculation |
| 3219 | ms.segmentsTillNextFullCalc = SegmentsPerFulArcCalculation; |
| 3220 | ms.currentAngleCosine = cosf(ms.arcCurrentAngle); |
| 3221 | ms.currentAngleSine = sinf(ms.arcCurrentAngle); |
| 3222 | } |
| 3223 | else |
| 3224 | { |
no test coverage detected