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:/${ProjName}/Libraries/Lwip}&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/utility}&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:/${ProjName}/Libraries/Lwip}&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/utility}&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/ctrl_access.h"
// From module: SD/MMC stack on Multimedia Card interface
#include "utility/sd_mmc_mem.h"
#include "utility/sd_mmc.h"
@ -39,25 +38,6 @@
// From module: High Speed Multimedia Card Interface
#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 */
#define CONF_BOARD_SD_MMC_HSMCI

View file

@ -48,6 +48,7 @@
#include "sd_mmc_protocol.h"
#include "pmc.h"
#include "hsmci.h"
#include "part.h"
/**
* \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"
#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"

View file

@ -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

View file

@ -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

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.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;

View file

@ -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);

View file

@ -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;

View file

@ -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"