cancel transfer on TX disabled
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-28 10:13:39 +02:00
parent 437288de1e
commit 746254a838
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 31 additions and 15 deletions

View File

@ -28,6 +28,12 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
} }
// Dump TMs when applicable // Dump TMs when applicable
if (store.getState() == PersistentTmStore::State::DUMPING) { if (store.getState() == PersistentTmStore::State::DUMPING) {
// The PTME might have been reset an transmitter state change, so there is
// not point in continuing the dump.
if(not channel.isTxOn()) {
cancelDump(dumpContext, store, false);
return returnvalue::OK;
}
size_t dumpedLen = 0; size_t dumpedLen = 0;
if (not channel.isBusy()) { if (not channel.isBusy()) {
dumpContext.ptmeBusyCounter = 0; dumpContext.ptmeBusyCounter = 0;
@ -60,15 +66,12 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
sif::warning << "PTME busy for longer period. Dumped length so far: " sif::warning << "PTME busy for longer period. Dumped length so far: "
<< dumpContext.dumpedBytes << std::endl; << dumpContext.dumpedBytes << std::endl;
triggerEvent(persTmStore::DUMP_WAS_CANCELLED, store.getObjectId()); triggerEvent(persTmStore::DUMP_WAS_CANCELLED, store.getObjectId());
dumpContext.reset(); cancelDump(dumpContext, store, channel.isTxOn());
store.cancelDump();
channel.cancelTransfer();
} }
} }
if (cancelDumpCd.hasTimedOut() or tmSinkBusyCd.hasTimedOut()) { if (cancelDumpCd.hasTimedOut() or tmSinkBusyCd.hasTimedOut()) {
triggerEvent(persTmStore::DUMP_WAS_CANCELLED, store.getObjectId()); triggerEvent(persTmStore::DUMP_WAS_CANCELLED, store.getObjectId());
dumpDoneHandler(dumpContext); cancelDump(dumpContext, store, channel.isTxOn());
store.cancelDump();
} }
} else { } else {
Command_t execCmd; Command_t execCmd;
@ -108,4 +111,10 @@ bool TmStoreTaskBase::cyclicStoreCheck() {
return true; return true;
} }
void TmStoreTaskBase::dumpDoneHandler(DumpContext& ctx) { ctx.reset(); } void TmStoreTaskBase::cancelDump(DumpContext& ctx, PersistentTmStore& store, bool isTxOn) {
ctx.reset();
store.cancelDump();
if(isTxOn) {
channel.cancelTransfer();
}
}

View File

@ -56,7 +56,7 @@ class TmStoreTaskBase : public SystemObject {
bool fileHasSwapped = false; bool fileHasSwapped = false;
SdCardMountedIF& sdcMan; SdCardMountedIF& sdcMan;
void dumpDoneHandler(DumpContext& ctx); void cancelDump(DumpContext& ctx, PersistentTmStore& store, bool isTxOn);
}; };
#endif /* MISSION_TMTC_TMSTORETASKBASE_H_ */ #endif /* MISSION_TMTC_TMSTORETASKBASE_H_ */

View File

@ -11,10 +11,10 @@ ReturnValue_t VirtualChannel::sendNextTm(const uint8_t* data, size_t size) {
} }
ReturnValue_t VirtualChannel::write(const uint8_t* data, size_t size) { ReturnValue_t VirtualChannel::write(const uint8_t* data, size_t size) {
// if (txOn) { if (txOn) {
return ptme.writeToVc(vcId, data, size); return ptme.writeToVc(vcId, data, size);
//} }
// return returnvalue::OK; return returnvalue::OK;
} }
uint8_t VirtualChannel::getVcid() const { return vcId; } uint8_t VirtualChannel::getVcid() const { return vcId; }
@ -23,10 +23,16 @@ const char* VirtualChannel::getName() const { return vcName.c_str(); }
bool VirtualChannel::isBusy() const { bool VirtualChannel::isBusy() const {
// Data is discarded, so channel is not busy. // Data is discarded, so channel is not busy.
// if (not txOn) { if (not txOn) {
// return false; return false;
//} }
return ptme.isBusy(vcId); return ptme.isBusy(vcId);
} }
void VirtualChannel::cancelTransfer() { ptme.cancelTransfer(vcId); } void VirtualChannel::cancelTransfer() {
ptme.cancelTransfer(vcId);
}
bool VirtualChannel::isTxOn() const {
return txOn;
}

View File

@ -30,6 +30,7 @@ class VirtualChannel : public SystemObject, public VirtualChannelIF {
ReturnValue_t write(const uint8_t* data, size_t size) override; ReturnValue_t write(const uint8_t* data, size_t size) override;
void cancelTransfer() override; void cancelTransfer() override;
uint8_t getVcid() const; uint8_t getVcid() const;
bool isTxOn() const;
const char* getName() const; const char* getName() const;