summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-11-01 21:52:18 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-11-01 21:52:18 +0100
commit332affa882cfb48d6056dd5bf07af6ef221d200d (patch)
treeed97bf3ed62e2d533e4ba12c9828e38a00a5742b /src/app
parent7823c6497e048c702a1d7b6ee260ea2a0af01f62 (diff)
MPU9250 motionlog: initialize values, slightly lower sample rate
Diffstat (limited to 'src/app')
-rw-r--r--src/app/mpu9250_motionlog/main.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/app/mpu9250_motionlog/main.cc b/src/app/mpu9250_motionlog/main.cc
index fc9ac1d..9bdfe0c 100644
--- a/src/app/mpu9250_motionlog/main.cc
+++ b/src/app/mpu9250_motionlog/main.cc
@@ -8,14 +8,18 @@
#endif
#include "driver/mpu9250.h"
+#define INIT0(val) int val = 0, min_ ## val = 0, max_ ## val = 0;
#define UPDATE_MIN(min_val, val) if ((val) < (min_val)) { (min_val) = (val); }
#define UPDATE_MAX(max_val, val) if ((val) > (max_val)) { (max_val) = (val); }
int main(void)
{
- int ax, ay, az, gx, gy, gz;
- int max_ax, max_ay, max_az, max_gx, max_gy, max_gz;
- int min_ax, min_ay, min_az, min_gx, min_gy, min_gz;
+ INIT0(ax);
+ INIT0(ay);
+ INIT0(az);
+ INIT0(gx);
+ INIT0(gy);
+ INIT0(gz);
unsigned char i = 0;
arch.setup();
@@ -49,17 +53,18 @@ int main(void)
UPDATE_MAX(max_gz, gz);
if (i++ == 200) {
- kout << "Temp: " << mpu9250.getTemperature() << endl;
kout << "Min Accel: " << min_ax << " / " << min_ay << " / " << min_az << endl;
kout << "Max Accel: " << max_ax << " / " << max_ay << " / " << max_az << endl;
kout << "Min Gyro: " << min_gx << " / " << min_gy << " / " << min_gz << endl;
kout << "Max Gyro: " << max_gx << " / " << max_gy << " / " << max_gz << endl;
+ kout << "Temp: " << mpu9250.getTemperature() << endl;
min_ax = min_ay = min_az = 0;
min_gx = min_gy = min_gz = 0;
max_ax = max_ay = max_az = 0;
max_gx = max_gy = max_gz = 0;
i = 0;
}
+ arch.delay_ms(1);
}
return 0;