update clock every 5 minutes
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2022-12-13 15:43:41 +01:00
parent 8858084f6e
commit 3e17de0127
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 11 additions and 1 deletions

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;