Persistent TM Store #320

Merged
muellerr merged 109 commits from mueller/pus-15-tm-storage into develop 2023-02-24 19:03:39 +01:00
2 changed files with 11 additions and 1 deletions
Showing only changes of commit 3e17de0127 - Show all commits

View File

@ -14,6 +14,7 @@ PusTmFunnel::PusTmFunnel(object_id_t objectId, TimeReaderIF &timeReader, Storage
eventStore(objects::EVENT_STORE, "event", RolloverInterval::HOURLY, 1, currentTv, sdcMan),
sdcMan(sdcMan) {
Clock::getClock_timeval(&currentTv);
Clock::getUptime(&lastTvUpdate);
miscStore.addApid(config::EIVE_PUS_APID);
miscStore.addService(17);
eventStore.addApid(config::EIVE_PUS_APID);
@ -60,6 +61,14 @@ ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage &message) {
sourceSequenceCount = sourceSequenceCount % ccsds::LIMIT_SEQUENCE_COUNT;
packet.updateErrorControl();
timeval currentUptime;
Clock::getUptime(&currentUptime);
if (currentUptime.tv_sec - lastTvUpdate.tv_sec >
static_cast<signed int>(TV_UPDATE_INTERVAL_SECS)) {
Clock::getClock_timeval(&currentTv);
lastTvUpdate = currentUptime;
}
if (sdcMan.isSdCardUsable(std::nullopt)) {
if (not storesInitialized) {
miscStore.updateBaseDir();

View File

@ -40,7 +40,8 @@ class PusTmFunnel : public TmFunnelBase {
uint16_t sourceSequenceCount = 0;
TimeReaderIF &timeReader;
bool storesInitialized = false;
timeval currentTv;
timeval currentTv{};
timeval lastTvUpdate{};
TmStore miscStore;
TmStore eventStore;
SdCardMountedIF &sdcMan;