summaryrefslogtreecommitdiff
path: root/megalogger
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2015-12-15 10:29:16 +1100
committerStanley Huang <stanleyhuangyc@gmail.com>2015-12-15 10:29:16 +1100
commita246fb7e13d7e649c868bcf709faeeae9b0862a4 (patch)
tree77e957ee4bf6561cef12a38a801feb149c60f2f5 /megalogger
parent426a76486a99d53ff779cdb3c416ebe283d14eec (diff)
download2021-arduino-obd-a246fb7e13d7e649c868bcf709faeeae9b0862a4.tar.gz
2021-arduino-obd-a246fb7e13d7e649c868bcf709faeeae9b0862a4.tar.bz2
2021-arduino-obd-a246fb7e13d7e649c868bcf709faeeae9b0862a4.zip
Update touch screen library
Diffstat (limited to 'megalogger')
-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;