eive-obsw/mission/utility/ProgressPrinter.cpp
Jakob Meier ffd64d0463
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
improvements in supervisor helper
2022-04-19 13:33:37 +02:00

17 lines
671 B
C++

#include "ProgressPrinter.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
ProgressPrinter::ProgressPrinter(std::string name, uint32_t numSteps, uint32_t percentageResolution)
: name(name), numSteps(numSteps), percentageResolution(percentageResolution) {}
ProgressPrinter::~ProgressPrinter() {}
void ProgressPrinter::print(uint32_t currentStep) {
float progressInPercent = static_cast<float>(currentStep) / static_cast<float>(numSteps) * 100;
if (static_cast<uint32_t>(progressInPercent) >= nextProgressPrint) {
sif::info << name << " progress: " << progressInPercent << " %" << std::endl;
nextProgressPrint += percentageResolution;
}
}