Code added to add a bed plane z = aX.x + aY.y + aC to all movements.
Note that this means that X/Y minimum speeds and accelerations now take precedence over Z, unless there is only Z movement.
This commit is contained in:
parent
953828081e
commit
027ddf3b8e
6 changed files with 1893 additions and 1858 deletions
62
Move.cpp
62
Move.cpp
|
@ -134,9 +134,13 @@ void Move::Init()
|
|||
|
||||
stepDistances[0] = 1.0/platform->DriveStepsPerUnit(AXES);
|
||||
extruderStepDistances[0] = stepDistances[0];
|
||||
|
||||
|
||||
currentFeedrate = -1.0;
|
||||
|
||||
|
||||
aX = 0.0;
|
||||
aY = 0.0;
|
||||
aC = 0.0;
|
||||
|
||||
lastTime = platform->Time();
|
||||
active = true;
|
||||
}
|
||||
|
@ -178,6 +182,8 @@ void Move::Spin()
|
|||
|
||||
if(gCodes->ReadMove(nextMove, checkEndStopsOnNextMove))
|
||||
{
|
||||
Transform(nextMove);
|
||||
|
||||
currentFeedrate = nextMove[DRIVES]; // Might be G1 with just an F field
|
||||
|
||||
int8_t mt = GetMovementType(lastMove->EndPoint(), nextMove);
|
||||
|
@ -200,14 +206,14 @@ void Move::Spin()
|
|||
else
|
||||
nextMove[DRIVES] = fmax(nextMove[DRIVES], platform->InstantDv(Z_AXIS));
|
||||
|
||||
// Restrict maximum feedrates; assumes z < e < xy FIXME??
|
||||
// Restrict maximum feedrates; assumes xy overrides e overrides z FIXME??
|
||||
|
||||
if(mt & zMove)
|
||||
nextMove[DRIVES] = fmin(nextMove[DRIVES], platform->MaxFeedrate(Z_AXIS));
|
||||
if(mt & xyMove)
|
||||
nextMove[DRIVES] = fmin(nextMove[DRIVES], platform->MaxFeedrate(X_AXIS));
|
||||
else if(mt & eMove)
|
||||
nextMove[DRIVES] = fmin(nextMove[DRIVES], platform->MaxFeedrate(AXES)); // Picks up the value for the first extruder. FIXME?
|
||||
else // Must be xy
|
||||
nextMove[DRIVES] = fmin(nextMove[DRIVES], platform->MaxFeedrate(X_AXIS)); // Assumes X and Y are equal. FIXME?
|
||||
else // Must be z
|
||||
nextMove[DRIVES] = fmin(nextMove[DRIVES], platform->MaxFeedrate(Z_AXIS)); // Assumes X and Y are equal. FIXME?
|
||||
|
||||
if(!LookAheadRingAdd(nextMove, 0.0, checkEndStopsOnNextMove))
|
||||
platform->Message(HOST_MESSAGE, "Can't add to non-full look ahead ring!\n"); // Should never happen...
|
||||
|
@ -269,10 +275,11 @@ bool Move::GetCurrentState(float m[])
|
|||
else
|
||||
m[DRIVES] = lastMove->EndPoint()[DRIVES];
|
||||
currentFeedrate = -1.0;
|
||||
InverseTransform(m);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Classify a move between to points.
|
||||
// Classify a move between two points.
|
||||
// Is it (a combination of):
|
||||
// A Z movement?
|
||||
// An XY movement?
|
||||
|
@ -281,6 +288,7 @@ bool Move::GetCurrentState(float m[])
|
|||
int8_t Move::GetMovementType(float p0[], float p1[])
|
||||
{
|
||||
int8_t result = noMove;
|
||||
|
||||
for(int8_t drive = 0; drive < DRIVES; drive++)
|
||||
{
|
||||
if(drive < AXES)
|
||||
|
@ -298,6 +306,7 @@ int8_t Move::GetMovementType(float p0[], float p1[])
|
|||
result |= eMove;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -441,9 +450,12 @@ void Move::DoLookAhead()
|
|||
if(c <= 0)
|
||||
{
|
||||
int8_t mt = GetMovementType(n0->EndPoint(), n1->EndPoint());
|
||||
if(mt & zMove)
|
||||
|
||||
// Assumes xy overrides z overrides e
|
||||
|
||||
if(mt & xyMove)
|
||||
c = platform->InstantDv(Z_AXIS);
|
||||
else if (mt & xyMove)
|
||||
else if (mt & zMove)
|
||||
c = platform->InstantDv(X_AXIS);
|
||||
else
|
||||
c = platform->InstantDv(AXES); // value for first extruder FIXME??
|
||||
|
@ -526,6 +538,16 @@ LookAhead* Move::LookAheadRingGet()
|
|||
return result;
|
||||
}
|
||||
|
||||
void Move::Transform(float move[])
|
||||
{
|
||||
move[2] = move[2] + aX*move[0] + aY*move[1] + aC;
|
||||
}
|
||||
|
||||
void Move::InverseTransform(float move[])
|
||||
{
|
||||
move[2] = move[2] - (aX*move[0] + aY*move[1] + aC);
|
||||
}
|
||||
|
||||
|
||||
// FIXME
|
||||
// This function is never normally called. It is a test to time
|
||||
|
@ -584,10 +606,10 @@ instantDv value) to use.
|
|||
|
||||
The rules are these:
|
||||
|
||||
if Z is moving
|
||||
Use Z acceleration
|
||||
else if X and/or Y are moving
|
||||
if X and/or Y are moving
|
||||
Use X acceleration
|
||||
else if Z is moving
|
||||
Use Z acceleration
|
||||
else
|
||||
Use the acceleration for the extruder that's moving.
|
||||
|
||||
|
@ -606,7 +628,7 @@ value stored for each.
|
|||
In the case of only extruders moving, the distance moved is taken to be the Pythagoran distance in
|
||||
the configuration space of the extruders.
|
||||
|
||||
TODO: Worry about having more than eight extruders...
|
||||
TODO: Worry about having more than eight extruders; X and Y behaving radically differently...
|
||||
|
||||
*/
|
||||
|
||||
|
@ -677,16 +699,16 @@ MovementProfile DDA::Init(LookAhead* lookAhead, float& u, float& v)
|
|||
// corresponding axis step. It will be divided
|
||||
// by a velocity later.
|
||||
|
||||
if(delta[Z_AXIS]) // Z involved?
|
||||
if(delta[X_AXIS] || delta[Y_AXIS]) // X or Y involved?
|
||||
{
|
||||
acceleration = platform->Acceleration(X_AXIS);
|
||||
instantDv = platform->InstantDv(X_AXIS);
|
||||
timeStep = 1.0/platform->DriveStepsPerUnit(X_AXIS); // Slight hack
|
||||
} else if (delta[Z_AXIS])// Z involved?
|
||||
{
|
||||
acceleration = platform->Acceleration(Z_AXIS);
|
||||
instantDv = platform->InstantDv(Z_AXIS);
|
||||
timeStep = 1.0/platform->DriveStepsPerUnit(Z_AXIS);
|
||||
} else if(delta[X_AXIS] || delta[Y_AXIS]) // X or Y involved?
|
||||
{
|
||||
acceleration = platform->Acceleration(X_AXIS);
|
||||
instantDv = platform->InstantDv(X_AXIS);
|
||||
timeStep = 1.0/platform->DriveStepsPerUnit(X_AXIS); // Slight hack
|
||||
} else // Must be extruders only
|
||||
{
|
||||
acceleration = FLT_MAX; // Slight hack
|
||||
|
|
5
Move.h
5
Move.h
|
@ -24,6 +24,7 @@ Licence: GPL
|
|||
#define DDA_RING_LENGTH 5
|
||||
#define LOOK_AHEAD_RING_LENGTH 20
|
||||
#define LOOK_AHEAD 7
|
||||
#define SMALL_Z_MOVE 0.03 // If a Z movement is less than this fraction of an XY move, the movement is classed as XY
|
||||
|
||||
enum MovementProfile
|
||||
{
|
||||
|
@ -136,6 +137,9 @@ class Move
|
|||
void DoLookAhead();
|
||||
void HitLowStop(int8_t drive, LookAhead* la);
|
||||
void HitHighStop(int8_t drive, LookAhead* la);
|
||||
void SetBedPlane();
|
||||
void Transform(float move[]);
|
||||
void InverseTransform(float move[]);
|
||||
void Diagnostics();
|
||||
|
||||
friend class DDA;
|
||||
|
@ -178,6 +182,7 @@ class Move
|
|||
float nextMove[DRIVES + 1]; // Extra is for feedrate
|
||||
float stepDistances[(1<<AXES)]; // Index bits: lsb -> dx, dy, dz <- msb
|
||||
float extruderStepDistances[(1<<(DRIVES-AXES))]; // NB - limits us to 5 extruders
|
||||
float aX, aY, aC;
|
||||
};
|
||||
|
||||
//********************************************************************************************************
|
||||
|
|
|
@ -86,7 +86,7 @@ Licence: GPL
|
|||
#define ACCELERATIONS {800.0, 800.0, 30.0, 250.0} // mm/sec^2??
|
||||
//#define ACCELERATIONS {80, 80, 3, 25}
|
||||
#define DRIVE_STEPS_PER_UNIT {91.4286, 91.4286, 4000.0, 948.0}
|
||||
#define INSTANT_DVS {15.0, 15.0, 0.4, 15} // (mm/sec) - Bit high? AB
|
||||
#define INSTANT_DVS {15.0, 15.0, 0.4, 0.5} // (mm/sec) - Bit high? AB
|
||||
|
||||
// AXES
|
||||
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -5,7 +5,7 @@ G21 ; mm
|
|||
G90 ; Absolute positioning
|
||||
M83 ; Extrusion relative
|
||||
M107; Fan off
|
||||
M906 X250 Y250 Z250 E250 ; Motor currents (mA)
|
||||
M906 X400 Y400 Z400 E400 ; Motor currents (mA)
|
||||
T0 ; Extruder 0
|
||||
|
||||
|
||||
|
|
Reference in a new issue