Bug found by Tony in the offsetting code fixed (I hope).

This commit is contained in:
Adrian Bowyer 2013-11-29 23:50:59 +00:00
parent f0b7da252b
commit dfbc35d369
3 changed files with 34 additions and 32 deletions

View file

@ -311,36 +311,36 @@ void GCodes::LoadMoveBufferFromGCode(GCodeBuffer *gb)
moveBuffer[DRIVES] = gFeedRate; // We always set it, as Move may have modified the last one.
}
void GCodes::LoadMoveBufferFromArray(float m[])
{
float absE;
for(uint8_t i = 0; i < DRIVES; i++)
{
if(i < AXES)
{
if(axesRelative)
moveBuffer[i] += m[i];
else
moveBuffer[i] = m[i];
} else
{
if(drivesRelative)
moveBuffer[i] = m[i];
else
{
absE = m[i];
moveBuffer[i] = absE - lastPos[i - AXES];
lastPos[i - AXES] = absE;
}
}
}
// Deal with feedrate
moveBuffer[DRIVES] = m[DRIVES]; // We always set it, as Move may have modified the last one.
}
//void GCodes::LoadMoveBufferFromArray(float m[])
//{
// float absE;
//
// for(uint8_t i = 0; i < DRIVES; i++)
// {
// if(i < AXES)
// {
// if(axesRelative)
// moveBuffer[i] += m[i];
// else
// moveBuffer[i] = m[i];
//
// } else
// {
// if(drivesRelative)
// moveBuffer[i] = m[i];
// else
// {
// absE = m[i];
// moveBuffer[i] = absE - lastPos[i - AXES];
// lastPos[i - AXES] = absE;
// }
// }
// }
//
// // Deal with feedrate
//
// moveBuffer[DRIVES] = m[DRIVES]; // We always set it, as Move may have modified the last one.
//}
// This function is called for a G Code that makes a move.
@ -470,7 +470,9 @@ bool GCodes::OffsetAxes(GCodeBuffer* gb)
if(DoCannedCycleMove(false))
{
LoadMoveBufferFromArray(record);
//LoadMoveBufferFromArray(record);
for(int drive = 0; drive <= DRIVES; drive++)
moveBuffer[drive] = record[drive];
reprap.GetMove()->SetLiveCoordinates(record); // This doesn't transform record
reprap.GetMove()->SetPositions(record); // This does
offSetSet = false;

View file

@ -93,7 +93,7 @@ class GCodes
bool SetOffsets(GCodeBuffer *gb);
bool SetPositions(GCodeBuffer *gb);
void LoadMoveBufferFromGCode(GCodeBuffer *gb);
void LoadMoveBufferFromArray(float m[]);
//void LoadMoveBufferFromArray(float m[]);
bool NoHome();
bool Push();
bool Pop();

Binary file not shown.