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-01-31 17:09:00 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-01-31 17:09:00 +0300
commit0d7b6c9a443aaaa610bfae2fcb218c47ffc94c24 (patch)
tree99dcaf6ccc40220bcd1c8648fb0b9f608ff40037 /src/InputMonitors
parentf4735c0104b643e060a1ee4c1c6fafa075d76e75 (diff)
Don't try to enable a pin interrupt when the ATE creates a handle
Diffstat (limited to 'src/InputMonitors')
-rw-r--r--src/InputMonitors/InputMonitor.cpp9
-rw-r--r--src/InputMonitors/InputMonitor.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/src/InputMonitors/InputMonitor.cpp b/src/InputMonitors/InputMonitor.cpp
index a59ce075..5bc4a97e 100644
--- a/src/InputMonitors/InputMonitor.cpp
+++ b/src/InputMonitors/InputMonitor.cpp
@@ -18,7 +18,7 @@ InputMonitor * volatile InputMonitor::monitorsList = nullptr;
InputMonitor * volatile InputMonitor::freeList = nullptr;
ReadWriteLock InputMonitor::listLock;
-bool InputMonitor::Activate() noexcept
+bool InputMonitor::Activate(bool useInterrupt) noexcept
{
bool ok = true;
if (!active)
@@ -27,7 +27,7 @@ bool InputMonitor::Activate() noexcept
{
// Digital input
const irqflags_t flags = cpu_irq_save();
- ok = port.AttachInterrupt(CommonDigitalPortInterrupt, InterruptMode::change, CallbackParameter(this));
+ ok = !useInterrupt || port.AttachInterrupt(CommonDigitalPortInterrupt, InterruptMode::change, CallbackParameter(this));
state = port.ReadDigital();
cpu_irq_restore(flags);
}
@@ -170,7 +170,8 @@ void InputMonitor::AnalogInterrupt(uint16_t reading) noexcept
{
newMonitor->next = monitorsList;
monitorsList = newMonitor;
- const bool ok = newMonitor->Activate();
+ // Pins used only by the ATE may not have interrupts, and the ATE doesn't need interrupts from them
+ const bool ok = newMonitor->Activate(msg.handle.u.parts.type != RemoteInputHandle::typeAte);
extra = (newMonitor->state) ? 1 : 0;
if (!ok)
{
@@ -211,7 +212,7 @@ void InputMonitor::AnalogInterrupt(uint16_t reading) noexcept
switch (msg.action)
{
case CanMessageChangeInputMonitor::actionDoMonitor:
- rslt = (m->Activate()) ? GCodeResult::ok : GCodeResult::error;
+ rslt = (m->Activate(true)) ? GCodeResult::ok : GCodeResult::error;
break;
case CanMessageChangeInputMonitor::actionDontMonitor:
diff --git a/src/InputMonitors/InputMonitor.h b/src/InputMonitors/InputMonitor.h
index 3e127c93..43ee12eb 100644
--- a/src/InputMonitors/InputMonitor.h
+++ b/src/InputMonitors/InputMonitor.h
@@ -38,7 +38,7 @@ public:
static void CommonAnalogPortInterrupt(CallbackParameter cbp, uint16_t reading) noexcept;
private:
- bool Activate() noexcept;
+ bool Activate(bool useInterrupt) noexcept;
void Deactivate() noexcept;
void DigitalInterrupt() noexcept;
void AnalogInterrupt(uint16_t reading) noexcept;