Merge pull request 'Tweak for TM stores' (#650) from another-tweak-for-tm-stores into v2.1.0-dev
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #650
This commit is contained in:
Marius Eggert 2023-05-25 10:21:19 +02:00
commit d22f948af4
4 changed files with 15 additions and 17 deletions

View File

@ -49,6 +49,8 @@ will consitute of a breaking change warranting a new major release:
- Transmitter state is not taken into account anymore for writing into the PTME. The PTME should - Transmitter state is not taken into account anymore for writing into the PTME. The PTME should
be perfectly capable of generating a valid CADU, even when the transmitter is not ON for any be perfectly capable of generating a valid CADU, even when the transmitter is not ON for any
reason. reason.
- OFF mode is ignores in TM store for determining whether a store will be written. The modes will
only be used to cancel a transfer.
## Added ## Added
@ -80,6 +82,7 @@ will consitute of a breaking change warranting a new major release:
- HK TM store: The HK store dump success event was triggered for cancelled HK dumps. - HK TM store: The HK store dump success event was triggered for cancelled HK dumps.
- When a PUS parsing error occured while parsing a TM store file, the dump completion procedure - When a PUS parsing error occured while parsing a TM store file, the dump completion procedure
was always executed. was always executed.
- Some smaller logic fixes in the TM store base class
# [v2.0.5] 2023-05-11 # [v2.0.5] 2023-05-11

View File

@ -131,25 +131,22 @@ ReturnValue_t TmStoreTaskBase::performDump(PersistentTmStoreWithTmQueue& store,
dumpContext.ptmeBusyCounter = 0; dumpContext.ptmeBusyCounter = 0;
tmSinkBusyCd.resetTimer(); tmSinkBusyCd.resetTimer();
ReturnValue_t result = store.getNextDumpPacket(tmReader, fileHasSwapped); ReturnValue_t result = store.getNextDumpPacket(tmReader, fileHasSwapped);
if (result != returnvalue::OK) { if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) {
sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl;
} else if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) {
// This can happen if a file is corrupted and the next file swap completes the dump. // This can happen if a file is corrupted and the next file swap completes the dump.
dumpDoneHandler(); dumpDoneHandler();
return returnvalue::OK; return returnvalue::OK;
} else if (result != returnvalue::OK) {
sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl;
return result;
} }
dumpedLen = tmReader.getFullPacketLen(); dumpedLen = tmReader.getFullPacketLen();
// Only write to VC if mode is on, but always confirm the dump.
// If the mode is OFF, it is assumed the PTME is not usable and is not allowed to be written
// (e.g. to confirm a reset or the transmitter is off anyway).
if (mode == MODE_ON) {
result = channel.write(tmReader.getFullData(), dumpedLen); result = channel.write(tmReader.getFullData(), dumpedLen);
if (result == DirectTmSinkIF::IS_BUSY) { if (result == DirectTmSinkIF::IS_BUSY) {
sif::warning << "PersistentTmStore: Unexpected VC channel busy" << std::endl; sif::warning << "PersistentTmStore: Unexpected VC channel busy" << std::endl;
} else if (result != returnvalue::OK) { } else if (result != returnvalue::OK) {
sif::warning << "PersistentTmStore: Unexpected VC channel write failure" << std::endl; sif::warning << "PersistentTmStore: Unexpected VC channel write failure" << std::endl;
} }
}
result = store.confirmDump(tmReader, fileHasSwapped); result = store.confirmDump(tmReader, fileHasSwapped);
if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK)) { if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK)) {
dumpPerformed = true; dumpPerformed = true;

View File

@ -18,9 +18,7 @@ uint8_t VirtualChannel::getVcid() const { return vcId; }
const char* VirtualChannel::getName() const { return vcName.c_str(); } const char* VirtualChannel::getName() const { return vcName.c_str(); }
bool VirtualChannel::isBusy() const { bool VirtualChannel::isBusy() const { return ptme.isBusy(vcId); }
return ptme.isBusy(vcId);
}
void VirtualChannel::cancelTransfer() { ptme.cancelTransfer(vcId); } void VirtualChannel::cancelTransfer() { ptme.cancelTransfer(vcId); }

View File

@ -256,6 +256,7 @@ ReturnValue_t PersistentTmStore::getNextDumpPacket(PusTmReader& reader, bool& fi
if (state == State::IDLE or dumpParams.pendingPacketDump) { if (state == State::IDLE or dumpParams.pendingPacketDump) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
fileHasSwapped = false;
reader.setReadOnlyData(fileBuf.data() + dumpParams.currentSize, reader.setReadOnlyData(fileBuf.data() + dumpParams.currentSize,
fileBuf.size() - dumpParams.currentSize); fileBuf.size() - dumpParams.currentSize);
// CRC check to fully ensure this is a valid TM // CRC check to fully ensure this is a valid TM
@ -270,7 +271,6 @@ ReturnValue_t PersistentTmStore::getNextDumpPacket(PusTmReader& reader, bool& fi
fileHasSwapped = true; fileHasSwapped = true;
return loadNextDumpFile(); return loadNextDumpFile();
} }
fileHasSwapped = false;
dumpParams.pendingPacketDump = true; dumpParams.pendingPacketDump = true;
return returnvalue::OK; return returnvalue::OK;
} }