Skip to content

Commit f2d5f10

Browse files
committed
#95 palette based images on TFT_eSPI
1 parent b8343a8 commit f2d5f10

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

examples/esp/esp32Amplifier/esp32Amplifier.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ void setup() {
4848
Serial.begin(115200);
4949
EEPROM.begin(512);
5050

51+
//serEnableLevel(SER_TCMENU_DEBUG, true);
52+
5153
renderer.setFirstWidget(&wifiWidget);
5254

5355
setupMenu();

src/graphics/MenuTouchScreenEncoder.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,18 @@ void MenuTouchScreenManager::sendEvent(float locationX, float locationY, float t
5858
}
5959

6060
void MenuTouchScreenEncoder::touched(const TouchNotification &evt) {
61-
serlogF4(SER_TCMENU_DEBUG, "Touch at (x,y,mode)", evt.getCursorPosition().x, evt.getCursorPosition().y, evt.isWithinItem())
6261
if(evt.isWithinItem()) {
6362
MenuItem *theItem = evt.getEntry()->getMenuItem();
63+
serlogF4(SER_TCMENU_DEBUG, "Item Touched (x,y,item)", evt.getCursorPosition().x, evt.getCursorPosition().y, theItem->getId());
64+
6465
if(menuMgr.getCurrentEditor() && theItem != menuMgr.getCurrentEditor()) {
6566
// stop editing, selected outside of item
6667
menuMgr.stopEditingCurrentItem(false);
6768
}
6869
else {
6970
bool wasActive = renderer->getActiveItem() == theItem;
7071
if(!wasActive) {
72+
serlogF(SER_TCMENU_DEBUG, "Activating item");
7173
// if it's not active try and activate, if it fails we can't continue.
7274
uint8_t itemIdx = renderer->setActiveItem(theItem);
7375
if(switches.getEncoder()) {
@@ -92,9 +94,11 @@ void MenuTouchScreenEncoder::touched(const TouchNotification &evt) {
9294
}
9395
}
9496
else if(isTouchActionable(theItem) && !held) {
97+
serlogF(SER_TCMENU_DEBUG, "Touch Act");
9598
menuMgr.onMenuSelect(false);
9699
}
97100
else if(isMenuRuntimeMultiEdit(theItem) && !theItem->isReadOnly()) {
101+
serlogF(SER_TCMENU_DEBUG, "TMPart");
98102
auto* dlg = renderer->getDialog();
99103
if(dlg && !dlg->isInUse()) {
100104
auto* menuDlg = reinterpret_cast<MenuBasedDialog*>(dlg);
@@ -105,6 +109,7 @@ void MenuTouchScreenEncoder::touched(const TouchNotification &evt) {
105109
else if(!theItem->isReadOnly()){
106110
GridPosition::GridDrawingMode drawingMode = evt.getEntry()->getPosition().getDrawingMode();
107111
if(drawingMode == GridPosition::DRAW_INTEGER_AS_UP_DOWN && wasActive) {
112+
serlogF(SER_TCMENU_DEBUG, "TUpDown");
108113
if(menuMgr.getCurrentEditor() != theItem) menuMgr.onMenuSelect(false);
109114
int increment = 0;
110115
auto xPos = evt.getCursorPosition().x;
@@ -127,21 +132,27 @@ void MenuTouchScreenEncoder::touched(const TouchNotification &evt) {
127132
}
128133
}
129134
else if(drawingMode == GridPosition::DRAW_INTEGER_AS_SCROLL && wasActive) {
135+
serlogF(SER_TCMENU_DEBUG, "TScroll");
130136
if(menuMgr.getCurrentEditor() != theItem) menuMgr.onMenuSelect(false);
131137
auto* analog = reinterpret_cast<AnalogMenuItem*>(theItem);
132138
float correction = float(analog->getMaximumValue()) / float(evt.getItemSize().x);
133139
float percentage = evt.getCursorPosition().x * correction;
134140
analog->setCurrentValue(percentage);
135141
}
142+
else {
143+
serlogF(SER_TCMENU_DEBUG, "Touch Ignored");
144+
}
136145
}
137146
}
138147
}
139148
else if(menuMgr.getCurrentEditor()) {
140149
// touched outside of the item, stop editing.
141150
menuMgr.stopEditingCurrentItem(false);
151+
serlogF(SER_TCMENU_DEBUG, "TEndEdit");
142152
}
143153
else {
144154
// deal with click completely outside of item area
155+
serlogF3(SER_TCMENU_DEBUG, "TOut (x,y)", evt.getCursorPosition().x, evt.getCursorPosition().y);
145156
}
146157
}
147158

src/tcMenu.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ void MenuManager::stopEditingCurrentItem(bool doMultiPartNext) {
276276
// unless we've run out of parts to edit, stay in edit mode, moving to next part.
277277
int editorRange = editableItem->nextPart();
278278
if (editorRange != 0) {
279+
serlogF2(SER_TCMENU_DEBUG, "Next Part", editableItem->getId());
279280
switches.changeEncoderPrecision(0, editorRange, editableItem->getPartValueAsInt(),
280281
isWrapAroundEncoder(editableItem), 1);
281282
return;

0 commit comments

Comments
 (0)