From c7e4704234c80757a9a3e062dc007f351b25428f Mon Sep 17 00:00:00 2001
From: Jakob Meier <meier-jakob@gmx.de>
Date: Wed, 11 May 2022 14:36:23 +0200
Subject: [PATCH 01/12] fixed merge conflict

---
 fsfw                                  | 2 +-
 linux/devices/ploc/PlocMPSoCHandler.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fsfw b/fsfw
index 19bd26d9..bc994595 160000
--- a/fsfw
+++ b/fsfw
@@ -1 +1 @@
-Subproject commit 19bd26d9983d97c8daf010649e9142afac7e2650
+Subproject commit bc994595dae47fbe57d5a4fa70ad23f90e9410f9
diff --git a/linux/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h
index da71dd47..62e32e0f 100644
--- a/linux/devices/ploc/PlocMPSoCHandler.h
+++ b/linux/devices/ploc/PlocMPSoCHandler.h
@@ -108,7 +108,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
   MessageQueueIF* eventQueue = nullptr;
   MessageQueueIF* commandActionHelperQueue = nullptr;
 
-  SourceSequenceCounter sequenceCount;
+  SourceSequenceCounter sequenceCount = SourceSequenceCounter(0);
 
   uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
 

From 835a10e538977417d5fc45042a7d250503239a7f Mon Sep 17 00:00:00 2001
From: Cleanroom Laptop L15 <meierj@irs.uni-stuttgart.de>
Date: Wed, 11 May 2022 16:11:17 +0200
Subject: [PATCH 02/12] sequence count init

---
 bsp_q7s/core/CoreController.cpp       | 10 +++++-----
 fsfw                                  |  2 +-
 linux/devices/ploc/PlocMPSoCHandler.h |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp
index 208999c2..0d166600 100644
--- a/bsp_q7s/core/CoreController.cpp
+++ b/bsp_q7s/core/CoreController.cpp
@@ -1708,11 +1708,11 @@ ReturnValue_t CoreController::timeFileHandler() {
     }
     std::string fileName = currMntPrefix + TIME_FILE;
     std::ofstream timeFile(fileName);
-    if (not timeFile.good()) {
-      sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
-                 << std::endl;
-      return RETURN_FAILED;
-    }
+//    if (not timeFile.good()) {
+//      sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
+//                 << std::endl;
+//      return RETURN_FAILED;
+//    }
     timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
   }
   return RETURN_OK;
diff --git a/fsfw b/fsfw
index bc994595..0d45b35e 160000
--- a/fsfw
+++ b/fsfw
@@ -1 +1 @@
-Subproject commit bc994595dae47fbe57d5a4fa70ad23f90e9410f9
+Subproject commit 0d45b35ea7fe2360e3aa4f9b16bb6c2f63422689
diff --git a/linux/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h
index 62e32e0f..9b96ce55 100644
--- a/linux/devices/ploc/PlocMPSoCHandler.h
+++ b/linux/devices/ploc/PlocMPSoCHandler.h
@@ -108,7 +108,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
   MessageQueueIF* eventQueue = nullptr;
   MessageQueueIF* commandActionHelperQueue = nullptr;
 
-  SourceSequenceCounter sequenceCount = SourceSequenceCounter(0);
+  SourceSequenceCounter sequenceCount = SourceSequenceCounter(SpacePacketBase::LIMIT_SEQUENCE_COUNT - 1);
 
   uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
 

From c7e2cc22af96a759c53303417e5093660f1d5da9 Mon Sep 17 00:00:00 2001
From: Jakob Meier <meier-jakob@gmx.de>
Date: Wed, 11 May 2022 16:49:07 +0200
Subject: [PATCH 03/12] init sequence count

---
 fsfw                                  | 2 +-
 linux/devices/ploc/PlocMPSoCHandler.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fsfw b/fsfw
index 0d45b35e..cccfe9e6 160000
--- a/fsfw
+++ b/fsfw
@@ -1 +1 @@
-Subproject commit 0d45b35ea7fe2360e3aa4f9b16bb6c2f63422689
+Subproject commit cccfe9e657a3b7e3567dae3acb74f64729fab251
diff --git a/linux/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h
index 9b96ce55..17014270 100644
--- a/linux/devices/ploc/PlocMPSoCHandler.h
+++ b/linux/devices/ploc/PlocMPSoCHandler.h
@@ -108,7 +108,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
   MessageQueueIF* eventQueue = nullptr;
   MessageQueueIF* commandActionHelperQueue = nullptr;
 
