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
This commit is contained in:
David Crocker 2016-03-25 21:25:08 +00:00
parent b55f0f28c3
commit a6e1258641
12 changed files with 56 additions and 47 deletions

View file

@ -86,6 +86,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${CoreName}/system/libsam/include}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${CoreName}/system/libsam/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/Lwip}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/Lwip}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/EMAC}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/EMAC}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/Fatfs}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SD_HSMCI}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SD_HSMCI}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SD_HSMCI/utility}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SD_HSMCI/utility}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SPI}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SPI}&quot;"/>
@ -201,6 +202,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${CoreName}/variants/duet}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${CoreName}/variants/duet}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/Lwip}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/Lwip}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/EMAC}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/EMAC}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/Fatfs}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SD_HSMCI}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SD_HSMCI}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SD_HSMCI/utility}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SD_HSMCI/utility}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SPI}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Libraries/SPI}&quot;"/>

View file

@ -30,7 +30,6 @@
#include "utility/conf_access.h" #include "utility/conf_access.h"
#include "utility/ctrl_access.h" #include "utility/ctrl_access.h"
// From module: SD/MMC stack on Multimedia Card interface // From module: SD/MMC stack on Multimedia Card interface
#include "utility/sd_mmc_mem.h" #include "utility/sd_mmc_mem.h"
#include "utility/sd_mmc.h" #include "utility/sd_mmc.h"
@ -39,25 +38,6 @@
// From module: High Speed Multimedia Card Interface // From module: High Speed Multimedia Card Interface
#include "utility/hsmci.h" #include "utility/hsmci.h"
// From module: DMAC - DMAC Controller
#include "utility/dmac.h"
// From module: FatFS file system
#include "../Fatfs/diskio.h"
#include "../Fatfs/ff.h"
// From module: Part identification macros
#include "sam.h"
#ifdef __SAM3X8E__
#define SAM3XE (1)
#endif
// From module: RTC - Real Time Clock
// Does not work right now
#include "utility/rtc.h"
/** Enable SD MMC interface pins through HSMCI */ /** Enable SD MMC interface pins through HSMCI */
#define CONF_BOARD_SD_MMC_HSMCI #define CONF_BOARD_SD_MMC_HSMCI

View file

@ -48,6 +48,7 @@
#include "sd_mmc_protocol.h" #include "sd_mmc_protocol.h"
#include "pmc.h" #include "pmc.h"
#include "hsmci.h" #include "hsmci.h"
#include "part.h"
/** /**
* \ingroup sam_drivers_hsmci * \ingroup sam_drivers_hsmci

View file

@ -0,0 +1,18 @@
/*
* part.h
*
* Created on: 25 Mar 2016
* Author: David
*/
#ifndef PART_H_
#define PART_H_
// Part identification macros
#include "sam.h"
#ifdef __SAM3X8E__
#define SAM3XE (1)
#endif
#endif /* PART_H_ */

View file

@ -26,11 +26,11 @@ Licence: GPL
#define NAME "RepRapFirmware" #define NAME "RepRapFirmware"
#ifndef VERSION #ifndef VERSION
#define VERSION "1.10" #define VERSION "1.10+1"
#endif #endif
#ifndef DATE #ifndef DATE
#define DATE "2016-03-24" #define DATE "2016-03-25"
#endif #endif
#define AUTHORS "reprappro, dc42, zpl, t3p3, dnewman" #define AUTHORS "reprappro, dc42, zpl, t3p3, dnewman"

View file

