From 6211285a64c40be81d367cf4230a89e2f4e31bde Mon Sep 17 00:00:00 2001
From: Davide Mor <davide.mor@skywarder.eu>
Date: Wed, 31 Jul 2024 15:56:00 +0200
Subject: [PATCH] [ADA] Exposed a couple of functions required for properly
 correcting pressure data

---
 src/shared/algorithms/ADA/ADA.cpp | 9 +++++++++
 src/shared/algorithms/ADA/ADA.h   | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/src/shared/algorithms/ADA/ADA.cpp b/src/shared/algorithms/ADA/ADA.cpp
index 0b61cd63a..929cacc5b 100644
--- a/src/shared/algorithms/ADA/ADA.cpp
+++ b/src/shared/algorithms/ADA/ADA.cpp
@@ -44,6 +44,15 @@ void ADA::update(const float pressure)
     updateState();
 }
 
+void ADA::update()
+{
+    // Update the Kalman filter
+    filter.predict();
+
+    // Convert filter data to altitudes and speeds
+    updateState();
+}
+
 ADAState ADA::getState() { return state; }
 
 void ADA::setReferenceValues(const ReferenceValues reference)
diff --git a/src/shared/algorithms/ADA/ADA.h b/src/shared/algorithms/ADA/ADA.h
index 26072b16a..5dc63c49c 100644
--- a/src/shared/algorithms/ADA/ADA.h
+++ b/src/shared/algorithms/ADA/ADA.h
@@ -44,6 +44,11 @@ public:
      */
     void update(const float pressure);
 
+    /**
+     * @brief Update the Kalman filter, skipping the correct step.
+     */
+    void update();
+
     /**
      * @param state ADA state with altitude and Kalman parameters.
      */
-- 
GitLab