32 lines
961 B
C++
32 lines
961 B
C++
#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h"
|
|
|
|
#include <cmath>
|
|
|
|
#include "fsfw/datapoollocal/LocalPoolDataSetBase.h"
|
|
#include "fsfw/serviceinterface.h"
|
|
|
|
PeriodicHousekeepingHelper::PeriodicHousekeepingHelper(LocalPoolDataSetBase* owner)
|
|
: owner(owner) {}
|
|
|
|
void PeriodicHousekeepingHelper::initialize(float collectionInterval,
|
|
dur_millis_t minimumPeriodicInterval) {
|
|
this->minimumPeriodicInterval = minimumPeriodicInterval;
|
|
changeCollectionInterval(collectionInterval);
|
|
}
|
|
|
|
bool PeriodicHousekeepingHelper::checkOpNecessary() {
|
|
if (hkGenerationCd.hasTimedOut()) {
|
|
hkGenerationCd.resetTimer();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void PeriodicHousekeepingHelper::changeCollectionInterval(float newIntervalSeconds) {
|
|
uint32_t intervalMs = newIntervalSeconds * 1000;
|
|
if (newIntervalSeconds <= 0) {
|
|
intervalMs = minimumPeriodicInterval;
|
|
}
|
|
hkGenerationCd.setTimeout(intervalMs);
|
|
}
|