diff options
-rw-r--r-- | src/app/mpu9250_motionlog/main.cc | 13 |
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; |