6#ifndef NUMERICINDICATOR_H_
7#define NUMERICINDICATOR_H_
11#define DEFAULT_NUMERIC_INDICATOR_STRING_LENGTH 15
70 virtual void Draw(
bool redraw)
override;
#define DEFAULT_NUMERIC_INDICATOR_STRING_LENGTH
Default max string length for a numeric indicator.
Definition NumericIndicator.h:11
Containing the abstract base class for all user interface elements (controls, indicators,...
uint8_t numNonFractionalDigits(T number)
Calculate the number of non-fractional digits of the given number.
Definition NumericIndicator.cpp:56
virtual void RecalculateDimensions() override
Recalculate the Height and Width of the UIElement.
Definition NumericIndicator.cpp:124
T _maxValue
Maximum value that can be shown by this numeric indicator.
Definition NumericIndicator.h:37
char * _stringDrawBuffer
Buffer holding the string that is drawn to the screen.
Definition NumericIndicator.h:31
uint8_t _numFractionalDigits
Number of fractional digits that are shown by this indicator.
Definition NumericIndicator.h:38
~NumericIndicator()
Destructor of the NumericIndicator.
Definition NumericIndicator.h:61
const char * _baseUnit
Base unit that is appended to the calculated prefix.
Definition NumericIndicator.h:34
uint8_t _numDigits
Number of digits calculated from the maxValue (_numFractionalDigits + numNonFractionalDigits).
Definition NumericIndicator.h:39
virtual void Draw(bool redraw) override
Method used for drawing of the NumericIndicator.
Definition NumericIndicator.cpp:81
NumericIndicator(T *valuePointer, const char *baseUnit, T maxValue, unsigned char numFractionalDigits, uint16_t locX=0, uint16_t locY=0, uint8_t maxStringBufferLength=DEFAULT_NUMERIC_INDICATOR_STRING_LENGTH)
Constructor of the NumericIndicator.
Definition NumericIndicator.cpp:69
void calculateDisplayValue(float value)
Calculate the _displayValue and the _unitPrefix from the given value.
Definition NumericIndicator.cpp:14
float _displayValue
Value that is displayed by Draw().
Definition NumericIndicator.h:41
T * _valuePointer
Pointer to the numeric variable that is shown by this indicator.
Definition NumericIndicator.h:35
const char * _unitPrefix
Current display prefix character ("m", "k", "M")
Definition NumericIndicator.h:30
int8_t _unitPrefixPower
Current display prefix power (m = -3, k = 3, M = 6)
Definition NumericIndicator.h:42
T _lastValueDraw
Last drawn numeric value.
Definition NumericIndicator.h:36
UIElement(UIElementType type)
Constructor of the UIElement.
Definition UIElement.h:43