summaryrefslogtreecommitdiff
path: root/libraries/OBD2UART/OBD2UART.cpp
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2017-05-08 22:29:41 +1000
committerStanley Huang <stanleyhuangyc@gmail.com>2017-05-08 22:29:41 +1000
commit473e08ae116f8b61804adbdb5e29ef090ee0ad5c (patch)
treee7b42cd6df96aa0ee646bba24bf2b7d70b2b41af /libraries/OBD2UART/OBD2UART.cpp
parentaa5b6250d0164963de25b214f3b15b07eb56ea42 (diff)
download2021-arduino-obd-473e08ae116f8b61804adbdb5e29ef090ee0ad5c.tar.gz
2021-arduino-obd-473e08ae116f8b61804adbdb5e29ef090ee0ad5c.tar.bz2
2021-arduino-obd-473e08ae116f8b61804adbdb5e29ef090ee0ad5c.zip
Fixed compiling issue on 32-bit systems
Diffstat (limited to 'libraries/OBD2UART/OBD2UART.cpp')
-rw-r--r--libraries/OBD2UART/OBD2UART.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libraries/OBD2UART/OBD2UART.cpp b/libraries/OBD2UART/OBD2UART.cpp
index 0352c6a..07b92fe 100644
--- a/libraries/OBD2UART/OBD2UART.cpp
+++ b/libraries/OBD2UART/OBD2UART.cpp
@@ -289,7 +289,7 @@ float COBD::getVoltage()
char buf[32];
if (sendCommand("ATRV\r", buf, sizeof(buf)) > 0) {
char* p = getResultValue(buf);
- if (p) return atof(p);
+ if (p) return (float)atof(p);
}
return 0;
}
@@ -321,12 +321,12 @@ bool COBD::isValidPID(byte pid)
pid--;
byte i = pid >> 3;
byte b = 0x80 >> (pid & 0x7);
- return pidmap[i] & b;
+ return (pidmap[i] & b) != 0;
}
byte COBD::begin()
{
- long baudrates[] = {38400, 115200};
+ long baudrates[] = {115200, 38400};
byte version = 0;
for (byte n = 0; n < sizeof(baudrates) / sizeof(baudrates[0]) && version == 0; n++) {
OBDUART.begin(baudrates[n]);
@@ -379,7 +379,7 @@ byte COBD::receive(char* buffer, byte bufsize, int timeout)
// prompt char received
break;
}
- if (millis() - startTime > timeout) {
+ if ((int)(millis() - startTime) > timeout) {
// timeout
break;
}
@@ -473,7 +473,7 @@ bool COBD::memsInit()
return sendCommand("ATTEMP\r", buf, sizeof(buf)) > 0 && !strchr(buf, '?');
}
-bool COBD::memsRead(int* acc, int* gyr, int* mag, int* temp)
+bool COBD::memsRead(int16_t* acc, int16_t* gyr, int16_t* mag, int16_t* temp)
{
char buf[64];
bool success;