Skip to content

Commit 0506d1b

Browse files
author
dave
committed
Prepare for 3.0 docs and small fix
1 parent 7493597 commit 0506d1b

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

src/extras/DrawableDashboard.h

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@
1212
#include <graphics/GraphicsDeviceRenderer.h>
1313

1414
/**
15-
* Draw parameters for static items that do not change, the alignment of text, the font and colors are stored in this
15+
* Base class for draw parameters, used for static items that do not change.
16+
* This class stores the alignment of text, the font and colors are stored in this
1617
* item. Fonts can be either Adafruit or TcUnicode.
1718
*/
1819
class DashDrawParameters {
1920
public:
21+
/**
22+
* Controls the alignment of an item in the dashboard. Options are fairly self-explanatory.
23+
*/
2024
enum DashAlign {
2125
TITLE_LEFT_VALUE_LEFT, TITLE_LEFT_VALUE_RIGHT,
2226
NO_TITLE_VALUE_LEFT, NO_TITLE_VALUE_RIGHT,
@@ -32,20 +36,70 @@ class DashDrawParameters {
3236
color_t bgColor;
3337
bool isAdaFont = true;
3438
public:
39+
/**
40+
* @brief Creates a dash parameter that has a background, foreground, font, and alignment. In this case the font is an
41+
* Adafruit graphics font.
42+
* @param fgColor_ the foreground color
43+
* @param bgColor_ the background color
44+
* @param font_ the font to draw with
45+
* @param align the alignment
46+
*/
3547
DashDrawParameters(color_t fgColor_, color_t bgColor_, const GFXfont* font_, DashAlign align = TITLE_RIGHT_VALUE_RIGHT);
48+
/**
49+
* @brief Creates a dash parameter that has a background, foreground, font, and alignment. In this case the font is a
50+
* tcUnicode font.
51+
* @param fgColor_ the foreground color
52+
* @param bgColor_ the background color
53+
* @param font_ the font to draw with
54+
* @param align the alignment
55+
*/
3656
DashDrawParameters(color_t fgColor_, color_t bgColor_, const UnicodeFont* font_, DashAlign align = TITLE_RIGHT_VALUE_RIGHT);
3757

58+
/**
59+
* @return true if the title is drawn, otherwise it returns false
60+
*/
3861
bool isTitleDrawn() { return alignment != NO_TITLE_VALUE_LEFT && alignment != NO_TITLE_VALUE_RIGHT; }
62+
/**
63+
* @return true if the title is aligned to the left of the value
64+
*/
3965
bool isTitleLeftAlign() { return alignment == TITLE_LEFT_VALUE_LEFT || alignment == TITLE_LEFT_VALUE_RIGHT; }
66+
/**
67+
* @return true if the title is aligned to the right of the value
68+
*/
4069
bool isValueLeftAlign() { return alignment == TITLE_RIGHT_VALUE_LEFT || alignment == TITLE_LEFT_VALUE_LEFT || alignment == NO_TITLE_VALUE_LEFT; }
41-
70+
71+
/**
72+
* @return true if the font is adafruit, otherwise false if the font is tcUnicode
73+
*/
4274
bool isAdafruitFont() const { return isAdaFont; }
75+
/**
76+
* @return the font as an Adafruit font, only call when isAdafruitFont returns true
77+
*/
4378
const GFXfont* getAsAdaFont() const { return adaFont; }
79+
/**
80+
* @return the font as a tcUnicode font, only call when isAdafruitFont returns false
81+
*/
4482
const UnicodeFont* getAsUnicodeFont() const { return uniFont; }
4583

84+
/**
85+
* the background color method is overloaded, each implementation has a different way of handling it.
86+
* @return the background color, in this class it is fixed
87+
*/
4688
virtual color_t getBgColor(MenuItem *item, bool updated) { return bgColor; }
89+
/**
90+
* the foreground color method is overloaded, each implementation has a different way of handling it.
91+
* @return the background color, in this class it is fixed
92+
*/
4793
virtual color_t getFgColor(MenuItem *item, bool updated) { return fgColor; }
94+
/**
95+
* the background title color method is overloaded, each implementation has a different way of handling it.
96+
* @return the background color for the title, in this class it is fixed
97+
*/
4898
virtual color_t getTitleBgColor(MenuItem *item, bool updated) { return bgColor; }
99+
/**
100+
* the foreground title color method is overloaded, each implementation has a different way of handling it.
101+
* @return the foreground color for the title, in this class it is fixed
102+
*/
49103
virtual color_t getTitleFgColor(MenuItem *item, bool updated) { return fgColor; }
50104
};
51105

src/tcMenu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ void MenuManager::setupForEditing(MenuItem* item) {
315315
auto* editableItem = reinterpret_cast<EditableMultiPartMenuItem*>(item);
316316
editableItem->beginMultiEdit();
317317
int range = editableItem->nextPart();
318-
switches.changeEncoderPrecision(0, range, editableItem->getPartValueAsInt(), editableItem->getId(), 1);
318+
switches.changeEncoderPrecision(0, range, editableItem->getPartValueAsInt(),
319+
isWrapAroundEncoder(editableItem), 1);
319320
switches.getEncoder()->setUserIntention(CHANGE_VALUE);
320321
}
321322
}

0 commit comments

Comments
 (0)