diff options
author | David Crocker <dcrocker@eschertech.com> | 2016-03-26 00:25:08 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2016-03-26 00:25:08 +0300 |
commit | a6e125864177532ab97a40c4b9129c5389fe0a8d (patch) | |
tree | cbde9fb96a341e433f57d0bc0007231c55d51f74 /src | |
parent | b55f0f28c35cd869b6d96abb16c2dda6da370998 (diff) |
Interim build 1.10+1
Fixed incorrect parameters for un-retraction moves when z-hop,
orthogonal axis compensation and pressure advance are all enabled
Further refactoring of SD_HSMCI library in preparation for moving hsmci,
dmac and rtc modules into CoreDuet
Diffstat (limited to 'src')
-rw-r--r-- | src/Configuration.h | 4 | ||||
-rw-r--r-- | src/DDA.cpp | 30 | ||||
-rw-r--r-- | src/DDA.h | 5 | ||||
-rw-r--r-- | src/GCodes.cpp | 19 | ||||
-rw-r--r-- | src/GCodes.h | 1 | ||||
-rw-r--r-- | src/Move.cpp | 2 | ||||
-rw-r--r-- | src/Platform.h | 1 |
7 files changed, 35 insertions, 27 deletions
diff --git a/src/Configuration.h b/src/Configuration.h index 28973a3c..57c10c2e 100644 --- a/src/Configuration.h +++ b/src/Configuration.h @@ -26,11 +26,11 @@ Licence: GPL #define NAME "RepRapFirmware" #ifndef VERSION -#define VERSION "1.10" +#define VERSION "1.10+1" #endif #ifndef DATE -#define DATE "2016-03-24" +#define DATE "2016-03-25" #endif #define AUTHORS "reprappro, dc42, zpl, t3p3, dnewman" diff --git a/src/DDA.cpp b/src/DDA.cpp index 0b7496e3..547432cc 100644 --- a/src/DDA.cpp +++ b/src/DDA.cpp @@ -80,14 +80,14 @@ void DDA::Init() } // Set up a real move. Return true if it represents real movement, else false. -bool DDA::Init(const float nextMove[], float reqSpeed, EndstopChecks ce, bool doMotorMapping, FilePosition fPos) +bool DDA::Init(const GCodes::RawMove *nextMove, bool doMotorMapping) { // 1. Compute the new endpoints and the movement vector const int32_t *positionNow = prev->DriveCoordinates(); const Move *move = reprap.GetMove(); if (doMotorMapping) { - move->MotorTransform(nextMove, endPoint); // transform the axis coordinates if on a delta or CoreXY printer + move->MotorTransform(nextMove->coords, endPoint); // transform the axis coordinates if on a delta or CoreXY printer isDeltaMovement = move->IsDeltaMode() && (endPoint[X_AXIS] != positionNow[X_AXIS] || endPoint[Y_AXIS] != positionNow[Y_AXIS] || endPoint[Z_AXIS] != positionNow[Z_AXIS]); } @@ -106,13 +106,13 @@ bool DDA::Init(const float nextMove[], float reqSpeed, EndstopChecks ce, bool do accelerations[drive] = normalAccelerations[drive]; if (drive >= AXES || !doMotorMapping) { - endPoint[drive] = Move::MotorEndPointToMachine(drive, nextMove[drive]); + endPoint[drive] = Move::MotorEndPointToMachine(drive, nextMove->coords[drive]); } int32_t delta; if (drive < AXES) { - endCoordinates[drive] = nextMove[drive]; + endCoordinates[drive] = nextMove->coords[drive]; delta = endPoint[drive] - positionNow[drive]; } else @@ -123,7 +123,7 @@ bool DDA::Init(const float nextMove[], float reqSpeed, EndstopChecks ce, bool do DriveMovement& dm = ddm[drive]; if (drive < AXES && !isSpecialDeltaMove) { - directionVector[drive] = nextMove[drive] - prev->GetEndCoordinate(drive, false); + directionVector[drive] = nextMove->coords[drive] - prev->GetEndCoordinate(drive, false); dm.state = (isDeltaMovement || delta != 0) ? DMState::moving // on a delta printer, if one tower moves then we assume they all do : DMState::idle; @@ -168,10 +168,12 @@ bool DDA::Init(const float nextMove[], float reqSpeed, EndstopChecks ce, bool do } // 3. Store some values - endStopsToCheck = ce; - filePos = fPos; + endStopsToCheck = nextMove->endStopsToCheck; + filePos = nextMove->filePos; + usePressureAdvance = nextMove->usePressureAdvance; + // The end coordinates will be valid at the end of this move if it does not involve endstop checks and is not a special move on a delta printer - endCoordinatesValid = (ce == 0) && (doMotorMapping || !move->IsDeltaMode()); + endCoordinatesValid = (endStopsToCheck == 0) && (doMotorMapping || !move->IsDeltaMode()); // 4. Normalise the direction vector and compute the amount of motion. // If there is any XYZ movement, then we normalise it so that the total XYZ movement has unit length. @@ -269,6 +271,7 @@ bool DDA::Init(const float nextMove[], float reqSpeed, EndstopChecks ce, bool do // Set the speed to the smaller of the requested and maximum speed. // Also enforce a minimum speed of 0.5mm/sec. We need a minimum speed to avoid overflow in the movement calculations. + float reqSpeed = nextMove->feedRate; if (isSpecialDeltaMove) { // Special case of a raw or homing move on a delta printer @@ -604,7 +607,6 @@ void DDA::Prepare() goingSlow = false; firstDM = nullptr; - bool xyMoving = false; for (size_t drive = 0; drive < DRIVES; ++drive) { @@ -615,7 +617,7 @@ void DDA::Prepare() reprap.GetPlatform()->EnableDrive(drive); if (drive >= AXES) { - dm.PrepareExtruder(*this, params, drive, xyMoving); + dm.PrepareExtruder(*this, params, drive, usePressureAdvance); // Check for sensible values, print them if they look dubious if (reprap.Debug(moduleDda) @@ -631,10 +633,6 @@ void DDA::Prepare() } else if (isDeltaMovement) { - if (drive <= Z_AXIS) - { - xyMoving = true; - } dm.PrepareDeltaAxis(*this, params, drive); // Check for sensible values, print them if they look dubious @@ -645,10 +643,6 @@ void DDA::Prepare() } else { - if (drive < Z_AXIS) - { - xyMoving = true; - } dm.PrepareCartesianAxis(*this, params, drive); // Check for sensible values, print them if they look dubious @@ -30,8 +30,7 @@ public: DDA(DDA* n); - bool Init(const float nextMove[], float reqSpeed, EndstopChecks ce, - bool doMotorMapping, FilePosition fPos); // Set up a new move, returning true if it represents real movement + bool Init(const GCodes::RawMove *nextMove, bool doMotorMapping); // Set up a new move, returning true if it represents real movement void Init(); // Set up initial positions for machine startup bool Start(uint32_t tim); // Start executing the DDA, i.e. move the move. bool Step(); // Take one step of the DDA, called by timed interrupt. @@ -99,9 +98,9 @@ private: uint8_t canPause : 1; // True if we can pause at the end of this move uint8_t goingSlow : 1; // True if we have reduced speed during homing uint8_t isPrintingMove : 1; // True if this move includes XY movement and extrusion + uint8_t usePressureAdvance : 1; // True if pressure advance should be applied to any forward extrusion EndstopChecks endStopsToCheck; // Which endstops we are checking on this move - // We are on a half-word boundary here, so expect 2 bytes of padding to be inserted at this point FilePosition filePos; // The position in the SD card file after this move was read, or zero if not read fro SD card diff --git a/src/GCodes.cpp b/src/GCodes.cpp index 9ff398d5..c3d60874 100644 --- a/src/GCodes.cpp +++ b/src/GCodes.cpp @@ -356,6 +356,7 @@ void GCodes::Spin() moveBuffer.feedRate = DEFAULT_FEEDRATE/minutesToSeconds; // ask for a good feed rate, we may have paused during a slow move moveBuffer.moveType = 0; moveBuffer.endStopsToCheck = 0; + moveBuffer.usePressureAdvance = false; moveBuffer.filePos = noFilePosition; if (state == GCodeState::resuming1 && currentZ > pausedMoveBuffer[Z_AXIS]) { @@ -826,9 +827,15 @@ int GCodes::SetUpMove(GCodeBuffer *gb, StringRef& reply) } // Load the move buffer with either the absolute movement required or the relative movement required + const float currentX = moveBuffer.coords[X_AXIS]; + const float currentY = moveBuffer.coords[Y_AXIS]; moveAvailable = LoadMoveBufferFromGCode(gb, false, limitAxes && moveBuffer.moveType == 0); if (moveAvailable) { + // Flag whether we should use pressure advance, if there is any extrusion in this move. + // We assume it is a normal printing move needing pressure advance if there is forward extrusion and XY movement. + // The movement code will only apply pressure advance if there is forward extrusion, so we only need to check for XY movement here. + moveBuffer.usePressureAdvance = (moveBuffer.coords[X_AXIS] != currentX || moveBuffer.coords[Y_AXIS] != currentY); moveBuffer.filePos = (gb == fileGCode) ? filePos : noFilePosition; //debugPrintf("Queue move pos %u\n", moveFilePos); } @@ -918,8 +925,9 @@ bool GCodes::DoCannedCycleMove(EndstopChecks ce) moveBuffer.feedRate = moveToDo[DRIVES]; moveBuffer.endStopsToCheck = ce; moveBuffer.filePos = noFilePosition; - cannedCycleMoveQueued = true; + moveBuffer.usePressureAdvance = false; moveAvailable = true; + cannedCycleMoveQueued = true; } return false; } @@ -2334,7 +2342,10 @@ bool GCodes::RetractFilament(bool retract) { moveBuffer.coords[i] = 0.0; } - moveBuffer.feedRate = retractSpeed * secondsToMinutes; // set the feed rate + // Set the feed rate. If there is any Z hop then we need to pass the Z speed, else we pass the extrusion speed. + moveBuffer.feedRate = (retractHop == 0.0) + ? retractSpeed * secondsToMinutes + : retractSpeed * secondsToMinutes * retractHop/retractLength; moveBuffer.coords[Z_AXIS] += ((retract) ? retractHop : -retractHop); for (size_t i = 0; i < nDrives; ++i) { @@ -2342,6 +2353,7 @@ bool GCodes::RetractFilament(bool retract) } moveBuffer.isFirmwareRetraction = true; + moveBuffer.usePressureAdvance = false; moveBuffer.filePos = filePos; moveAvailable = true; } @@ -2422,6 +2434,7 @@ bool GCodes::HandleGcode(GCodeBuffer* gb, StringRef& reply) moveBuffer.feedRate = (gb->Seen(feedrateLetter)) ? gb->GetFValue() : feedRate; } moveBuffer.filePos = noFilePosition; + moveBuffer.usePressureAdvance = false; moveAvailable = true; } else @@ -4598,7 +4611,7 @@ bool GCodes::HandleMcode(GCodeBuffer* gb, StringRef& reply) } else { - reply.printf("Elastic compensation for extruder %u is %.3f seconds", extruder, platform->GetElasticComp(extruder)); + reply.printf("Pressure advance for extruder %u is %.3f seconds", extruder, platform->GetElasticComp(extruder)); } } break; diff --git a/src/GCodes.h b/src/GCodes.h index 8cd920c2..a3de3c9d 100644 --- a/src/GCodes.h +++ b/src/GCodes.h @@ -83,6 +83,7 @@ public: EndstopChecks endStopsToCheck; // endstops to check uint8_t moveType; // the S parameter from the G0 or G1 command, 0 for a normal move bool isFirmwareRetraction; // true if this is a firmware retraction/un-retraction move + bool usePressureAdvance; // true if we want to us extruder pressure advance, if there is any extrusion }; GCodes(Platform* p, Webserver* w); diff --git a/src/Move.cpp b/src/Move.cpp index b869610e..ee3ce5c4 100644 --- a/src/Move.cpp +++ b/src/Move.cpp @@ -190,7 +190,7 @@ void Move::Spin() { Transform(nextMove.coords); } - if (ddaRingAddPointer->Init(nextMove.coords, nextMove.feedRate, nextMove.endStopsToCheck, doMotorMapping, nextMove.filePos)) + if (ddaRingAddPointer->Init(&nextMove, doMotorMapping)) { ddaRingAddPointer = ddaRingAddPointer->GetNext(); idleCount = 0; diff --git a/src/Platform.h b/src/Platform.h index 1ab8a286..159db6f9 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -46,6 +46,7 @@ Licence: GPL #include "Arduino.h" #include "OutputMemory.h" +#include "ff.h" #include "SD_HSMCI.h" #include "MAX31855.h" #include "MCP4461.h" |