PLOC SUPV update 2 #324

Merged
muellerr merged 10 commits from mueller/tas_ploc_supv_update_2 into develop 2022-11-24 14:48:23 +01:00
4 changed files with 15 additions and 32 deletions
Showing only changes of commit c7b90fb8e0 - Show all commits

View File

@ -578,8 +578,8 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
// }
tmReader.setData(start, remainingSize);
sif::debug << "PlocSupervisorHandler::scanForReply: Received Packet" << std::endl;
arrayprinter::print(start, remainingSize);
// sif::debug << "PlocSupervisorHandler::scanForReply: Received Packet" << std::endl;
// arrayprinter::print(start, remainingSize);
uint16_t apid = tmReader.getModuleApid();
switch (apid) {

View File

@ -68,8 +68,8 @@ ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
// Use non-canonical mode and clear echo flag
tty.c_lflag &= ~(ICANON | ECHO);
// Blocking mode, 0.5 seconds timeout
tty.c_cc[VTIME] = 5;
// Blocking mode, 0.2 seconds timeout
tty.c_cc[VTIME] = 2;
tty.c_cc[VMIN] = 0;
uart::setBaudrate(tty, uartCookie->getBaudrate());
@ -429,8 +429,7 @@ ReturnValue_t PlocSupvUartManager::writeUpdatePackets() {
update.bytesWritten);
return result;
}
result = handlePacketTransmissionNoReply(packet);
// result = encodeAndSendPacket(packet.getFullPacket(), packet.getFullPacketLen());
result = handlePacketTransmissionNoReply(packet, 2000);
if (result != returnvalue::OK) {
triggerEvent(WRITE_MEMORY_FAILED, buildProgParams1(progPercent, update.sequenceCount),
update.bytesWritten);
@ -494,19 +493,6 @@ uint32_t PlocSupvUartManager::buildProgParams1(uint8_t percent, uint16_t seqCoun
// return result;
// }
ReturnValue_t PlocSupvUartManager::handleRemainingExeReport(ploc::SpTmReader& reader) {
size_t remBytes = reader.getPacketDataLen() + 1;
ReturnValue_t result = handleTmReception(remBytes, tmBuf.data() + ccsds::HEADER_LEN);
if (result != returnvalue::OK) {
sif::warning << "Reading exe failure report failed" << std::endl;
}
result = exeReportHandling();
if (result != returnvalue::OK) {
sif::warning << "Handling exe report failed" << std::endl;
}
return result;
}
ReturnValue_t PlocSupvUartManager::selectMemory() {
ReturnValue_t result = returnvalue::OK;
resetSpParams();
@ -515,7 +501,7 @@ ReturnValue_t PlocSupvUartManager::selectMemory() {
if (result != returnvalue::OK) {
return result;
}
result = handlePacketTransmissionNoReply(packet);
result = handlePacketTransmissionNoReply(packet, 2000);
if (result != returnvalue::OK) {
return result;
}
@ -580,7 +566,6 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
if (not ackReceived) {
retval = handleAckReception(packet, packetLen);
if (retval == 1) {
sif::debug << "ACK received" << std::endl;
ackReceived = true;
packetWasHandled = true;
} else if (retval == -1) {
@ -589,7 +574,6 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
} else {
retval = handleExeAckReception(packet, packetLen);
if (retval == 1) {
sif::debug << "EXE ACK received" << std::endl;
break;
} else if (retval == -1) {
return returnvalue::FAILED;
@ -601,7 +585,7 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
decodedRingBuf.deleteData(packetLen);
}
} else {
TaskFactory::delayTask(50);
TaskFactory::delayTask(20);
}
if (countdown.hasTimedOut()) {
return result::NO_REPLY_TIMEOUT;
@ -777,7 +761,6 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand(uint8_t failStep) {
if (retval == 1) {
packetWasHandled = true;
exeReceived = true;
break;
} else if (retval == -1) {
return returnvalue::FAILED;
}
@ -795,7 +778,6 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand(uint8_t failStep) {
result = report.verifyCrc(update.crc);
if (result == returnvalue::OK) {
triggerEvent(SUPV_MEM_CHECK_OK, result);
return result;
} else {
sif::warning
@ -813,7 +795,7 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand(uint8_t failStep) {
decodedRingBuf.deleteData(packetLen);
}
} else {
TaskFactory::delayTask(50);
TaskFactory::delayTask(20);
}
if (ackReceived and exeReceived and checkReplyReceived) {
break;
@ -823,7 +805,6 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand(uint8_t failStep) {
}
}
return returnvalue::OK;
return result;
}
uint32_t PlocSupvUartManager::getFileSize(std::string filename) {
@ -963,8 +944,10 @@ ReturnValue_t PlocSupvUartManager::handleRunningLongerRequest() {
ReturnValue_t PlocSupvUartManager::encodeAndSendPacket(const uint8_t* sendData, size_t sendLen) {
size_t encodedLen = 0;
addHdlcFraming(sendData, sendLen, encodedSendBuf.data(), &encodedLen, encodedSendBuf.size());
sif::debug << "Sending TC" << std::endl;
arrayprinter::print(encodedSendBuf.data(), encodedLen);
if (printTc) {
sif::debug << "Sending TC" << std::endl;
arrayprinter::print(encodedSendBuf.data(), encodedLen);
}
size_t bytesWritten = write(serialPort, encodedSendBuf.data(), encodedLen);
if (bytesWritten != encodedLen) {
sif::warning

View File

@ -253,6 +253,7 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};
bool printTc = false;
bool debugMode = false;
bool timestamping = true;
@ -275,7 +276,7 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
ReturnValue_t writeUpdatePackets();
// ReturnValue_t performEventBufferRequest();
ReturnValue_t handlePacketTransmissionNoReply(supv::TcBase& packet,
uint32_t timeoutExecutionReport = 60000);
uint32_t timeoutExecutionReport);
int handleAckReception(supv::TcBase& tc, size_t packetLen);
int handleExeAckReception(supv::TcBase& tc, size_t packetLen);
@ -310,7 +311,6 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
*/
uint32_t getFileSize(std::string filename);
ReturnValue_t handleEventBufferReception(ploc::SpTmReader& reader);
ReturnValue_t handleRemainingExeReport(ploc::SpTmReader& reader);
void resetSpParams();
void pushIpcData(const uint8_t* data, size_t len);

2
tmtc

@ -1 +1 @@
Subproject commit 70a1d49246b5bd5297c22d336e9dd8f58f019f90
Subproject commit 292bafa0918d386e7f64bf9ed0e114a887420899