diff options
Diffstat (limited to 'unologger/datalogger.h')
-rw-r--r-- | unologger/datalogger.h | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/unologger/datalogger.h b/unologger/datalogger.h index 2c4ebfe..4fdf805 100644 --- a/unologger/datalogger.h +++ b/unologger/datalogger.h @@ -93,7 +93,7 @@ typedef struct { #define FILE_NAME_FORMAT "/DAT%05d.CSV" #endif -#if ENABLE_DATA_OUT && !USE_OBD_BT +#if ENABLE_DATA_OUT #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) SoftwareSerial mySerial(A8, A9); /* for BLE Shield on MEGA*/ #elif defined(__AVR_ATmega644P__) @@ -111,12 +111,8 @@ public: void initSender() { #if ENABLE_DATA_OUT -#if USE_OBD_BT - btInit(9600); -#else mySerial.begin(9600); #endif -#endif #if ENABLE_DATA_LOG && LOG_FORMAT == FORMAT_CSV m_lastDataTime = 0; #endif @@ -140,26 +136,17 @@ public: info.logType = hdr.logType; info.logFlags = hdr.flags; info.checksum = getChecksum((char*)&info, sizeof(info)); -#if USE_OBD_BT - btSend((uint8_t*)&info, sizeof(info)); -#else mySerial.write((uint8_t*)&info, sizeof(info)); -#endif } void sendCommand(byte message, void* data = 0, byte bytes = 0) { LOG_DATA_COMMAND msg = {0, PID_MESSAGE, message}; if (data) memcpy(msg.data, data, bytes); msg.checksum = getChecksum((char*)&msg, sizeof(msg)); -#if USE_OBD_BT - btSend((uint8_t*)&msg, sizeof(msg)); -#else mySerial.write((uint8_t*)&msg, sizeof(msg)); -#endif } bool receiveCommand(LOG_DATA_COMMAND& msg) { -#if !USE_OBD_BT if (!mySerial.available()) return false; @@ -171,7 +158,6 @@ public: if (getChecksum((char*)&msg, sizeof(msg)) != msg.checksum) { return false; } -#endif return true; } #endif @@ -180,12 +166,8 @@ public: LOG_DATA_COMM ld = {dataTime, pid, 1, 0, value}; ld.checksum = getChecksum((char*)&ld, 12); #if ENABLE_DATA_OUT -#if USE_OBD_BT - btSend((uint8_t*)&ld, 12); -#else mySerial.write((uint8_t*)&ld, 12); #endif -#endif #if ENABLE_DATA_LOG #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 12); @@ -206,12 +188,8 @@ public: LOG_DATA_COMM ld = {dataTime, pid, 1, 0, value}; ld.checksum = getChecksum((char*)&ld, 12); #if ENABLE_DATA_OUT -#if USE_OBD_BT - btSend((uint8_t*)&ld, 12); -#else mySerial.write((uint8_t*)&ld, 12); #endif -#endif #if ENABLE_DATA_LOG #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 12); @@ -232,12 +210,8 @@ public: LOG_DATA_COMM ld = {dataTime, pid, 2, 0, {value1, value2}}; ld.checksum = getChecksum((char*)&ld, 16); #if ENABLE_DATA_OUT -#if USE_OBD_BT - btSend((uint8_t*)&ld, 16); -#else mySerial.write((uint8_t*)&ld, 16); #endif -#endif #if ENABLE_DATA_LOG #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 16); @@ -248,7 +222,7 @@ public: dataSize += sdfile.print(pid, HEX); dataSize += sdfile.write(','); dataSize += sdfile.print(value1, 6); - dataSize += sdfile.write(','); + dataSize += sdfile.write(' '); dataSize += sdfile.print(value2, 6); dataSize += sdfile.write('\n'); m_lastDataTime = dataTime; @@ -260,12 +234,8 @@ public: LOG_DATA_COMM ld = {dataTime, pid, 2, 0, {value1, value2}}; ld.checksum = getChecksum((char*)&ld, 16); #if ENABLE_DATA_OUT -#if USE_OBD_BT - btSend((uint8_t*)&ld, 16); -#else mySerial.write((uint8_t*)&ld, 16); #endif -#endif #if ENABLE_DATA_LOG #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 16); @@ -288,12 +258,8 @@ public: LOG_DATA_COMM ld = {dataTime, pid, 3, 0, {value1, value2, value3}}; ld.checksum = getChecksum((char*)&ld, 20); #if ENABLE_DATA_OUT -#if USE_OBD_BT - btSend((uint8_t*)&ld, 20); -#else mySerial.write((uint8_t*)&ld, 20); #endif -#endif #if ENABLE_DATA_LOG #if LOG_FORMAT == FORMAT_BIN sdfile.write((uint8_t*)&ld, 20); |