v1.10.0 #220

Merged
meierj merged 592 commits from develop into main 2022-04-22 07:42:20 +02:00
3 changed files with 197 additions and 190 deletions
Showing only changes of commit 595b9aff6c - Show all commits

View File

@ -78,7 +78,7 @@ public:
* @brief Constructor
*
* @param sequenceCount Sequence count of space packet which will be incremented with each
* sent and received packet.s
* sent and received packets.
*/
TcBase(uint16_t apid, uint16_t sequenceCount) :
SpacePacket(INIT_LENGTH, true, apid, sequenceCount) {

View File

@ -1,15 +1,14 @@
#include "PlocMPSoCHelper.h"
#include "mission/utility/Timestamp.h"
#include "bsp_q7s/memory/FileSystemHelper.h"
#include <fstream>
#include <filesystem>
#include <fstream>
PlocMPSoCHelper::PlocMPSoCHelper(object_id_t objectId) : SystemObject(objectId){
#include "bsp_q7s/memory/FileSystemHelper.h"
#include "mission/utility/Timestamp.h"
}
PlocMPSoCHelper::PlocMPSoCHelper(object_id_t objectId) : SystemObject(objectId) {}
PlocMPSoCHelper::~PlocMPSoCHelper() {
}
PlocMPSoCHelper::~PlocMPSoCHelper() {}
ReturnValue_t PlocMPSoCHelper::initialize() {
sdcMan = SdCardManager::instance();
@ -33,8 +32,7 @@ ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) {
result = performFlashWrite();
if (result == RETURN_OK) {
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL);
}
else {
} else {
triggerEvent(MPSOC_FLASH_WRITE_FAILED);
}
internalState = InternalState::IDLE;
@ -56,9 +54,7 @@ ReturnValue_t PlocMPSoCHelper::setComIF(DeviceCommunicationIF* communicationInte
return RETURN_OK;
}
void PlocMPSoCHelper::setComCookie(CookieIF* comCookie_) {
comCookie = comCookie_;
}
void PlocMPSoCHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
sequenceCount = sequenceCount_;
@ -80,9 +76,7 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string file) {
return RETURN_OK;
}
void PlocMPSoCHelper::stopProcess() {
terminate = true;
}
void PlocMPSoCHelper::stopProcess() { terminate = true; }
ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
ReturnValue_t result = RETURN_OK;
@ -99,12 +93,11 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
}
if (remainingSize > mpsoc::MAX_DATA_SIZE) {
dataLength = mpsoc::MAX_DATA_SIZE;
}
else {
} else {
dataLength = remainingSize;
}
file.read(reinterpret_cast<char*>(tempData), dataLength);
sequenceCount++;
(*sequenceCount)++;
mpsoc::FlashWrite tc(*sequenceCount);
tc.createPacket(tempData, dataLength);
result = sendCommand(&tc);
@ -123,6 +116,21 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
return result;
}
ReturnValue_t PlocMPSoCHelper::flashfopen() {
ReturnValue_t result = RETURN_OK;
(*sequenceCount)++;
mpsoc::FlashFopen flashFopen(*sequenceCount);
sendCommand(&flashFopen);
result = flashFopen.createPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
return result;
}
copyToCommandBuffer(&flashFopen);
return RETURN_OK;
}
ReturnValue_t PlocMPSoCHelper::flashfclose() {}
ReturnValue_t PlocMPSoCHelper::sendCommand(mpsoc::TcBase* tc) {
ReturnValue_t result = RETURN_OK;
result = uartComIF->sendMessage(comCookie, tc->getWholeData(), tc->getFullSize());
@ -154,8 +162,7 @@ void PlocMPSoCHelper::handleAckApidFailure(uint16_t apid) {
triggerEvent(ACK_FAILURE_REPORT, static_cast<uint32_t>(internalState));
sif::warning << "PlocMPSoCHelper::handleAckApidFailure: Received acknowledgement failure "
<< "report" << std::endl;
}
else {
} else {
triggerEvent(ACK_INVALID_APID, apid, static_cast<uint32_t>(internalState));
sif::warning << "PlocMPSoCHelper::handleAckApidFailure: Expected acknowledgement report "
<< "but received space packet with apid " << std::hex << apid << std::endl;
@ -182,8 +189,7 @@ void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
triggerEvent(EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
sif::warning << "PlocMPSoCHelper::handleExeApidFailure: Received execution failure "
<< "report" << std::endl;
}
else {
} else {
triggerEvent(EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
sif::warning << "PlocMPSoCHelper::handleAckApidFailure: Expected execution report "
<< "but received space packet with apid " << std::hex << apid << std::endl;
@ -234,8 +240,7 @@ ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t
result = uartComIF->readReceivedMessage(comCookie, &data, readBytes);
if (result != RETURN_OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl;
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result,
static_cast<uint32_t>(internalState));
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
return RETURN_FAILED;
}
return result;

View File

@ -135,6 +135,8 @@ private:
SourceSequenceCounter* sequenceCount;
ReturnValue_t performFlashWrite();
ReturnValue_t flashfopen();
ReturnValue_t flashfclose();
ReturnValue_t sendCommand(mpsoc::TcBase* tc);
ReturnValue_t receive(uint8_t* data, size_t* readBytes, size_t requestBytes);
ReturnValue_t handleAck();