@ -80,14 +80,14 @@ void DDA::Init()
} }
// Set up a real move. Return true if it represents real movement, else false. // 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 // 1. Compute the new endpoints and the movement vector
const int32_t *positionNow = prev->DriveCoordinates(); const int32_t *positionNow = prev->DriveCoordinates();
const Move *move = reprap.GetMove(); const Move *move = reprap.GetMove();
if (doMotorMapping) 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() isDeltaMovement = move->IsDeltaMode()
&& (endPoint[X_AXIS] != positionNow[X_AXIS] || endPoint[Y_AXIS] != positionNow[Y_AXIS] || endPoint[Z_AXIS] != positionNow[Z_AXIS]); && (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]; accelerations[drive] = normalAccelerations[drive];
if (drive >= AXES || !doMotorMapping) if (drive >= AXES || !doMotorMapping)
{ {
endPoint[drive] = Move::MotorEndPointToMachine(drive, nextMove[drive]); endPoint[drive] = Move::MotorEndPointToMachine(drive, nextMove->coords[drive]);
} }
int32_t delta; int32_t delta;
if (drive < AXES) if (drive < AXES)
{ {
endCoordinates[drive] = nextMove[drive]; endCoordinates[drive] = nextMove->coords[drive];
delta = endPoint[drive] - positionNow[drive]; delta = endPoint[drive] - positionNow[drive];
} }
else else
@ -123,7 +123,7 @@ bool DDA::Init(const float nextMove[], float reqSpeed, EndstopChecks ce, bool do
DriveMovement& dm = ddm[drive]; DriveMovement& dm = ddm[drive];
if (drive < AXES && !isSpecialDeltaMove) 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) dm.state = (isDeltaMovement || delta != 0)
? DMState::moving // on a delta printer, if one tower moves then we assume they all do ? DMState::moving // on a delta printer, if one tower moves then we assume they all do
: DMState::idle; : DMState::idle;
@ -168,10 +168,12 @@ bool DDA::Init(const float nextMove[], float reqSpeed, EndstopChecks ce, bool do
} }
// 3. Store some values // 3. Store some values
endStopsToCheck = ce; endStopsToCheck = nextMove->endStopsToCheck;
filePos = fPos; 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 // 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. // 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. // 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. // 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. // 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) if (isSpecialDeltaMove)
{ {
// Special case of a raw or homing move on a delta printer // Special case of a raw or homing move on a delta printer
@ -604,7 +607,6 @@ void DDA::Prepare()
goingSlow = false; goingSlow = false;
firstDM = nullptr; firstDM = nullptr;
bool xyMoving = false;
for (size_t drive = 0; drive < DRIVES; ++drive) for (size_t drive = 0; drive < DRIVES; ++drive)
{ {
@ -615,7 +617,7 @@ void DDA::Prepare()
reprap.GetPlatform()->EnableDrive(drive); reprap.GetPlatform()->EnableDrive(drive);
if (drive >= AXES) 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 // Check for sensible values, print them if they look dubious
if (reprap.Debug(moduleDda) if (reprap.Debug(moduleDda)
@ -631,10 +633,6 @@ void DDA::Prepare()
} }
else if (isDeltaMovement) else if (isDeltaMovement)
{ {
if (drive <= Z_AXIS)
{
xyMoving = true;
}
dm.PrepareDeltaAxis(*this, params, drive); dm.PrepareDeltaAxis(*this, params, drive);
// Check for sensible values, print them if they look dubious // Check for sensible values, print them if they look dubious
@ -645,10 +643,6 @@ void DDA::Prepare()
} }
else else
{ {
if (drive < Z_AXIS)
{
xyMoving = true;
}
dm.PrepareCartesianAxis(*this, params, drive); dm.PrepareCartesianAxis(*this, params, drive);
// Check for sensible values, print them if they look dubious // Check for sensible values, print them if they look dubious

View file

@ -30,8 +30,7 @@ public:
DDA(DDA* n); DDA(DDA* n);
bool Init(const float nextMove[], float reqSpeed, EndstopChecks ce, bool Init(const GCodes::RawMove *nextMove, bool doMotorMapping); // Set up a new move, returning true if it represents real movement
bool doMotorMapping, FilePosition fPos); // Set up a new move, returning true if it represents real movement
void Init(); // Set up initial positions for machine startup void Init(); // Set up initial positions for machine startup
bool Start(uint32_t tim); // Start executing the DDA, i.e. move the move. 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. 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 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 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 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 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 FilePosition filePos; // The position in the SD card file after this move was read, or zero if not read fro SD card

View file

@ -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.feedRate = DEFAULT_FEEDRATE/minutesToSeconds; // ask for a good feed rate, we may have paused during a slow move
moveBuffer.moveType = 0; moveBuffer.moveType = 0;
moveBuffer.endStopsToCheck = 0; moveBuffer.endStopsToCheck = 0;
moveBuffer.usePressureAdvance = false;
moveBuffer.filePos = noFilePosition; moveBuffer.filePos = noFilePosition;
if (state == GCodeState::resuming1 && currentZ > pausedMoveBuffer[Z_AXIS]) 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 // 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); moveAvailable = LoadMoveBufferFromGCode(gb, false, limitAxes && moveBuffer.moveType == 0);
if (moveAvailable) 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; moveBuffer.filePos = (gb == fileGCode) ? filePos : noFilePosition;
//debugPrintf("Queue move pos %u\n", moveFilePos); //debugPrintf("Queue move pos %u\n", moveFilePos);
} }
@ -918,8 +925,9 @@ bool GCodes::DoCannedCycleMove(EndstopChecks ce)
moveBuffer.feedRate = moveToDo[DRIVES]; moveBuffer.feedRate = moveToDo[DRIVES];
moveBuffer.endStopsToCheck = ce; moveBuffer.endStopsToCheck = ce;
moveBuffer.filePos = noFilePosition; moveBuffer.filePos = noFilePosition;
cannedCycleMoveQueued = true; moveBuffer.usePressureAdvance = false;
moveAvailable = true; moveAvailable = true;
cannedCycleMoveQueued = true;
} }
return false; return false;
} }
@ -2334,7 +2342,10 @@ bool GCodes::RetractFilament(bool retract)
{ {
moveBuffer.coords[i] = 0.0; 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); moveBuffer.coords[Z_AXIS] += ((retract) ? retractHop : -retractHop);
for (size_t i = 0; i < nDrives; ++i) for (size_t i = 0; i < nDrives; ++i)
{ {
@ -2342,6 +2353,7 @@ bool GCodes::RetractFilament(bool retract)
} }
moveBuffer.isFirmwareRetraction = true; moveBuffer.isFirmwareRetraction = true;
moveBuffer.usePressureAdvance = false;
moveBuffer.filePos = filePos; moveBuffer.filePos = filePos;
moveAvailable = true; moveAvailable = true;
} }
@ -2422,6 +2434,7 @@ bool GCodes::HandleGcode(GCodeBuffer* gb, StringRef& reply)
moveBuffer.feedRate = (gb->Seen(feedrateLetter)) ? gb->GetFValue() : feedRate; moveBuffer.feedRate = (gb->Seen(feedrateLetter)) ? gb->GetFValue() : feedRate;
} }
moveBuffer.filePos = noFilePosition; moveBuffer.filePos = noFilePosition;
moveBuffer.usePressureAdvance = false;
moveAvailable = true; moveAvailable = true;
} }
else else
@ -4598,7 +4611,7 @@ bool GCodes::HandleMcode(GCodeBuffer* gb, StringRef& reply)
} }
else 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; break;

