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
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2017-11-03 16:36:17 +0300
committerDavid Crocker <dcrocker@eschertech.com>2017-11-03 16:36:17 +0300
commit9330b5f0c95fb46cc14d6167ac341b77f79503ee (patch)
treee2e0076d57b88c6f6849f66f20a86764ff39cc08 /src/Movement
parent1f15e46454ec2ee0d0db6e0661fff09b85a821ae (diff)
Version 1.20beta5
Implemented motor load monitoring and sensorless homing Various bug fixes and other changes, see whatsnew file
Diffstat (limited to 'src/Movement')
-rw-r--r--src/Movement/DDA.cpp8
-rw-r--r--src/Movement/DDA.h19
-rw-r--r--src/Movement/DriveMovement.h19
-rw-r--r--src/Movement/Kinematics/CoreBaseKinematics.cpp4
-rw-r--r--src/Movement/Kinematics/CoreXYUKinematics.cpp4
-rw-r--r--src/Movement/Move.h16
6 files changed, 59 insertions, 11 deletions
diff --git a/src/Movement/DDA.cpp b/src/Movement/DDA.cpp
index 40b648b7..090afbbf 100644
--- a/src/Movement/DDA.cpp
+++ b/src/Movement/DDA.cpp
@@ -196,7 +196,7 @@ void DDA::DebugPrint() const
{
if (pddm[axis] != nullptr)
{
- pddm[axis]->DebugPrint(reprap.GetGCodes().axisLetters[axis], isDeltaMovement);
+ pddm[axis]->DebugPrint(reprap.GetGCodes().GetAxisLetters()[axis], isDeltaMovement);
}
}
for (size_t i = numAxes; i < DRIVES; ++i)
@@ -1212,7 +1212,7 @@ void DDA::CheckEndstops(Platform& platform)
reprap.GetGCodes().MoveStoppedByZProbe();
return;
- case EndStopHit::lowNear:
+ case EndStopHit::nearStop:
ReduceHomingSpeed();
break;
@@ -1234,7 +1234,7 @@ void DDA::CheckEndstops(Platform& platform)
}
break;
- case EndStopHit::lowNear:
+ case EndStopHit::nearStop:
case EndStopHit::noStop:
if (probeTriggered)
{
@@ -1283,7 +1283,7 @@ void DDA::CheckEndstops(Platform& platform)
}
break;
- case EndStopHit::lowNear:
+ case EndStopHit::nearStop:
// Only reduce homing speed if there are no more axes to be homed. This allows us to home X and Y simultaneously.
if (endStopsToCheck == MakeBitmap<AxesBitmap>(drive))
{
diff --git a/src/Movement/DDA.h b/src/Movement/DDA.h
index 231e1db8..c45c453f 100644
--- a/src/Movement/DDA.h
+++ b/src/Movement/DDA.h
@@ -74,7 +74,7 @@ public:
void LimitSpeedAndAcceleration(float maxSpeed, float maxAcceleration); // Limit the speed an acceleration of this move
int32_t GetStepsTaken(size_t drive) const;
- float GetProportionDone() const; // Return the proportion of extrusion for the complete multi-segment move already done
+ float GetProportionDone() const; // Return the proportion of extrusion for the complete multi-segment move already done
void MoveAborted();
@@ -86,9 +86,13 @@ public:
IoBits_t GetIoBits() const { return ioBits; }
#endif
+#if HAS_SMART_DRIVERS
+ uint32_t GetStepInterval(size_t axis, uint32_t microstepShift) const; // Get the current full step interval for this axis or extruder
+#endif
+
void DebugPrint() const;
- static constexpr uint32_t stepClockRate = VARIANT_MCK/128; // the frequency of the clock used for stepper pulse timing (see Platform::InitialiseInterrupts)
+ static constexpr uint32_t stepClockRate = VARIANT_MCK/128; // the frequency of the clock used for stepper pulse timing (see Platform::InitialiseInterrupts)
static constexpr uint64_t stepClockRateSquared = (uint64_t)stepClockRate * stepClockRate;
// Note on the following constant:
@@ -214,4 +218,15 @@ inline void DDA::SetDriveCoordinate(int32_t a, size_t drive)
endCoordinatesValid = false;
}
+#if HAS_SMART_DRIVERS
+
+// Get the current full step interval for this axis or extruder
+inline uint32_t DDA::GetStepInterval(size_t axis, uint32_t microstepShift) const
+{
+ const DriveMovement * const dm = pddm[axis];
+ return (dm != nullptr) ? dm->GetStepInterval(microstepShift) : 0;
+}
+
+#endif
+
#endif /* DDA_H_ */
diff --git a/src/Movement/DriveMovement.h b/src/Movement/DriveMovement.h
index 788f495d..70c728a9 100644
--- a/src/Movement/DriveMovement.h
+++ b/src/Movement/DriveMovement.h
@@ -46,6 +46,8 @@ enum class DMState : uint8_t
class DriveMovement
{
public:
+ friend class DDA;
+
DriveMovement(DriveMovement *next);
bool CalcNextStepTimeCartesian(const DDA &dda, bool live) __attribute__ ((hot));
@@ -58,6 +60,10 @@ public:
int32_t GetNetStepsLeft() const;
int32_t GetNetStepsTaken() const;
+#if HAS_SMART_DRIVERS
+ uint32_t GetStepInterval(uint32_t microstepShift) const; // Get the current full step interval for this axis or extruder
+#endif
+
static void InitialAllocate(unsigned int num);
static int NumFree() { return numFree; }
static int MinFree() { return minFree; }
@@ -73,7 +79,6 @@ private:
static int numFree;
static int minFree;
-public:
// Parameters common to Cartesian, delta and extruder moves
// The following only need to be stored per-drive if we are supporting pressure advance
@@ -223,4 +228,16 @@ inline void DriveMovement::Release(DriveMovement *item)
++numFree;
}
+#if HAS_SMART_DRIVERS
+
+// Get the current full step interval for this axis or extruder
+inline uint32_t DriveMovement::GetStepInterval(uint32_t microstepShift) const
+{
+ return ((nextStep >> microstepShift) != 0) // if at least 1 full step done
+ ? stepInterval << microstepShift // return the interval between steps converted to full steps
+ : 0;
+}
+
+#endif
+
#endif /* DRIVEMOVEMENT_H_ */
diff --git a/src/Movement/Kinematics/CoreBaseKinematics.cpp b/src/Movement/Kinematics/CoreBaseKinematics.cpp
index f6b74b5e..0ba9046c 100644
--- a/src/Movement/Kinematics/CoreBaseKinematics.cpp
+++ b/src/Movement/Kinematics/CoreBaseKinematics.cpp
@@ -27,7 +27,7 @@ bool CoreBaseKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, StringRe
bool seen = false;
for (size_t axis = 0; axis < XYZ_AXES; ++axis)
{
- if (gb.Seen(GCodes::axisLetters[axis]))
+ if (gb.Seen(reprap.GetGCodes().GetAxisLetters()[axis]))
{
axisFactors[axis] = gb.GetFValue();
seen = true;
@@ -38,7 +38,7 @@ bool CoreBaseKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, StringRe
reply.printf("Printer mode is %s with axis factors", GetName());
for (size_t axis = 0; axis < XYZ_AXES; ++axis)
{
- reply.catf(" %c:%f", GCodes::axisLetters[axis], (double)axisFactors[axis]);
+ reply.catf(" %c:%f", reprap.GetGCodes().GetAxisLetters()[axis], (double)axisFactors[axis]);
}
}
return seen;
diff --git a/src/Movement/Kinematics/CoreXYUKinematics.cpp b/src/Movement/Kinematics/CoreXYUKinematics.cpp
index ca327652..80ab8f84 100644
--- a/src/Movement/Kinematics/CoreXYUKinematics.cpp
+++ b/src/Movement/Kinematics/CoreXYUKinematics.cpp
@@ -33,7 +33,7 @@ bool CoreXYUKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, StringRef
bool seen = false;
for (size_t axis = 0; axis < CoreXYU_AXES; ++axis)
{
- if (gb.Seen(GCodes::axisLetters[axis]))
+ if (gb.Seen(reprap.GetGCodes().GetAxisLetters()[axis]))
{
axisFactors[axis] = gb.GetFValue();
seen = true;
@@ -44,7 +44,7 @@ bool CoreXYUKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, StringRef
reply.printf("Printer mode is %s with axis factors", GetName(false));
for (size_t axis = 0; axis < CoreXYU_AXES; ++axis)
{
- reply.catf(" %c:%f", GCodes::axisLetters[axis], (double)axisFactors[axis]);
+ reply.catf(" %c:%f", reprap.GetGCodes().GetAxisLetters()[axis], (double)axisFactors[axis]);
}
}
return seen;
diff --git a/src/Movement/Move.h b/src/Movement/Move.h
index 38e55e5e..86eb6ab3 100644
--- a/src/Movement/Move.h
+++ b/src/Movement/Move.h
@@ -119,6 +119,10 @@ public:
bool WriteResumeSettings(FileStore *f) const; // Write settings for resuming the print
+#if HAS_SMART_DRIVERS
+ uint32_t GetStepInterval(size_t axis, uint32_t microstepShift) const; // Get the current step interval for this axis or extruder
+#endif
+
static int32_t MotorEndPointToMachine(size_t drive, float coord); // Convert a single motor position to number of steps
static float MotorEndpointToPosition(int32_t endpoint, size_t drive); // Convert number of motor steps to motor position
@@ -231,4 +235,16 @@ inline void Move::Interrupt()
}
}
+#if HAS_SMART_DRIVERS
+
+// Get the current step interval for this axis or extruder, or 0 if it is not moving
+// This is called from the stepper drivers SPI interface ISR
+inline uint32_t Move::GetStepInterval(size_t axis, uint32_t microstepShift) const
+{
+ const DDA * const cdda = currentDda; // capture volatile variable
+ return (cdda != nullptr) ? cdda->GetStepInterval(axis, microstepShift) : 0;
+}
+
+#endif
+
#endif /* MOVE_H_ */