summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--megalogger/megalogger.ino3
-rw-r--r--megalogger/touch.h27
2 files changed, 5 insertions, 25 deletions
diff --git a/megalogger/megalogger.ino b/megalogger/megalogger.ino
index 34da1ab..8626dd0 100644
--- a/megalogger/megalogger.ino
+++ b/megalogger/megalogger.ino
@@ -628,7 +628,7 @@ void showECUCap()
bool scanned = false;
for (;;) {
bool touched = false;
- for (byte i = 0, n = 4; i < sizeof(pidlist) / sizeof(pidlist[0]) && !(touched = touch.available()); i++) {
+ for (byte i = 0, n = 4; i < sizeof(pidlist) / sizeof(pidlist[0]) && !touched; i++) {
byte pid = pgm_read_byte(pidlist + i);
if (obd.isValidPID(pid)) {
int value;
@@ -648,6 +648,7 @@ void showECUCap()
lcd.print("N/A");
}
}
+ touched = touch.available();
}
if (touched) break;
scanned = true;
diff --git a/megalogger/touch.h b/megalogger/touch.h
index 93ba740..d0e6d01 100644
--- a/megalogger/touch.h
+++ b/megalogger/touch.h
@@ -72,7 +72,7 @@ public:
return(data);
}
- void read()
+ void read(int& x, int& y)
{
unsigned long tx=0;
unsigned long ty=0;
@@ -93,35 +93,14 @@ public:
}
digitalWrite(T_CS,HIGH);
-
- TP_X=tx/PREC_TOUCH_CONST;
- TP_Y=ty/PREC_TOUCH_CONST;
+ x = (tx / PREC_TOUCH_CONST - PixOffsX) / PixSizeX;
+ y = (ty / PREC_TOUCH_CONST - PixOffsX) / PixSizeX;
}
bool available()
{
return digitalRead(T_IRQ) == 0;
}
-
- int getX()
- {
- int value;
- value = ((TP_X-PixOffsX)/PixSizeX);
- if (value < 0)
- value = 0;
- return value;
- }
-
- int getY()
- {
- int value;
- value = ((TP_Y-PixOffsY)/PixSizeY);
- if (value < 0)
- value = 0;
- return value;
- }
-private:
- int TP_X,TP_Y;
};
CTouch touch;