diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-11-05 14:40:28 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-11-05 14:40:28 +0300 |
commit | 3b2f8c98a7e32c3d8fd90cafa77e6ba63ab22737 (patch) | |
tree | 0949ac382e19fbda523488d60ee1d4b66d374d23 /src/Platform | |
parent | e07e82db07d0962efd26cdef2d302128b4772d6d (diff) |
Introduced reduced accelerations and M201.1
Corrected setting of default max speeds, accelerations and jerks
Added M201.1 to allow the reduced accelerations to be set
Diffstat (limited to 'src/Platform')
-rw-r--r-- | src/Platform/Platform.cpp | 22 | ||||
-rw-r--r-- | src/Platform/Platform.h | 17 |
2 files changed, 21 insertions, 18 deletions
diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 69eb67f5..9d935855 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -609,25 +609,27 @@ void Platform::Init() noexcept axisMinima[axis] = DefaultAxisMinimum; axisMaxima[axis] = DefaultAxisMaximum; - maxFeedrates[axis] = DefaultXYMaxFeedrate; - accelerations[axis] = DefaultXYAcceleration; - driveStepsPerUnit[axis] = DefaultXYDriveStepsPerUnit; - instantDvs[axis] = DefaultXYInstantDv; + maxFeedrates[axis] = ConvertSpeedFromMmPerSec(DefaultAxisMaxFeedrate); + normalAccelerations[axis] = ConvertAcceleration(DefaultAxisAcceleration); + reducedAccelerations[axis] = ConvertAcceleration(DefaultReducedAxisAcceleration); + driveStepsPerUnit[axis] = DefaultAxisDriveStepsPerUnit; + instantDvs[axis] = ConvertSpeedFromMmPerSec(DefaultAxisInstantDv); } // We use different defaults for the Z axis - maxFeedrates[Z_AXIS] = DefaultZMaxFeedrate; - accelerations[Z_AXIS] = DefaultZAcceleration; + maxFeedrates[Z_AXIS] = ConvertSpeedFromMmPerSec(DefaultZMaxFeedrate); + normalAccelerations[Z_AXIS] = ConvertAcceleration(DefaultZAcceleration); + reducedAccelerations[Z_AXIS] = ConvertAcceleration(DefaultReducedZAcceleration); driveStepsPerUnit[Z_AXIS] = DefaultZDriveStepsPerUnit; - instantDvs[Z_AXIS] = DefaultZInstantDv; + instantDvs[Z_AXIS] = ConvertSpeedFromMmPerSec(DefaultZInstantDv); // Extruders for (size_t drive = MaxAxes; drive < MaxAxesPlusExtruders; ++drive) { - maxFeedrates[drive] = DefaultEMaxFeedrate; - accelerations[drive] = DefaultEAcceleration; + maxFeedrates[drive] = ConvertSpeedFromMmPerSec(DefaultEMaxFeedrate); + normalAccelerations[drive] = reducedAccelerations[drive] = ConvertAcceleration(DefaultEAcceleration); driveStepsPerUnit[drive] = DefaultEDriveStepsPerUnit; - instantDvs[drive] = DefaultEInstantDv; + instantDvs[drive] = ConvertSpeedFromMmPerSec(DefaultEInstantDv); } minimumMovementSpeed = ConvertSpeedFromMmPerSec(DefaultMinFeedrate); diff --git a/src/Platform/Platform.h b/src/Platform/Platform.h index 44473d3e..a3f8b7c3 100644 --- a/src/Platform/Platform.h +++ b/src/Platform/Platform.h @@ -463,8 +463,8 @@ public: { return driveStepsPerUnit; } void SetDriveStepsPerUnit(size_t axisOrExtruder, float value, uint32_t requestedMicrostepping) noexcept; float Acceleration(size_t axisOrExtruder) const noexcept; - const float *_ecv_array Accelerations() const noexcept; - void SetAcceleration(size_t axisOrExtruder, float value) noexcept; + const float *_ecv_array Accelerations(bool useReduced) const noexcept; + void SetAcceleration(size_t axisOrExtruder, float value, bool reduced) noexcept; float MaxFeedrate(size_t axisOrExtruder) const noexcept; const float *_ecv_array MaxFeedrates() const noexcept { return maxFeedrates; } void SetMaxFeedrate(size_t axisOrExtruder, float value) noexcept; @@ -722,7 +722,8 @@ private: volatile DriverStatus driverState[MaxAxesPlusExtruders]; float maxFeedrates[MaxAxesPlusExtruders]; // max feed rates in mm per step clock - float accelerations[MaxAxesPlusExtruders]; // max accelerations in mm per step clock squared + float normalAccelerations[MaxAxesPlusExtruders]; // max accelerations in mm per step clock squared for normal moves + float reducedAccelerations[MaxAxesPlusExtruders]; // max accelerations in mm per step clock squared for probing and stall detection moves float driveStepsPerUnit[MaxAxesPlusExtruders]; float instantDvs[MaxAxesPlusExtruders]; // max jerk in mm per step clock uint32_t driveDriverBits[MaxAxesPlusExtruders + NumDirectDrivers]; @@ -923,17 +924,17 @@ inline float Platform::DriveStepsPerUnit(size_t drive) const noexcept inline float Platform::Acceleration(size_t drive) const noexcept { - return accelerations[drive]; + return normalAccelerations[drive]; } -inline const float *_ecv_array Platform::Accelerations() const noexcept +inline const float *_ecv_array Platform::Accelerations(bool useReduced) const noexcept { - return accelerations; + return (useReduced) ? reducedAccelerations : normalAccelerations; } -inline void Platform::SetAcceleration(size_t drive, float value) noexcept +inline void Platform::SetAcceleration(size_t drive, float value, bool reduced) noexcept { - accelerations[drive] = max<float>(value, ConvertAcceleration(MinimumAcceleration)); // don't allow zero or negative + ((reduced) ? reducedAccelerations : normalAccelerations)[drive] = max<float>(value, ConvertAcceleration(MinimumAcceleration)); // don't allow zero or negative } inline float Platform::MaxFeedrate(size_t drive) const noexcept |