From 1eba68348adf3b105ac99beedecc9c7eebb663c8 Mon Sep 17 00:00:00 2001
From: Davide Basso <davide.basso@skywarder.eu>
Date: Fri, 3 Jan 2025 10:13:24 +0100
Subject: [PATCH] [Parafoil] Replace chrono with Boardcore units

---
 src/Parafoil/Actuators/Actuators.cpp   |  8 ++++----
 src/Parafoil/Configs/ActuatorsConfig.h | 13 ++++++-------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/Parafoil/Actuators/Actuators.cpp b/src/Parafoil/Actuators/Actuators.cpp
index b0cd1f8f8..1aa20a6e7 100644
--- a/src/Parafoil/Actuators/Actuators.cpp
+++ b/src/Parafoil/Actuators/Actuators.cpp
@@ -38,14 +38,14 @@ Actuators::Actuators()
 {
     leftServo.servo = std::make_unique<Servo>(
         config::LeftServo::TIMER, config::LeftServo::PWM_CH,
-        config::LeftServo::MIN_PULSE.count(),
-        config::LeftServo::MAX_PULSE.count());
+        config::LeftServo::MIN_PULSE.value(),
+        config::LeftServo::MAX_PULSE.value());
     leftServo.fullRangeAngle = config::LeftServo::ROTATION;
 
     rightServo.servo = std::make_unique<Servo>(
         config::RightServo::TIMER, config::RightServo::PWM_CH,
-        config::RightServo::MIN_PULSE.count(),
-        config::RightServo::MAX_PULSE.count());
+        config::RightServo::MIN_PULSE.value(),
+        config::RightServo::MAX_PULSE.value());
     rightServo.fullRangeAngle = config::RightServo::ROTATION;
 }
 
diff --git a/src/Parafoil/Configs/ActuatorsConfig.h b/src/Parafoil/Configs/ActuatorsConfig.h
index 915a2d757..24aa23422 100644
--- a/src/Parafoil/Configs/ActuatorsConfig.h
+++ b/src/Parafoil/Configs/ActuatorsConfig.h
@@ -24,8 +24,7 @@
 
 #include <drivers/timer/TimerUtils.h>
 #include <units/Angle.h>
-
-#include <chrono>
+#include <units/Time.h>
 
 namespace Parafoil
 {
@@ -34,7 +33,7 @@ namespace Config
 namespace Actuators
 {
 
-/* linter off */ using namespace std::chrono_literals;
+/* linter off */ using namespace Boardcore::Units::Time;
 /* linter off */ using namespace Boardcore::Units::Angle;
 
 namespace LeftServo
@@ -44,8 +43,8 @@ constexpr Boardcore::TimerUtils::Channel PWM_CH =
     Boardcore::TimerUtils::Channel::CHANNEL_1;
 
 constexpr auto ROTATION  = 180_deg;
-constexpr auto MIN_PULSE = 500us;
-constexpr auto MAX_PULSE = 2460us;
+constexpr auto MIN_PULSE = 500_us;
+constexpr auto MAX_PULSE = 2460_us;
 }  // namespace LeftServo
 
 namespace RightServo
@@ -55,8 +54,8 @@ constexpr Boardcore::TimerUtils::Channel PWM_CH =
     Boardcore::TimerUtils::Channel::CHANNEL_2;
 
 constexpr auto ROTATION  = 180_deg;
-constexpr auto MIN_PULSE = 2460us;
-constexpr auto MAX_PULSE = 500us;
+constexpr auto MIN_PULSE = 2460_us;
+constexpr auto MAX_PULSE = 500_us;
 }  // namespace RightServo
 
 constexpr auto SERVO_TWIRL_RADIUS = 0.5f;  // [%]
-- 
GitLab