-  SourceSequenceCounter sequenceCount = SourceSequenceCounter(SpacePacketBase::LIMIT_SEQUENCE_COUNT - 1);
+  SourceSequenceCounter sequenceCount =
+      SourceSequenceCounter(SpacePacketBase::LIMIT_SEQUENCE_COUNT - 1);
 
   uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
 

From beba258a77cd31fba17939fc28a8d8994dc27942 Mon Sep 17 00:00:00 2001
From: Jakob Meier <meier-jakob@gmx.de>
Date: Wed, 11 May 2022 16:57:23 +0200
Subject: [PATCH 04/12] update fsfw

---
 fsfw | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fsfw b/fsfw
index cccfe9e6..b0b75b85 160000
--- a/fsfw
+++ b/fsfw
@@ -1 +1 @@
-Subproject commit cccfe9e657a3b7e3567dae3acb74f64729fab251
+Subproject commit b0b75b85a913d0d19022059cd2c790e4a1a9797b

From 8a90f0025b08c3711d6632f919ba3a2660ade711 Mon Sep 17 00:00:00 2001
From: Jakob Meier <meier-jakob@gmx.de>
Date: Wed, 11 May 2022 17:01:03 +0200
Subject: [PATCH 05/12] commented in time file write

---
 bsp_q7s/core/CoreController.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp
index 0d166600..208999c2 100644
--- a/bsp_q7s/core/CoreController.cpp
+++ b/bsp_q7s/core/CoreController.cpp
@@ -1708,11 +1708,11 @@ ReturnValue_t CoreController::timeFileHandler() {
     }
     std::string fileName = currMntPrefix + TIME_FILE;
     std::ofstream timeFile(fileName);
-//    if (not timeFile.good()) {
-//      sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
-//                 << std::endl;
-//      return RETURN_FAILED;
-//    }
+    if (not timeFile.good()) {
+      sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
+                 << std::endl;
+      return RETURN_FAILED;
+    }
     timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
   }
   return RETURN_OK;

From af52b90abef2c4b646b3a610069db246e4eafeca Mon Sep 17 00:00:00 2001
From: Jakob Meier <meier-jakob@gmx.de>
Date: Wed, 11 May 2022 17:16:40 +0200
Subject: [PATCH 06/12] fsfwgen update

---
 generators/fsfwgen | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/generators/fsfwgen b/generators/fsfwgen
index 5ad9fb94..169ad98c 160000
--- a/generators/fsfwgen
+++ b/generators/fsfwgen
@@ -1 +1 @@
-Subproject commit 5ad9fb94af3312d29863527106396395f7b808a5
+Subproject commit 169ad98cdeebe3ccfd1b78938934496a20b6a294

From 0dd0af73a1890ca1d7a5760dc4f2460bb94fd01f Mon Sep 17 00:00:00 2001
From: Cleanroom Laptop L15 <meierj@irs.uni-stuttgart.de>
Date: Thu, 12 May 2022 10:50:12 +0200
Subject: [PATCH 07/12] change in mpsoc status codes

---
 .../devicedefinitions/PlocSupervisorDefinitions.h    | 12 +++++++++++-
 linux/devices/ploc/PlocSupervisorHandler.cpp         |  4 ++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h
