Skip to content

Commit

Permalink
Version 1.20.1RC2
Browse files Browse the repository at this point in the history
Added nonlineear extrusion support (M592)
Show calibration parameters in M592 D# response
Bug fix: don't run stop.g, sleep.g or cancel.g at the end of simulating
a print or cancelling a simulation
  • Loading branch information
dc42 committed Jan 2, 2018
1 parent ddcc69d commit 1ecf339
Show file tree
Hide file tree
Showing 19 changed files with 137 additions and 227 deletions.
Binary file modified EdgeRelease/DuetEthernetFirmware.bin
Binary file not shown.
Binary file modified EdgeRelease/DuetWiFiFirmware.bin
Binary file not shown.
Binary file added EdgeRelease/DuetWiFiServer.bin
Binary file not shown.
Binary file modified EdgeRelease/RepRapFirmware-Alligator.bin
Binary file not shown.
Binary file modified EdgeRelease/RepRapFirmware-RADDS.bin
Binary file not shown.
Binary file modified EdgeRelease/RepRapFirmware.bin
Binary file not shown.
185 changes: 0 additions & 185 deletions src/BugList.txt

This file was deleted.

2 changes: 2 additions & 0 deletions src/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ constexpr float DefaultArcSegmentLength = 0.2; // G2 and G3 arc movement comma
constexpr uint32_t DefaultIdleTimeout = 30000; // Milliseconds
constexpr float DefaultIdleCurrentFactor = 0.3; // Proportion of normal motor current that we use for idle hold

constexpr float DefaultNonlinearExtrusionLimit = 0.2; // Maximum additional commanded extrusion to compensate for nonlinearity

// Triggers
constexpr unsigned int MaxTriggers = 10; // Must be <= 32 because we store a bitmap of pending triggers in a uint32_t

