60 while (fabs(number) >= 1)
99 char formatStringBuffer[15];
103 uint16_t minus_width;
104 UiManager.Gfx->getTextBounds(
"-", 0, 0,
nullptr,
nullptr, &minus_width,
nullptr);
132 char formatStringBuffer[15];
136 uint16_t minus_width;
137 UiManager.Gfx->getTextBounds(
"-", 0, 0,
nullptr,
nullptr, &minus_width,
nullptr);
139 uint16_t string_width;
Containing a class for a numeric indicator that is only showing a numeric variable value.
Containing a class that is used to handle the drawing and key handling of all UI_Elements.
UI_Manager UiManager
Access object for the singleton instance of the UI_Manager.
Definition UI_Manager.cpp:7
@ UI_INDICATOR
Indicator elements are only used to show information to the user.
Definition UIElementType.h:15
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
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
bool _lastDrawnVisible
The Visible value that was last drawn.
Definition UIElement.h:26
UIElementType Type
Element type (control, indicator, container)
Definition UIElement.h:29
uint16_t Height
Drawing height of the UIElement.
Definition UIElement.h:33
uint16_t LocY
Y Location of the upper left corner of the UIElement.
Definition UIElement.h:31
bool Visible
The UIElement is only drawn if the visibility is set to true.
Definition UIElement.h:34
uint16_t Width
Drawing width of the UIElement.
Definition UIElement.h:32
UIElement(UIElementType type)
Constructor of the UIElement.
Definition UIElement.h:43
uint16_t LocX
X Location of the upper left corner of the UIElement.
Definition UIElement.h:30