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>2022-02-16 23:34:07 +0300
committerDavid Crocker <dcrocker@eschertech.com>2022-02-16 23:34:07 +0300
commit9eaf29caa032334bcc7d602a00d5062554cc9183 (patch)
tree7c4fdc6318c0ab2f1760b76eac78764c07b87348 /src/ObjectModel
parentec5722b5e1045ae54b1fa496b3f81290805d46b9 (diff)
Corrected adjustment to number of decimal places when printing floats
Diffstat (limited to 'src/ObjectModel')
-rw-r--r--src/ObjectModel/ObjectModel.cpp14
-rw-r--r--src/ObjectModel/ObjectModel.h4
2 files changed, 2 insertions, 16 deletions
diff --git a/src/ObjectModel/ObjectModel.cpp b/src/ObjectModel/ObjectModel.cpp
index b8e2c9ea..714f4470 100644
--- a/src/ObjectModel/ObjectModel.cpp
+++ b/src/ObjectModel/ObjectModel.cpp
@@ -193,20 +193,6 @@ void ExpressionValue::Release() noexcept
}
}
-// Get the format string to use assuming this is a floating point number
-const char *_ecv_array ExpressionValue::GetFloatFormatString() const noexcept
-{
- float f = 1.0;
- unsigned int digitsAfterPoint = param;
- while (digitsAfterPoint > 1 && fVal > f)
- {
- f *= 10.0;
- --digitsAfterPoint;
- }
-
- return ::GetFloatFormatString(digitsAfterPoint);
-}
-
#if SUPPORT_CAN_EXPANSION
// Given that this is a CanExpansionBoardDetails value, extract the part requested according to the parameter and append it to the string
diff --git a/src/ObjectModel/ObjectModel.h b/src/ObjectModel/ObjectModel.h
index bcf77791..5a9227f2 100644
--- a/src/ObjectModel/ObjectModel.h
+++ b/src/ObjectModel/ObjectModel.h
@@ -71,7 +71,7 @@ class UniqueId;
// Encapsulated time_t, used to facilitate overloading the ExpressionValue constructor
struct DateTime
{
- explicit DateTime(time_t t) : tim(t) { }
+ explicit DateTime(time_t t) noexcept : tim(t) { }
time_t tim;
};
@@ -192,7 +192,7 @@ struct ExpressionValue
#endif
// Get the format string to use assuming this is a floating point number
- const char *_ecv_array GetFloatFormatString() const noexcept;
+ const char *_ecv_array GetFloatFormatString() const noexcept { return ::GetFloatFormatString(fVal, param); }
// Append a string representation of this value to a string
void AppendAsString(const StringRef& str) const noexcept;