progress printer
This commit is contained in:
16
mission/utility/ProgressPrinter.cpp
Normal file
16
mission/utility/ProgressPrinter.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "ProgressPrinter.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
ProgressPrinter::ProgressPrinter(std::string name, uint32_t numSteps)
|
||||
: name(name), numSteps(numSteps) {}
|
||||
|
||||
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 += FIVE_PERCENT;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user