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-01-19 02:03:39 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-19 02:03:39 +0300
commitc812ce5e14cf476526d955edbce2effa9d922902 (patch)
treeda67dc55e46efdd38a0647318977a342da730345 /src/Endstops/SwitchEndstop.cpp
parente0bbf71357b07c22e6d43be3cca5c7422163be32 (diff)
Major refactoring, bug fixes in function evaluation
Changed all bitmaps to use the bitmap class from RRFLibraries Fixed bugs in functoin evaluation
Diffstat (limited to 'src/Endstops/SwitchEndstop.cpp')
-rw-r--r--src/Endstops/SwitchEndstop.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Endstops/SwitchEndstop.cpp b/src/Endstops/SwitchEndstop.cpp
index d8c5eca9..fa4a903a 100644
--- a/src/Endstops/SwitchEndstop.cpp
+++ b/src/Endstops/SwitchEndstop.cpp
@@ -133,9 +133,9 @@ EndStopHit SwitchEndstop::Stopped() const noexcept
bool SwitchEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) noexcept
{
// Decide whether we stop just the driver, just the axis, or everything
- stopAll = ((kin.GetConnectedAxes(GetAxis()) & ~MakeBitmap<AxesBitmap>(GetAxis())) != 0);
+ stopAll = kin.GetConnectedAxes(GetAxis()).Intersects(~AxesBitmap::MakeFromBits(GetAxis()));
numPortsLeftToTrigger = (numPortsUsed != axisDrivers.numDrivers) ? 1 : numPortsUsed;
- portsLeftToTrigger = LowestNBits<PortsBitmap>(numPortsUsed);
+ portsLeftToTrigger = PortsBitmap::MakeLowestNBits(numPortsUsed);
#if SUPPORT_CAN_EXPANSION
// For each remote switch, check that the expansion board knows about it, and make sure we have an up-to-date state
@@ -163,11 +163,11 @@ bool SwitchEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDr
EndstopHitDetails SwitchEndstop::CheckTriggered(bool goingSlow) noexcept
{
EndstopHitDetails rslt; // initialised by default constructor
- if (portsLeftToTrigger != 0)
+ if (portsLeftToTrigger.IsNonEmpty())
{
for (size_t i = 0; i < numPortsUsed; ++i)
{
- if (IsBitSet(portsLeftToTrigger, i) && IsTriggered(i))
+ if (portsLeftToTrigger.IsBitSet(i) && IsTriggered(i))
{
rslt.axis = GetAxis();
if (stopAll)
@@ -219,7 +219,7 @@ bool SwitchEndstop::Acknowledge(EndstopHitDetails what) noexcept
return true;
case EndstopHitAction::stopDriver:
- ClearBit(portsLeftToTrigger, what.internalUse);
+ portsLeftToTrigger.ClearBit(what.internalUse);
--numPortsLeftToTrigger;
return false;