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 13:29:44 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-19 13:29:44 +0300
commit55cfc22143b67ab0182e31d7f9b14a7ce60f4913 (patch)
tree4ff247466afa1d6c094556e3cc73039e85ba9dab
parent4d5d844fe5d6ed73fd87c325b3d80daddbc5598c (diff)
Added missing noexcept specifiers
-rw-r--r--src/Movement/BedProbing/Grid.cpp50
-rw-r--r--src/Movement/BedProbing/Grid.h70
-rw-r--r--src/Movement/BedProbing/RandomProbePointSet.cpp28
-rw-r--r--src/Movement/BedProbing/RandomProbePointSet.h46
-rw-r--r--src/Movement/HeightControl/HeightController.cpp12
-rw-r--r--src/Movement/HeightControl/HeightController.h12
-rw-r--r--src/Movement/RawMove.cpp4
-rw-r--r--src/Movement/RawMove.h4
-rw-r--r--src/ObjectModel/ObjectModel.h8
9 files changed, 117 insertions, 117 deletions
diff --git a/src/Movement/BedProbing/Grid.cpp b/src/Movement/BedProbing/Grid.cpp
index 0a325f2f..8c76a632 100644
--- a/src/Movement/BedProbing/Grid.cpp
+++ b/src/Movement/BedProbing/Grid.cpp
@@ -20,14 +20,14 @@ const char * const GridDefinition::HeightMapLabelLines[] =
};
// Initialise the grid to be invalid
-GridDefinition::GridDefinition()
+GridDefinition::GridDefinition() noexcept
: xMin(0.0), xMax(-1.0), yMin(0.0), yMax(-1.0), radius(-1.0), xSpacing(0.0), ySpacing(0.0)
{
CheckValidity(); // will flag the grid as invalid
}
// Set the grid parameters ands return true if it is now valid
-bool GridDefinition::Set(const float xRange[2], const float yRange[2], float pRadius, const float pSpacings[2])
+bool GridDefinition::Set(const float xRange[2], const float yRange[2], float pRadius, const float pSpacings[2]) noexcept
{
xMin = xRange[0];
xMax = xRange[1];
@@ -42,7 +42,7 @@ bool GridDefinition::Set(const float xRange[2], const float yRange[2], float pRa
// Set up internal variables and check validity of the grid.
// numX, numY are always set up, but recipXspacing, recipYspacing only if the grid is valid
-void GridDefinition::CheckValidity()
+void GridDefinition::CheckValidity() noexcept
{
numX = (xMax - xMin >= MinRange && xSpacing >= MinSpacing) ? (uint32_t)((xMax - xMin)/xSpacing) + 1 : 0;
numY = (yMax - yMin >= MinRange && ySpacing >= MinSpacing) ? (uint32_t)((yMax - yMin)/ySpacing) + 1 : 0;
@@ -58,37 +58,37 @@ void GridDefinition::CheckValidity()
}
}
-float GridDefinition::GetXCoordinate(unsigned int xIndex) const
+float GridDefinition::GetXCoordinate(unsigned int xIndex) const noexcept
{
return xMin + (xIndex * xSpacing);
}
-float GridDefinition::GetYCoordinate(unsigned int yIndex) const
+float GridDefinition::GetYCoordinate(unsigned int yIndex) const noexcept
{
return yMin + (yIndex * ySpacing);
}
-bool GridDefinition::IsInRadius(float x, float y) const
+bool GridDefinition::IsInRadius(float x, float y) const noexcept
{
return radius < 0.0 || x * x + y * y < radius * radius;
}
// Append the grid parameters to the end of a string
-void GridDefinition::PrintParameters(const StringRef& s) const
+void GridDefinition::PrintParameters(const StringRef& s) const noexcept
{
s.catf("X%.1f:%.1f, Y%.1f:%.1f, radius %.1f, X spacing %.1f, Y spacing %.1f, %" PRIu32 " points",
(double)xMin, (double)xMax, (double)yMin, (double)yMax, (double)radius, (double)xSpacing, (double)ySpacing, NumPoints());
}
// Write the parameter label line to a string
-void GridDefinition::WriteHeadingAndParameters(const StringRef& s) const
+void GridDefinition::WriteHeadingAndParameters(const StringRef& s) const noexcept
{
s.printf("%s\n%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%" PRIi32 ",%" PRIi32 "\n",
HeightMapLabelLines[ARRAY_UPB(HeightMapLabelLines)], (double)xMin, (double)xMax, (double)yMin, (double)yMax, (double)radius, (double)xSpacing, (double)ySpacing, numX, numY);
}
// Check the parameter label line, returning -1 if not recognised, else the version we found
-/*static*/ int GridDefinition::CheckHeading(const StringRef& s)
+/*static*/ int GridDefinition::CheckHeading(const StringRef& s) noexcept
{
for (size_t i = 0; i < ARRAY_SIZE(HeightMapLabelLines); ++i)
{
@@ -101,7 +101,7 @@ void GridDefinition::WriteHeadingAndParameters(const StringRef& s) const
}
// Read the grid parameters from a string returning true if success
-bool GridDefinition::ReadParameters(const StringRef& s, int version)
+bool GridDefinition::ReadParameters(const StringRef& s, int version) noexcept
{
// 2018-04-08: rewrote this not to use sscanf because that function isn't thread safe
isValid = false; // assume failure
@@ -182,7 +182,7 @@ bool GridDefinition::ReadParameters(const StringRef& s, int version)
}
// Print what is wrong with the grid, appending it to the existing string
-void GridDefinition::PrintError(float originalXrange, float originalYrange, const StringRef& r) const
+void GridDefinition::PrintError(float originalXrange, float originalYrange, const StringRef& r) const noexcept
{
if (xSpacing < MinSpacing || ySpacing < MinSpacing)
{
@@ -217,27 +217,27 @@ void GridDefinition::PrintError(float originalXrange, float originalYrange, cons
// Increase the version number in the following string whenever we change the format of the height map file.
const char * const HeightMap::HeightMapComment = "RepRapFirmware height map file v2";
-HeightMap::HeightMap() : useMap(false) { }
+HeightMap::HeightMap() noexcept : useMap(false) { }
-void HeightMap::SetGrid(const GridDefinition& gd)
+void HeightMap::SetGrid(const GridDefinition& gd) noexcept
{
useMap = false;
def = gd;
ClearGridHeights();
}
-void HeightMap::ClearGridHeights()
+void HeightMap::ClearGridHeights() noexcept
{
gridHeightSet.ClearAll();
}
// Set the height of a grid point
-void HeightMap::SetGridHeight(size_t xIndex, size_t yIndex, float height)
+void HeightMap::SetGridHeight(size_t xIndex, size_t yIndex, float height) noexcept
{
SetGridHeight(yIndex * def.numX + xIndex, height);
}
-void HeightMap::SetGridHeight(size_t index, float height)
+void HeightMap::SetGridHeight(size_t index, float height) noexcept
{
if (index < MaxGridProbePoints)
{
@@ -248,7 +248,7 @@ void HeightMap::SetGridHeight(size_t index, float height)
// Return the minimum number of segments for a move by this X or Y amount
// Note that deltaX and deltaY may be negative
-unsigned int HeightMap::GetMinimumSegments(float deltaX, float deltaY) const
+unsigned int HeightMap::GetMinimumSegments(float deltaX, float deltaY) const noexcept
{
const float xDistance = fabsf(deltaX);
unsigned int xSegments = (xDistance > 0.0) ? (unsigned int)(xDistance * def.recipXspacing + 0.4) : 1;
@@ -262,7 +262,7 @@ unsigned int HeightMap::GetMinimumSegments(float deltaX, float deltaY) const
#if HAS_MASS_STORAGE
// Save the grid to file returning true if an error occurred
-bool HeightMap::SaveToFile(FileStore *f, float zOffset) const
+bool HeightMap::SaveToFile(FileStore *f, float zOffset) const noexcept
{
String<StringLength500> bufferSpace;
const StringRef buf = bufferSpace.GetRef();
@@ -325,7 +325,7 @@ bool HeightMap::SaveToFile(FileStore *f, float zOffset) const
}
// Load the grid from file, returning true if an error occurred with the error reason appended to the buffer
-bool HeightMap::LoadFromFile(FileStore *f, const StringRef& r)
+bool HeightMap::LoadFromFile(FileStore *f, const StringRef& r) noexcept
{
const size_t MaxLineLength = (MaxXGridPoints * 8) + 2; // maximum length of a line in the height map file, need 8 characters per grid point
const char* const readFailureText = "failed to read line from file";
@@ -415,7 +415,7 @@ bool HeightMap::LoadFromFile(FileStore *f, const StringRef& r)
#if HAS_LINUX_INTERFACE
// Save the grid to a sequential array in the same way as to a regular CSV file
-void HeightMap::SaveToArray(float *arr, float zOffset) const
+void HeightMap::SaveToArray(float *arr, float zOffset) const noexcept
{
size_t index = 0;
for (size_t i = 0; i < def.numY; ++i)
@@ -431,7 +431,7 @@ void HeightMap::SaveToArray(float *arr, float zOffset) const
#endif
// Return number of points probed, mean and RMS deviation, min and max error
-unsigned int HeightMap::GetStatistics(Deviation& deviation, float& minError, float& maxError) const
+unsigned int HeightMap::GetStatistics(Deviation& deviation, float& minError, float& maxError) const noexcept
{
double heightSum = 0.0, heightSquaredSum = 0.0;
minError = 9999.0;
@@ -462,14 +462,14 @@ unsigned int HeightMap::GetStatistics(Deviation& deviation, float& minError, flo
}
// Try to turn mesh compensation on or off and report the state achieved
-bool HeightMap::UseHeightMap(bool b)
+bool HeightMap::UseHeightMap(bool b) noexcept
{
useMap = b && def.IsValid();
return useMap;
}
// Compute the height error at the specified point
-float HeightMap::GetInterpolatedHeightError(float x, float y) const
+float HeightMap::GetInterpolatedHeightError(float x, float y) const noexcept
{
if (!useMap)
{
@@ -498,7 +498,7 @@ float HeightMap::GetInterpolatedHeightError(float x, float y) const
return InterpolateXY(xIndex, yIndex, xf - xFloor, yf - yFloor);
}
-float HeightMap::InterpolateXY(uint32_t xIndex, uint32_t yIndex, float xFrac, float yFrac) const
+float HeightMap::InterpolateXY(uint32_t xIndex, uint32_t yIndex, float xFrac, float yFrac) const noexcept
{
const uint32_t indexX0Y0 = GetMapIndex(xIndex, yIndex); // (X0,Y0)
const uint32_t indexX1Y0 = indexX0Y0 + 1; // (X1,Y0)
@@ -512,7 +512,7 @@ float HeightMap::InterpolateXY(uint32_t xIndex, uint32_t yIndex, float xFrac, fl
+ (gridHeights[indexX1Y1] * xyFrac);
}
-void HeightMap::ExtrapolateMissing()
+void HeightMap::ExtrapolateMissing() noexcept
{
//1: calculating the bed plane by least squares fit
//2: filling in missing points
diff --git a/src/Movement/BedProbing/Grid.h b/src/Movement/BedProbing/Grid.h
index 0998f9fa..c8a2a8bc 100644
--- a/src/Movement/BedProbing/Grid.h
+++ b/src/Movement/BedProbing/Grid.h
@@ -21,27 +21,27 @@ public:
friend class DataTransfer;
friend class HeightMap;
- GridDefinition();
-
- uint32_t NumXpoints() const { return numX; }
- uint32_t NumYpoints() const { return numY; }
- uint32_t NumPoints() const { return numX * numY; }
- float GetXCoordinate(unsigned int xIndex) const;
- float GetYCoordinate(unsigned int yIndex) const;
- bool IsInRadius(float x, float y) const;
- bool IsValid() const { return isValid; }
-
- bool Set(const float xRange[2], const float yRange[2], float pRadius, const float pSpacings[2]);
- void PrintParameters(const StringRef& r) const;
- void WriteHeadingAndParameters(const StringRef& r) const;
- static int CheckHeading(const StringRef& s);
- bool ReadParameters(const StringRef& s, int version);
-
- void PrintError(float originalXrange, float originalYrange, const StringRef& r) const
+ GridDefinition() noexcept;
+
+ uint32_t NumXpoints() const noexcept { return numX; }
+ uint32_t NumYpoints() const noexcept { return numY; }
+ uint32_t NumPoints() const noexcept { return numX * numY; }
+ float GetXCoordinate(unsigned int xIndex) const noexcept;
+ float GetYCoordinate(unsigned int yIndex) const noexcept;
+ bool IsInRadius(float x, float y) const noexcept;
+ bool IsValid() const noexcept { return isValid; }
+
+ bool Set(const float xRange[2], const float yRange[2], float pRadius, const float pSpacings[2]) noexcept;
+ void PrintParameters(const StringRef& r) const noexcept;
+ void WriteHeadingAndParameters(const StringRef& r) const noexcept;
+ static int CheckHeading(const StringRef& s) noexcept;
+ bool ReadParameters(const StringRef& s, int version) noexcept;
+
+ void PrintError(float originalXrange, float originalYrange, const StringRef& r) const noexcept
pre(!IsValid());
private:
- void CheckValidity();
+ void CheckValidity() noexcept;
static constexpr float MinSpacing = 0.1; // The minimum point spacing allowed
static constexpr float MinRange = 1.0; // The minimum X and Y range allowed
@@ -62,35 +62,35 @@ private:
class HeightMap
{
public:
- HeightMap();
+ HeightMap() noexcept;
- const GridDefinition& GetGrid() const { return def; }
- void SetGrid(const GridDefinition& gd);
+ const GridDefinition& GetGrid() const noexcept { return def; }
+ void SetGrid(const GridDefinition& gd) noexcept;
- float GetInterpolatedHeightError(float x, float y) const; // Compute the interpolated height error at the specified point
- void ClearGridHeights(); // Clear all grid height corrections
- void SetGridHeight(size_t xIndex, size_t yIndex, float height); // Set the height of a grid point
- void SetGridHeight(size_t index, float height); // Set the height of a grid point
+ float GetInterpolatedHeightError(float x, float y) const noexcept; // Compute the interpolated height error at the specified point
+ void ClearGridHeights() noexcept; // Clear all grid height corrections
+ void SetGridHeight(size_t xIndex, size_t yIndex, float height) noexcept; // Set the height of a grid point
+ void SetGridHeight(size_t index, float height) noexcept; // Set the height of a grid point
#if HAS_MASS_STORAGE
- bool SaveToFile(FileStore *f, float zOffset) const // Save the grid to file returning true if an error occurred
+ bool SaveToFile(FileStore *f, float zOffset) const noexcept // Save the grid to file returning true if an error occurred
pre(IsValid());
- bool LoadFromFile(FileStore *f, const StringRef& r); // Load the grid from file returning true if an error occurred
+ bool LoadFromFile(FileStore *f, const StringRef& r) noexcept; // Load the grid from file returning true if an error occurred
#endif
#if HAS_LINUX_INTERFACE
- void SaveToArray(float *array, float zOffset) const // Save the grid Z coordinates to an array
+ void SaveToArray(float *array, float zOffset) const noexcept // Save the grid Z coordinates to an array
pre(IsValid());
#endif
- unsigned int GetMinimumSegments(float deltaX, float deltaY) const; // Return the minimum number of segments for a move by this X or Y amount
+ unsigned int GetMinimumSegments(float deltaX, float deltaY) const noexcept; // Return the minimum number of segments for a move by this X or Y amount
- bool UseHeightMap(bool b);
- bool UsingHeightMap() const { return useMap; }
+ bool UseHeightMap(bool b) noexcept;
+ bool UsingHeightMap() const noexcept { return useMap; }
- unsigned int GetStatistics(Deviation& deviation, float& minError, float& maxError) const;
+ unsigned int GetStatistics(Deviation& deviation, float& minError, float& maxError) const noexcept;
// Return number of points probed, mean and RMS deviation, min and max error
- void ExtrapolateMissing(); // Extrapolate missing points to ensure consistency
+ void ExtrapolateMissing() noexcept; // Extrapolate missing points to ensure consistency
private:
static const char * const HeightMapComment; // The start of the comment we write at the start of the height map file
@@ -100,9 +100,9 @@ private:
LargeBitmap<MaxGridProbePoints> gridHeightSet; // Bitmap of which heights are set
bool useMap; // True to do bed compensation
- uint32_t GetMapIndex(uint32_t xIndex, uint32_t yIndex) const { return (yIndex * def.NumXpoints()) + xIndex; }
+ uint32_t GetMapIndex(uint32_t xIndex, uint32_t yIndex) const noexcept { return (yIndex * def.NumXpoints()) + xIndex; }
- float InterpolateXY(uint32_t xIndex, uint32_t yIndex, float xFrac, float yFrac) const;
+ float InterpolateXY(uint32_t xIndex, uint32_t yIndex, float xFrac, float yFrac) const noexcept;
};
#endif /* SRC_MOVEMENT_GRID_H_ */
diff --git a/src/Movement/BedProbing/RandomProbePointSet.cpp b/src/Movement/BedProbing/RandomProbePointSet.cpp
index d8e6f40e..c7d430d6 100644
--- a/src/Movement/BedProbing/RandomProbePointSet.cpp
+++ b/src/Movement/BedProbing/RandomProbePointSet.cpp
@@ -30,7 +30,7 @@ DEFINE_GET_OBJECT_MODEL_TABLE(RandomProbePointSet)
#endif
-RandomProbePointSet::RandomProbePointSet() : numBedCompensationPoints(0)
+RandomProbePointSet::RandomProbePointSet() noexcept : numBedCompensationPoints(0)
{
for (size_t point = 0; point < MaxProbePoints; point++)
{
@@ -40,7 +40,7 @@ RandomProbePointSet::RandomProbePointSet() : numBedCompensationPoints(0)
}
// Record the X and Y coordinates of a probe point
-void RandomProbePointSet::SetXYBedProbePoint(size_t index, float x, float y)
+void RandomProbePointSet::SetXYBedProbePoint(size_t index, float x, float y) noexcept
{
xBedProbePoints[index] = x;
yBedProbePoints[index] = y;
@@ -48,7 +48,7 @@ void RandomProbePointSet::SetXYBedProbePoint(size_t index, float x, float y)
}
// Record the Z coordinate of a probe point
-void RandomProbePointSet::SetZBedProbePoint(size_t index, float z, bool wasXyCorrected, bool wasError)
+void RandomProbePointSet::SetZBedProbePoint(size_t index, float z, bool wasXyCorrected, bool wasError) noexcept
{
zBedProbePoints[index] = z;
probePointSet[index] |= zSet;
@@ -72,7 +72,7 @@ void RandomProbePointSet::SetZBedProbePoint(size_t index, float z, bool wasXyCor
}
}
-size_t RandomProbePointSet::NumberOfProbePoints() const
+size_t RandomProbePointSet::NumberOfProbePoints() const noexcept
{
for (size_t i = 0; i < MaxProbePoints; i++)
{
@@ -85,7 +85,7 @@ size_t RandomProbePointSet::NumberOfProbePoints() const
}
// Clear out the Z heights so that we don't re-use old points
-void RandomProbePointSet::ClearProbeHeights()
+void RandomProbePointSet::ClearProbeHeights() noexcept
{
for (size_t i = 0; i < MaxProbePoints; ++i)
{
@@ -94,7 +94,7 @@ void RandomProbePointSet::ClearProbeHeights()
}
// Set the bed transform, returning true if error
-bool RandomProbePointSet::SetProbedBedEquation(size_t numPoints, const StringRef& reply)
+bool RandomProbePointSet::SetProbedBedEquation(size_t numPoints, const StringRef& reply) noexcept
{
if (!GoodProbePointOrdering(numPoints))
{
@@ -182,7 +182,7 @@ bool RandomProbePointSet::SetProbedBedEquation(size_t numPoints, const StringRef
}
// Compute the interpolated height error at the specified point
-float RandomProbePointSet::GetInterpolatedHeightError(float x, float y) const
+float RandomProbePointSet::GetInterpolatedHeightError(float x, float y) const noexcept
{
switch(numBedCompensationPoints)
{
@@ -202,7 +202,7 @@ float RandomProbePointSet::GetInterpolatedHeightError(float x, float y) const
}
// Check whether the specified set of points has been successfully defined and probed
-bool RandomProbePointSet::GoodProbePoints(size_t numPoints) const
+bool RandomProbePointSet::GoodProbePoints(size_t numPoints) const noexcept
{
for (size_t i = 0; i < numPoints; ++i)
{
@@ -215,7 +215,7 @@ bool RandomProbePointSet::GoodProbePoints(size_t numPoints) const
}
// Check that the probe points are in the right order
-bool RandomProbePointSet::GoodProbePointOrdering(size_t numPoints) const
+bool RandomProbePointSet::GoodProbePointOrdering(size_t numPoints) const noexcept
{
if (numPoints >= 2 && yBedProbePoints[1] <= yBedProbePoints[0])
{
@@ -251,7 +251,7 @@ bool RandomProbePointSet::GoodProbePointOrdering(size_t numPoints) const
}
// Print out the probe heights and any errors
-void RandomProbePointSet::ReportProbeHeights(size_t numPoints, const StringRef& reply) const
+void RandomProbePointSet::ReportProbeHeights(size_t numPoints, const StringRef& reply) const noexcept
{
reply.copy("G32 bed probe heights:");
float sum = 0.0;
@@ -291,7 +291,7 @@ void RandomProbePointSet::ReportProbeHeights(size_t numPoints, const StringRef&
*
* The values of x and y are transformed to put them in the interval [0, 1].
*/
-float RandomProbePointSet::SecondDegreeTransformZ(float x, float y) const
+float RandomProbePointSet::SecondDegreeTransformZ(float x, float y) const noexcept
{
x = (x - xBedProbePoints[0])*xRectangle;
y = (y - yBedProbePoints[0])*yRectangle;
@@ -309,7 +309,7 @@ float RandomProbePointSet::SecondDegreeTransformZ(float x, float y) const
* -----X---->
*
*/
-float RandomProbePointSet::TriangleZ(float x, float y) const
+float RandomProbePointSet::TriangleZ(float x, float y) const noexcept
{
for (size_t i = 0; i < 4; i++)
{
@@ -325,7 +325,7 @@ float RandomProbePointSet::TriangleZ(float x, float y) const
return 0.0;
}
-void RandomProbePointSet::BarycentricCoordinates(size_t p1, size_t p2, size_t p3, float x, float y, float& l1, float& l2, float& l3) const
+void RandomProbePointSet::BarycentricCoordinates(size_t p1, size_t p2, size_t p3, float x, float y, float& l1, float& l2, float& l3) const noexcept
{
const float y23 = baryYBedProbePoints[p2] - baryYBedProbePoints[p3];
const float x3 = x - baryXBedProbePoints[p3];
@@ -339,7 +339,7 @@ void RandomProbePointSet::BarycentricCoordinates(size_t p1, size_t p2, size_t p3
l3 = 1.0 - l1 - l2;
}
-void RandomProbePointSet::DebugPrint(size_t numPoints) const
+void RandomProbePointSet::DebugPrint(size_t numPoints) const noexcept
{
debugPrintf("Z probe offsets:");
float sum = 0.0;
diff --git a/src/Movement/BedProbing/RandomProbePointSet.h b/src/Movement/BedProbing/RandomProbePointSet.h
index 49360ff5..ab207046 100644
--- a/src/Movement/BedProbing/RandomProbePointSet.h
+++ b/src/Movement/BedProbing/RandomProbePointSet.h
@@ -14,47 +14,47 @@
class RandomProbePointSet INHERIT_OBJECT_MODEL
{
public:
- RandomProbePointSet();
+ RandomProbePointSet() noexcept;
- unsigned int GetNumBedCompensationPoints() const { return numBedCompensationPoints; }
+ unsigned int GetNumBedCompensationPoints() const noexcept { return numBedCompensationPoints; }
- float GetZHeight(size_t index) const
+ float GetZHeight(size_t index) const noexcept
pre(index < numPoints) { return zBedProbePoints[index]; }
- float GetXCoord(size_t index) const
+ float GetXCoord(size_t index) const noexcept
pre(index < numPoints) { return xBedProbePoints[index]; }
- float GetYCoord(size_t index) const
+ float GetYCoord(size_t index) const noexcept
pre(index < numPoints) { return yBedProbePoints[index]; }
- bool PointWasCorrected(size_t index) const
+ bool PointWasCorrected(size_t index) const noexcept
pre(index < numPoints) { return (probePointSet[index] & xyCorrected) != 0; }
- size_t NumberOfProbePoints() const; // Return the number of points probed
+ size_t NumberOfProbePoints() const noexcept; // Return the number of points probed
- void SetXYBedProbePoint(size_t index, float x, float y); // Record the X and Y coordinates of a probe point
- void SetZBedProbePoint(size_t index, float z, bool wasXyCorrected, bool wasError); // Record the Z coordinate of a probe point
+ void SetXYBedProbePoint(size_t index, float x, float y) noexcept; // Record the X and Y coordinates of a probe point
+ void SetZBedProbePoint(size_t index, float z, bool wasXyCorrected, bool wasError) noexcept; // Record the Z coordinate of a probe point
- void ClearProbeHeights(); // Clear out the Z heights so that we don't re-use old points
- bool SetProbedBedEquation(size_t numPoints, const StringRef& reply); // When we have a full set of probed points, work out the bed's equation
- void SetIdentity() { numBedCompensationPoints = 0; } // Set identity transform
+ void ClearProbeHeights() noexcept; // Clear out the Z heights so that we don't re-use old points
+ bool SetProbedBedEquation(size_t numPoints, const StringRef& reply) noexcept; // When we have a full set of probed points, work out the bed's equation
+ void SetIdentity() noexcept { numBedCompensationPoints = 0; } // Set identity transform
- float GetInterpolatedHeightError(float x, float y) const; // Compute the interpolated height error at the specified point
+ float GetInterpolatedHeightError(float x, float y) const noexcept; // Compute the interpolated height error at the specified point
- bool GoodProbePoints(size_t numPoints) const; // Check whether the specified set of points has been successfully defined and probed
- void ReportProbeHeights(size_t numPoints, const StringRef& reply) const; // Print out the probe heights and any errors
- void DebugPrint(size_t numPoints) const;
+ bool GoodProbePoints(size_t numPoints) const noexcept; // Check whether the specified set of points has been successfully defined and probed
+ void ReportProbeHeights(size_t numPoints, const StringRef& reply) const noexcept; // Print out the probe heights and any errors
+ void DebugPrint(size_t numPoints) const noexcept;
protected:
DECLARE_OBJECT_MODEL
private:
- bool GoodProbePointOrdering(size_t numPoints) const; // Check that the probe points are in the right order
- float SecondDegreeTransformZ(float x, float y) const; // Used for second degree bed equation
- float TriangleZ(float x, float y) const; // Interpolate onto a triangular grid
- void BarycentricCoordinates(size_t p0, size_t p1, // Compute the barycentric coordinates of a point in a triangle
- size_t p2, float x, float y, float& l1, // (see http://en.wikipedia.org/wiki/Barycentric_coordinate_system).
- float& l2, float& l3) const;
+ bool GoodProbePointOrdering(size_t numPoints) const noexcept; // Check that the probe points are in the right order
+ float SecondDegreeTransformZ(float x, float y) const noexcept; // Used for second degree bed equation
+ float TriangleZ(float x, float y) const noexcept; // Interpolate onto a triangular grid
+ void BarycentricCoordinates(size_t p0, size_t p1, // Compute the barycentric coordinates of a point in a triangle
+ size_t p2, float x, float y, float& l1, // (see http://en.wikipedia.org/wiki/Barycentric_coordinate_system).
+ float& l2, float& l3) const noexcept;
// Enumeration to record what has been set
enum PointCoordinateSet
@@ -66,7 +66,7 @@ private:
probeError = 8
};
- uint32_t numBedCompensationPoints; // The number of points we are actually using for bed compensation, 0 means identity bed transform
+ uint32_t numBedCompensationPoints; // The number of points we are actually using for bed compensation, 0 means identity bed transform
// Variables used to report what has been probed
float xBedProbePoints[MaxProbePoints]; // The X coordinates of the points on the bed at which to probe
diff --git a/src/Movement/HeightControl/HeightController.cpp b/src/Movement/HeightControl/HeightController.cpp
index 40e27d41..34126d9e 100644
--- a/src/Movement/HeightControl/HeightController.cpp
+++ b/src/Movement/HeightControl/HeightController.cpp
@@ -17,7 +17,7 @@
#include "Movement/Move.h"
#include <TaskPriorities.h>
-HeightController::HeightController()
+HeightController::HeightController() noexcept
: heightControllerTask(nullptr), sensorNumber(-1),
sampleInterval(DefaultSampleInterval), setPoint(1.0), pidP(1.0), configuredPidI(0.0), configuredPidD(0.0), iAccumulator(0.0),
zMin(5.0), zMax(10.0), state(PidState::stopped)
@@ -25,7 +25,7 @@ HeightController::HeightController()
CalcDerivedValues();
}
-extern "C" [[noreturn]] void HeightControllerTaskStart(void *p)
+extern "C" [[noreturn]] void HeightControllerTaskStart(void *p) noexcept
{
static_cast<HeightController*>(p)->RunTask();
}
@@ -89,7 +89,7 @@ GCodeResult HeightController::Configure(GCodeBuffer& gb, const StringRef& reply)
}
// Start/stop height following
-GCodeResult HeightController::StartHeightFollowing(GCodeBuffer& gb, const StringRef& reply)
+GCodeResult HeightController::StartHeightFollowing(GCodeBuffer& gb, const StringRef& reply) noexcept
{
if (gb.Seen('P'))
{
@@ -137,12 +137,12 @@ GCodeResult HeightController::StartHeightFollowing(GCodeBuffer& gb, const String
}
// Stop height following mode
-void HeightController::Stop()
+void HeightController::Stop() noexcept
{
state = PidState::stopped;
}
-[[noreturn]] void HeightController::RunTask()
+[[noreturn]] void HeightController::RunTask() noexcept
{
lastWakeTime = xTaskGetTickCount();
for (;;)
@@ -213,7 +213,7 @@ void HeightController::Stop()
}
}
-void HeightController::CalcDerivedValues()
+void HeightController::CalcDerivedValues() noexcept
{
actualPidI = configuredPidI * ((float)sampleInterval * MillisToSeconds);
actualPidD = configuredPidD * (SecondsToMillis/(float)sampleInterval);
diff --git a/src/Movement/HeightControl/HeightController.h b/src/Movement/HeightControl/HeightController.h
index bdfb99cb..9816c659 100644
--- a/src/Movement/HeightControl/HeightController.h
+++ b/src/Movement/HeightControl/HeightController.h
@@ -19,16 +19,16 @@
class HeightController
{
public:
- HeightController();
+ HeightController() noexcept;
- GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply);
- GCodeResult StartHeightFollowing(GCodeBuffer& gb, const StringRef& reply); // Start/stop height following
- void Stop(); // stop height following mode
+ GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply) THROWS_GCODE_EXCEPTION;
+ GCodeResult StartHeightFollowing(GCodeBuffer& gb, const StringRef& reply) noexcept; // Start/stop height following
+ void Stop() noexcept; // stop height following mode
- [[noreturn]] void RunTask();
+ [[noreturn]] void RunTask() noexcept;
private:
- void CalcDerivedValues();
+ void CalcDerivedValues() noexcept;
static constexpr unsigned int HeightControllerTaskStackWords = 100;
static constexpr uint32_t DefaultSampleInterval = 200;
diff --git a/src/Movement/RawMove.cpp b/src/Movement/RawMove.cpp
index e4232172..fbee84e1 100644
--- a/src/Movement/RawMove.cpp
+++ b/src/Movement/RawMove.cpp
@@ -8,7 +8,7 @@
#include "RawMove.h"
// Set up some default values in the move buffer for special moves, e.g. for Z probing and firmware retraction
-void RawMove::SetDefaults(size_t firstDriveToZero)
+void RawMove::SetDefaults(size_t firstDriveToZero) noexcept
{
moveType = 0;
isCoordinated = false;
@@ -27,7 +27,7 @@ void RawMove::SetDefaults(size_t firstDriveToZero)
#if SUPPORT_ASYNC_MOVES
-void AsyncMove::SetDefaults()
+void AsyncMove::SetDefaults() noexcept
{
for (float& f : movements)
{
diff --git a/src/Movement/RawMove.h b/src/Movement/RawMove.h
index 1002a897..fe551c5c 100644
--- a/src/Movement/RawMove.h
+++ b/src/Movement/RawMove.h
@@ -34,7 +34,7 @@ struct RawMove
checkEndstops : 1, // true if any endstops or the Z probe can terminate the move
reduceAcceleration : 1; // true if Z probing so we should limit the Z acceleration
- void SetDefaults(size_t firstDriveToZero); // set up default values
+ void SetDefaults(size_t firstDriveToZero) noexcept; // set up default values
};
#if SUPPORT_ASYNC_MOVES
@@ -45,7 +45,7 @@ struct AsyncMove
float startSpeed, endSpeed, requestedSpeed;
float acceleration, deceleration;
- void SetDefaults();
+ void SetDefaults() noexcept;
};
#endif
diff --git a/src/ObjectModel/ObjectModel.h b/src/ObjectModel/ObjectModel.h
index eac396fc..3d73d7d9 100644
--- a/src/ObjectModel/ObjectModel.h
+++ b/src/ObjectModel/ObjectModel.h
@@ -201,7 +201,7 @@ protected:
};
// Function used for compile-time check for the correct number of entries in an object model table
-static inline constexpr size_t ArraySum(const uint8_t *arr, size_t numEntries)
+static inline constexpr size_t ArraySum(const uint8_t *arr, size_t numEntries) noexcept
{
return (numEntries == 0) ? 0 : arr[0] + ArraySum(arr + 1, numEntries - 1);
}
@@ -236,19 +236,19 @@ public:
int IdCompare(const char *id) const noexcept;
// Return true if a section of the OMT is ordered
- static inline constexpr bool IsOrdered(const ObjectModelTableEntry *omt, size_t len)
+ static inline constexpr bool IsOrdered(const ObjectModelTableEntry *omt, size_t len) noexcept
{
return len <= 1 || (strcmp(omt[1].name, omt[0].name) == 1 && IsOrdered(omt + 1, len - 1));
}
// Return true if a section of the OMT specified by the descriptor is ordered
- static inline constexpr bool IsOrdered(uint8_t sectionsLeft, const uint8_t *descriptorSection, const ObjectModelTableEntry *omt)
+ static inline constexpr bool IsOrdered(uint8_t sectionsLeft, const uint8_t *descriptorSection, const ObjectModelTableEntry *omt) noexcept
{
return sectionsLeft == 0 || (IsOrdered(omt, *descriptorSection) && IsOrdered(sectionsLeft - 1, descriptorSection + 1, omt + *descriptorSection));
}
// Return true if the whole OMT is ordered
- static inline constexpr bool IsOrdered(const uint8_t *descriptor, const ObjectModelTableEntry *omt)
+ static inline constexpr bool IsOrdered(const uint8_t *descriptor, const ObjectModelTableEntry *omt) noexcept
{
return IsOrdered(descriptor[0], descriptor + 1, omt);
}