summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'libraries')
-rw-r--r--libraries/OBD/OBD.cpp4
-rw-r--r--libraries/OBD/OBD.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/libraries/OBD/OBD.cpp b/libraries/OBD/OBD.cpp
index 3dba269..cd5290e 100644
--- a/libraries/OBD/OBD.cpp
+++ b/libraries/OBD/OBD.cpp
@@ -225,14 +225,14 @@ byte COBD::receive(char* buffer, int timeout)
unsigned char n = 0;
bool prompted = false;
- buffer[0] = 0;
+ if (buffer) buffer[0] = 0;
for (;;) {
if (available()) {
char c = read();
if (n > 2 && c == '>') {
// prompt char received
prompted = true;
- } else if (n < OBD_RECV_BUF_SIZE - 1) {
+ } else if (n < OBD_RECV_BUF_SIZE - 1 && buffer) {
buffer[n++] = c;
if (c == '.') {
n = 0;
diff --git a/libraries/OBD/OBD.h b/libraries/OBD/OBD.h
index 22d9f12..2718eb2 100644
--- a/libraries/OBD/OBD.h
+++ b/libraries/OBD/OBD.h
@@ -10,7 +10,7 @@
#define OBD_TIMEOUT_SHORT 2000 /* ms */
#define OBD_TIMEOUT_LONG 7000 /* ms */
#define OBD_SERIAL_BAUDRATE 38400
-#define OBD_RECV_BUF_SIZE 80
+#define OBD_RECV_BUF_SIZE 128
#ifndef OBDUART
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega644P__)
@@ -155,7 +155,7 @@ public:
// GPS API
bool gpsQuery(GPS_DATA* gpsdata);
void gpsSetup(uint32_t baudrate, const char* cmds = 0);
-private:
+protected:
bool sendCommand(byte cmd, uint8_t data = 0, byte* payload = 0, byte payloadBytes = 0);
byte receive(char* buffer, int timeout = OBD_TIMEOUT_SHORT);
byte m_addr;