bugfixes and improvements
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
This commit is contained in:
parent
37211e2c5f
commit
cc863503ac
@ -359,7 +359,7 @@ void FreshMpsocHandler::handleTransitionToOn() {
|
|||||||
void FreshMpsocHandler::handleTransitionToOff() {
|
void FreshMpsocHandler::handleTransitionToOff() {
|
||||||
if (handleHwShutdown()) {
|
if (handleHwShutdown()) {
|
||||||
hkReport.setReportingEnabled(false);
|
hkReport.setReportingEnabled(false);
|
||||||
setMode(MODE_OFF);
|
setMode(MODE_OFF, 0);
|
||||||
transitionState = TransitionState::NONE;
|
transitionState = TransitionState::NONE;
|
||||||
activeCmdInfo.reset();
|
activeCmdInfo.reset();
|
||||||
powerState = PowerState::IDLE;
|
powerState = PowerState::IDLE;
|
||||||
@ -476,6 +476,23 @@ ReturnValue_t FreshMpsocHandler::executeRegularCmd(ActionId_t actionId,
|
|||||||
result = commandTcMemRead(commandData, commandDataLen);
|
result = commandTcMemRead(commandData, commandDataLen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case (mpsoc::TC_FLASHFOPEN): {
|
||||||
|
mpsoc::TcFlashFopen cmd(spParams, commandSequenceCount);
|
||||||
|
// C string constructor.
|
||||||
|
std::string filename = std::string(reinterpret_cast<const char*>(commandData));
|
||||||
|
if (filename.size() > mpsoc::MAX_FILENAME_SIZE) {
|
||||||
|
return mpsoc::NAME_TOO_LONG;
|
||||||
|
}
|
||||||
|
uint8_t mode = commandData[filename.size() + 2];
|
||||||
|
cmd.setPayload(filename, mode);
|
||||||
|
result = finishAndSendTc(actionId, cmd);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (mpsoc::TC_FLASHFCLOSE): {
|
||||||
|
mpsoc::TcFlashFclose cmd(spParams, commandSequenceCount);
|
||||||
|
result = finishAndSendTc(actionId, cmd);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case (mpsoc::TC_FLASHDELETE): {
|
case (mpsoc::TC_FLASHDELETE): {
|
||||||
result = commandTcFlashDelete(commandData, commandDataLen);
|
result = commandTcFlashDelete(commandData, commandDataLen);
|
||||||
break;
|
break;
|
||||||
@ -518,6 +535,7 @@ ReturnValue_t FreshMpsocHandler::executeRegularCmd(ActionId_t actionId,
|
|||||||
}
|
}
|
||||||
mpsoc::TcFlashMkfs cmd(spParams, commandSequenceCount,
|
mpsoc::TcFlashMkfs cmd(spParams, commandSequenceCount,
|
||||||
static_cast<mpsoc::FlashId>(commandData[0]));
|
static_cast<mpsoc::FlashId>(commandData[0]));
|
||||||
|
sif::info << "PLOC MPSoC: Formatting Flash " << (int)commandData[0] << std::endl;
|
||||||
result = finishAndSendTc(actionId, cmd, mpsoc::CMD_TIMEOUT_MKFS);
|
result = finishAndSendTc(actionId, cmd, mpsoc::CMD_TIMEOUT_MKFS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -541,6 +559,10 @@ ReturnValue_t FreshMpsocHandler::executeRegularCmd(ActionId_t actionId,
|
|||||||
result = commandTcSimplexStreamFile(commandData, commandDataLen);
|
result = commandTcSimplexStreamFile(commandData, commandDataLen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case (mpsoc::TC_SIMPLEX_STORE_FILE): {
|
||||||
|
result = commandTcSimplexStoreFile(commandData, commandDataLen);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case (mpsoc::TC_DOWNLINK_DATA_MODULATE): {
|
case (mpsoc::TC_DOWNLINK_DATA_MODULATE): {
|
||||||
result = commandTcDownlinkDataModulate(commandData, commandDataLen);
|
result = commandTcDownlinkDataModulate(commandData, commandDataLen);
|
||||||
break;
|
break;
|
||||||
@ -590,7 +612,7 @@ ReturnValue_t FreshMpsocHandler::commandTcMemRead(const uint8_t* commandData,
|
|||||||
|
|
||||||
ReturnValue_t FreshMpsocHandler::commandTcFlashDelete(const uint8_t* commandData,
|
ReturnValue_t FreshMpsocHandler::commandTcFlashDelete(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
if (commandDataLen > mpsoc::FILENAME_FIELD_SIZE) {
|
||||||
return mpsoc::NAME_TOO_LONG;
|
return mpsoc::NAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
@ -224,7 +224,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
|
|||||||
|
|
||||||
ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(uint8_t mode) {
|
ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(uint8_t mode) {
|
||||||
spParams.buf = commandBuffer;
|
spParams.buf = commandBuffer;
|
||||||
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
|
mpsoc::TcFlashFopen flashFopen(spParams, *sequenceCount);
|
||||||
ReturnValue_t result = flashFopen.setPayload(flashReadAndWrite.mpsocFile, mode);
|
ReturnValue_t result = flashFopen.setPayload(flashReadAndWrite.mpsocFile, mode);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -243,7 +243,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(uint8_t mode) {
|
|||||||
|
|
||||||
ReturnValue_t PlocMpsocSpecialComHelper::flashfclose() {
|
ReturnValue_t PlocMpsocSpecialComHelper::flashfclose() {
|
||||||
spParams.buf = commandBuffer;
|
spParams.buf = commandBuffer;
|
||||||
mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
|
mpsoc::TcFlashFclose flashFclose(spParams, *sequenceCount);
|
||||||
ReturnValue_t result = flashFclose.finishPacket();
|
ReturnValue_t result = flashFclose.finishPacket();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
#include <mission/payload/plocSpBase.h>
|
#include <mission/payload/plocSpBase.h>
|
||||||
|
|
||||||
#include "eive/definitions.h"
|
|
||||||
#include "eive/eventSubsystemIds.h"
|
#include "eive/eventSubsystemIds.h"
|
||||||
#include "eive/resultClassIds.h"
|
#include "eive/resultClassIds.h"
|
||||||
#include "fsfw/action/HasActionsIF.h"
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
@ -245,7 +244,9 @@ static constexpr size_t CRC_SIZE = 2;
|
|||||||
*/
|
*/
|
||||||
static const uint8_t SIZE_MEM_READ_RPT_FIX = 6;
|
static const uint8_t SIZE_MEM_READ_RPT_FIX = 6;
|
||||||
|
|
||||||
static const size_t MAX_FILENAME_SIZE = 256;
|
static const size_t FILENAME_FIELD_SIZE = 256;
|
||||||
|
// Subtract size of NULL terminator.
|
||||||
|
static const size_t MAX_FILENAME_SIZE = FILENAME_FIELD_SIZE - 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PLOC space packet length for fixed size packets. This is the size of the whole packet data
|
* PLOC space packet length for fixed size packets. This is the size of the whole packet data
|
||||||
@ -448,23 +449,21 @@ class TcMemWrite : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Class to help creation of flash fopen command.
|
* @brief Class to help creation of flash fopen command.
|
||||||
*/
|
*/
|
||||||
class FlashFopen : public TcBase {
|
class TcFlashFopen : public TcBase {
|
||||||
public:
|
public:
|
||||||
FlashFopen(ploc::SpTcParams params, uint16_t sequenceCount)
|
TcFlashFopen(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
: TcBase(params, apid::TC_FLASHFOPEN, sequenceCount) {}
|
: TcBase(params, apid::TC_FLASHFOPEN, sequenceCount) {}
|
||||||
|
|
||||||
ReturnValue_t setPayload(std::string filename, uint8_t mode) {
|
ReturnValue_t setPayload(std::string filename, uint8_t mode) {
|
||||||
accessMode = mode;
|
accessMode = mode;
|
||||||
size_t nameSize = filename.size();
|
size_t nameSize = filename.size();
|
||||||
spParams.setFullPayloadLen(256 + sizeof(uint8_t) + CRC_SIZE);
|
spParams.setFullPayloadLen(FILENAME_FIELD_SIZE + CRC_SIZE);
|
||||||
ReturnValue_t result = checkPayloadLen();
|
ReturnValue_t result = checkPayloadLen();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
std::memset(payloadStart, 0, FILENAME_FIELD_SIZE);
|
||||||
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||||
// payloadStart[nameSize] = NULL_TERMINATOR;
|
|
||||||
std::memset(payloadStart + nameSize, 0, 256 - nameSize);
|
|
||||||
// payloadStart[255] = NULL_TERMINATOR;
|
|
||||||
payloadStart[256] = accessMode;
|
payloadStart[256] = accessMode;
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -476,9 +475,9 @@ class FlashFopen : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Class to help creation of flash fclose command.
|
* @brief Class to help creation of flash fclose command.
|
||||||
*/
|
*/
|
||||||
class FlashFclose : public TcBase {
|
class TcFlashFclose : public TcBase {
|
||||||
public:
|
public:
|
||||||
FlashFclose(ploc::SpTcParams params, uint16_t sequenceCount)
|
TcFlashFclose(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
: TcBase(params, apid::TC_FLASHFCLOSE, sequenceCount) {
|
: TcBase(params, apid::TC_FLASHFCLOSE, sequenceCount) {
|
||||||
spParams.setFullPayloadLen(CRC_SIZE);
|
spParams.setFullPayloadLen(CRC_SIZE);
|
||||||
}
|
}
|
||||||
@ -506,7 +505,13 @@ class TcFlashMkfs : public TcBase {
|
|||||||
TcFlashMkfs(ploc::SpTcParams params, uint16_t sequenceCount, FlashId flashId)
|
TcFlashMkfs(ploc::SpTcParams params, uint16_t sequenceCount, FlashId flashId)
|
||||||
: TcBase(params, apid::TC_FLASH_MKFS, sequenceCount) {
|
: TcBase(params, apid::TC_FLASH_MKFS, sequenceCount) {
|
||||||
spParams.setFullPayloadLen(1 + CRC_SIZE);
|
spParams.setFullPayloadLen(1 + CRC_SIZE);
|
||||||
payloadStart[0] = flashId;
|
const char* flashIdStr = "0:/";
|
||||||
|
if (flashId == FlashId::FLASH_1) {
|
||||||
|
flashIdStr = "1:/";
|
||||||
|
}
|
||||||
|
std::memcpy(payloadStart, flashIdStr, 3);
|
||||||
|
// Null terminator
|
||||||
|
payloadStart[3] = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -595,20 +600,14 @@ class TcFlashDelete : public TcBase {
|
|||||||
|
|
||||||
ReturnValue_t setPayload(std::string filename) {
|
ReturnValue_t setPayload(std::string filename) {
|
||||||
size_t nameSize = filename.size();
|
size_t nameSize = filename.size();
|
||||||
spParams.setFullPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE);
|
spParams.setFullPayloadLen(FILENAME_FIELD_SIZE + CRC_SIZE);
|
||||||
auto res = checkPayloadLen();
|
auto res = checkPayloadLen();
|
||||||
if (res != returnvalue::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||||
*(payloadStart + nameSize) = NULL_TERMINATOR;
|
*(payloadStart + nameSize) = NULL_TERMINATOR;
|
||||||
|
return returnvalue::OK;
|
||||||
updateSpFields();
|
|
||||||
res = checkSizeAndSerializeHeader();
|
|
||||||
if (res != returnvalue::OK) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
return calcAndSetCrc();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -760,8 +759,9 @@ class TcGetDirContent : public TcBase {
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
std::memset(payloadStart, 0, 256);
|
||||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||||
payloadStart[255] = '\0';
|
payloadStart[255] = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -802,7 +802,7 @@ class TcReplayWriteSeq : public TcBase {
|
|||||||
static const size_t USE_DECODING_LENGTH = 1;
|
static const size_t USE_DECODING_LENGTH = 1;
|
||||||
|
|
||||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||||
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE or
|
if (commandDataLen > USE_DECODING_LENGTH + FILENAME_FIELD_SIZE or
|
||||||
checkPayloadLen() != returnvalue::OK) {
|
checkPayloadLen() != returnvalue::OK) {
|
||||||
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
|
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -821,18 +821,18 @@ class FlashBasePusCmd {
|
|||||||
virtual ~FlashBasePusCmd() = default;
|
virtual ~FlashBasePusCmd() = default;
|
||||||
|
|
||||||
virtual ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) {
|
virtual ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) {
|
||||||
if (commandDataLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE + MAX_FILENAME_SIZE)) {
|
if (commandDataLen > FILENAME_FIELD_SIZE) {
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
size_t fileLen = strnlen(reinterpret_cast<const char*>(commandData), commandDataLen);
|
size_t fileLen = strnlen(reinterpret_cast<const char*>(commandData), commandDataLen);
|
||||||
if (fileLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE)) {
|
if (fileLen > MAX_FILENAME_SIZE) {
|
||||||
return FILENAME_TOO_LONG;
|
return FILENAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
obcFile = std::string(reinterpret_cast<const char*>(commandData), fileLen);
|
obcFile = std::string(reinterpret_cast<const char*>(commandData), fileLen);
|
||||||
fileLen =
|
fileLen =
|
||||||
strnlen(reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR),
|
strnlen(reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR),
|
||||||
commandDataLen - obcFile.size() - 1);
|
commandDataLen - obcFile.size() - 1);
|
||||||
if (fileLen > MAX_FILENAME_SIZE) {
|
if (fileLen > FILENAME_FIELD_SIZE) {
|
||||||
return MPSOC_FILENAME_TOO_LONG;
|
return MPSOC_FILENAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
mpsocFile = std::string(
|
mpsocFile = std::string(
|
||||||
@ -921,15 +921,15 @@ class TcCamTakePic : public TcBase {
|
|||||||
size_t deserLen = commandDataLen;
|
size_t deserLen = commandDataLen;
|
||||||
size_t serLen = 0;
|
size_t serLen = 0;
|
||||||
fileName = reinterpret_cast<const char*>(commandData);
|
fileName = reinterpret_cast<const char*>(commandData);
|
||||||
if (fileName.size() + sizeof(NULL_TERMINATOR) > FILENAME_LEN) {
|
if (fileName.size() > MAX_FILENAME_SIZE) {
|
||||||
return FILENAME_TOO_LONG;
|
return FILENAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
deserLen -= FILENAME_LEN;
|
deserLen -= fileName.length() + 1;
|
||||||
*dataPtr += FILENAME_LEN;
|
*dataPtr += fileName.length() + 1;
|
||||||
uint8_t** payloadPtr = &payloadStart;
|
uint8_t** payloadPtr = &payloadStart;
|
||||||
memcpy(payloadStart, fileName.data(), fileName.size());
|
memcpy(payloadStart, fileName.data(), fileName.size());
|
||||||
*payloadStart += FILENAME_LEN;
|
*payloadPtr += FILENAME_FIELD_SIZE;
|
||||||
serLen += FILENAME_LEN;
|
serLen += FILENAME_FIELD_SIZE;
|
||||||
ReturnValue_t result = SerializeAdapter::deSerialize(&encoderSettingY, dataPtr, &deserLen,
|
ReturnValue_t result = SerializeAdapter::deSerialize(&encoderSettingY, dataPtr, &deserLen,
|
||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
@ -1022,8 +1022,7 @@ class TcCamTakePic : public TcBase {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static const size_t PARAMETER_SIZE = 28;
|
static const size_t PARAMETER_SIZE = 28;
|
||||||
static constexpr size_t FILENAME_LEN = 64;
|
static constexpr size_t FULL_PAYLOAD_SIZE = FILENAME_FIELD_SIZE + PARAMETER_SIZE;
|
||||||
static constexpr size_t FULL_PAYLOAD_SIZE = FILENAME_LEN + PARAMETER_SIZE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1039,7 +1038,7 @@ class TcSimplexStreamFile : public TcBase {
|
|||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
std::string fileName(reinterpret_cast<const char*>(commandData));
|
std::string fileName(reinterpret_cast<const char*>(commandData));
|
||||||
if (fileName.size() + sizeof(NULL_TERMINATOR) > MAX_FILENAME_SIZE) {
|
if (fileName.size() > MAX_FILENAME_SIZE) {
|
||||||
return FILENAME_TOO_LONG;
|
return FILENAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1080,7 +1079,7 @@ class TcSimplexStoreFile : public TcBase {
|
|||||||
return INVALID_PARAMETER;
|
return INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
std::string fileName(reinterpret_cast<const char*>(*dataPtr));
|
std::string fileName(reinterpret_cast<const char*>(*dataPtr));
|
||||||
if (fileName.size() + sizeof(NULL_TERMINATOR) > MAX_FILENAME_SIZE) {
|
if (fileName.size() + sizeof(NULL_TERMINATOR) > FILENAME_FIELD_SIZE) {
|
||||||
return FILENAME_TOO_LONG;
|
return FILENAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
size_t currentCopyIdx = 0;
|
size_t currentCopyIdx = 0;
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit dfa45dbdba16d2190616eca6ba1dc13e94692b63
|
Subproject commit a59aceda751bd1594b91c632fe0ae85b844707df
|
Loading…
x
Reference in New Issue
Block a user