Skip to content
This repository was archived by the owner on Jul 9, 2020. It is now read-only.

Commit adcff08

Browse files
committed
Merge remote-tracking branch 'dc42/dev' into v2-dev-lpc
2 parents a7e9217 + 0cdb467 commit adcff08

File tree

21 files changed

+273
-213
lines changed

21 files changed

+273
-213
lines changed

WHATS_NEW.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
Summary of important changes in recent versions
22
===============================================
33

4-
<<<<<<< HEAD
5-
Version 2.04
4+
Version 2.05RC1
65
===============
76
Compatible files:
87
- DuetWiFiServer 1.23
98
- DuetWebControl 2.0.4 (recommended) or 1.22.6
10-
=======
11-
Version 2.05 (in preparation)
12-
============
13-
Compatible files:
14-
- DuetWiFiServer 1.23
15-
- DuetWebControl 2.0.4 (recommended) or 1.22.6
169

1710
Upgrade notes: none
1811

@@ -26,6 +19,8 @@ Bug fixes:
2619
- When using SCARA kinematics the calculation of the minimum achoievable radius was incorrect. Depending on the B parameter of the M667 command, this could result in spurious "Intermediate position unreachable" errors, or non-extruding G1 moves being turned into G0 moves.
2720
- A badly-formed GCode file that returned the layer height or object height as nan or inf caused DWC to disconnect because of a JSON parse failure
2821
- M579 scale factors were not applied correctly to G2 and G3 arc moves
22+
- Spurious newlines were sometimes sent to USB and other output channels when commands such as M106 were deferred to execute in step with movement commands, or when commands were executed in response to triggers
23+
- Messages sent to USB and Telnet output channels did not always time out when the channel became unavailable for writing
2924

3025
Version 2.04
3126
============

src/GCodes/GCodes.cpp

Lines changed: 87 additions & 57 deletions
Large diffs are not rendered by default.

src/GCodes/GCodes.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ class GCodes INHERIT_OBJECT_MODEL
121121
float acceleration; // the requested acceleration, for async moves
122122
};
123123
FilePosition filePos; // offset in the file being printed at the start of reading this move
124-
float proportionLeft; // what proportion of the entire move remains after this segment
125-
AxesBitmap xAxes; // axes that X is mapped to
126-
AxesBitmap yAxes; // axes that Y is mapped to
124+
float proportionDone; // what proportion of the entire move has been done when this segment is complete
125+
float initialUserX, initialUserY; // if this is a segment of an arc move, the user X and Y coordinates at the start
126+
const Tool *tool; // which tool (if any) is being used
127127
EndstopsBitmap endStopsToCheck; // endstops to check
128128
#if SUPPORT_LASER || SUPPORT_IOBITS
129129
LaserPwmOrIoBits laserPwmOrIoBits; // the laser PWM or port bit settings required
@@ -482,10 +482,13 @@ class GCodes INHERIT_OBJECT_MODEL
482482
unsigned int totalSegments; // The total number of segments left in the complete move
483483

484484
unsigned int segmentsLeftToStartAt;
485-
float moveFractionToStartAt; // how much of the next move was printed before the power failure
486485
float moveFractionToSkip;
487486
float firstSegmentFractionToSkip;
488487

488+
float restartMoveFractionDone; // how much of the next move was printed before the pause or power failure (from M26)
489+
float restartInitialUserX; // if the print was paused during an arc move, the user X coordinate at the start of that move (from M26)
490+
float restartInitialUserY; // if the print was paused during an arc move, the user X coordinate at the start of that move (from M26)
491+
489492
float arcCentre[MaxAxes];
490493
float arcRadius;
491494
float arcCurrentAngle;

