Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-10-25 16:27:27 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-10-25 16:27:27 +0300
commit2ee6b1a26dcf7fd0b6037c519ac3e056f1e15c62 (patch)
tree2e38724110775fb004150638238966624697f937 /src/FilamentMonitors
parent9251d9613e377a1a877376ade7cdf3b9b8ecbbd6 (diff)
Bug fixes to filament monitors
Diffstat (limited to 'src/FilamentMonitors')
-rw-r--r--src/FilamentMonitors/FilamentMonitor.cpp16
-rw-r--r--src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/FilamentMonitors/FilamentMonitor.cpp b/src/FilamentMonitors/FilamentMonitor.cpp
index 99ae6b18..f44871a6 100644
--- a/src/FilamentMonitors/FilamentMonitor.cpp
+++ b/src/FilamentMonitors/FilamentMonitor.cpp
@@ -76,9 +76,8 @@ void FilamentMonitor::Disable() noexcept
port.Release();
}
-// Do the configuration that is
-// Try to get the pin number from the GCode command in the buffer, setting Seen if a pin number was provided and returning true if error.
-// Also attaches the ISR.
+// Do the configuration that is common to all types of filament monitor
+// Try to get the pin number from the GCode command in the buffer, setting Seen if a pin number was provided. Also attaches the ISR.
// For a remote filament monitor, this does the full configuration or query of the remote object instead, and we always return seen true because we don't need to report local status.
GCodeResult FilamentMonitor::CommonConfigure(GCodeBuffer& gb, const StringRef& reply, InterruptMode interruptMode, bool& seen) THROWS(GCodeException)
{
@@ -199,27 +198,28 @@ bool FilamentMonitor::IsValid(size_t extruderNumber) const noexcept
// Factory function to create a filament monitor
/*static*/ FilamentMonitor *FilamentMonitor::Create(unsigned int extruder, unsigned int monitorType, GCodeBuffer& gb, const StringRef& reply) noexcept
{
+ const size_t drv = ExtruderToLogicalDrive(extruder);
const DriverId did = reprap.GetPlatform().GetExtruderDriver(extruder);
FilamentMonitor *fm;
switch (monitorType)
{
case 1: // active high switch
case 2: // active low switch
- fm = new SimpleFilamentMonitor(extruder, monitorType, did);
+ fm = new SimpleFilamentMonitor(drv, monitorType, did);
break;
case 3: // duet3d rotating magnet, no switch
case 4: // duet3d rotating magnet + switch
- fm = new RotatingMagnetFilamentMonitor(extruder, monitorType, did);
+ fm = new RotatingMagnetFilamentMonitor(drv, monitorType, did);
break;
case 5: // duet3d laser, no switch
case 6: // duet3d laser + switch
- fm = new LaserFilamentMonitor(extruder, monitorType, did);
+ fm = new LaserFilamentMonitor(drv, monitorType, did);
break;
case 7: // simple pulse output sensor
- fm = new PulsedFilamentMonitor(extruder, monitorType, did);
+ fm = new PulsedFilamentMonitor(drv, monitorType, did);
break;
default: // no sensor, or unknown sensor
@@ -293,8 +293,8 @@ bool FilamentMonitor::IsValid(size_t extruderNumber) const noexcept
}
else
{
- IrqEnable();
extruderStepsCommanded = reprap.GetMove().GetAccumulatedExtrusion(fs.driveNumber, isPrinting); // get and clear the net extrusion commanded
+ IrqEnable();
fromIsr = false;
locIsrMillis = 0;
}
diff --git a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
index c2f7cac1..410fd7a9 100644
--- a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
+++ b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
@@ -374,7 +374,7 @@ void RotatingMagnetFilamentMonitor::HandleIncomingData() noexcept
// Call the following at intervals to check the status. This is only called when printing is in progress.
// 'filamentConsumed' is the net amount of extrusion commanded since the last call to this function.
-// 'hadNonPrintingMove' is true if filamentConsumed includes extruder movement from non-printing moves.
+// 'isPrinting' is true if the current movement is not a non-printing extruder move.
// 'fromIsr' is true if this measurement was taken at the end of the ISR because a potential start bit was seen
FilamentSensorStatus RotatingMagnetFilamentMonitor::Check(bool isPrinting, bool fromIsr, uint32_t isrMillis, float filamentConsumed) noexcept
{