diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-01-04 21:15:22 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-01-04 21:15:22 +0300 |
commit | 5bd28a1aea25e83e6e1d7a0ca50cd000e7baf1a7 (patch) | |
tree | 059d11bfc384d80c7ff07d3457e994ac50a0c07e /src/Endstops/SwitchEndstop.cpp | |
parent | 8ded9143fa9d07dcddd525683403980c42881f1a (diff) |
Conditional GCode fixes and exception specifiers
Loops are now working
Added noexcept specifiers to omst of the remaining C++ source files
Diffstat (limited to 'src/Endstops/SwitchEndstop.cpp')
-rw-r--r-- | src/Endstops/SwitchEndstop.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Endstops/SwitchEndstop.cpp b/src/Endstops/SwitchEndstop.cpp index 4b000710..d8c5eca9 100644 --- a/src/Endstops/SwitchEndstop.cpp +++ b/src/Endstops/SwitchEndstop.cpp @@ -20,18 +20,18 @@ #endif // Switch endstop -SwitchEndstop::SwitchEndstop(uint8_t axis, EndStopPosition pos) : Endstop(axis, pos), numPortsUsed(0) +SwitchEndstop::SwitchEndstop(uint8_t axis, EndStopPosition pos) noexcept : Endstop(axis, pos), numPortsUsed(0) { // ports will be initialised automatically by the IoPort default constructor } -SwitchEndstop::~SwitchEndstop() +SwitchEndstop::~SwitchEndstop() noexcept { ReleasePorts(); } // Release any local and remote ports we have allocated and set numPortsUsed to zero -void SwitchEndstop::ReleasePorts() +void SwitchEndstop::ReleasePorts() noexcept { while (numPortsUsed != 0) { @@ -60,7 +60,7 @@ GCodeResult SwitchEndstop::Configure(GCodeBuffer& gb, const StringRef& reply) return Configure(portNames.c_str(), reply); } -GCodeResult SwitchEndstop::Configure(const char *pinNames, const StringRef& reply) +GCodeResult SwitchEndstop::Configure(const char *pinNames, const StringRef& reply) noexcept { ReleasePorts(); @@ -111,13 +111,13 @@ GCodeResult SwitchEndstop::Configure(const char *pinNames, const StringRef& repl return GCodeResult::ok; } -EndStopType SwitchEndstop::GetEndstopType() const +EndStopType SwitchEndstop::GetEndstopType() const noexcept { return EndStopType::inputPin; } // Test whether we are at or near the stop -EndStopHit SwitchEndstop::Stopped() const +EndStopHit SwitchEndstop::Stopped() const noexcept { for (size_t i = 0; i < numPortsUsed; ++i) { @@ -130,7 +130,7 @@ EndStopHit SwitchEndstop::Stopped() const } // This is called to prime axis endstops -bool SwitchEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) +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); @@ -160,7 +160,7 @@ bool SwitchEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDr // Check whether the endstop is triggered and return the action that should be performed. Don't update the state until Acknowledge is called. // Called from the step ISR. -EndstopHitDetails SwitchEndstop::CheckTriggered(bool goingSlow) +EndstopHitDetails SwitchEndstop::CheckTriggered(bool goingSlow) noexcept { EndstopHitDetails rslt; // initialised by default constructor if (portsLeftToTrigger != 0) @@ -210,7 +210,7 @@ EndstopHitDetails SwitchEndstop::CheckTriggered(bool goingSlow) // This is called by the ISR to acknowledge that it is acting on the return from calling CheckTriggered. Called from the step ISR. // Return true if we have finished with this endstop or probe in this move. -bool SwitchEndstop::Acknowledge(EndstopHitDetails what) +bool SwitchEndstop::Acknowledge(EndstopHitDetails what) noexcept { switch (what.GetAction()) { @@ -228,7 +228,7 @@ bool SwitchEndstop::Acknowledge(EndstopHitDetails what) } } -void SwitchEndstop::AppendDetails(const StringRef& str) +void SwitchEndstop::AppendDetails(const StringRef& str) noexcept { str.catf((numPortsUsed == 1) ? "switch connected to pin" : "switches connected to pins"); @@ -262,7 +262,7 @@ void SwitchEndstop::AppendDetails(const StringRef& str) #if SUPPORT_CAN_EXPANSION // Process a remote endstop input change that relates to this endstop -void SwitchEndstop::HandleRemoteInputChange(CanAddress src, uint8_t handleMinor, bool state) +void SwitchEndstop::HandleRemoteInputChange(CanAddress src, uint8_t handleMinor, bool state) noexcept { if (handleMinor < numPortsUsed && boardNumbers[handleMinor] == src) { |