src/GCodes/GCodes2.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply)
795795
// We need to copy the absolute/relative and volumetric extrusion flags over
796796
fileGCode->OriginalMachineState().CopyStateFrom(gb.MachineState());
797797
fileToPrint.Seek(fileOffsetToPrint);
798-
moveFractionToSkip = moveFractionToStartAt;
798+
moveFractionToSkip = restartMoveFractionDone;
799799
}
800800
StartPrinting(fromStart);
801801
}
@@ -869,10 +869,9 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply)
869869
if (gb.Seen('S'))
870870
{
871871
fileOffsetToPrint = (FilePosition)gb.GetUIValue();
872-
if (gb.Seen('P'))
873-
{
874-
moveFractionToStartAt = constrain<float>(gb.GetFValue(), 0.0, 1.0);
875-
}
872+
restartMoveFractionDone = (gb.Seen('P')) ? constrain<float>(gb.GetFValue(), 0.0, 1.0) : 0.0;
873+
restartInitialUserX = (gb.Seen('X')) ? gb.GetFValue() : 0.0;
874+
restartInitialUserY = (gb.Seen('Y')) ? gb.GetFValue() : 0.0;
876875
}
877876
break;
878877

src/GCodes/GCodes3.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,10 @@ GCodeResult GCodes::ProbeTool(GCodeBuffer& gb, const StringRef& reply)
847847
SavePosition(toolChangeRestorePoint, gb);
848848

849849
// Prepare another move similar to G1 .. S3
850+
moveBuffer.SetDefaults(numVisibleAxes);
850851
moveBuffer.moveType = 3;
852+
moveBuffer.canPauseAfter = false;
853+
851854
if (endStopToUse < 0)
852855
{
853856
moveBuffer.endStopsToCheck = 0;
@@ -864,11 +867,6 @@ GCodeResult GCodes::ProbeTool(GCodeBuffer& gb, const StringRef& reply)
864867
moveBuffer.endStopsToCheck |= ActiveLowEndstop;
865868
}
866869
}
867-
moveBuffer.xAxes = DefaultXAxisMapping;
868-
moveBuffer.yAxes = DefaultYAxisMapping;
869-
moveBuffer.usePressureAdvance = false;
870-
moveBuffer.filePos = noFilePosition;
871-
moveBuffer.canPauseAfter = false;
872870

873871
// Decide which way and how far to go
874872
if (gb.Seen('R'))

src/GCodes/RestorePoint.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ void RestorePoint::Init()
2323
virtualExtruderPosition = 0.0;
2424
filePos = noFilePosition;
2525
proportionDone = 0.0;
26+
initialUserX = initialUserY = 0.0;
2627
#if SUPPORT_LASER || SUPPORT_IOBITS
2728
laserPwmOrIoBits.Clear();
2829
#endif

src/GCodes/RestorePoint.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct RestorePoint
2121
float virtualExtruderPosition; // The virtual extruder position at the start of this move
2222
float proportionDone; // How much of this move we have already done (zero unless we interrupted a move)
2323
FilePosition filePos; // The file position that this move was read from
24+
float initialUserX, initialUserY; // If we paused during an arc move and proportionDone is nonzero, the X and Y user coordinates at the start of the move
2425
int toolNumber; // The tool number that was active
2526

2627
#if SUPPORT_LASER || SUPPORT_IOBITS

src/Movement/DDA.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "Move.h"
1212
#include "StepTimer.h"
1313
#include "Kinematics/LinearDeltaKinematics.h" // for DELTA_AXES
14+
#include "Tools/Tool.h"
1415

