From 8212727fd9e1e29b5a5fbd3d495dbc01a5c2249f Mon Sep 17 00:00:00 2001
From: Federico Lolli <federico.lolli@skywarder.eu>
Date: Fri, 31 May 2024 20:45:54 +0200
Subject: [PATCH] [ARP] Fixed SMController start

---
 .../Automated/SMController/SMController.cpp        | 14 ++++----------
 .../Automated/SMController/SMControllerData.h      |  7 ++++---
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/src/boards/Groundstation/Automated/SMController/SMController.cpp b/src/boards/Groundstation/Automated/SMController/SMController.cpp
index fd14eb265..b4c07f141 100644
--- a/src/boards/Groundstation/Automated/SMController/SMController.cpp
+++ b/src/boards/Groundstation/Automated/SMController/SMController.cpp
@@ -55,16 +55,10 @@ SMController::SMController(TaskScheduler* sched)
 
 bool SMController::start()
 {
-    size_t result;
-    bool ok = true;
-
-    // add the update task
-    result = scheduler->addTask(bind(&SMController::update, this),
-                                SMControllerConfig::UPDATE_PERIOD,
-                                TaskScheduler::Policy::RECOVER);
-    ok &= result != 0;
-
-    return ActiveObject::start() && ok;
+    size_t result = scheduler->addTask(bind(&SMController::update, this),
+                                       SMControllerConfig::UPDATE_PERIOD,
+                                       TaskScheduler::Policy::RECOVER);
+    return HSM::start() && result != 0;
 }
 
 void SMController::setAntennaCoordinates(
diff --git a/src/boards/Groundstation/Automated/SMController/SMControllerData.h b/src/boards/Groundstation/Automated/SMController/SMControllerData.h
index 98b3fa259..f13fd8047 100644
--- a/src/boards/Groundstation/Automated/SMController/SMControllerData.h
+++ b/src/boards/Groundstation/Automated/SMController/SMControllerData.h
@@ -60,13 +60,14 @@ enum class SMControllerState : uint8_t
      * @brief macro state for no feedback (armed_nf, test_nf,
      * fix_rocket_nf, active_nf)
      */
-    NO_FEEDBACK
+    NO_FEEDBACK,
+    INVALID,
 };
 
 struct SMControllerStatus
 {
-    uint64_t timestamp;
-    SMControllerState state;
+    uint64_t timestamp      = 0;
+    SMControllerState state = SMControllerState::INVALID;
 
     static std::string header() { return "timestamp,state\n"; }
 
-- 
GitLab