Expand Down
16 changes: 14 additions & 2 deletions src/FilamentSensors/Duet3DFilamentSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ bool Duet3DFilamentSensor::Configure(GCodeBuffer& gb, StringRef& reply, bool& se
}
else
{
reply.printf("Duet3D filament sensor on endstop %u, %s microswitch, %.1fmm per rev, check every %.1fmm, tolerance %.1f%%, ",
reply.printf("Duet3D filament monitor on E%u, %s microswitch, %.2fmm/rev, check every %.1fmm, tolerance %.1f%%, ",
GetEndstopNumber(), (withSwitch) ? "with" : "no", (double)mmPerRev, (double)minimumExtrusionCheckLength, (double)(tolerance * 100.0));

if (!dataReceived)
Expand All @@ -66,7 +66,19 @@ bool Duet3DFilamentSensor::Configure(GCodeBuffer& gb, StringRef& reply, bool& se
}
else
{
reply.catf("current angle %.1f", (double)GetCurrentAngle());
reply.catf("current angle %.1f, ", (double)GetCurrentAngle());
if (calibrationStarted && fabsf(totalRevsMeasured) > 1.0 && totalExtrusionCommanded > 20.0)
{
const float measuredMmPerRev = totalExtrusionCommanded/totalRevsMeasured;
const float normalRatio = 1.0/measuredMmPerRev;
const int measuredPosTolerance = lrintf(100.0 * (((normalRatio > 0.0) ? maxMovementRatio : minMovementRatio) - normalRatio)/normalRatio);
const int measuredNegTolerance = lrintf(100.0 * (normalRatio - ((normalRatio > 0.0) ? minMovementRatio : maxMovementRatio))/normalRatio);
reply.catf("measured %.2fmm/rev +%d%% -%d%% over %.1fmm\n", (double)measuredMmPerRev, measuredPosTolerance, measuredNegTolerance, (double)totalExtrusionCommanded);
}
else
{
reply.cat("no calibration data");
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/FilamentSensors/FilamentSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ bool FilamentSensor::ConfigurePin(GCodeBuffer& gb, StringRef& reply, bool& seen)
}

// Return the filament sensor associated with a particular extruder
/*static*/ FilamentSensor *FilamentSensor::GetFilamentSensor(int extruder)
/*static*/ FilamentSensor *FilamentSensor::GetFilamentSensor(unsigned int extruder)
{
return (extruder >= 0 && extruder < (int)MaxExtruders) ? filamentSensors[extruder] : nullptr;
return (extruder < MaxExtruders) ? filamentSensors[extruder] : nullptr;
}

// Set the filament sensor associated with a particular extruder
/*static*/ bool FilamentSensor::SetFilamentSensorType(int extruder, int newSensorType)
/*static*/ bool FilamentSensor::SetFilamentSensorType(unsigned int extruder, int newSensorType)
{
if (extruder >= 0 && extruder < (int)MaxExtruders)
if (extruder < MaxExtruders)
{
FilamentSensor*& sensor = filamentSensors[extruder];
const int oldSensorType = (sensor == nullptr) ? 0 : sensor->GetType();
Expand Down
4 changes: 2 additions & 2 deletions src/FilamentSensors/FilamentSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ class FilamentSensor
static void Spin(bool full);

// Return the filament sensor associated with a particular extruder
static FilamentSensor *GetFilamentSensor(int extruder);
static FilamentSensor *GetFilamentSensor(unsigned int extruder);

// Set the filament sensor associated with a particular extruder
static bool SetFilamentSensorType(int extruder, int newSensorType);
static bool SetFilamentSensorType(unsigned int extruder, int newSensorType);

// Send diagnostics info
static void Diagnostics(MessageType mtype);
Expand Down
35 changes: 16 additions & 19 deletions src/GCodes/GCodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,29 +652,26 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, StringRef& reply)

case GCodeState::stopping: // MO after executing stop.g if present
case GCodeState::sleeping: // M1 after executing sleep.g if present
if (simulationMode == 0)
// Deselect the active tool and turn off all heaters, unless parameter Hn was used with n > 0
if (!gb.Seen('H') || gb.GetIValue() <= 0)
{
// Deselect the active tool and turn off all heaters, unless parameter Hn was used with n > 0
if (!gb.Seen('H') || gb.GetIValue() <= 0)
Tool* tool = reprap.GetCurrentTool();
if (tool != nullptr)
{
Tool* tool = reprap.GetCurrentTool();
if (tool != nullptr)
{
reprap.StandbyTool(tool->Number(), simulationMode != 0);
}
reprap.GetHeat().SwitchOffAll(true);
reprap.StandbyTool(tool->Number(), simulationMode != 0);
}
reprap.GetHeat().SwitchOffAll(true);
}

// chrishamm 2014-18-10: Although RRP says M0 is supposed to turn off all drives and heaters,
// I think M1 is sufficient for this purpose. Leave M0 for a normal reset.
if (gb.GetState() == GCodeState::sleeping)
{
DisableDrives();
}
else
{
platform.SetDriversIdle();
}
// chrishamm 2014-18-10: Although RRP says M0 is supposed to turn off all drives and heaters,
// I think M1 is sufficient for this purpose. Leave M0 for a normal reset.
if (gb.GetState() == GCodeState::sleeping)
{
DisableDrives();
}
else
{
platform.SetDriversIdle();
}
gb.SetState(GCodeState::normal);
break;
Expand Down
45 changes: 36 additions & 9 deletions src/GCodes/GCodes2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,21 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, StringRef& reply)
}
{
const bool wasPaused = isPaused; // isPaused gets cleared by CancelPrint
const bool wasSimulating = IsSimulating(); // simulationMode may get cleared by CancelPrint
StopPrint(&gb == fileGCode); // if this is normal end-of-print commanded by the file, delete the resurrect.g file

// If we are cancelling a paused print with M0 and we are homed and cancel.g exists then run it and do nothing else
if (wasPaused && code == 0 && AllAxesAreHomed() && DoFileMacro(gb, CANCEL_G, false))
if (!wasSimulating) // don't run any macro files or turn heaters off etc. if we were simulating before we stopped the print
{
break;
// If we are cancelling a paused print with M0 and we are homed and cancel.g exists then run it and do nothing else
if (wasPaused && code == 0 && AllAxesAreHomed() && DoFileMacro(gb, CANCEL_G, false))
{
break;
}

gb.SetState((code == 0) ? GCodeState::stopping : GCodeState::sleeping);
DoFileMacro(gb, (code == 0) ? STOP_G : SLEEP_G, false);
}
}

gb.SetState((code == 0) ? GCodeState::stopping : GCodeState::sleeping);
DoFileMacro(gb, (code == 0) ? STOP_G : SLEEP_G, false);
break;

case 3: // Spin spindle clockwise
Expand Down Expand Up @@ -3384,8 +3388,8 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, StringRef& reply)
case 591: // Configure filament sensor
if (gb.Seen('D'))
{
int extruder = gb.GetIValue();
if (extruder >= 0 && extruder < (int)numExtruders)
const unsigned int extruder = gb.GetUIValue();
if (extruder < numExtruders)
{
bool seen = false;
long sensorType;
Expand All @@ -3408,12 +3412,35 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, StringRef& reply)
}
else if (!seen)
{
reply.printf("Extruder drive %d has no filament sensor", extruder);
reply.printf("Extruder drive %u has no filament sensor", extruder);
}
}
}
break;

#if NONLINEAR_EXTRUSION
case 592: // Configure nonlinear extrusion
if (gb.Seen('D'))
{
const unsigned int extruder = gb.GetUIValue();
bool seen = false;
float a = 0.0, b = 0.0, limit = DefaultNonlinearExtrusionLimit;
gb.TryGetFValue('A', a, seen);
gb.TryGetFValue('B', b, seen);
gb.TryGetFValue('L', limit, seen);
if (seen)
{
platform.SetNonlinearExtrusion(extruder, a, b, limit);
}
else
{
platform.GetExtrusionCoefficients(extruder, a, b, limit);
reply.printf("Drive %u nonlinear extrusion coefficients: A=%.3f, B=%.4f, limit=%.2f", extruder, (double)a, (double)b, (double)limit);
}
}
break;
#endif

case 593: // Configure filament properties
// TODO: We may need this code later to restrict specific filaments to certain tools or to reset filament counters.
break;
Expand Down
Loading

0 comments on commit 1ecf339

Please sign in to comment.