Skip to content

Commit

Permalink
Version 2.02RC5
Browse files Browse the repository at this point in the history
Shortened M591 filament monitor reports
Added filament detection state to M591 report for simple filament sensor
Tool offsets are no longer applied when G54 is in effect
M500 saves workplace coordinates
Implemented M851 for Marlin compatibility
Added check for NaNs when computing derivatives during auto calibration
Scara printers can now xo XY moves before Z has been homed
Don't allow M291 to create messatge popups that can never time out or be dismissed
  • Loading branch information
dc42 committed Nov 28, 2018
1 parent 7e8d235 commit 6e45773
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 118 deletions.
1 change: 1 addition & 0 deletions .cproject
Expand Up @@ -99,6 +99,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Duet}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Duet/Lwip}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Duet/EMAC}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RRFLibraries/src}&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1548770846" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__SAM3X8E__"/>
Expand Down
41 changes: 21 additions & 20 deletions src/BugList.txt
Expand Up @@ -159,33 +159,34 @@ Failed tests:
- [fixed, ok] M557 with even P parameter on circular bed does too few points
- [bad connection on hot end] Crane Quad hot end reads about 60C at room temperature

To be fixed in 2.02 release:
- [can't reproduce] Investigate macros causing a hang, https://forum.duet3d.com/topic/7782/issues-with-macros-halting-the-printer/11
To be investigated for 2.02RC5 or release:
- [tested, ok] Test error handling when the mesh is badly defined, https://forum.duet3d.com/topic/7759/solved-duet-2-wifi-java-error/10
- [review M292 handling, even though can't reproduce - I can't see a problem] Investigate macros causing a hang, https://forum.duet3d.com/topic/7782/issues-with-macros-halting-the-printer/11
- [can't reproduce] re-test M226, https://forum.duet3d.com/topic/7747/reprapfirmware-2-02rc4-released/29
- investigate incorrect layer count, https://forum.duet3d.com/topic/7747/reprapfirmware-2-02rc4-released/31
- investigate slow movement, https://forum.duet3d.com/topic/6974/problem-with-3-independent-z-axis-motors-and-endstops/32
- [was caused by spurious E0 in an travel move] investigate incorrect layer count, https://forum.duet3d.com/topic/7747/reprapfirmware-2-02rc4-released/31
- [probing speed was too high] Multiple G29 commands in succession, https://forum.duet3d.com/topic/7920/bed-compensation-g29-problems
- [may be fixed by possible fix for for Z and U moving at different speeds] investigate slow movement, https://forum.duet3d.com/topic/6974/problem-with-3-independent-z-axis-motors-and-endstops/32

To be fixed in 2.02RC5:
- [done, ok] 12864 display of speed factor wrong, https://forum.duet3d.com/topic/7747/reprapfirmware-2-02rc4-released/10
- [done, ok] 12864 button menu handling wrong, https://forum.duet3d.com/topic/7747/reprapfirmware-2-02rc4-released/14
- [tested, ok] Test error handling when the mesh is badly defined, https://forum.duet3d.com/topic/7759/solved-duet-2-wifi-java-error/10
- [done, ok] 12864 items 510- display user position not machine position
- [done, ok] M117 on 12864, https://forum.duet3d.com/topic/7826/display-characters-text-in-macro/4
- [done, ok] M291 and manual Z-probing on 12864, https://forum.duet3d.com/topic/7826/display-characters-text-in-macro/4
- [done, ok] Live XYZ movement and baby stepping on 12864
- [done, retest] Change "Resume-after-power-fail state saved" message to something appropriate for an ordinary pause, https://forum.duet3d.com/topic/7784/power-fail-triggers-unexpectedly/3
- [done, ok] SCARA: after prox and distal are homed allow XY moves, https://forum.duet3d.com/topic/7747/reprapfirmware-2-02rc4-released/24
- [done, test] Support M851, offset is negated + using M851 causes M500 to save Z probe parameters
- [done, test] If G31 parameters were read from config-override.g (m501) then a subsequent M500 command saves them too
- [done, retest] Save workplace coordinate systems in M500
- [done, retest] Shorten M591 response by removing unnecessary text
- [done, test] When delta auto calibration produces NaNs, abort calibration and emit an error message suggesting a smaller probing radius
- [done, test] M106 Pnn Svv always set full PWM if vv > 1 and there were additional parameters e.g. F, https://forum.duet3d.com/topic/7810/question-about-m106/6
- [done, ok] Support M851, offset is negated + using M851 causes M500 to save Z probe parameters
- [done, ok] If G31 parameters were read from config-override.g (m501) then a subsequent M500 command saves them too
- [done, ok] Save workplace coordinate systems in M500
- [done, ok] Shorten M591 response by removing unnecessary text
- [done, can't test] When delta auto calibration produces NaNs, abort calibration and emit an error message suggesting a smaller probing radius
- [done, ok] M106 Pnn Svv always set full PWM if vv > 1 and there were additional parameters e.g. F, https://forum.duet3d.com/topic/7810/question-about-m106/6
- [done] Possible fix for Z and U moving at different speeds, https://forum.duet3d.com/topic/7755/drive-3-is-slower-as-drive-2-at-homing-in-z-solved/32
- [done, test] For SimpleFilamentMonitor, include filament present/not present status in M591 report
- [done, ok] M117 on 12864, https://forum.duet3d.com/topic/7826/display-characters-text-in-macro/4
- [done, test] M291 and manual Z-probing on 12864? https://forum.duet3d.com/topic/7826/display-characters-text-in-macro/4
- [done, ok] For SimpleFilamentMonitor, include filament present/not present status in M591 report
- [done, ok] Heater turn on momentarily when Duet is reset
- [done, test] When G53 is in effect, don't apply tool offsets or axis mapping
- Don't alow both S0 and T0 in M291, it creates a message that can't be dismissed

Test failures:
- M291 T"title" P"message" S0 creates a messasge that can't be dismissed
- M291 not working on 12864, clears rectangular area but that's all
- [done, ok] When G53 is in effect, don't apply tool offsets or axis mapping
- [done, ok] Don't alow both S0 and T0 in M291, it creates a message that can't be dismissed

Future:
- Option for an endstop input to trigger an emergency pause
Expand Down
15 changes: 6 additions & 9 deletions src/Duet/Pins_Duet.h
Expand Up @@ -24,9 +24,8 @@ constexpr size_t NumFirmwareUpdateModules = 1;
#define SUPPORT_DHT_SENSOR 0 // set nonzero to support DHT temperature/humidity sensors

// The physical capabilities of the machine

constexpr size_t DRIVES = 9; // The number of drives in the machine, including X, Y, and Z plus extruder drives
#define DRIVES_(a,b,c,d,e,f,g,h,i,j,k,l) { a,b,c,d,e,f,g,h,i }
constexpr size_t NumDirectDrivers = 9;
constexpr size_t MaxTotalDrivers = NumDirectDrivers;

constexpr size_t NumEndstops = 9; // The number of inputs we have for endstops, filament sensors etc.
constexpr size_t NumHeaters = 7; // The number of heaters in the machine; 0 is the heated bed even if there isn't one
Expand All @@ -35,10 +34,8 @@ constexpr size_t NumThermistorInputs = 7;

constexpr size_t MinAxes = 3; // The minimum and default number of axes
constexpr size_t MaxAxes = 6; // The maximum number of movement axes in the machine, usually just X, Y and Z, <= DRIVES
// Initialization macro used in statements needing to initialize values in arrays of size MAX_AXES
#define AXES_(a,b,c,d,e,f,g,h,i) { a,b,c,d,e,f }

constexpr size_t MaxExtruders = DRIVES - MinAxes; // The maximum number of extruders
constexpr size_t MaxExtruders = NumDirectDrivers - MinAxes; // The maximum number of extruders
constexpr size_t MaxDriversPerAxis = 4; // The maximum number of stepper drivers assigned to one axis

constexpr size_t NUM_SERIAL_CHANNELS = 3; // The number of serial IO channels (USB and two auxiliary UARTs)
Expand All @@ -53,9 +50,9 @@ constexpr size_t NUM_SERIAL_CHANNELS = 3; // The number of serial IO channels

// Drives

constexpr Pin ENABLE_PINS[DRIVES] = { 29, 27, X1, X0, 37, X8, 50, 47, X13 };
constexpr Pin STEP_PINS[DRIVES] = { 14, 25, 5, X2, 41, 39, X4, 49, X10 };
constexpr Pin DIRECTION_PINS[DRIVES] = { 15, 26, 4, X3, 35, 53, 51, 48, X11 };
constexpr Pin ENABLE_PINS[NumDirectDrivers] = { 29, 27, X1, X0, 37, X8, 50, 47, X13 };
constexpr Pin STEP_PINS[NumDirectDrivers] = { 14, 25, 5, X2, 41, 39, X4, 49, X10 };
constexpr Pin DIRECTION_PINS[NumDirectDrivers] = { 15, 26, 4, X3, 35, 53, 51, 48, X11 };

// Endstops
// RepRapFirmware only has a single endstop per axis.
Expand Down
2 changes: 1 addition & 1 deletion src/FilamentMonitors/FilamentMonitor.cpp
Expand Up @@ -116,7 +116,7 @@ bool FilamentMonitor::ConfigurePin(GCodeBuffer& gb, const StringRef& reply, Inte
}
else if (!seen)
{
reply.printf("Extruder drive %u has no filament sensor", extruder);
reply.printf("Extruder %u has no filament sensor", extruder);
}
return GCodeResult::ok;
}
Expand Down
8 changes: 4 additions & 4 deletions src/FilamentMonitors/LaserFilamentMonitor.cpp
Expand Up @@ -75,8 +75,8 @@ bool LaserFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef& reply, bo
}
else
{
reply.printf("Duet3D laser filament monitor%s on endstop input %u, %s, allowed movement %ld%% to %ld%%, check every %.1fmm, ",
(switchOpenMask != 0) ? " with microswitch" : "",
reply.printf("Duet3D laser filament monitor%s on input %u, %s, allow %ld%% to %ld%%, check every %.1fmm, ",
(switchOpenMask != 0) ? " with switch" : "",
GetEndstopNumber(),
(comparisonEnabled) ? "enabled" : "disabled",
lrintf(minMovementAllowed * 100.0),
Expand All @@ -93,10 +93,10 @@ bool LaserFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef& reply, bo
}
else
{
reply.catf("current position %.1f, brightness %u, shutter %u, ", (double)GetCurrentPosition(), qualityWord & 0x00FF, (qualityWord >> 8) & 0x3F);
reply.catf("current pos %.1f, brightness %u, shutter %u, ", (double)GetCurrentPosition(), qualityWord & 0x00FF, (qualityWord >> 8) & 0x3F);
if (laserMonitorState != LaserMonitorState::calibrating && totalExtrusionCommanded > 10.0)
{
reply.catf("measured minimum %ld%%, average %ld%%, maximum %ld%% over %.1fmm",
reply.catf("measured min %ld%% avg %ld%% max %ld%% over %.1fmm",
lrintf(100 * minMovementRatio),
lrintf((100 * totalMovementMeasured)/totalExtrusionCommanded),
lrintf(100 * maxMovementRatio),
Expand Down
8 changes: 4 additions & 4 deletions src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
Expand Up @@ -77,8 +77,8 @@ bool RotatingMagnetFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef&
}
else
{
reply.printf("Duet3D rotating magnet filament monitor%s on endstop input %u, %s, sensitivity %.2fmm/rev, allowed movement %ld%% to %ld%%, check every %.1fmm, ",
(switchOpenMask != 0) ? " with microswitch" : "",
reply.printf("Duet3D rotating magnet filament monitor%s on input %u, %s, sensitivity %.2fmm/rev, allow %ld%% to %ld%%, check every %.1fmm, ",
(switchOpenMask != 0) ? " with switch" : "",
GetEndstopNumber(),
(comparisonEnabled) ? "enabled" : "disabled",
(double)mmPerRev,
Expand All @@ -95,11 +95,11 @@ bool RotatingMagnetFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef&
}
else
{
reply.catf("current position %.1f, ", (double)GetCurrentPosition());
reply.catf("current pos %.1f, ", (double)GetCurrentPosition());
if (calibrationStarted && fabsf(totalMovementMeasured) > 1.0 && totalExtrusionCommanded > 20.0)
{
const float measuredMmPerRev = totalExtrusionCommanded/totalMovementMeasured;
reply.catf("measured sensitivity %.2fmm/rev, measured minimum %ld%%, maximum %ld%% over %.1fmm\n",
reply.catf("measured sensitivity %.2fmm/rev, min %ld%% max %ld%% over %.1fmm\n",
(double)measuredMmPerRev,
lrintf(100 * minMovementRatio),
lrintf(100 * maxMovementRatio),
Expand Down
7 changes: 5 additions & 2 deletions src/FilamentMonitors/SimpleFilamentMonitor.cpp
Expand Up @@ -35,8 +35,11 @@ bool SimpleFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef& reply, b
}
else
{
reply.printf("Simple filament sensor on endstop %d, %s, output %s when no filament",
GetEndstopNumber(), (enabled) ? "enabled" : "disabled", (highWhenNoFilament) ? "high" : "low");
reply.printf("Simple filament sensor on endstop %d, %s, output %s when no filament, filament present: %s",
GetEndstopNumber(),
(enabled) ? "enabled" : "disabled",
(highWhenNoFilament) ? "high" : "low",
(filamentPresent) ? "yes" : "no");
}

return false;
Expand Down
3 changes: 3 additions & 0 deletions src/GCodes/GCodeMachineState.h
Expand Up @@ -119,6 +119,9 @@ class GCodeMachineState
static GCodeMachineState *Allocate()
post(!result.IsLive(); result.state == GCodeState::normal);

// Return true if the G54 command is in effect
bool UsingG54() const { return useMachineCoordinates || useMachineCoordinatesSticky; }

// Copy values that may have been altered by config.g into this state record
void CopyStateFrom(const GCodeMachineState& other)
{
Expand Down
65 changes: 35 additions & 30 deletions src/GCodes/GCodes.cpp
Expand Up @@ -2187,7 +2187,7 @@ void GCodes::SaveResumeInfo(bool wasPowerFailure)
}
if (ok)
{
platform.Message(LoggedGenericMessage, "Resume-after-power-fail state saved\n");
platform.Message(LoggedGenericMessage, "Resume state saved\n");
}
else
{
Expand Down Expand Up @@ -2424,17 +2424,20 @@ const char* GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated)
if (gb.Seen('H') || (machineType != MachineType::laser && gb.Seen('S')))
{
const int ival = gb.GetIValue();
if (ival == 1 || ival == 2 || ival == 3)
if (ival >= 1 && ival <= 3)
{
moveBuffer.moveType = ival;
moveBuffer.xAxes = DefaultXAxisMapping;
moveBuffer.yAxes = DefaultYAxisMapping;
}
else if (ival == 99) // temporary code to log Z probe change positions
{
moveBuffer.endStopsToCheck |= LogProbeChanges;
}
}
#if SUPPORT_WORKPLACE_COORDINATES
else if (gb.MachineState().UsingG54())
{
moveBuffer.xAxes = DefaultXAxisMapping;
moveBuffer.yAxes = DefaultYAxisMapping;
}
#endif

// Check for 'R' parameter to move relative to a restore point
const RestorePoint * rp = nullptr;
Expand Down Expand Up @@ -2490,7 +2493,7 @@ const char* GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated)
#endif
#endif

if (moveBuffer.moveType != 0)
if (moveBuffer.moveType != 0 || gb.MachineState().UsingG54())
{
// This may be a raw motor move, in which case we need the current raw motor positions in moveBuffer.coords.
// If it isn't a raw motor move, it will still be applied without axis or bed transform applied,
Expand All @@ -2517,7 +2520,7 @@ const char* GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated)

SetBit(axesMentioned, axis);
const float moveArg = gb.GetFValue() * distanceScale;
if (moveBuffer.moveType != 0)
if (moveBuffer.moveType != 0 || gb.MachineState().UsingG54())
{
if (gb.MachineState().axesRelative)
{
Expand All @@ -2536,12 +2539,6 @@ const char* GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated)
{
currentUserPosition[axis] += moveArg;
}
#if SUPPORT_WORKPLACE_COORDINATES
else if (gb.MachineState().useMachineCoordinates || gb.MachineState().useMachineCoordinatesSticky)
{
currentUserPosition[axis] = moveArg - workplaceCoordinates[currentCoordinateSystem][axis];
}
#endif
else
{
currentUserPosition[axis] = moveArg;
Expand Down Expand Up @@ -2589,12 +2586,20 @@ const char* GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated)
}
else
{
if (&gb == fileGCode && !gb.IsDoingFileMacro() && moveBuffer.hasExtrusion && (axesMentioned & ((1 << X_AXIS) | (1 << Y_AXIS))) != 0)
if (gb.MachineState().UsingG54())
{
lastPrintingMoveHeight = currentUserPosition[Z_AXIS];
gb.SetState(GCodeState::waitingForSpecialMoveToComplete); // we need to update the user coordinates after the move
}
else
{
if (&gb == fileGCode && !gb.IsDoingFileMacro() && moveBuffer.hasExtrusion && (axesMentioned & ((1 << X_AXIS) | (1 << Y_AXIS))) != 0)
{
lastPrintingMoveHeight = currentUserPosition[Z_AXIS];
}

ToolOffsetTransform(currentUserPosition, moveBuffer.coords, axesMentioned); // apply tool offset, axis mapping, baby stepping, Z hop and axis scaling
}

ToolOffsetTransform(currentUserPosition, moveBuffer.coords, axesMentioned); // apply tool offset, axis mapping, baby stepping, Z hop and axis scaling
AxesBitmap effectiveAxesHomed = axesHomed;
if (doingManualBedProbe)
{
Expand Down Expand Up @@ -2629,7 +2634,7 @@ const char* GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated)
const float moveTime = xyLength/moveBuffer.feedRate; // this is a best-case time, often the move will take longer
totalSegments = (unsigned int)max<int>(1, min<int>(rintf(xyLength/kin.GetMinSegmentLength()), rintf(moveTime * kin.GetSegmentsPerSecond())));
}
else if (reprap.GetMove().IsUsingMesh())
else if (reprap.GetMove().IsUsingMesh() && (isCoordinated || machineType == MachineType::fff))
{
const HeightMap& heightMap = reprap.GetMove().AccessHeightMap();
totalSegments = max<unsigned int>(1, heightMap.GetMinimumSegments(currentUserPosition[X_AXIS] - initialX, currentUserPosition[Y_AXIS] - initialY));
Expand Down Expand Up @@ -2714,13 +2719,6 @@ const char* GCodes::DoArcMove(GCodeBuffer& gb, bool clockwise)
currentUserPosition[X_AXIS] += xParam;
currentUserPosition[Y_AXIS] += yParam;
}
#if SUPPORT_WORKPLACE_COORDINATES
else if (gb.MachineState().useMachineCoordinates || gb.MachineState().useMachineCoordinatesSticky)
{
currentUserPosition[X_AXIS] = xParam - workplaceCoordinates[currentCoordinateSystem][X_AXIS];
currentUserPosition[Y_AXIS] = yParam - workplaceCoordinates[currentCoordinateSystem][Y_AXIS];
}
#endif
else
{
currentUserPosition[X_AXIS] = xParam;
Expand Down Expand Up @@ -4747,6 +4745,13 @@ GCodeResult GCodes::WriteConfigOverrideFile(GCodeBuffer& gb, const StringRef& re
ok = reprap.WriteToolParameters(f);
}

#if SUPPORT_WORKPLACE_COORDINATES
if (ok)
{
ok = WriteWorkplaceCoordinates(f);
}
#endif

if (!f->Close())
{
ok = false;
Expand Down Expand Up @@ -5089,24 +5094,24 @@ void GCodes::CheckHeaterFault()
}
}

// Return the current speed factor
// Return the current speed factor as a percentage
float GCodes::GetSpeedFactor() const
{
return speedFactor;
}

// Return a current extrusion factor
// Return a current extrusion factor as a percentage
float GCodes::GetExtrusionFactor(size_t extruder)
{
return (extruder < numExtruders) ? extrusionFactors[extruder] : 0.0;
return (extruder < numExtruders) ? extrusionFactors[extruder] * 100.0 : 0.0;
}

// Set an extrusion factor
// Set a percentage extrusion factor
void GCodes::SetExtrusionFactor(size_t extruder, float factor)
{
if (extruder < numExtruders)
{
extrusionFactors[extruder] = constrain<float>(factor, 0.0, 2.0);
extrusionFactors[extruder] = constrain<float>(factor, 0.0, 200.0)/100.0;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/GCodes/GCodes.h
Expand Up @@ -309,6 +309,7 @@ class GCodes INHERIT_OBJECT_MODEL

#if SUPPORT_WORKPLACE_COORDINATES
GCodeResult GetSetWorkplaceCoordinates(GCodeBuffer& gb, const StringRef& reply, bool compute); // Set workspace coordinates
bool WriteWorkplaceCoordinates(FileStore *f) const;
#endif

GCodeResult SetHeaterProtection(GCodeBuffer &gb, const StringRef &reply); // Configure heater protection (M143)
Expand Down Expand Up @@ -504,7 +505,7 @@ class GCodes INHERIT_OBJECT_MODEL
float pausedFanSpeeds[NUM_FANS]; // Fan speeds when the print was paused or a tool change started
float lastDefaultFanSpeed; // Last speed given in a M106 command with on fan number
float pausedDefaultFanSpeed; // The speed of the default print cooling fan when the print was paused or a tool change started
float speedFactor; // speed factor, including the conversion from mm/min to mm/sec, normally 1/60
float speedFactor; // speed factor as a percentage (normally 100.0)
float extrusionFactors[MaxExtruders]; // extrusion factors (normally 1.0)
float volumetricExtrusionFactors[MaxExtruders]; // Volumetric extrusion factors
float currentBabyStepZOffset; // The accumulated Z offset due to baby stepping requests
Expand Down

0 comments on commit 6e45773

Please sign in to comment.