From 4caa5b784849540bc622c284036b7004701ec7dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niccol=C3=B2=20Betto?= <niccolo.betto@skywarder.eu>
Date: Fri, 1 Dec 2023 17:17:31 +0100
Subject: [PATCH] [ImuCalibration] Update to Miosix 2.7 API

---
 src/entrypoints/imu-calibration.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/entrypoints/imu-calibration.cpp b/src/entrypoints/imu-calibration.cpp
index d42b4977f..b28705fef 100644
--- a/src/entrypoints/imu-calibration.cpp
+++ b/src/entrypoints/imu-calibration.cpp
@@ -29,6 +29,7 @@
 #include <iostream>
 
 using namespace Boardcore;
+using namespace Boardcore::Constants;
 using namespace Eigen;
 using namespace miosix;
 
@@ -108,14 +109,14 @@ void calibrateMagnetometer()
     scheduler.start();
 
     // Wait and then stop the sampling
-    auto startTick = getTick();
-    auto lastTick  = startTick;
-    while (getTick() - startTick < MAG_CALIBRATION_DURATION * 1e3)
+    auto startTime = getTime();
+    auto lastTime  = startTime;
+    while (getTime() - startTime < MAG_CALIBRATION_DURATION * NS_IN_S)
     {
         mpu.sample();
         calibration.feed(mpu.getLastSample());
-        Thread::sleepUntil(lastTick + IMU_SAMPLE_PERIOD);
-        lastTick = getTick();
+        Thread::nanoSleepUntil(lastTime + (IMU_SAMPLE_PERIOD * NS_IN_MS));
+        lastTime = getTime();
     }
 
     scheduler.stop();
-- 
GitLab