ItemFloatRange
-
class ItemFloatRange : public ItemRangeBase<float>
- #include <ItemFloatRange.h>
Item that allows user to input float information within a range. The value can be incremented or decremented by a specified step.
Public Functions
Public Static Functions
-
static inline uint8_t calculateWidth(float currentValue, uint8_t decimalPlaces)
Calculates the width of a floating-point number when displayed with a specified number of decimal places.
This function computes the width of the string representation of a floating-point number, including the decimal point and the specified number of decimal places.
- Parameters:
currentValue – The floating-point number whose width is to be calculated.
decimalPlaces – The number of decimal places to include in the width calculation.
- Returns:
The width of the floating-point number when displayed as a string.
-
static inline uint8_t calculateDecimalPlaces(float step)
Calculates the number of decimal places in a given floating-point step value.
This function converts the floating-point step value to a string representation, then determines the number of decimal places by counting the digits after the decimal point. Trailing zeros are not counted as decimal places.
- Parameters:
step – The floating-point step value to analyze.
- Returns:
The number of decimal places in the step value.
-
static inline uint8_t calculateWidth(float currentValue, uint8_t decimalPlaces)