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 e0e741a commit 1331149
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/FilamentMonitors/LaserFilamentMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ GCodeResult LaserFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef& re
const GCodeResult rslt = CommonConfigure(gb, 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
}

gb.TryGetFValue('L', calibrationFactor, seen);
gb.TryGetFValue('E', minimumExtrusionCheckLength, seen);

Expand Down Expand Up @@ -158,7 +163,6 @@ GCodeResult LaserFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef& re

if (seen)
{
Init();
reprap.SensorsUpdated();
}
else
Expand Down
6 changes: 5 additions & 1 deletion src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ GCodeResult RotatingMagnetFilamentMonitor::Configure(GCodeBuffer& gb, const Stri
const GCodeResult rslt = CommonConfigure(gb, 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
}

gb.TryGetFValue('L', mmPerRev, seen);
gb.TryGetFValue('E', minimumExtrusionCheckLength, seen);

Expand Down Expand Up @@ -160,7 +165,6 @@ GCodeResult RotatingMagnetFilamentMonitor::Configure(GCodeBuffer& gb, const Stri

if (seen)
{
Init();
reprap.SensorsUpdated();
}
else
Expand Down

0 comments on commit 1331149

Please sign in to comment.