this is more useful information

This commit is contained in:
Robin Müller 2023-03-11 14:59:55 +01:00
parent 97698a08d5
commit a4e6d877ff
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
8 changed files with 41 additions and 20 deletions

View File

@ -28,15 +28,15 @@ static constexpr Event BUSY_DUMPING_EVENT = event::makeEvent(SUBSYSTEM_ID, 2, se
//! [EXPORT] : [COMMENT] Dump was cancelled. P1: Object ID of store.
static constexpr Event DUMP_WAS_CANCELLED = event::makeEvent(SUBSYSTEM_ID, 3, severity::LOW);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets.
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_OK_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 5, severity::INFO);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets.
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_NOK_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 6, severity::INFO);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets.
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_MISC_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 7, severity::INFO);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets.
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_HK_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 8, severity::INFO);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets.
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_CFDP_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 9, severity::INFO);
}; // namespace persTmStore

View File

@ -6,7 +6,10 @@
PersistentLogTmStoreTask::PersistentLogTmStoreTask(object_id_t objectId, StorageManagerIF& ipcStore,
LogStores stores, VirtualChannel& channel,
SdCardMountedIF& sdcMan)
: TmStoreTaskBase(objectId, ipcStore, channel, sdcMan), stores(stores) {}
: TmStoreTaskBase(objectId, ipcStore, channel, sdcMan), stores(stores),
okStoreContext(persTmStore::DUMP_OK_STORE_DONE),
notOkStoreContext(persTmStore::DUMP_NOK_STORE_DONE),
miscStoreContext(persTmStore::DUMP_MISC_STORE_DONE) {}
ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
while (true) {
@ -15,15 +18,15 @@ ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
}
bool someonesBusy = false;
bool busy = false;
busy = handleOneStore(stores.okStore, persTmStore::DUMP_OK_STORE_DONE);
busy = handleOneStore(stores.okStore, okStoreContext);
if (busy) {
someonesBusy = true;
}
busy = handleOneStore(stores.notOkStore, persTmStore::DUMP_NOK_STORE_DONE);
busy = handleOneStore(stores.notOkStore, notOkStoreContext);
if (busy) {
someonesBusy = true;
}
busy = handleOneStore(stores.miscStore, persTmStore::DUMP_MISC_STORE_DONE);
busy = handleOneStore(stores.miscStore, miscStoreContext);
if (busy) {
someonesBusy = true;
}

View File

@ -28,6 +28,9 @@ class PersistentLogTmStoreTask : public TmStoreTaskBase, public ExecutableObject
private:
LogStores stores;
DumpContext okStoreContext;
DumpContext notOkStoreContext;
DumpContext miscStoreContext;
Countdown tcHandlingCd = Countdown(400);
bool initStoresIfPossible();

View File

@ -7,7 +7,7 @@ PersistentSingleTmStoreTask::PersistentSingleTmStoreTask(
VirtualChannel& channel, Event eventIfDumpDone, SdCardMountedIF& sdcMan)
: TmStoreTaskBase(objectId, ipcStore, channel, sdcMan),
storeWithQueue(tmStore),
eventIfDumpDone(eventIfDumpDone) {}
dumpContext(eventIfDumpDone) {}
ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
while (true) {
@ -15,7 +15,7 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
if (not cyclicStoreCheck()) {
continue;
}
bool busy = handleOneStore(storeWithQueue, eventIfDumpDone);
bool busy = handleOneStore(storeWithQueue, dumpContext);
if (not busy) {
TaskFactory::delayTask(40);
}

View File

@ -17,8 +17,7 @@ class PersistentSingleTmStoreTask : public TmStoreTaskBase, public ExecutableObj
private:
PersistentTmStoreWithTmQueue& storeWithQueue;
Event eventIfDumpDone;
uint32_t numberOfDumpedPackets = 0;
DumpContext dumpContext;
Countdown tcHandlingCd = Countdown(400);
bool initStoresIfPossible();

View File

@ -11,8 +11,8 @@ TmStoreTaskBase::TmStoreTaskBase(object_id_t objectId, StorageManagerIF& ipcStor
VirtualChannel& channel, SdCardMountedIF& sdcMan)
: SystemObject(objectId), ipcStore(ipcStore), channel(channel), sdcMan(sdcMan) {}
bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store, Event eventIfDone,
uint32_t& numberOfDumpedPackets) {
bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
DumpContext& dumpContext) {
ReturnValue_t result;
bool tmToStoreReceived = false;
bool tcRequestReceived = false;
@ -24,17 +24,21 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store, Event
}
// Dump TMs when applicable
if (store.getState() == PersistentTmStore::State::DUMPING) {
size_t dumpedLen;
size_t dumpedLen = 0;
bool fileHasSwapped;
if (not channel.isBusy()) {
tmSinkBusyCd.resetTimer();
// TODO: We could continously dump until a file swap during active downlink..
result = store.dumpNextPacket(channel, dumpedLen, fileHasSwapped);
if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK) and dumpedLen > 0) {
dumpContext.dumpedBytes += dumpedLen;
dumpContext.numberOfDumpedPackets += 1;
}
if (result == PersistentTmStore::DUMP_DONE) {
uint32_t startTime;
uint32_t endTime;
store.getStartAndEndTimeCurrentOrLastDump(startTime, endTime);
triggerEvent(eventIfDone, numberOfDumpedPackets);
triggerEvent(dumpContext.eventIfDone, dumpContext.numberOfDumpedPackets,
dumpContext.dumpedBytes);
dumpsPerformed = true;
} else if (result == returnvalue::OK) {
dumpsPerformed = true;
@ -52,6 +56,7 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store, Event
if (execCmd == TmStoreMessage::DOWNLINK_STORE_CONTENT_TIME) {
cancelDumpCd.resetTimer();
tmSinkBusyCd.resetTimer();
dumpContext.reset();
}
tcRequestReceived = true;
}

View File

@ -7,6 +7,17 @@
class TmStoreTaskBase : public SystemObject {
public:
struct DumpContext {
DumpContext(Event eventIfDone) : eventIfDone(eventIfDone) {}
void reset() {
numberOfDumpedPackets = 0;
dumpedBytes = 0;
}
const Event eventIfDone;
uint32_t numberOfDumpedPackets = 0;
uint32_t dumpedBytes = 0;
};
TmStoreTaskBase(object_id_t objectId, StorageManagerIF& ipcStore, VirtualChannel& channel,
SdCardMountedIF& sdcMan);
@ -16,7 +27,7 @@ class TmStoreTaskBase : public SystemObject {
* @param store
* @return
*/
bool handleOneStore(PersistentTmStoreWithTmQueue& store, Event eventIfDone);
bool handleOneStore(PersistentTmStoreWithTmQueue& store, DumpContext& dumpContext);
/**
* Occasionally check whether SD card is okay to be used. If not, poll whether it is ready to

2
tmtc

@ -1 +1 @@
Subproject commit cd0fd4d5a7142554c95d90574b5539931adcd5ff
Subproject commit 4686550eb9455175227559dc36902469255e36b7