diff options
author | David Crocker <dcrocker@eschertech.com> | 2017-08-11 23:30:20 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2017-08-11 23:30:20 +0300 |
commit | ba7778b3e6f278fed1f5d30d31ed2a2a8be7369c (patch) | |
tree | 1af19ecbdc9119882ff5f9c9e9f0e0895aaaa10c /src/Movement | |
parent | 0acba07cf0d17c9be05a2e19b28200fc4fbf5cc0 (diff) |
Version 1.19RC7
Don't enable pullup resistors on endstop inputs used for switch-type Z
probes, to increase the threashold voltage a little
Duet3D filament sensor support is now working
Diffstat (limited to 'src/Movement')
-rw-r--r-- | src/Movement/DDA.cpp | 40 | ||||
-rw-r--r-- | src/Movement/DDA.h | 7 | ||||
-rw-r--r-- | src/Movement/Move.cpp | 7 |
3 files changed, 46 insertions, 8 deletions
diff --git a/src/Movement/DDA.cpp b/src/Movement/DDA.cpp index e6f6e62e..7387694d 100644 --- a/src/Movement/DDA.cpp +++ b/src/Movement/DDA.cpp @@ -1625,4 +1625,44 @@ bool DDA::Free() return hadLookaheadUnderrun; } +// Return the number of net steps already taken in this move by a particular drive +int32_t DDA::GetStepsTaken(size_t drive) const +{ + const DriveMovement * const dmp = pddm[drive]; + int32_t ret; + if (dmp == nullptr) + { + ret = 0; + } + else + { + const uint32_t ns = dmp->nextStep; + if (ns == 0) + { + ret = 0; // not taken any steps yet + } + else + { + const uint32_t rss = dmp->reverseStartStep; + if (ns <= rss) + { + ret = (int32_t)ns; // get number of steps already taken + if (!dmp->direction) // if backwards movement + { + ret = -ret; // invert sign + } + } + else + { + ret = (int)(2 * rss) - (int)ns; + if (dmp->direction) + { + ret = -ret; + } + } + } + } + return ret; +} + // End diff --git a/src/Movement/DDA.h b/src/Movement/DDA.h index e0d69020..510f0db2 100644 --- a/src/Movement/DDA.h +++ b/src/Movement/DDA.h @@ -199,11 +199,4 @@ inline void DDA::SetDriveCoordinate(int32_t a, size_t drive) endCoordinatesValid = false; } -// Return the number of steps already taken in this move by a particular drive -inline int32_t DDA::GetStepsTaken(size_t drive) const -{ - const DriveMovement * const dmp = pddm[drive]; - return (dmp == nullptr) ? 0 : (int32_t)dmp->nextStep; -} - #endif /* DDA_H_ */ diff --git a/src/Movement/Move.cpp b/src/Movement/Move.cpp index 79837fee..b1d52994 100644 --- a/src/Movement/Move.cpp +++ b/src/Movement/Move.cpp @@ -863,8 +863,13 @@ void Move::CurrentMoveCompleted() { // Save the current motor coordinates, and the machine Cartesian coordinates if known liveCoordinatesValid = currentDda->FetchEndPosition(const_cast<int32_t*>(liveEndPoints), const_cast<float *>(liveCoordinates)); - + const size_t numAxes = reprap.GetGCodes().GetTotalAxes(); + for (size_t drive = numAxes; drive < DRIVES; ++drive) + { + extrusionAccumulators[drive - numAxes] += currentDda->GetStepsTaken(drive); + } currentDda = nullptr; + ddaRingGetPointer = ddaRingGetPointer->GetNext(); completedMoves++; } |