diff options
Diffstat (limited to 'megalogger')
-rw-r--r-- | megalogger/config.h | 8 | ||||
-rw-r--r-- | megalogger/datalogger.h | 20 |
2 files changed, 8 insertions, 20 deletions
diff --git a/megalogger/config.h b/megalogger/config.h index 9f6a343..881d7f2 100644 --- a/megalogger/config.h +++ b/megalogger/config.h @@ -23,12 +23,12 @@ // uses software(1)/hardware(0) serial for data streaming #define USE_SOFTSERIAL 0 +#define RF_SERIAL Serial3 // this defines the format of data streaming // FORMAT_BIN is required by Freematics OBD iOS App -// FORMAT_CSV for text-based data, hex digits for PID // FORMAT_TEXT for text-based, text names for PID -#define STREAM_FORMAT FORMAT_BIN +#define STREAM_FORMAT FORMAT_TEXT /* Default streaming baudrates: 9600bps for BLE @@ -51,8 +51,8 @@ /************************************** * Accelerometer & Gyro **************************************/ -#define USE_MPU6050 1 -//#define USE_MPU9150 1 +//#define USE_MPU6050 1 +#define USE_MPU9150 1 #define ACC_DATA_RATIO 160 #define GYRO_DATA_RATIO 256 #define COMPASS_DATA_RATIO 8 diff --git a/megalogger/datalogger.h b/megalogger/datalogger.h index 45b1cb7..d59819e 100644 --- a/megalogger/datalogger.h +++ b/megalogger/datalogger.h @@ -6,8 +6,7 @@ *************************************************************************/ #define FORMAT_BIN 0 -#define FORMAT_CSV 1 -#define FORMAT_TEXT 2 +#define FORMAT_TEXT 1 typedef struct { uint32_t time; @@ -40,6 +39,8 @@ typedef struct { #if USE_SOFTSERIAL SoftwareSerial SerialRF(A2, A3); +#elif defined(RF_SERIAL) +#define SerialRF RF_SERIAL #else #define SerialRF Serial #endif @@ -77,13 +78,8 @@ public: { #if ENABLE_DATA_OUT SerialRF.begin(STREAM_BAUDRATE); - /* SerialRF.print("AT+NAMEFreematics"); delay(10); - while (SerialRF.available()) SerialRF.read(); - SerialRF.println(); - */ - m_lastSendTime = 0; #endif #if ENABLE_DATA_LOG m_lastDataTime = 0; @@ -101,12 +97,7 @@ public: void sendData(const char* buf, byte len) { SerialRF.write(buf, len); -#if MIN_DATA_INTERVAL - uint32_t t = millis(); - uint32_t elapsed = t - m_lastSendTime; - if (elapsed < MIN_DATA_INTERVAL) delay(MIN_DATA_INTERVAL - elapsed); - m_lastSendTime = t; -#endif + delay(10); } void logData(char c) { @@ -247,7 +238,4 @@ private: #if ENABLE_DATA_LOG uint32_t m_lastDataTime; #endif -#if ENABLE_DATA_OUT - uint32_t m_lastSendTime; -#endif }; |