diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-10-19 12:51:35 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-10-19 12:51:35 +0300 |
commit | 7361f65fc75ed4d5e73aa3d87b71b060aaaac1e5 (patch) | |
tree | bef8c81cd771d981bf936ffea5449e4af0a82788 | |
parent | 7f04c9f483e561899467d4feab3d660a92bee1d1 (diff) |
Minor refactoring to bring IoPorts into line with expansion board f/w
-rw-r--r-- | src/Endstops/LocalZProbe.cpp | 2 | ||||
-rw-r--r-- | src/Endstops/SwitchEndstop.h | 4 | ||||
-rw-r--r-- | src/FilamentMonitors/Duet3DFilamentMonitor.cpp | 2 | ||||
-rw-r--r-- | src/FilamentMonitors/FilamentMonitor.cpp | 3 | ||||
-rw-r--r-- | src/FilamentMonitors/SimpleFilamentMonitor.cpp | 2 | ||||
-rw-r--r-- | src/GPIO/GpInPort.cpp | 4 | ||||
-rw-r--r-- | src/Hardware/IoPorts.cpp | 2 | ||||
-rw-r--r-- | src/Hardware/IoPorts.h | 2 | ||||
-rw-r--r-- | src/Heating/Sensors/DhtSensor.cpp | 2 | ||||
-rw-r--r-- | src/Movement/DDARing.h | 2 |
10 files changed, 13 insertions, 12 deletions
diff --git a/src/Endstops/LocalZProbe.cpp b/src/Endstops/LocalZProbe.cpp index 57228a7f..9b2a593d 100644 --- a/src/Endstops/LocalZProbe.cpp +++ b/src/Endstops/LocalZProbe.cpp @@ -102,7 +102,7 @@ uint16_t LocalZProbe::GetRawReading() const noexcept case ZProbeType::digital: case ZProbeType::unfilteredDigital: case ZProbeType::blTouch: - return (inputPort.Read()) ? MaxReading : 0; + return (inputPort.ReadDigital()) ? MaxReading : 0; default: return MaxReading; diff --git a/src/Endstops/SwitchEndstop.h b/src/Endstops/SwitchEndstop.h index 88ac12e0..a4f33da6 100644 --- a/src/Endstops/SwitchEndstop.h +++ b/src/Endstops/SwitchEndstop.h @@ -45,9 +45,9 @@ private: inline bool IsTriggered(size_t index) const noexcept { #if SUPPORT_CAN_EXPANSION - return (boardNumbers[index] == CanId::MasterAddress) ? ports[index].Read() : states[index]; + return (boardNumbers[index] == CanId::MasterAddress) ? ports[index].ReadDigital() : states[index]; #else - return ports[index].Read(); + return ports[index].ReadDigital(); #endif } diff --git a/src/FilamentMonitors/Duet3DFilamentMonitor.cpp b/src/FilamentMonitors/Duet3DFilamentMonitor.cpp index 494f6ca9..7cd26c10 100644 --- a/src/FilamentMonitors/Duet3DFilamentMonitor.cpp +++ b/src/FilamentMonitors/Duet3DFilamentMonitor.cpp @@ -48,7 +48,7 @@ bool Duet3DFilamentMonitor::Interrupt() noexcept const size_t writePointer = edgeCaptureWritePointer; // capture volatile variable if ((writePointer + 1) % EdgeCaptureBufferSize != edgeCaptureReadPointer) // if buffer is not full { - if (GetPort().Read()) + if (GetPort().ReadDigital()) { if ((writePointer & 1) == 0) // low-to-high transitions should occur on odd indices { diff --git a/src/FilamentMonitors/FilamentMonitor.cpp b/src/FilamentMonitors/FilamentMonitor.cpp index ee20f482..369072e0 100644 --- a/src/FilamentMonitors/FilamentMonitor.cpp +++ b/src/FilamentMonitors/FilamentMonitor.cpp @@ -253,7 +253,6 @@ bool FilamentMonitor::IsValid() const noexcept if (fs.IsLocal()) #endif { - GCodes& gCodes = reprap.GetGCodes(); bool isPrinting; bool fromIsr; int32_t extruderStepsCommanded; @@ -275,6 +274,8 @@ bool FilamentMonitor::IsValid() const noexcept fromIsr = false; locIsrMillis = 0; } + + GCodes& gCodes = reprap.GetGCodes(); if (gCodes.IsReallyPrinting() && !gCodes.IsSimulating()) { const float extrusionCommanded = (float)extruderStepsCommanded/reprap.GetPlatform().DriveStepsPerUnit(ExtruderToLogicalDrive(extruder)); diff --git a/src/FilamentMonitors/SimpleFilamentMonitor.cpp b/src/FilamentMonitors/SimpleFilamentMonitor.cpp index 3f2b8250..301e21c9 100644 --- a/src/FilamentMonitors/SimpleFilamentMonitor.cpp +++ b/src/FilamentMonitors/SimpleFilamentMonitor.cpp @@ -79,7 +79,7 @@ bool SimpleFilamentMonitor::Interrupt() noexcept // Call the following regularly to keep the status up to date void SimpleFilamentMonitor::Poll() noexcept { - const bool b = GetPort().Read(); + const bool b = GetPort().ReadDigital(); filamentPresent = (highWhenNoFilament) ? !b : b; } diff --git a/src/GPIO/GpInPort.cpp b/src/GPIO/GpInPort.cpp index 57bd7b4a..cd2b28b7 100644 --- a/src/GPIO/GpInPort.cpp +++ b/src/GPIO/GpInPort.cpp @@ -47,7 +47,7 @@ bool GpInputPort::GetState() const noexcept return currentState; } #endif - return port.Read(); + return port.ReadDigital(); } // Return true if the port is not configured @@ -107,7 +107,7 @@ GCodeResult GpInputPort::Configure(uint32_t gpinNumber, GCodeBuffer &gb, const S { if (port.AssignPort(pinName.c_str(), reply, PinUsedBy::gpin, PinAccess::read)) { - currentState = port.Read(); + currentState = port.ReadDigital(); rslt = GCodeResult::ok; } else diff --git a/src/Hardware/IoPorts.cpp b/src/Hardware/IoPorts.cpp index b0711e5e..985eb417 100644 --- a/src/Hardware/IoPorts.cpp +++ b/src/Hardware/IoPorts.cpp @@ -490,7 +490,7 @@ Pin IoPort::GetPin() const noexcept return (IsValid()) ? GetPinNoCheck() : NoPin; } -bool IoPort::Read() const noexcept +bool IoPort::ReadDigital() const noexcept { if (IsValid()) { diff --git a/src/Hardware/IoPorts.h b/src/Hardware/IoPorts.h index 1b16b497..d70366f0 100644 --- a/src/Hardware/IoPorts.h +++ b/src/Hardware/IoPorts.h @@ -35,7 +35,7 @@ public: void SetInvert(bool pInvert) noexcept; void ToggleInvert(bool pInvert) noexcept; - bool Read() const noexcept; + bool ReadDigital() const noexcept; bool AttachInterrupt(StandardCallbackFunction callback, InterruptMode mode, CallbackParameter param) const noexcept; void DetachInterrupt() const noexcept; diff --git a/src/Heating/Sensors/DhtSensor.cpp b/src/Heating/Sensors/DhtSensor.cpp index 748f08af..cefacfb5 100644 --- a/src/Heating/Sensors/DhtSensor.cpp +++ b/src/Heating/Sensors/DhtSensor.cpp @@ -109,7 +109,7 @@ void DhtTemperatureSensor::Interrupt() noexcept if (numPulses < ARRAY_SIZE(pulses)) { const uint16_t now = StepTimer::GetTimerTicks16(); - if (port.Read()) + if (port.ReadDigital()) { lastPulseTime = now; } diff --git a/src/Movement/DDARing.h b/src/Movement/DDARing.h index 9a71ed8f..05a1e0c6 100644 --- a/src/Movement/DDARing.h +++ b/src/Movement/DDARing.h @@ -123,7 +123,7 @@ private: // Start the next move. Return true if laser or IO bits need to be active // Must be called with base priority greater than or equal to the step interrupt, to avoid a race with the step ISR. inline bool DDARing::StartNextMove(Platform& p, uint32_t startTime) noexcept -pre(ddaRingGetPointer->GetState() == DDA::frozen) +pre(getPointer->GetState() == DDA::frozen) { DDA * const cdda = getPointer; // capture volatile variable if (cdda->IsNonPrintingExtruderMove()) |