From bb397a58de9fa1fc96b683d7d4f73ae6496b49d6 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 13 May 2022 10:47:10 +0200 Subject: [PATCH] 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