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-22 16:02:36 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-10-22 16:02:36 +0300
commite82b96e6025c0ab33e41fb40ff827b4ab2e4e8a8 (patch)
treedd46f7889838eaa928e16aacc8b2d4ee03b26625 /src/FilamentMonitors
parentce8b859b0190f5d1a77037803647db376e53a638 (diff)
Fixed bug in recent filament monitor change commit
Diffstat (limited to 'src/FilamentMonitors')
-rw-r--r--src/FilamentMonitors/FilamentMonitor.cpp95
1 files changed, 50 insertions, 45 deletions
diff --git a/src/FilamentMonitors/FilamentMonitor.cpp b/src/FilamentMonitors/FilamentMonitor.cpp
index 6a8a254c..d5b288f4 100644
--- a/src/FilamentMonitors/FilamentMonitor.cpp
+++ b/src/FilamentMonitors/FilamentMonitor.cpp
@@ -273,59 +273,64 @@ bool FilamentMonitor::IsValid(size_t extruderNumber) const noexcept
haveMonitor = true;
#endif
FilamentMonitor& fs = *filamentSensors[drv];
- bool isPrinting;
- bool fromIsr;
- int32_t extruderStepsCommanded;
- uint32_t locIsrMillis;
- IrqDisable();
- if (fs.haveIsrStepsCommanded)
- {
- extruderStepsCommanded = fs.isrExtruderStepsCommanded;
- isPrinting = fs.isrWasPrinting;
- locIsrMillis = fs.lastIsrMillis;
- fs.haveIsrStepsCommanded = false;
- IrqEnable();
- fromIsr = true;
- }
- else
+#if SUPPORT_CAN_EXPANSION
+ if (fs.IsLocal())
+#endif
{
- IrqEnable();
- extruderStepsCommanded = reprap.GetMove().GetAccumulatedExtrusion(fs.driveNumber, isPrinting); // get and clear the net extrusion commanded
- fromIsr = false;
- locIsrMillis = 0;
- }
+ bool isPrinting;
+ bool fromIsr;
+ int32_t extruderStepsCommanded;
+ uint32_t locIsrMillis;
+ IrqDisable();
+ if (fs.haveIsrStepsCommanded)
+ {
+ extruderStepsCommanded = fs.isrExtruderStepsCommanded;
+ isPrinting = fs.isrWasPrinting;
+ locIsrMillis = fs.lastIsrMillis;
+ fs.haveIsrStepsCommanded = false;
+ IrqEnable();
+ fromIsr = true;
+ }
+ else
+ {
+ IrqEnable();
+ extruderStepsCommanded = reprap.GetMove().GetAccumulatedExtrusion(fs.driveNumber, isPrinting); // get and clear the net extrusion commanded
+ fromIsr = false;
+ locIsrMillis = 0;
+ }
- GCodes& gCodes = reprap.GetGCodes();
- if (gCodes.IsReallyPrinting() && !gCodes.IsSimulating())
- {
- const float extrusionCommanded = (float)extruderStepsCommanded/reprap.GetPlatform().DriveStepsPerUnit(fs.driveNumber);
- fst = fs.Check(isPrinting, fromIsr, locIsrMillis, extrusionCommanded);
- }
- else
- {
- fst = fs.Clear();
- }
+ GCodes& gCodes = reprap.GetGCodes();
+ if (gCodes.IsReallyPrinting() && !gCodes.IsSimulating())
+ {
+ const float extrusionCommanded = (float)extruderStepsCommanded/reprap.GetPlatform().DriveStepsPerUnit(fs.driveNumber);
+ fst = fs.Check(isPrinting, fromIsr, locIsrMillis, extrusionCommanded);
+ }
+ else
+ {
+ fst = fs.Clear();
+ }
- if (fst != fs.lastStatus)
- {
+ if (fst != fs.lastStatus)
+ {
#if SUPPORT_REMOTE_COMMANDS
- statusChanged = true;
+ statusChanged = true;
#endif
- fs.lastStatus = fst;
- if (fst != FilamentSensorStatus::ok
+ fs.lastStatus = fst;
+ if (fst != FilamentSensorStatus::ok
#if SUPPORT_REMOTE_COMMANDS
- && !CanInterface::InExpansionMode()
+ && !CanInterface::InExpansionMode()
#endif
- )
- {
- const size_t extruder = LogicalDriveToExtruder(fs.driveNumber);
- if (reprap.Debug(moduleFilamentSensors))
+ )
{
- debugPrintf("Filament error: extruder %u reports %s\n", extruder, fst.ToString());
- }
- else
- {
- gCodes.FilamentError(extruder, fst);
+ const size_t extruder = LogicalDriveToExtruder(fs.driveNumber);
+ if (reprap.Debug(moduleFilamentSensors))
+ {
+ debugPrintf("Filament error: extruder %u reports %s\n", extruder, fst.ToString());
+ }
+ else
+ {
+ gCodes.FilamentError(extruder, fst);
+ }
}
}
}