Skip to content

Commit

Permalink
Fixes GetFullStepsPerMotorRev
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbelobb committed Aug 28, 2018
1 parent 18d4dbe commit a335bd7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/Movement/Kinematics/HangprinterKinematics.cpp
Expand Up @@ -286,6 +286,11 @@ float HangprinterKinematics::MotorAngToAxisPosition(float ang, uint32_t stepsPer
return ((c / k0[axis] + sqrtk1[axis]) * (c / k0[axis] + sqrtk1[axis]) - k1[axis]) / k2[axis] - lineLengthsOrigin[axis];
}

uint32_t HangprinterKinematics::GetFullStepsPerMotorRev(size_t axis)
{
return fullStepsPerMotorRev[axis];
}

// Return true if the specified XY position is reachable by the print head reference point.
bool HangprinterKinematics::IsReachable(float x, float y, bool isCoordinated) const
{
Expand Down
3 changes: 2 additions & 1 deletion src/Movement/Kinematics/HangprinterKinematics.h
Expand Up @@ -40,6 +40,7 @@ class HangprinterKinematics : public Kinematics
bool WriteResumeSettings(FileStore *f) const override;
void LimitSpeedAndAcceleration(DDA& dda, const float *normalisedDirectionVector) const override;
float MotorAngToAxisPosition(float ang, uint32_t fullStepsPerRevolution, const float stepsPerMm[], size_t axis) override;
uint32_t GetFullStepsPerMotorRev(size_t axis) override;

private:
static constexpr float DefaultSegmentsPerSecond = 100.0;
Expand Down Expand Up @@ -68,7 +69,7 @@ class HangprinterKinematics : public Kinematics
float spoolBuildupFactor;
float mountedLine[HANGPRINTER_AXES], spoolRadii[HANGPRINTER_AXES];
uint32_t mechanicalAdvantage[HANGPRINTER_AXES], actionPoints[HANGPRINTER_AXES];
uint32_t motorGearTeeth[HANGPRINTER_AXES], spoolGearTeeth[HANGPRINTER_AXES], fullStepsPerRevolution[HANGPRINTER_AXES];
uint32_t motorGearTeeth[HANGPRINTER_AXES], spoolGearTeeth[HANGPRINTER_AXES], fullStepsPerMotorRev[HANGPRINTER_AXES];

// Derived parameters
float printRadiusSquared;
Expand Down
8 changes: 7 additions & 1 deletion src/Movement/Kinematics/Kinematics.cpp
Expand Up @@ -57,7 +57,8 @@ bool Kinematics::IsReachable(float x, float y, bool isCoordinated) const
return x >= platform.AxisMinimum(X_AXIS) && y >= platform.AxisMinimum(Y_AXIS) && x <= platform.AxisMaximum(X_AXIS) && y <= platform.AxisMaximum(Y_AXIS);
}

float Kinematics::MotorAngToAxisPosition(float ang, uint32_t fullStepsPerRevolution, const float stepsPerMm[], size_t axis){
float Kinematics::MotorAngToAxisPosition(float ang, uint32_t fullStepsPerRevolution, const float stepsPerMm[], size_t axis)
{
bool dummy;
const Platform& platform = reprap.GetPlatform();
const AxisDriversConfig& axisConfig = platform.GetAxisDriversConfig(axis);
Expand All @@ -66,6 +67,11 @@ float Kinematics::MotorAngToAxisPosition(float ang, uint32_t fullStepsPerRevolut
return (stepsPerRevolution / stepsPerMm[axis]) * ang / 360.0;
}

uint32_t Kinematics::GetFullStepsPerMotorRev(size_t axis)
{
return 200;
}

// Limit the Cartesian position that the user wants to move to, returning true if any coordinates were changed
// This default implementation just applies the rectangular limits set up by M208 to those axes that have been homed.
bool Kinematics::LimitPosition(float coords[], size_t numVisibleAxes, AxesBitmap axesHomed, bool isCoordinated) const
Expand Down
5 changes: 3 additions & 2 deletions src/Movement/Kinematics/Kinematics.h
Expand Up @@ -168,6 +168,9 @@ class Kinematics
// Given a motor angle relative to that in the origin, what is our position along that axis?
virtual float MotorAngToAxisPosition(float ang, uint32_t fullStepsPerRevolution, const float stepsPerMm[], size_t axis);

// How many full steps does the motor on the axis have?
virtual uint32_t GetFullStepsPerMotorRev(size_t axis);

// Return true if the specified axis is a continuous rotation axis
virtual bool IsContinuousRotationAxis(size_t axis) const { return false; }

Expand All @@ -185,7 +188,6 @@ class Kinematics
bool UseRawG0() const { return useRawG0; }
float GetSegmentsPerSecond() const pre(UseSegmentation()) { return segmentsPerSecond; }
float GetMinSegmentLength() const pre(UseSegmentation()) { return minSegmentLength; }
uint32_t GetFullStepsPerMotorRev(size_t axis) const { return fullStepsPerMotorRev[axis]; }

protected:
// Constructor. Pass segsPerSecond <= 0.0 to get non-segmented motion.
Expand All @@ -201,7 +203,6 @@ class Kinematics

float segmentsPerSecond; // if we are using segmentation, the target number of segments/second
float minSegmentLength; // if we are using segmentation, the minimum segment size
uint32_t fullStepsPerMotorRev[DRIVES] = { 200 }; // Default full steps per revolution is 200

static const char * const HomeAllFileName;
static const char * const StandardHomingFileNames[];
Expand Down

0 comments on commit a335bd7

Please sign in to comment.