diff options
Diffstat (limited to 'src/Movement/MoveSegment.h')
-rw-r--r-- | src/Movement/MoveSegment.h | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/Movement/MoveSegment.h b/src/Movement/MoveSegment.h index a8ab7928..de089fab 100644 --- a/src/Movement/MoveSegment.h +++ b/src/Movement/MoveSegment.h @@ -134,9 +134,6 @@ #include <RepRapFirmware.h> #include <Platform/Tasks.h> -//#define MS_USE_FPU (__FPU_USED) -#define MS_USE_FPU (1) // Try using floating point maths for processors without FPU too. We have implemented fastSqrtf on those processors. - class MoveSegment { public: @@ -147,7 +144,6 @@ public: MoveSegment(MoveSegment *p_next) noexcept; -#if MS_USE_FPU float GetSegmentLength() const noexcept { return segLength; } float GetSegmentTime() const noexcept { return segTime; } float CalcNonlinearA(float startDistance) const noexcept; @@ -160,20 +156,6 @@ public: void SetLinear(float pSegmentLength, float p_segTime, float p_c) noexcept; void SetNonLinear(float pSegmentLength, float p_segTime, float p_b, float p_c) noexcept; -#else - uint32_t GetSegmentLength() const noexcept { return iSegLength; } - uint32_t GetSegmentTime() const noexcept { return iSegTime; } - int64_t CalcNonlinearA(uint32_t startDistance) const noexcept; - int64_t CalcNonlinearA(uint32_t startDistance, uint32_t pressureAdvanceK) const noexcept; - int32_t CalcNonlinearB(uint32_t startTime) const noexcept; - int32_t CalcNonlinearB(uint32_t startTime, uint32_t pressureAdvanceK) const noexcept; - int32_t CalcLinearB(uint32_t startDistance, uint32_t startTime) const noexcept; - int32_t CalcC(uint32_t mmPerStepTimesK) const noexcept; - int32_t GetC() const noexcept { return ic; } - - void SetLinear(uint32_t pSegmentLength, uint32_t p_segTime, int32_t p_c) noexcept; - void SetNonLinear(uint32_t pSegmentLength, uint32_t p_segTime, int32_t p_b, int32_t p_c) noexcept; -#endif void SetReverse() noexcept; MoveSegment *GetNext() const noexcept; @@ -217,16 +199,9 @@ private: // The 'next' field is a MoveSegment pointer with two flag bits in the bottom two bits uint32_t nextAndFlags; // pointer to the next segment, plus flag bits -#if MS_USE_FPU float segLength; // the length of this segment before applying the movement fraction float segTime; // the time in step clocks at which this move ends float b, c; // the move parameters (b is not needed for linear moves) -#else - uint32_t iSegLength; // the length of this segment before applying the movement fraction - uint32_t iSegTime; // the time in step clocks at which this move ends - int32_t ib, ic; // the move parameters (b is not needed for linear moves) -#endif - }; // Create a new one, leaving the flags clear @@ -257,7 +232,6 @@ inline bool MoveSegment::IsLast() const noexcept return GetNext() == nullptr; } -#if MS_USE_FPU inline float MoveSegment::CalcNonlinearA(float startDistance) const noexcept { @@ -313,64 +287,6 @@ inline bool MoveSegment::IsAccelerating() const noexcept return c > 0.0; } -#else - -inline int64_t MoveSegment::CalcNonlinearA(uint32_t startDistance) const noexcept -{ - return isquare64(ib) - (int64_t)startDistance * ic; -} - -inline int64_t MoveSegment::CalcNonlinearA(uint32_t startDistance, uint32_t pressureAdvanceK) const noexcept -{ - return isquare64(ib - pressureAdvanceK) - (int64_t)startDistance * ic; -} - -inline int32_t MoveSegment::CalcNonlinearB(uint32_t startTime) const noexcept -{ - return ib + (int32_t)startTime; -} - -inline int32_t MoveSegment::CalcNonlinearB(uint32_t startTime, uint32_t pressureAdvanceK) const noexcept -{ - return (ib - (int32_t)pressureAdvanceK) + (int32_t)startTime; -} - -inline int32_t MoveSegment::CalcLinearB(uint32_t startDistance, uint32_t startTime) const noexcept -{ - return (int32_t)startTime - (((int64_t)startDistance * ic) >> SFdistance); -} - -inline int32_t MoveSegment::CalcC(uint32_t mmPerStepTimesK) const noexcept -{ - return (int32_t)((ic * (int64_t)mmPerStepTimesK) >> SFmmPerStep); -} - -inline void MoveSegment::SetLinear(uint32_t pSegmentLength, uint32_t p_segTime, int32_t p_c) noexcept -{ - iSegLength = pSegmentLength; - iSegTime = p_segTime; - ib = 0; - ic = p_c; - nextAndFlags |= LinearFlag; -} - -// Set up an accelerating or decelerating move. We assume that the 'linear' flag is already clear. -inline void MoveSegment::SetNonLinear(uint32_t pSegmentLength, uint32_t p_segTime, int32_t p_b, int32_t p_c) noexcept -{ - iSegLength = pSegmentLength; - iSegTime = p_segTime; - ib = p_b; - ic = p_c; -} - -// Given that this is an accelerating or decelerating move, return true if it is accelerating -inline bool MoveSegment::IsAccelerating() const noexcept -{ - return ic > 0; -} - -#endif - // Release a single MoveSegment. Not thread-safe. inline void MoveSegment::Release(MoveSegment *item) noexcept { |