index 557756e8..f71eaa17 100644
--- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h
+++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h
@@ -1460,7 +1460,9 @@ class ExecutionReport : public VerificationReport {
     OUT_OF_RANGE = 0x103,
     OUT_OF_HEAP_MEMORY = 0x104,
     INVALID_STATE_TRANSITION = 0x105,
-    MPSOC_BOOT_FAILED = 0x106,
+    MPSOC_ALREADY_BOOTING = 0x106,
+    MPSOC_ALREADY_OPERATIONAL = 0x107,
+    MPSOC_BOOT_FAILED = 0x108,
     SP_NOT_AVAILABLE = 0x200,
     SP_DATA_INSUFFICIENT = 0x201,
     SP_MEMORY_ID_INVALID = 0x202,
@@ -1594,6 +1596,14 @@ class ExecutionReport : public VerificationReport {
         sif::warning << STATUS_PRINTOUT_PREFIX << "Invalid state transition" << std::endl;
         break;
       }
+      case StatusCode::MPSOC_ALREADY_BOOTING: {
+        sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC already booting" << std::endl;
+        break;
+      }
+      case StatusCode::MPSOC_ALREADY_OPERATIONAL: {
+        sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC already operational" << std::endl;
+        break;
+      }
       case StatusCode::MPSOC_BOOT_FAILED: {
         sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC boot failed" << std::endl;
         break;
diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp
index b5f5ca6c..cb1e0b09 100644
--- a/linux/devices/ploc/PlocSupervisorHandler.cpp
+++ b/linux/devices/ploc/PlocSupervisorHandler.cpp
@@ -1062,8 +1062,8 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
   nextReplyId = supv::EXE_REPORT;
 
 #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1
-  sif::info << "PlocSupervisorHandler::handleBootStatusReport: SoC State (0 - off, 1 - booting, 3 "
-               "- operating, 4 - Shutdown): "
+  sif::info << "PlocSupervisorHandler::handleBootStatusReport: SoC State (0 - off, 1 - booting, 2 - Update, 3 "
+               "- operating, 4 - Shutdown, 5 - Reset): "
             << static_cast<unsigned int>(bootStatusReport.socState.value) << std::endl;
   sif::info << "PlocSupervisorHandler::handleBootStatusReport: Power Cycles: "
             << static_cast<unsigned int>(bootStatusReport.powerCycles.value) << std::endl;

From e6f55ba2c1466d93a72a58aa5ba715c268b07ff0 Mon Sep 17 00:00:00 2001
From: Cleanroom Laptop L15 <meierj@irs.uni-stuttgart.de>
Date: Thu, 12 May 2022 14:04:55 +0200
Subject: [PATCH 08/12] increased execution timeout of prepare update command

---
 bsp_q7s/core/CoreController.cpp       | 10 +++++-----
 linux/devices/ploc/PlocSupvHelper.cpp |  6 +++---
 linux/devices/ploc/PlocSupvHelper.h   |  1 +
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp
index 208999c2..0d166600 100644
--- a/bsp_q7s/core/CoreController.cpp
+++ b/bsp_q7s/core/CoreController.cpp
@@ -1708,11 +1708,11 @@ ReturnValue_t CoreController::timeFileHandler() {
     }
     std::string fileName = currMntPrefix + TIME_FILE;
     std::ofstream timeFile(fileName);
-    if (not timeFile.good()) {
-      sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
-                 << std::endl;
-      return RETURN_FAILED;
-    }
+//    if (not timeFile.good()) {
+//      sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
+//                 << std::endl;
+//      return RETURN_FAILED;
+//    }
     timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
   }
   return RETURN_OK;
diff --git a/linux/devices/ploc/PlocSupvHelper.cpp b/linux/devices/ploc/PlocSupvHelper.cpp
index 2e483b7e..c5214ca6 100644
--- a/linux/devices/ploc/PlocSupvHelper.cpp
+++ b/linux/devices/ploc/PlocSupvHelper.cpp
@@ -233,7 +233,7 @@ ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
 ReturnValue_t PlocSupvHelper::prepareUpdate() {
   ReturnValue_t result = RETURN_OK;
   supv::ApidOnlyPacket packet(supv::APID_PREPARE_UPDATE);
-  result = handlePacketTransmission(packet);
+  result = handlePacketTransmission(packet, PREPARE_UPDATE_EXECUTION_REPORT);
   if (result != RETURN_OK) {
     return result;
   }
@@ -342,8 +342,8 @@ ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t
     }
   }
   if (remainingBytes != 0) {
-    sif::warning << "PlocSupvHelper::handleTmReception: Failed to read " << remainingBytes
-                 << " bytes" << std::endl;
+    sif::warning << "PlocSupvHelper::handleTmReception: Failed to read " << std::dec
+                 << remainingBytes << " bytes" << std::endl;
     return RETURN_FAILED;
   }
   result = tmPacket->checkCrc();
diff --git a/linux/devices/ploc/PlocSupvHelper.h b/linux/devices/ploc/PlocSupvHelper.h
index e4f0d40a..cf433ca8 100644
--- a/linux/devices/ploc/PlocSupvHelper.h
+++ b/linux/devices/ploc/PlocSupvHelper.h
@@ -128,6 +128,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
   static const size_t SIZE_EVENT_BUFFER_FULL_PACKET = 1024;
   static const size_t SIZE_EVENT_BUFFER_LAST_PACKET = 200;
   static const uint32_t CRC_EXECUTION_TIMEOUT = 60000;