View file

@ -83,6 +83,7 @@ public:
EndstopChecks endStopsToCheck; // endstops to check EndstopChecks endStopsToCheck; // endstops to check
uint8_t moveType; // the S parameter from the G0 or G1 command, 0 for a normal move 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 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); GCodes(Platform* p, Webserver* w);

View file

@ -190,7 +190,7 @@ void Move::Spin()
{ {
Transform(nextMove.coords); Transform(nextMove.coords);
} }
if (ddaRingAddPointer->Init(nextMove.coords, nextMove.feedRate, nextMove.endStopsToCheck, doMotorMapping, nextMove.filePos)) if (ddaRingAddPointer->Init(&nextMove, doMotorMapping))
{ {
ddaRingAddPointer = ddaRingAddPointer->GetNext(); ddaRingAddPointer = ddaRingAddPointer->GetNext();
idleCount = 0; idleCount = 0;

View file

@ -46,6 +46,7 @@ Licence: GPL
#include "Arduino.h" #include "Arduino.h"
#include "OutputMemory.h" #include "OutputMemory.h"
#include "ff.h"
#include "SD_HSMCI.h" #include "SD_HSMCI.h"
#include "MAX31855.h" #include "MAX31855.h"
#include "MCP4461.h" #include "MCP4461.h"