diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-12-16 20:27:24 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-12-16 20:27:24 +0300 |
commit | 1331149dcffa70252840e7ff2d796e78bd9c7f57 (patch) | |
tree | 42a59f37bef312ec08fa535d0daea3e7c1613923 | |
parent | e0e741a76f7183dd94668218b0eb4d3e9d53d014 (diff) |
Bug fix: when enabling a filament monitor, don't reset it3.4.0beta7
-rw-r--r-- | src/FilamentMonitors/LaserFilamentMonitor.cpp | 6 | ||||
-rw-r--r-- | src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/FilamentMonitors/LaserFilamentMonitor.cpp b/src/FilamentMonitors/LaserFilamentMonitor.cpp index d20d8adf..aa68eb8d 100644 --- a/src/FilamentMonitors/LaserFilamentMonitor.cpp +++ b/src/FilamentMonitors/LaserFilamentMonitor.cpp @@ -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); @@ -158,7 +163,6 @@ GCodeResult LaserFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef& re if (seen) { - Init(); reprap.SensorsUpdated(); } else diff --git a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp index 2957411d..df8e65b8 100644 --- a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp +++ b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp @@ -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); @@ -160,7 +165,6 @@ GCodeResult RotatingMagnetFilamentMonitor::Configure(GCodeBuffer& gb, const Stri if (seen) { - Init(); reprap.SensorsUpdated(); } else |