summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2015-03-23 17:23:17 +1100
committerStanley Huang <stanleyhuangyc@gmail.com>2015-03-23 17:23:17 +1100
commit9b19acc4b759b5c16d65c16c1b6e15d781f8116d (patch)
tree6d445fd590624147657f5ad16249a0a3ca34e215
parent06a579e730bb356cb3e14ef4a166cbfc6bc8affc (diff)
download2021-arduino-obd-9b19acc4b759b5c16d65c16c1b6e15d781f8116d.tar.gz
2021-arduino-obd-9b19acc4b759b5c16d65c16c1b6e15d781f8116d.tar.bz2
2021-arduino-obd-9b19acc4b759b5c16d65c16c1b6e15d781f8116d.zip
Add support for MPU-9150
-rw-r--r--megalogger/config.h1
-rw-r--r--megalogger/megalogger.ino6
2 files changed, 6 insertions, 1 deletions
diff --git a/megalogger/config.h b/megalogger/config.h
index 24b456f..9a4d8c1 100644
--- a/megalogger/config.h
+++ b/megalogger/config.h
@@ -53,6 +53,7 @@
//#define USE_MPU9150 1
#define ACC_DATA_RATIO 160
#define GYRO_DATA_RATIO 256
+#define COMPASS_DATA_RATIO 8
/**************************************
* Timeout/interval options
diff --git a/megalogger/megalogger.ino b/megalogger/megalogger.ino
index 22ba948..6def771 100644
--- a/megalogger/megalogger.ino
+++ b/megalogger/megalogger.ino
@@ -475,7 +475,11 @@ void processAccelerometer()
gx /= GYRO_DATA_RATIO;
gy /= GYRO_DATA_RATIO;
gz /= GYRO_DATA_RATIO;
-
+#if USE_MPU9150
+ mx /= COMPASS_DATA_RATIO;
+ my /= COMPASS_DATA_RATIO;
+ mz /= COMPASS_DATA_RATIO;
+#endif
// display MEMS data
lcd.setFontSize(FONT_SIZE_SMALL);
lcd.setCursor(214, 22);