+  static const uint32_t PREPARE_UPDATE_EXECUTION_REPORT = 2000;
 
   struct Update {
     uint8_t memoryId;

From 3a6beafae5dd9deaa4db754e428f4f69c10baec3 Mon Sep 17 00:00:00 2001
From: Jakob Meier <meier-jakob@gmx.de>
Date: Thu, 12 May 2022 15:31:52 +0200
Subject: [PATCH 09/12] commented time file writing in again

---
 bsp_q7s/core/CoreController.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp
index 0d166600..208999c2 100644
--- a/bsp_q7s/core/CoreController.cpp
+++ b/bsp_q7s/core/CoreController.cpp
@@ -1708,11 +1708,11 @@ ReturnValue_t CoreController::timeFileHandler() {
     }
     std::string fileName = currMntPrefix + TIME_FILE;
     std::ofstream timeFile(fileName);
-//    if (not timeFile.good()) {
-//      sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
-//                 << std::endl;
-//      return RETURN_FAILED;
-//    }
+    if (not timeFile.good()) {
+      sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
+                 << std::endl;
+      return RETURN_FAILED;
+    }
     timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
   }
   return RETURN_OK;

From bb397a58de9fa1fc96b683d7d4f73ae6496b49d6 Mon Sep 17 00:00:00 2001
From: Jakob Meier <meier-jakob@gmx.de>
Date: Fri, 13 May 2022 10:47:10 +0200
Subject: [PATCH 10/12] event with packet number for which mpsoc update failed

---
 linux/devices/ploc/PlocSupvHelper.cpp | 7 +++++++
 linux/devices/ploc/PlocSupvHelper.h   | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/linux/devices/ploc/PlocSupvHelper.cpp b/linux/devices/ploc/PlocSupvHelper.cpp
index c5214ca6..bacbd850 100644
--- a/linux/devices/ploc/PlocSupvHelper.cpp
+++ b/linux/devices/ploc/PlocSupvHelper.cpp
@@ -11,6 +11,7 @@
 
 #include "fsfw/globalfunctions/CRC.h"
 #include "fsfw/timemanager/Countdown.h"
+#include "fsfw/tasks/TaskFactory.h"
 #include "mission/utility/Filenaming.h"
 #include "mission/utility/ProgressPrinter.h"
 #include "mission/utility/Timestamp.h"
@@ -158,6 +159,7 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
   uint16_t dataLength = 0;
   size_t bytesWritten = 0;
   uint16_t sequenceCount = 1;
+  uint32_t packetNum = 1;
   supv::SequenceFlags seqFlags = supv::SequenceFlags::FIRST_PKT;
   while (remainingSize > 0) {
     if (terminate) {
@@ -193,8 +195,10 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
                              update.startAddress + bytesWritten, dataLength, tempData);
     result = handlePacketTransmission(packet);
     if (result != RETURN_OK) {
+      triggerEvent(WRITE_MEMORY_FAILED, packetNum);
       return result;
     }
+    packetNum += 1;
     bytesWritten += dataLength;
 #if OBSW_DEBUG_PLOC_SUPERVISOR == 1
     progressPrinter.print(bytesWritten);
@@ -373,6 +377,9 @@ ReturnValue_t PlocSupvHelper::receive(uint8_t* data, size_t* readBytes, size_t r
   if (*readBytes > 0) {
     std::memcpy(data, buffer, *readBytes);
   }
+  else {
+    TaskFactory::delayTask(40);
+  }
   return result;
 }
 
diff --git a/linux/devices/ploc/PlocSupvHelper.h b/linux/devices/ploc/PlocSupvHelper.h
index cf433ca8..e50693a8 100644
--- a/linux/devices/ploc/PlocSupvHelper.h
+++ b/linux/devices/ploc/PlocSupvHelper.h
@@ -78,6 +78,9 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
   //! P1: Return value
   //! P2: Apid of command for which the reception of the execution report failed
   static const Event EXE_RECEPTION_FAILURE = MAKE_EVENT(16, severity::LOW);
+  //! [EXPORT] : [COMMENT] Update procedure failed when sending packet with number P1
+  //! P1: Packet number for which the memory write command fails
+  static const Event WRITE_MEMORY_FAILED = MAKE_EVENT(17, severity::LOW);
 
   PlocSupvHelper(object_id_t objectId);
   virtual ~PlocSupvHelper();
@@ -178,7 +181,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
   ReturnValue_t performUpdate();
   ReturnValue_t performEventBufferRequest();
   ReturnValue_t handlePacketTransmission(SpacePacket& packet,
-                                         uint32_t timeoutExecutionReport = 1000);
+                                         uint32_t timeoutExecutionReport = 2000);
   ReturnValue_t sendCommand(SpacePacket& packet);
   /**
    * @brief Function which reads form the communication interface

From 54d739246767b5c8d0c5c287f26d81098ee9993d Mon Sep 17 00:00:00 2001
From: Cleanroom Laptop L15 <meierj@irs.uni-stuttgart.de>
Date: Fri, 13 May 2022 18:37:16 +0200
Subject: [PATCH 11/12] improved mpsoc update handling

---
 fsfw                                                        | 2 +-
 linux/devices/devicedefinitions/PlocSupervisorDefinitions.h | 6 +++++-
 linux/devices/ploc/PlocSupvHelper.cpp                       | 6 +++---
 tmtc                                                        | 2 +-
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/fsfw b/fsfw
index c0ff84bb..dafcaa60 160000
--- a/fsfw
+++ b/fsfw
@@ -1 +1 @@
-Subproject commit c0ff84bb9d81bc3444992fef38b74d260d54d5a0
+Subproject commit dafcaa60079ba8e57753d389e6a569ee3eb0b7cb
diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h
index f71eaa17..4cefc552 100644
--- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h
+++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h
@@ -309,6 +309,10 @@ class ApidOnlyPacket : public SpacePacket {
  */
 class MPSoCBootSelect : public SpacePacket {
  public:
+
+	static const uint8_t NVM0 = 0;
+	static const uint8_t NVM1 = 1;
+
   /**
    * @brief   Constructor
    *
@@ -317,7 +321,7 @@ class MPSoCBootSelect : public SpacePacket {
    * @param bp1   Partition pin 1
    * @param bp2   Partition pin 2
    */
-  MPSoCBootSelect(uint8_t mem, uint8_t bp0, uint8_t bp1, uint8_t bp2)
+  MPSoCBootSelect(uint8_t mem = 0, uint8_t bp0 = 0, uint8_t bp1 = 0, uint8_t bp2 = 0)
       : SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SEL_MPSOC_BOOT_IMAGE, DEFAULT_SEQUENCE_COUNT),
         mem(mem),
         bp0(bp0),
