Skip to content

Commit 309196b

Browse files
committed
#175 #174 fix compile issue and ensure navigation works as expected.
1 parent c79a878 commit 309196b

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"authors": "DaveTCC"
2727
}
2828
],
29-
"version": "3.0.0",
29+
"version": "3.0.1",
3030
"license": "Apache-2.0",
3131
"frameworks": "arduino, mbed",
3232
"platforms": "*"

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55

66
name=tcMenu
7-
version=3.0.0
7+
version=3.0.1
88
maintainer=www.thecoderscorner.com
99
author=davetcc
1010
category=Other

src/extras/DrawableDashboard.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ color_t DashMenuItem::staticPalette[4] = {};
152152

153153
DashMenuItem::DashMenuItem(MenuItem *theItem, Coord topLeft, DashDrawParameters* params, int numCharsInValue,
154154
const char* titleOverride, int countDownTicks) : item(theItem), screenLoc(topLeft),
155-
parameters(params), updateCountDown(countDownTicks), numChars(numCharsInValue),
156-
valueWidth(0), titleExtents(0, 0), countDownTicks(countDownTicks) {
155+
parameters(params), updateCountDown(countDownTicks), titleExtents(0, 0),
156+
numChars(numCharsInValue), valueWidth(0), countDownTicks(countDownTicks), baseline(0),
157+
titleText{} {
157158

158159
if(titleOverride != nullptr) {
159160
strncpy(titleText, titleOverride, sizeof(titleText));
@@ -173,7 +174,7 @@ bool DashMenuItem::needsPainting() {
173174
return item->isChanged() || updateCountDown != 0;
174175
}
175176

176-
void DashMenuItem::setFont(DashDrawParameters* params, UnicodeFontHandler* unicodeHandler) {
177+
void DashMenuItem::setFont(UnicodeFontHandler* unicodeHandler) {
177178
if(parameters->isAdafruitFont()) {
178179
unicodeHandler->setFont(parameters->getAsAdaFont());
179180
} else {
@@ -183,7 +184,7 @@ void DashMenuItem::setFont(DashDrawParameters* params, UnicodeFontHandler* unico
183184

184185
void DashMenuItem::paintTitle(DeviceDrawable* drawableRoot) {
185186
UnicodeFontHandler* unicodeHandler = drawableRoot->getUnicodeHandler(true);
186-
setFont(parameters, unicodeHandler);
187+
setFont(unicodeHandler);
187188
titleExtents = unicodeHandler->textExtents(titleText, &baseline);
188189
valueWidth = unicodeHandler->textExtents("0", &baseline).x * numChars;
189190
valueWidth = int(valueWidth * 1.20);
@@ -199,7 +200,7 @@ void DashMenuItem::paintTitle(DeviceDrawable* drawableRoot) {
199200

200201
unicodeHandler->setDrawColor(wrapper.fgColUnderlying());
201202
unicodeHandler->setCursor(wrapper.offsetLocation(screenLoc, startX, titleExtents.y - baseline));
202-
setFont(parameters, unicodeHandler);
203+
setFont(unicodeHandler);
203204
unicodeHandler->print(titleText);
204205

205206
wrapper.endDraw();
@@ -216,10 +217,9 @@ void DashMenuItem::paintItem(DeviceDrawable* drawableRoot) {
216217

217218
UnicodeFontHandler* unicodeHandler = wrapper.getDrawable()->getUnicodeHandler(true);
218219
unicodeHandler->setDrawColor(wrapper.fgColUnderlying());
219-
setFont(parameters, unicodeHandler);
220+
setFont(unicodeHandler);
220221
auto padding = 0;
221222
if(!parameters->isValueLeftAlign()) {
222-
int baseline;
223223
Coord valueLen = unicodeHandler->textExtents(sz, &baseline);
224224
padding = valueWidth - (valueLen.x + 4);
225225
}

src/extras/DrawableDashboard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class DashMenuItem {
221221
char titleText[20];
222222
public:
223223
DashMenuItem() : item(nullptr), screenLoc(0, 0), parameters(nullptr), updateCountDown(0), titleExtents(0, 0),
224-
numChars(0), valueWidth(0), countDownTicks(0), titleText() {}
224+
numChars(0), valueWidth(0), countDownTicks(0), baseline(0), titleText() {}
225225
DashMenuItem(MenuItem *theItem, Coord topLeft, DashDrawParameters* params, int numCharsInValue, const char* titleOverride, int countDownTicks);
226226
DashMenuItem(const DashMenuItem &other) = default;
227227
DashMenuItem& operator= (const DashMenuItem& other) = default;
@@ -231,7 +231,7 @@ class DashMenuItem {
231231
}
232232

233233
bool needsPainting();
234-
void setFont(DashDrawParameters* params, UnicodeFontHandler* unicodeHandler);
234+
void setFont(UnicodeFontHandler* unicodeHandler);
235235
void paintTitle(DeviceDrawable* canvasDrawable);
236236
void paintItem(DeviceDrawable* canvasDrawable);
237237
};

src/tcMenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void MenuManager::actionOnSubMenu(MenuItem* nextSub) {
155155
navigateToMenu(popup->getRootItem(), popup->getItemToActivate(), true);
156156
}
157157
else {
158-
navigateToMenu(subMenu->getChild());
158+
navigateToMenu(subMenu->getChild(), findCurrentActive());
159159
}
160160
}
161161

src/tcMenuVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace tccore {
1818
// here we define the version as both a string and separate field
1919
#define TCMENU_MAJOR 3
2020
#define TCMENU_MINOR 0
21-
#define TCMENU_PATCH 0
21+
#define TCMENU_PATCH 1
2222

2323
/**
2424
* A helper to generate the major minor version numbers used in the protocol

0 commit comments

Comments
 (0)