added missing store initialization code
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
parent
e6aa582fcb
commit
d50cbe9e5b
@ -771,7 +771,7 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(CcsdsComponentArgs& args) {
|
|||||||
auto* vcWithQueue =
|
auto* vcWithQueue =
|
||||||
new VirtualChannelWithQueue(objects::PTME_VC0_LIVE_TM, ccsds::VC0, "PTME VC0 LIVE TM", *ptme,
|
new VirtualChannelWithQueue(objects::PTME_VC0_LIVE_TM, ccsds::VC0, "PTME VC0 LIVE TM", *ptme,
|
||||||
LINK_STATE, args.tmStore, 500);
|
LINK_STATE, args.tmStore, 500);
|
||||||
args.liveDestination = vcWithQueue->getReportReceptionQueue(0);
|
args.liveDestination = vcWithQueue;
|
||||||
new LiveTmTask(objects::LIVE_TM_TASK, *vcWithQueue);
|
new LiveTmTask(objects::LIVE_TM_TASK, *vcWithQueue);
|
||||||
|
|
||||||
// Set up log store.
|
// Set up log store.
|
||||||
@ -779,17 +779,19 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(CcsdsComponentArgs& args) {
|
|||||||
LINK_STATE);
|
LINK_STATE);
|
||||||
LogStores logStores(args.stores);
|
LogStores logStores(args.stores);
|
||||||
// Core task which handles the LOG store and takes care of dumping it as TM using a VC directly
|
// Core task which handles the LOG store and takes care of dumping it as TM using a VC directly
|
||||||
new PersistentLogTmStoreTask(objects::LOG_STORE_TASK, args.ipcStore, logStores, *vc);
|
new PersistentLogTmStoreTask(objects::LOG_STORE_TASK, args.ipcStore, logStores, *vc,
|
||||||
|
*SdCardManager::instance());
|
||||||
|
|
||||||
vc = new VirtualChannel(objects::PTME_VC2_HK_TM, ccsds::VC2, "PTME VC2 HK TM", *ptme, LINK_STATE);
|
vc = new VirtualChannel(objects::PTME_VC2_HK_TM, ccsds::VC2, "PTME VC2 HK TM", *ptme, LINK_STATE);
|
||||||
// Core task which handles the HK store and takes care of dumping it as TM using a VC directly
|
// Core task which handles the HK store and takes care of dumping it as TM using a VC directly
|
||||||
new PersistentSingleTmStoreTask(objects::HK_STORE_TASK, args.ipcStore, *args.stores.hkStore, *vc);
|
new PersistentSingleTmStoreTask(objects::HK_STORE_TASK, args.ipcStore, *args.stores.hkStore, *vc,
|
||||||
|
*SdCardManager::instance());
|
||||||
|
|
||||||
vc = new VirtualChannel(objects::PTME_VC3_CFDP_TM, ccsds::VC3, "PTME VC3 CFDP TM", *ptme,
|
vc = new VirtualChannel(objects::PTME_VC3_CFDP_TM, ccsds::VC3, "PTME VC3 CFDP TM", *ptme,
|
||||||
LINK_STATE);
|
LINK_STATE);
|
||||||
// Core task which handles the CFDP store and takes care of dumping it as TM using a VC directly
|
// Core task which handles the CFDP store and takes care of dumping it as TM using a VC directly
|
||||||
new PersistentSingleTmStoreTask(objects::CFDP_STORE_TASK, args.ipcStore, *args.stores.cfdpStore,
|
new PersistentSingleTmStoreTask(objects::CFDP_STORE_TASK, args.ipcStore, *args.stores.cfdpStore,
|
||||||
*vc);
|
*vc, *SdCardManager::instance());
|
||||||
|
|
||||||
ReturnValue_t result = (*args.ipCoreHandler)->connectModeTreeParent(satsystem::com::SUBSYSTEM);
|
ReturnValue_t result = (*args.ipCoreHandler)->connectModeTreeParent(satsystem::com::SUBSYSTEM);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
|
@ -80,11 +80,9 @@ void ObjectFactory::produce(void* args) {
|
|||||||
CcsdsComponentArgs ccsdsArgs(*gpioComIF, *ipcStore, *tmStore, stores, &ipCoreHandler);
|
CcsdsComponentArgs ccsdsArgs(*gpioComIF, *ipcStore, *tmStore, stores, &ipCoreHandler);
|
||||||
createCcsdsComponents(ccsdsArgs);
|
createCcsdsComponents(ccsdsArgs);
|
||||||
#if OBSW_TM_TO_PTME == 1
|
#if OBSW_TM_TO_PTME == 1
|
||||||
// TODO: Remove this if not needed anymore
|
if (ccsdsArgs.liveDestination != nullptr) {
|
||||||
if (*ccsdsArgs.liveDestination != nullptr) {
|
|
||||||
pusFunnel->addLiveDestination("VC0 LIVE TM", *ccsdsArgs.liveDestination, 0);
|
pusFunnel->addLiveDestination("VC0 LIVE TM", *ccsdsArgs.liveDestination, 0);
|
||||||
}
|
}
|
||||||
// addTmtcIpCoresToFunnels(*ipCoreHandler, *pusFunnel, *cfdpFunnel);
|
|
||||||
#endif
|
#endif
|
||||||
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
|
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
|
||||||
|
|
||||||
|
@ -3,20 +3,26 @@
|
|||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
|
||||||
PersistentLogTmStoreTask::PersistentLogTmStoreTask(object_id_t objectId, StorageManagerIF& ipcStore,
|
PersistentLogTmStoreTask::PersistentLogTmStoreTask(object_id_t objectId, StorageManagerIF& ipcStore,
|
||||||
LogStores stores, VirtualChannel& channel)
|
LogStores stores, VirtualChannel& channel,
|
||||||
: TmStoreTaskBase(objectId, ipcStore, channel), stores(stores) {}
|
SdCardMountedIF& sdcMan)
|
||||||
|
: TmStoreTaskBase(objectId, ipcStore, channel, sdcMan), stores(stores) {}
|
||||||
|
|
||||||
ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
|
ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
|
||||||
while (true) {
|
while (true) {
|
||||||
bool someonesBusy = false;
|
if (not cyclicStoreCheck()) {
|
||||||
bool busy = handleOneStore(stores.okStore);
|
continue;
|
||||||
if (busy) {
|
|
||||||
someonesBusy = true;
|
|
||||||
}
|
}
|
||||||
|
bool someonesBusy = false;
|
||||||
|
bool busy = false;
|
||||||
busy = handleOneStore(stores.okStore);
|
busy = handleOneStore(stores.okStore);
|
||||||
if (busy) {
|
if (busy) {
|
||||||
someonesBusy = true;
|
someonesBusy = true;
|
||||||
}
|
}
|
||||||
|
busy = handleOneStore(stores.notOkStore);
|
||||||
|
if (busy) {
|
||||||
|
someonesBusy = true;
|
||||||
|
}
|
||||||
|
|
||||||
busy = handleOneStore(stores.miscStore);
|
busy = handleOneStore(stores.miscStore);
|
||||||
if (busy) {
|
if (busy) {
|
||||||
someonesBusy = true;
|
someonesBusy = true;
|
||||||
@ -26,3 +32,12 @@ ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PersistentLogTmStoreTask::initStoresIfPossible() {
|
||||||
|
if (sdcMan.isSdCardUsable(std::nullopt)) {
|
||||||
|
stores.okStore.initializeTmStore();
|
||||||
|
stores.miscStore.initializeTmStore();
|
||||||
|
stores.notOkStore.initializeTmStore();
|
||||||
|
storesInitialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -22,12 +22,14 @@ struct LogStores {
|
|||||||
class PersistentLogTmStoreTask : public TmStoreTaskBase, public ExecutableObjectIF {
|
class PersistentLogTmStoreTask : public TmStoreTaskBase, public ExecutableObjectIF {
|
||||||
public:
|
public:
|
||||||
PersistentLogTmStoreTask(object_id_t objectId, StorageManagerIF& ipcStore, LogStores tmStore,
|
PersistentLogTmStoreTask(object_id_t objectId, StorageManagerIF& ipcStore, LogStores tmStore,
|
||||||
VirtualChannel& channel);
|
VirtualChannel& channel, SdCardMountedIF& sdcMan);
|
||||||
|
|
||||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LogStores stores;
|
LogStores stores;
|
||||||
|
|
||||||
|
void initStoresIfPossible();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_TMTC_PERSISTENTLOGTMSTORETASK_H_ */
|
#endif /* MISSION_TMTC_PERSISTENTLOGTMSTORETASK_H_ */
|
||||||
|
@ -4,14 +4,20 @@
|
|||||||
PersistentSingleTmStoreTask::PersistentSingleTmStoreTask(object_id_t objectId,
|
PersistentSingleTmStoreTask::PersistentSingleTmStoreTask(object_id_t objectId,
|
||||||
StorageManagerIF& ipcStore,
|
StorageManagerIF& ipcStore,
|
||||||
PersistentTmStoreWithTmQueue& tmStore,
|
PersistentTmStoreWithTmQueue& tmStore,
|
||||||
VirtualChannel& channel)
|
VirtualChannel& channel,
|
||||||
: TmStoreTaskBase(objectId, ipcStore, channel), storeWithQueue(tmStore) {}
|
SdCardMountedIF& sdcMan)
|
||||||
|
: TmStoreTaskBase(objectId, ipcStore, channel, sdcMan), storeWithQueue(tmStore) {}
|
||||||
|
|
||||||
ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
|
ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
if (not cyclicStoreCheck()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
bool busy = handleOneStore(storeWithQueue);
|
bool busy = handleOneStore(storeWithQueue);
|
||||||
if (not busy) {
|
if (not busy) {
|
||||||
TaskFactory::delayTask(5);
|
TaskFactory::delayTask(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PersistentSingleTmStoreTask::initStoresIfPossible() {}
|
||||||
|
@ -10,13 +10,15 @@
|
|||||||
class PersistentSingleTmStoreTask : public TmStoreTaskBase, public ExecutableObjectIF {
|
class PersistentSingleTmStoreTask : public TmStoreTaskBase, public ExecutableObjectIF {
|
||||||
public:
|
public:
|
||||||
PersistentSingleTmStoreTask(object_id_t objectId, StorageManagerIF& ipcStore,
|
PersistentSingleTmStoreTask(object_id_t objectId, StorageManagerIF& ipcStore,
|
||||||
PersistentTmStoreWithTmQueue& storeWithQueue,
|
PersistentTmStoreWithTmQueue& storeWithQueue, VirtualChannel& channel,
|
||||||
VirtualChannel& channel);
|
SdCardMountedIF& sdcMan);
|
||||||
|
|
||||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PersistentTmStoreWithTmQueue& storeWithQueue;
|
PersistentTmStoreWithTmQueue& storeWithQueue;
|
||||||
|
|
||||||
|
void initStoresIfPossible();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_TMTC_PERSISTENTSINGLETMSTORETASK_H_ */
|
#endif /* MISSION_TMTC_PERSISTENTSINGLETMSTORETASK_H_ */
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
#include "TmStoreTaskBase.h"
|
#include "TmStoreTaskBase.h"
|
||||||
|
|
||||||
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
|
||||||
TmStoreTaskBase::TmStoreTaskBase(object_id_t objectId, StorageManagerIF& ipcStore,
|
TmStoreTaskBase::TmStoreTaskBase(object_id_t objectId, StorageManagerIF& ipcStore,
|
||||||
VirtualChannel& channel)
|
VirtualChannel& channel, SdCardMountedIF& sdcMan)
|
||||||
: SystemObject(objectId), ipcStore(ipcStore), channel(channel) {}
|
: SystemObject(objectId), ipcStore(ipcStore), channel(channel), sdcMan(sdcMan) {}
|
||||||
|
|
||||||
bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store) {
|
bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store) {
|
||||||
bool tmToStoreReceived = true;
|
bool tmToStoreReceived = true;
|
||||||
@ -33,3 +35,22 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TmStoreTaskBase::cyclicStoreCheck() {
|
||||||
|
if (not storesInitialized) {
|
||||||
|
initStoresIfPossible();
|
||||||
|
if (not storesInitialized) {
|
||||||
|
TaskFactory::delayTask(400);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (sdCardCheckCd.hasTimedOut()) {
|
||||||
|
if (not sdcMan.isSdCardUsable(std::nullopt)) {
|
||||||
|
// Might be due to imminent shutdown or SD card switch.
|
||||||
|
storesInitialized = false;
|
||||||
|
TaskFactory::delayTask(100);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sdCardCheckCd.resetTimer();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
#ifndef MISSION_TMTC_TMSTORETASKBASE_H_
|
#ifndef MISSION_TMTC_TMSTORETASKBASE_H_
|
||||||
#define MISSION_TMTC_TMSTORETASKBASE_H_
|
#define MISSION_TMTC_TMSTORETASKBASE_H_
|
||||||
|
|
||||||
|
#include <fsfw/timemanager/Countdown.h>
|
||||||
#include <mission/tmtc/PersistentTmStoreWithTmQueue.h>
|
#include <mission/tmtc/PersistentTmStoreWithTmQueue.h>
|
||||||
#include <mission/tmtc/VirtualChannel.h>
|
#include <mission/tmtc/VirtualChannel.h>
|
||||||
|
|
||||||
class TmStoreTaskBase : public SystemObject {
|
class TmStoreTaskBase : public SystemObject {
|
||||||
public:
|
public:
|
||||||
TmStoreTaskBase(object_id_t objectId, StorageManagerIF& ipcStore, VirtualChannel& channel);
|
TmStoreTaskBase(object_id_t objectId, StorageManagerIF& ipcStore, VirtualChannel& channel,
|
||||||
|
SdCardMountedIF& sdcMan);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* Handling for one store. Returns if anything was done.
|
* Handling for one store. Returns if anything was done.
|
||||||
* @param store
|
* @param store
|
||||||
@ -14,9 +18,19 @@ class TmStoreTaskBase : public SystemObject {
|
|||||||
*/
|
*/
|
||||||
bool handleOneStore(PersistentTmStoreWithTmQueue& store);
|
bool handleOneStore(PersistentTmStoreWithTmQueue& store);
|
||||||
|
|
||||||
private:
|
/**
|
||||||
|
* Occasionally check whether SD card is okay to be used. If not, poll whether it is ready to
|
||||||
|
* be used again and re-initialize stores. Returns whether store is okay to be used.
|
||||||
|
*/
|
||||||
|
bool cyclicStoreCheck();
|
||||||
|
|
||||||
|
virtual void initStoresIfPossible() = 0;
|
||||||
|
|
||||||
StorageManagerIF& ipcStore;
|
StorageManagerIF& ipcStore;
|
||||||
|
Countdown sdCardCheckCd = Countdown(800);
|
||||||
VirtualChannel& channel;
|
VirtualChannel& channel;
|
||||||
|
bool storesInitialized = false;
|
||||||
|
SdCardMountedIF& sdcMan;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_TMTC_TMSTORETASKBASE_H_ */
|
#endif /* MISSION_TMTC_TMSTORETASKBASE_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user