summaryrefslogtreecommitdiff
path: root/libraries/OBD/OBD.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/OBD/OBD.cpp')
-rw-r--r--libraries/OBD/OBD.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/libraries/OBD/OBD.cpp b/libraries/OBD/OBD.cpp
index 8ee5ae9..b431297 100644
--- a/libraries/OBD/OBD.cpp
+++ b/libraries/OBD/OBD.cpp
@@ -261,6 +261,26 @@ float COBD::getVoltage()
return 0;
}
+bool COBD::getVIN(char* buffer)
+{
+ if (sendCommand("0902\r", buffer)) {
+ char *p = strstr(buffer, "0: 49 02");
+ if (p) {
+ char *q = buffer;
+ p += 10;
+ do {
+ for (++p; *p == ' '; p += 3) {
+ if (*q = hex2uint8(p + 1)) q++;
+ }
+ p = strchr(p, ':');
+ } while(p);
+ *q = 0;
+ return true;
+ }
+ }
+ return false;
+}
+
bool COBD::isValidPID(byte pid)
{
if (pid >= 0x7f)
@@ -380,7 +400,7 @@ bool COBD::setBaudRate(unsigned long baudrate)
OBDUART.print("ATBR1 ");
OBDUART.print(baudrate);
OBDUART.print('\r');
- delay(100);
+ delay(50);
OBDUART.end();
OBDUART.begin(baudrate);
while (available()) read();