From 5958ea47a47d5f514403e39b132a4fc6035f0e5f Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Sun, 11 May 2014 12:45:48 +0800 Subject: Update OBD library --- libraries/OBD/OBD.cpp | 10 +++++----- libraries/OBD/OBD.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/OBD/OBD.cpp b/libraries/OBD/OBD.cpp index 9b503c9..dd770d9 100644 --- a/libraries/OBD/OBD.cpp +++ b/libraries/OBD/OBD.cpp @@ -1,7 +1,7 @@ /************************************************************************* * Arduino Library for OBD-II UART/I2C Adapter * Distributed under GPL v2.0 -* Visit http://arduinodev.com for more information +* Visit http://freematics.com for more information * (C)2012-2014 Stanley Huang *************************************************************************/ @@ -482,7 +482,7 @@ uint16_t COBDI2C::getData(byte pid, int& result) case PID_ABSOLUTE_ENGINE_LOAD: case PID_ETHANOL_PERCENTAGE: case PID_HYBRID_BATTERY_PERCENTAGE: - result = pi->value * 100 / 255; // % + result = (uint16_t)(pi->value * 100 + 50) / 255; break; case PID_MAF_FLOW: result = pi->value / 100; @@ -490,14 +490,14 @@ uint16_t COBDI2C::getData(byte pid, int& result) case PID_TIMING_ADVANCE: result = (int)pi->value / 2 - 64; break; - case PID_CONTROL_MODULE_VOLTAGE: // V - result = pi->value / 1000; + case PID_CONTROL_MODULE_VOLTAGE: // mV + result = pi->value; break; case PID_ENGINE_FUEL_RATE: // L/h result = pi->value / 20; break; case PID_ENGINE_TORQUE_PERCENTAGE: // % - result = (int)pi->value - 125; + result = (uint16_t)pi->value - 125; break; default: result = pi->value; diff --git a/libraries/OBD/OBD.h b/libraries/OBD/OBD.h index dcf4890..f5cf78e 100644 --- a/libraries/OBD/OBD.h +++ b/libraries/OBD/OBD.h @@ -1,7 +1,7 @@ /************************************************************************* * Arduino Library for OBD-II UART/I2C Adapter * Distributed under GPL v2.0 -* Visit http://arduinodev.com for more information +* Visit http://freematics.com for more information * (C)2012-2014 Stanley Huang *************************************************************************/ -- cgit v1.2.3 From cdbb8b35621239c14bd7b1043614ad158b233c32 Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Sun, 11 May 2014 13:13:44 +0800 Subject: Update UNO logger --- unologger/config.h | 10 +++------- unologger/unologger.ino | 4 +++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/unologger/config.h b/unologger/config.h index e5c8deb..75ac11b 100644 --- a/unologger/config.h +++ b/unologger/config.h @@ -1,19 +1,16 @@ #ifndef CONFIG_H_INCLUDED #define CONFIG_H_INCLUDED -#define OBD_MODEL_UART 0 -#define OBD_MODEL_I2C 1 - /************************************** * OBD-II options **************************************/ -#define OBD_MODEL OBD_MODEL_I2C +#define OBD_MODEL OBD_MODEL_UART #define OBD_PROTOCOL 0 /* 0 for auto */ /************************************** * Data logging/streaming out **************************************/ -#define ENABLE_DATA_OUT 1 +#define ENABLE_DATA_OUT 0 #define ENABLE_DATA_LOG 0 #define USE_SOFTSERIAL 0 //this defines the format of log file @@ -44,8 +41,7 @@ LCD_ILI9341 lcd; /************************************** * Other options **************************************/ -#define USE_MPU6050 1 -#define GPS_DATA_TIMEOUT 2000 /* ms */ +#define USE_MPU6050 0 //#define DEBUG Serial #define DEBUG_BAUDRATE 9600 diff --git a/unologger/unologger.ino b/unologger/unologger.ino index c6db802..da93d79 100644 --- a/unologger/unologger.ino +++ b/unologger/unologger.ino @@ -19,12 +19,14 @@ #endif #include "datalogger.h" -// logger states #define STATE_SD_READY 0x1 #define STATE_OBD_READY 0x2 #define STATE_ACC_READY 0x10 #define STATE_SLEEPING 0x20 +#define OBD_MODEL_UART 0 +#define OBD_MODEL_I2C 1 + static uint32_t lastFileSize = 0; static int speed = 0; static uint32_t distance = 0; -- cgit v1.2.3