diff --git a/linux/devices/ploc/PlocSupvHelper.cpp b/linux/devices/ploc/PlocSupvHelper.cpp
index bacbd850..167c7932 100644
--- a/linux/devices/ploc/PlocSupvHelper.cpp
+++ b/linux/devices/ploc/PlocSupvHelper.cpp
@@ -10,8 +10,8 @@
 #endif
 
 #include "fsfw/globalfunctions/CRC.h"
-#include "fsfw/timemanager/Countdown.h"
 #include "fsfw/tasks/TaskFactory.h"
+#include "fsfw/timemanager/Countdown.h"
 #include "mission/utility/Filenaming.h"
 #include "mission/utility/ProgressPrinter.h"
 #include "mission/utility/Timestamp.h"
@@ -164,6 +164,7 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
   while (remainingSize > 0) {
     if (terminate) {
       terminate = false;
+      triggerEvent(TERMINATED_UPDATE_PROCEDURE);
       return PROCESS_TERMINATED;
     }
     if (remainingSize > supv::WriteMemory::CHUNK_MAX) {
@@ -376,8 +377,7 @@ ReturnValue_t PlocSupvHelper::receive(uint8_t* data, size_t* readBytes, size_t r
   }
   if (*readBytes > 0) {
     std::memcpy(data, buffer, *readBytes);
-  }
-  else {
+  } else {
     TaskFactory::delayTask(40);
   }
   return result;
diff --git a/tmtc b/tmtc
index a6818502..bc02c9d6 160000
--- a/tmtc
+++ b/tmtc
@@ -1 +1 @@
-Subproject commit a681850248fdf33c948b8cbda84acdf268d28669
+Subproject commit bc02c9d6076dc3f6e0b37a67be04a445245fdd1e

From a6abeb697f2352e877780f8bf967ea8f19f99e20 Mon Sep 17 00:00:00 2001
From: Robin Mueller <muellerr@irs.uni-stuttgart.de>
Date: Mon, 16 May 2022 15:09:02 +0200
Subject: [PATCH 12/12] comment

---
 linux/devices/ploc/PlocMPSoCHandler.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/linux/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h
index 17014270..e2950885 100644
--- a/linux/devices/ploc/PlocMPSoCHandler.h
+++ b/linux/devices/ploc/PlocMPSoCHandler.h
@@ -108,6 +108,9 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
   MessageQueueIF* eventQueue = nullptr;
   MessageQueueIF* commandActionHelperQueue = nullptr;
 
+  // Initiate the sequence count with the maximum value. It is incremented before
+  // a packet is sent, so the first value will be 0 accordingly using
+  // the wrap around of the counter.
   SourceSequenceCounter sequenceCount =
       SourceSequenceCounter(SpacePacketBase::LIMIT_SEQUENCE_COUNT - 1);