Skip to content

Commit 52a5d76

Browse files
author
dave
committed
prepare for release, fixes to touch screen
1 parent 553f851 commit 52a5d76

File tree

6 files changed

+15
-36
lines changed

6 files changed

+15
-36
lines changed

examples/arduino32/stm32DuinoDemo/generated/stm32DuinoDemo_menu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void setupMenu() {
120120
switches.init(internalDigitalIo(), SWITCHES_POLL_EVERYTHING, true);
121121
menuMgr.initForEncoder(&renderer, &menu33, PC8, PC10, PC9);
122122
remoteServer.addConnection(&ethernetConnection);
123-
renderer.setTitleMode(BaseGraphicalRenderer::TITLE_ALWAYS);
123+
renderer.setTitleMode(BaseGraphicalRenderer::NO_TITLE);
124124
renderer.setUseSliderForAnalog(false);
125125
installMonoInverseTitleTheme(renderer, MenuFontDef(nullptr, 1), MenuFontDef(u8g2_font_prospero_bold_nbp_tr, 1), true);
126126

examples/arduino32/stm32DuinoDemo/stm32DuinoDemo.emf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@
662662
},
663663
{
664664
"name": "TITLE_SHOW_MODE",
665-
"latestValue": "TITLE_ALWAYS",
665+
"latestValue": "NO_TITLE",
666666
"subsystem": "THEME"
667667
},
668668
{

src/extras/DrawableTouchCalibrator.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,24 @@ void IoaTouchScreenCalibrator::renderLoop(unsigned int currentValue, RenderPress
5757
strcat(sz, ", z: ");
5858
fastltoa(sz, touchState, 1, NOT_PADDED, sizeof sz);
5959
drawable->setDrawColor(TOUCH_BLACK);
60-
drawable->drawBox(Coord(0, 140), Coord(dims.x, 50), true);
60+
drawable->drawBox(Coord(0, 140), Coord(dims.x, 70), true);
6161
drawable->setColors(TOUCH_YELLOW, TOUCH_BLACK);
6262
drawable->drawText(Coord(0, 140), itemConfig->getFont(), 0, sz);
6363

64+
drawable->setDrawColor(TOUCH_BLACK);
65+
drawable->setColors(TOUCH_YELLOW, TOUCH_BLACK);
66+
6467
strcpy(sz, "sx:");
6568
fastftoa(sz, calibrationHandler.getMinX(), 3, sizeof sz);
6669
strcat(sz, ", ex:");
6770
fastftoa(sz, calibrationHandler.getMaxX(), 3, sizeof sz);
68-
strcat(sz, ", sy:");
71+
drawable->drawText(Coord(0, 160), itemConfig->getFont(), 0, sz);
72+
73+
strcpy(sz, ", sy:");
6974
fastftoa(sz, calibrationHandler.getMinY(), 3, sizeof sz);
7075
strcat(sz, ", ey:");
7176
fastftoa(sz, calibrationHandler.getMaxY(), 3, sizeof sz);
72-
drawable->setDrawColor(TOUCH_BLACK);
73-
drawable->setColors(TOUCH_YELLOW, TOUCH_BLACK);
74-
drawable->drawText(Coord(0, 160), itemConfig->getFont(), 0, sz);
77+
drawable->drawText(Coord(0, 180), itemConfig->getFont(), 0, sz);
7578
#endif
7679

7780
int buttonSize = 75;
@@ -105,9 +108,7 @@ void IoaTouchScreenCalibrator::renderLoop(unsigned int currentValue, RenderPress
105108
} else if(oldX > rightCorner) {
106109
calibrationHandler.setXPosition(lastX, !orientation.isXInverted());
107110
calibrationHandler.setYPosition(lastY, orientation.isYInverted());
108-
109111
}
110-
111112
} else if(oldY > (dims.y - buttonSize)) {
112113
// bottom
113114
if(oldX < buttonSize) {
@@ -116,7 +117,7 @@ void IoaTouchScreenCalibrator::renderLoop(unsigned int currentValue, RenderPress
116117
giveItBack();
117118
}
118119
else if(oldX > rightCorner) {
119-
calibrationHandler.setYPosition(lastY, orientation.isYInverted());
120+
calibrationHandler.setYPosition(lastY, !orientation.isYInverted());
120121
}
121122
}
122123

src/graphics/MenuTouchScreenEncoder.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ void MenuTouchScreenEncoder::touched(const TouchNotification &evt) {
6969
bool wasActive = renderer->getActiveItem() == theItem;
7070
if(!wasActive) {
7171
// if it's not active try and activate, if it fails we can't continue.
72-
if (!menuMgr.activateMenuItem(theItem)) return;
72+
uint8_t itemIdx = renderer->setActiveItem(theItem);
73+
if(switches.getEncoder()) {
74+
switches.getEncoder()->setCurrentReading(itemIdx);
75+
}
7376
}
7477

7578
auto menuType = theItem->getMenuType();

src/tcMenu.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -302,23 +302,6 @@ MenuItem* MenuManager::getParentAndReset() {
302302
return pItem;
303303
}
304304

305-
bool MenuManager::activateMenuItem(MenuItem *item) {
306-
if(renderer->getRendererType() == RENDER_TYPE_NOLOCAL) return false;
307-
auto* r = reinterpret_cast<BaseMenuRenderer*>(renderer);
308-
uint8_t count = r->itemCount(getCurrentMenu(), false);
309-
for(int i=0; i < count; i++) {
310-
auto* pItem = r->getMenuItemAtIndex(getCurrentMenu(), i);
311-
if(pItem != nullptr && pItem->getId() == item->getId()) {
312-
if(switches.getEncoder()) {
313-
switches.getEncoder()->setCurrentReading(i);
314-
}
315-
valueChanged(i);
316-
return true;
317-
}
318-
}
319-
return false;
320-
}
321-
322305
void MenuManager::setupForEditing(MenuItem* item) {
323306
// if the item is NULL, or it's read only, then it can't be edited.
324307
if (item == nullptr || item->isReadOnly()) return;

src/tcMenu.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,6 @@ class MenuManager {
358358
*/
359359
MenuItem* findCurrentActive();
360360

361-
/**
362-
* Activates the menu item provided if it is within the current menu, this actually does
363-
* more than set active, it does the equivalent of an encoder button press.
364-
* @param item the item to activate
365-
* @return if the item was activated
366-
*/
367-
bool activateMenuItem(MenuItem* item);
368-
369361
/**
370362
* Get the root of all menus, the first menu item basically
371363
*/

0 commit comments

Comments
 (0)