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>2020-09-09 23:02:09 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-09-09 23:02:09 +0300
commit40ac3f2c5826db8954c45035201c7e047f4b66c7 (patch)
tree5490c2b865786788571dede95cd7e1d2d0b38584 /src/FilamentMonitors
parent4d84f1e5214d1815ed4cde55cccd114162a087dd (diff)
Fixed issues which prevented IAP being loaded correctly on Duet 2
Diffstat (limited to 'src/FilamentMonitors')
-rw-r--r--src/FilamentMonitors/FilamentMonitor.cpp35
-rw-r--r--src/FilamentMonitors/FilamentMonitor.h3
2 files changed, 27 insertions, 11 deletions
diff --git a/src/FilamentMonitors/FilamentMonitor.cpp b/src/FilamentMonitors/FilamentMonitor.cpp
index 10f35a2c..149d9285 100644
--- a/src/FilamentMonitors/FilamentMonitor.cpp
+++ b/src/FilamentMonitors/FilamentMonitor.cpp
@@ -127,25 +127,25 @@ bool FilamentMonitor::ConfigurePin(GCodeBuffer& gb, const StringRef& reply, Inte
}
// Factory function
-/*static*/ FilamentMonitor *FilamentMonitor::Create(unsigned int extruder, unsigned int type) noexcept
+/*static*/ FilamentMonitor *FilamentMonitor::Create(unsigned int extruder, unsigned int monitorType) noexcept
{
- switch (type)
+ switch (monitorType)
{
case 1: // active high switch
case 2: // active low switch
- return new SimpleFilamentMonitor(extruder, type);
+ return new SimpleFilamentMonitor(extruder, monitorType);
break;
case 3: // duet3d rotating magnet, no switch
case 4: // duet3d rotating magnet + switch
- return new RotatingMagnetFilamentMonitor(extruder, type);
+ return new RotatingMagnetFilamentMonitor(extruder, monitorType);
case 5: // duet3d laser, no switch
case 6: // duet3d laser + switch
- return new LaserFilamentMonitor(extruder, type);
+ return new LaserFilamentMonitor(extruder, monitorType);
case 7: // simple pulse output sensor
- return new PulsedFilamentMonitor(extruder, type);
+ return new PulsedFilamentMonitor(extruder, monitorType);
break;
default: // no sensor, or unknown sensor
@@ -183,7 +183,6 @@ bool FilamentMonitor::ConfigurePin(GCodeBuffer& gb, const StringRef& reply, Inte
{
ReadLocker lock(filamentMonitorsLock);
- // Filament sensors
for (size_t extruder = 0; extruder < MaxExtruders; ++extruder)
{
if (filamentSensors[extruder] != nullptr)
@@ -193,13 +192,13 @@ bool FilamentMonitor::ConfigurePin(GCodeBuffer& gb, const StringRef& reply, Inte
bool isPrinting;
bool fromIsr;
int32_t extruderStepsCommanded;
- uint32_t isrMillis;
+ uint32_t locIsrMillis;
cpu_irq_disable();
if (fs.haveIsrStepsCommanded)
{
extruderStepsCommanded = fs.isrExtruderStepsCommanded;
isPrinting = fs.isrWasPrinting;
- isrMillis = fs.isrMillis;
+ locIsrMillis = fs.isrMillis;
fs.haveIsrStepsCommanded = false;
cpu_irq_enable();
fromIsr = true;
@@ -209,12 +208,12 @@ bool FilamentMonitor::ConfigurePin(GCodeBuffer& gb, const StringRef& reply, Inte
cpu_irq_enable();
extruderStepsCommanded = reprap.GetMove().GetAccumulatedExtrusion(extruder, isPrinting); // get and clear the net extrusion commanded
fromIsr = false;
- isrMillis = 0;
+ locIsrMillis = 0;
}
if (gCodes.IsReallyPrinting() && !gCodes.IsSimulating())
{
const float extrusionCommanded = (float)extruderStepsCommanded/reprap.GetPlatform().DriveStepsPerUnit(ExtruderToLogicalDrive(extruder));
- const FilamentSensorStatus fstat = fs.Check(isPrinting, fromIsr, isrMillis, extrusionCommanded);
+ const FilamentSensorStatus fstat = fs.Check(isPrinting, fromIsr, locIsrMillis, extrusionCommanded);
if (fstat != FilamentSensorStatus::ok)
{
if (reprap.Debug(moduleFilamentSensors))
@@ -235,6 +234,20 @@ bool FilamentMonitor::ConfigurePin(GCodeBuffer& gb, const StringRef& reply, Inte
}
}
+// Close down the filament monitors, in particular stop them generating interrupts. Called when we are about to update firmware.
+/*static*/ void FilamentMonitor::DisableAll() noexcept
+{
+ ReadLocker lock(filamentMonitorsLock);
+
+ for (FilamentMonitor *f : filamentSensors)
+ {
+ if (f != nullptr)
+ {
+ f->Disable();
+ }
+ }
+}
+
// Send diagnostics info
/*static*/ void FilamentMonitor::Diagnostics(MessageType mtype) noexcept
{
diff --git a/src/FilamentMonitors/FilamentMonitor.h b/src/FilamentMonitors/FilamentMonitor.h
index 76970de0..2db16e2e 100644
--- a/src/FilamentMonitors/FilamentMonitor.h
+++ b/src/FilamentMonitors/FilamentMonitor.h
@@ -63,6 +63,9 @@ public:
// Poll the filament sensors
static void Spin() noexcept;
+ // Close down the filament monitors, in particular stop them generating interrupts. Called when we are about to update firmware.
+ static void DisableAll() noexcept;
+
// Handle M591
static GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, unsigned int extruder) THROWS(GCodeException)
pre(extruder < MaxExtruders);