that did not help
All checks were successful
EIVE/eive-obsw/pipeline/pr-v2.1.0-dev This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-v2.1.0-dev This commit looks good
This commit is contained in:
parent
c3b6b0a7ee
commit
0179c04472
@ -198,6 +198,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
|
||||
while (readSoFar < flashReadAndWrite.totalReadSize) {
|
||||
if (terminate) {
|
||||
std::filesystem::remove(flashReadAndWrite.obcFile, e);
|
||||
// TODO: Might not be needed
|
||||
flashfclose();
|
||||
return returnvalue::OK;
|
||||
}
|
||||
@ -208,6 +209,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
|
||||
sif::debug << "reading " << nextReadSize << " bytes from offset " << readSoFar << std::endl;
|
||||
if (ofile.bad() or not ofile.is_open()) {
|
||||
std::filesystem::remove(flashReadAndWrite.obcFile, e);
|
||||
// TODO: Might not be needed
|
||||
flashfclose();
|
||||
return FILE_READ_ERROR;
|
||||
}
|
||||
@ -215,12 +217,14 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
|
||||
result = flashReadRequest.setPayload(nextReadSize);
|
||||
if (result != returnvalue::OK) {
|
||||
std::filesystem::remove(flashReadAndWrite.obcFile, e);
|
||||
// TODO: Might not be needed
|
||||
flashfclose();
|
||||
return result;
|
||||
}
|
||||
result = flashReadRequest.finishPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
std::filesystem::remove(flashReadAndWrite.obcFile, e);
|
||||
// TODO: Might not be needed
|
||||
flashfclose();
|
||||
return result;
|
||||
}
|
||||
@ -228,7 +232,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
|
||||
result = handlePacketTransmissionFlashRead(flashReadRequest, ofile, nextReadSize);
|
||||
if (result != returnvalue::OK) {
|
||||
std::filesystem::remove(flashReadAndWrite.obcFile, e);
|
||||
sif::debug << "flash close" << std::endl;
|
||||
// TODO: Might not be needed
|
||||
flashfclose();
|
||||
return result;
|
||||
}
|
||||
@ -283,7 +287,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionFlashRead(mpsoc
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
// ccsds::HEADER_LEN + mpsoc::FLASH_READ_MIN_OVERHEAD + tc.readSize + mpsoc::CRC_SIZE
|
||||
result = handleTmReception();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -296,6 +299,10 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionFlashRead(mpsoc
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
result = handleTmReception();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return handleExe();
|
||||
} else if (spReader.getApid() == mpsoc::apid::EXE_FAILURE) {
|
||||
handleExeFailure();
|
||||
@ -322,6 +329,8 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionNoReply(ploc::S
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::sendCommand(ploc::SpTcBase& tc) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sif::debug << "sending TC" << std::endl;
|
||||
arrayprinter::print(tc.getFullPacket(), tc.getFullPacketLen());
|
||||
result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
|
||||
@ -419,7 +428,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception() {
|
||||
usleepDelay *= 4;
|
||||
}
|
||||
}
|
||||
sif::debug << "recvd first 6 bytes" << std::endl;
|
||||
// sif::debug << "recvd first 6 bytes" << std::endl;
|
||||
while (true) {
|
||||
if (tmCountdown.hasTimedOut()) {
|
||||
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
|
||||
@ -428,7 +437,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception() {
|
||||
result = receive(tmBuf.data() + readBytes, fullPacketLen - readBytes, ¤tBytes);
|
||||
readBytes += currentBytes;
|
||||
if (fullPacketLen == readBytes) {
|
||||
sif::debug << "recvd full " << fullPacketLen << std::endl;
|
||||
// sif::debug << "recvd full " << fullPacketLen << std::endl;
|
||||
break;
|
||||
}
|
||||
usleep(usleepDelay);
|
||||
@ -436,6 +445,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception() {
|
||||
usleepDelay *= 4;
|
||||
}
|
||||
}
|
||||
arrayprinter::print(tmBuf.data(), readBytes);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -375,8 +375,9 @@ class FlashFopen : public TcBase {
|
||||
return result;
|
||||
}
|
||||
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||
payloadStart[nameSize] = NULL_TERMINATOR;
|
||||
payloadStart[255] = NULL_TERMINATOR;
|
||||
// payloadStart[nameSize] = NULL_TERMINATOR;
|
||||
std::memset(payloadStart + nameSize, 0, 256 - nameSize);
|
||||
// payloadStart[255] = NULL_TERMINATOR;
|
||||
payloadStart[256] = static_cast<uint8_t>(accessMode);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
@ -445,7 +446,7 @@ class TcFlashRead : public TcBase {
|
||||
sif::error << "TcFlashRead: Read length " << readLen << " too large" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
spParams.setFullPayloadLen(readLen + FLASH_READ_MIN_OVERHEAD + CRC_SIZE);
|
||||
spParams.setFullPayloadLen(sizeof(uint32_t) + CRC_SIZE);
|
||||
ReturnValue_t result = checkPayloadLen();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user