1516
#if SUPPORT_CAN_EXPANSION
1617
# include "CAN/CanInterface.h"
@@ -306,7 +307,7 @@ bool DDA::InitStandardMove(DDARing& ring, GCodes::RawMove &nextMove, bool doMoto
306307
{
307308
const float positionDelta = endCoordinates[drive] - prev->GetEndCoordinate(drive, false);
308309
directionVector[drive] = positionDelta;
309-
if (positionDelta != 0.0 && (IsBitSet(nextMove.yAxes, drive) || IsBitSet(nextMove.xAxes, drive)))
310+
if (positionDelta != 0.0 && (IsBitSet(Tool::GetXAxes(nextMove.tool), drive) || IsBitSet(Tool::GetYAxes(nextMove.tool), drive)))
310311
{
311312
flags.xyMoving = true;
312313
}
@@ -365,13 +366,12 @@ bool DDA::InitStandardMove(DDARing& ring, GCodes::RawMove &nextMove, bool doMoto
365366
}
366367

367368
// 3. Store some values
368-
xAxes = nextMove.xAxes;
369-
yAxes = nextMove.yAxes;
369+
tool = nextMove.tool;
370370
flags.usesEndstops = (nextMove.endStopsToCheck != 0);
371371
endStopsToCheck = nextMove.endStopsToCheck; //TODO move this to DDARing
372372
filePos = nextMove.filePos;
373373
virtualExtruderPosition = nextMove.virtualExtruderPosition;
374-
proportionLeft = nextMove.proportionLeft;
374+
proportionDone = nextMove.proportionDone;
375375

376376
flags.canPauseAfter = nextMove.canPauseAfter;
377377
flags.usingStandardFeedrate = nextMove.usingStandardFeedrate;
@@ -535,8 +535,7 @@ bool DDA::InitLeadscrewMove(DDARing& ring, float feedrate, const float adjustmen
535535
flags.continuousRotationShortcut = false;
536536
endStopsToCheck = 0;
537537
virtualExtruderPosition = prev->virtualExtruderPosition;
538-
xAxes = prev->xAxes;
539-
yAxes = prev->yAxes;
538+
tool = nullptr;
540539
filePos = prev->filePos;
541540
flags.endCoordinatesValid = prev->flags.endCoordinatesValid;
542541
acceleration = deceleration = reprap.GetPlatform().Accelerations()[Z_AXIS];
@@ -1491,6 +1490,8 @@ float DDA::NormaliseXYZ()
14911490
// First calculate the magnitude of the vector. If there is more than one X or Y axis, take an average of their movements (they should be equal).
14921491
float xMagSquared = 0.0, yMagSquared = 0.0;
14931492
unsigned int numXaxes = 0, numYaxes = 0;
1493+
const AxesBitmap xAxes = Tool::GetXAxes(tool);
1494+
const AxesBitmap yAxes = Tool::GetYAxes(tool);
14941495
for (size_t d = 0; d < MaxAxes; ++d)
14951496
{
14961497
if (IsBitSet(xAxes, d))
@@ -1881,14 +1882,13 @@ void DDA::MoveAborted()
18811882
float DDA::GetProportionDone(bool moveWasAborted) const
18821883
{
18831884
// Get the proportion of extrusion already done at the start of this segment
1884-
float proportionDone = (filePos != noFilePosition && filePos == prev->filePos)
1885-
? 1.0 - prev->proportionLeft
1885+
float proportionDoneSoFar = (filePos != noFilePosition && filePos == prev->filePos)
1886+
? prev->proportionDone
18861887
: 0.0;
18871888
if (moveWasAborted)
18881889
{
18891890
// The move was aborted, so subtract how much was done
1890-
const float proportionDoneAtEnd = 1.0 - proportionLeft;
1891-
if (proportionDoneAtEnd > proportionDone)
1891+
if (proportionDone > proportionDoneSoFar)
18921892
{
18931893
int32_t taken = 0, left = 0;
18941894
for (size_t drive = reprap.GetGCodes().GetTotalAxes(); drive < NumDirectDrivers; ++drive)
@@ -1903,11 +1903,11 @@ float DDA::GetProportionDone(bool moveWasAborted) const
19031903
const int32_t total = taken + left;
19041904
if (total > 0) // if the move has net extrusion
19051905
{
1906-
proportionDone += (((proportionDoneAtEnd - proportionDone) * taken) + (total/2)) / total;
1906+
proportionDoneSoFar += (((proportionDone - proportionDoneSoFar) * taken) + (total/2)) / total;
19071907
}
19081908
}
19091909
}
1910-
return proportionDone;
1910+
return proportionDoneSoFar;
19111911
}
19121912

19131913
// Reduce the speed of this move to the indicated speed.

src/Movement/DDA.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,16 @@ class DDA
7575
float GetVirtualExtruderPosition() const { return virtualExtruderPosition; }
7676
float AdvanceBabyStepping(DDARing& ring, size_t axis, float amount); // Try to push babystepping earlier in the move queue
7777
bool IsHomingAxes() const { return (endStopsToCheck & HomeAxes) != 0; }
78-
uint32_t GetXAxes() const { return xAxes; }
79-
uint32_t GetYAxes() const { return yAxes; }
78+
const Tool *GetTool() const { return tool; }
8079
float GetTotalDistance() const { return totalDistance; }
8180
void LimitSpeedAndAcceleration(float maxSpeed, float maxAcceleration); // Limit the speed an acceleration of this move
8281

8382
// Filament monitor support
8483
int32_t GetStepsTaken(size_t drive) const;
8584

8685
float GetProportionDone(bool moveWasAborted) const; // Return the proportion of extrusion for the complete multi-segment move already done
86+
float GetInitialUserX() const { return initialUserX; }
87+
float GetInitialUserY() const { return initialUserY; }
8788

8889
void MoveAborted();
8990

@@ -207,8 +208,7 @@ class DDA
207208
#endif
208209

209210
EndstopsBitmap endStopsToCheck; // Which endstops we are checking on this move
210-
AxesBitmap xAxes; // Which axes are behaving as X axes
211-
AxesBitmap yAxes; // Which axes are behaving as Y axes
211+
const Tool *tool; // which tool (if any) is active
212212

213213
FilePosition filePos; // The position in the SD card file after this move was read, or zero if not read from SD card
214214

@@ -226,7 +226,8 @@ class DDA
226226
float endSpeed;
227227
float topSpeed;
228228

229-
float proportionLeft; // what proportion of the extrusion in the G1 or G0 move of which this is a part remains to be done after this segment is complete
229+
float proportionDone; // what proportion of the extrusion in the G1 or G0 move of which this is a part has been done after this segment is complete
230+
float initialUserX, initialUserY; // if this is a segment of an arc move, the user X and Y coordinates at the start
230231
uint32_t clocksNeeded;
231232

232233
union

src/Movement/DDARing.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ bool DDARing::PauseMoves(RestorePoint& rp)
535535
rp.moveCoords[axis] = prevDda->GetEndCoordinate(axis, false);
536536
}
537537

538-
reprap.GetMove().InverseAxisAndBedTransform(rp.moveCoords, prevDda->GetXAxes(), prevDda->GetYAxes()); // we assume that xAxes hasn't changed between the moves
538+
reprap.GetMove().InverseAxisAndBedTransform(rp.moveCoords, prevDda->GetTool());
539539

540540
#if SUPPORT_LASER || SUPPORT_IOBITS
541541
rp.laserPwmOrIoBits = dda->GetLaserPwmOrIoBits();
@@ -548,6 +548,8 @@ bool DDARing::PauseMoves(RestorePoint& rp)
548548

549549
dda = addPointer;
550550
rp.proportionDone = dda->GetProportionDone(false); // get the proportion of the current multi-segment move that has been completed
551+
rp.initialUserX = dda->GetInitialUserX();
552+
rp.initialUserY = dda->GetInitialUserY();
551553
if (dda->UsingStandardFeedrate())
552554
{
553555
rp.feedRate = dda->GetRequestedSpeed();
@@ -623,6 +625,8 @@ bool DDARing::LowPowerOrStallPause(RestorePoint& rp)
623625
rp.virtualExtruderPosition = dda->GetVirtualExtruderPosition();
624626
rp.filePos = dda->GetFilePosition();
625627
rp.proportionDone = dda->GetProportionDone(abortedMove); // store how much of the complete multi-segment move's extrusion has been done
628+
rp.initialUserX = dda->GetInitialUserX();
629+
rp.initialUserY = dda->GetInitialUserY();
626630

627631
#if SUPPORT_LASER || SUPPORT_IOBITS
628632
rp.laserPwmOrIoBits = dda->GetLaserPwmOrIoBits();
@@ -638,7 +642,7 @@ bool DDARing::LowPowerOrStallPause(RestorePoint& rp)
638642
rp.moveCoords[axis] = prevDda->GetEndCoordinate(axis, false);
639643
}
640644

641-
reprap.GetMove().InverseAxisAndBedTransform(rp.moveCoords, prevDda->GetXAxes(), prevDda->GetYAxes()); // we assume that xAxes and yAxes have't changed between the moves
645+
reprap.GetMove().InverseAxisAndBedTransform(rp.moveCoords, prevDda->GetTool());
642646

643647
// Free the DDAs for the moves we are going to skip
644648
for (dda = addPointer; dda != savedDdaRingAddPointer; dda = dda->GetNext())

0 commit comments

Comments
 (0)