Skip to content

Commit

Permalink
Bug fix: when enabling a filament monitor, don't reset it
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed Dec 16, 2021
1 parent e6f37f6 commit 41b857d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/FilamentMonitors/LaserFilamentMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ GCodeResult LaserFilamentMonitor::Configure(const CanMessageGenericParser& parse
const GCodeResult rslt = CommonConfigure(parser, reply, InterruptMode::change, seen);
if (rslt <= GCodeResult::warning)
{
if (seen)
{
Init(); // Init() resets dataReceived and version, so only do it if the port has been configured
}

if (parser.GetFloatParam('L', calibrationFactor))
{
seen = true;
Expand Down Expand Up @@ -105,11 +110,7 @@ GCodeResult LaserFilamentMonitor::Configure(const CanMessageGenericParser& parse
checkNonPrintingMoves = (temp > 0);
}

if (seen)
{
Init();
}
else
if (!seen)
{
reply.printf("Duet3D laser filament monitor v%u%s on pin ", version, (switchOpenMask != 0) ? " with switch" : "");
GetPort().AppendPinName(reply);
Expand Down
12 changes: 7 additions & 5 deletions src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,14 @@ GCodeResult RotatingMagnetFilamentMonitor::Configure(const CanMessageGenericPars
{
bool seen = false;
const GCodeResult rslt = CommonConfigure(parser, reply, InterruptMode::change, seen);

if (rslt <= GCodeResult::warning)
{
if (seen)
{
Init(); // Init() resets dataReceived and version, so only do it if the port has been configured
}

if (parser.GetFloatParam('L', mmPerRev))
{
seen = true;
Expand Down Expand Up @@ -107,11 +113,7 @@ GCodeResult RotatingMagnetFilamentMonitor::Configure(const CanMessageGenericPars
checkNonPrintingMoves = (temp > 0);
}

if (seen)
{
Init();
}
else
if (!seen)
{
reply.printf("Duet3D rotating magnet filament monitor v%u%s on pin ", version, (switchOpenMask != 0) ? " with switch" : "");
GetPort().AppendPinName(reply);
Expand Down

0 comments on commit 41b857d

Please sign in to comment.