Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-07-24 15:42:27 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-07-24 15:42:27 +0300
commita1c2af661f19f248c70e9716f6142c597deb5ca0 (patch)
tree561667b7e45c532d400c09d7c1656338617afd90 /src
parent992684e22ded508c7e11ba777a50ec447d3737c9 (diff)
Fixes for change to time units
Diffstat (limited to 'src')
-rw-r--r--src/Configuration.h4
-rw-r--r--src/Movement/DriveMovement.h12
-rw-r--r--src/Movement/Move.cpp2
-rw-r--r--src/RepRapFirmware.h9
4 files changed, 17 insertions, 10 deletions
diff --git a/src/Configuration.h b/src/Configuration.h
index 72b18337..b5b6b4a2 100644
--- a/src/Configuration.h
+++ b/src/Configuration.h
@@ -51,7 +51,9 @@ constexpr float DefaultEInstantDv = 2.0;
constexpr float DefaultMinFeedrate = 0.5; // the default minimum movement speed in mm/sec (extruding moves will go slower than this if the extrusion rate demands it)
constexpr float AbsoluteMinFeedrate = 0.01; // the absolute minimum movement speed in mm/sec
constexpr float MinimumJerk = 0.1; // the minimum jerk in mm/sec
-constexpr float MinimumAcceleration = 0.1; // he minimum acceleration in mm/sec^2
+constexpr float MinimumAcceleration = 0.1; // the minimum acceleration in mm/sec^2
+constexpr float DefaultPrintingAcceleration = 20000.0; // higher than the likely max acceleration defined by M201
+constexpr float DefaultTravelAcceleration = 20000.0; // higher than the likely max acceleration defined by M201
constexpr float DefaultAxisMinimum = 0.0;
constexpr float DefaultAxisMaximum = 200.0;
diff --git a/src/Movement/DriveMovement.h b/src/Movement/DriveMovement.h
index 5d16e16a..21e1d421 100644
--- a/src/Movement/DriveMovement.h
+++ b/src/Movement/DriveMovement.h
@@ -100,8 +100,14 @@ private:
uint32_t stepInterval; // how many clocks between steps
float distanceSoFar;
+#if DM_USE_FPU
float timeSoFar;
float pA, pB, pC;
+#else
+ uint32_t iTimeSoFar;
+ int64_t ipA;
+ int32_t ipB, ipC;
+#endif
// Parameters unique to a style of move (Cartesian, delta or extruder). Currently, extruders and Cartesian moves use the same parameters.
union
@@ -109,11 +115,11 @@ private:
struct DeltaParameters // Parameters for delta movement
{
// The following don't depend on how the move is executed, so they could be set up in Init() if we use fixed acceleration/deceleration
-#if DM_USE_FPU
float fTwoA;
float fTwoB;
- float fDSquaredMinusAsquaredMinusBsquaredTimesSsquared;
float h0MinusZ0; // the height subtended by the rod at the start of the move
+#if DM_USE_FPU
+ float fDSquaredMinusAsquaredMinusBsquaredTimesSsquared;
float fHmz0s; // the starting height less the starting Z height, multiplied by the Z movement fraction (can go negative)
float fMinusAaPlusBbTimesS;
float reverseStartDistance; // the overall move distance at which movement reversal occurs
@@ -133,8 +139,6 @@ private:
} cart;
} mp;
- static constexpr uint32_t NoStepTime = 0xFFFFFFFF; // value to indicate that no further steps are needed when calculating the next step time
-
#if !DM_USE_FPU
static constexpr uint32_t K1 = 1024; // a power of 2 used to multiply the value mmPerStepTimesCdivtopSpeed to reduce rounding errors
static constexpr uint32_t K2 = 512; // a power of 2 used in delta calculations to reduce rounding errors (but too large makes things worse)
diff --git a/src/Movement/Move.cpp b/src/Movement/Move.cpp
index bff92a17..08c8761f 100644
--- a/src/Movement/Move.cpp
+++ b/src/Movement/Move.cpp
@@ -167,7 +167,7 @@ Move::Move() noexcept
#if SUPPORT_ASYNC_MOVES
heightController(nullptr),
#endif
- maxPrintingAcceleration(10000.0), maxTravelAcceleration(10000.0),
+ maxPrintingAcceleration(ConvertAcceleration(DefaultPrintingAcceleration)), maxTravelAcceleration(ConvertAcceleration(DefaultTravelAcceleration)),
jerkPolicy(0),
numCalibratedFactors(0)
{
diff --git a/src/RepRapFirmware.h b/src/RepRapFirmware.h
index 53019c85..efb8c5d6 100644
--- a/src/RepRapFirmware.h
+++ b/src/RepRapFirmware.h
@@ -494,6 +494,7 @@ const AxesBitmap XyAxes = AxesBitmap::MakeLowestNBits(XY_AXES);
// Common conversion factors
constexpr float MinutesToSeconds = 60.0;
+constexpr uint32_t iMinutesToSeconds = 60;
constexpr float SecondsToMinutes = 1.0/MinutesToSeconds;
constexpr float SecondsToMillis = 1000.0;
constexpr float MillisToSeconds = 0.001;
@@ -525,12 +526,12 @@ static inline constexpr float ConvertSpeedFromMmPerSec(float speed) noexcept
static inline constexpr float ConvertSpeedFromMmPerMin(float speed) noexcept
{
- return speed * (MinutesToSeconds/StepClockRate);
+ return speed * (1.0/(StepClockRate * iMinutesToSeconds));
}
static inline constexpr float ConvertSpeedFromMm(float speed, bool useSeconds) noexcept
{
- return speed * ((useSeconds) ? 1.0/StepClockRate : MinutesToSeconds/StepClockRate);
+ return speed * ((useSeconds) ? 1.0/StepClockRate : 1.0/(StepClockRate * iMinutesToSeconds));
}
static inline constexpr float InverseConvertSpeedToMmPerSec(float speed) noexcept
@@ -540,12 +541,12 @@ static inline constexpr float InverseConvertSpeedToMmPerSec(float speed) noexcep
static inline constexpr float InverseConvertSpeedToMmPerMin(float speed) noexcept
{
- return speed * (StepClockRate * SecondsToMinutes);
+ return speed * (StepClockRate * iMinutesToSeconds);
}
static inline constexpr float InverseConvertSpeedToMm(float speed, bool useSeconds) noexcept
{
- return speed * ((useSeconds) ? StepClockRate : StepClockRate * SecondsToMinutes);
+ return speed * ((useSeconds) ? StepClockRate : StepClockRate * iMinutesToSeconds);
}
static inline constexpr float ConvertAcceleration(float accel) noexcept