op divider additional features

This commit is contained in:
muellerr committed 2020-12-01 17:08:46 +01:00
1 parent f0f7388c0d
commit 29e701d14d
2 files changed
+23 -3

No files matched your search

+12 -2
View File
@@ -7,16 +7,26 @@ PeriodicOperationDivider::PeriodicOperationDivider(uint32_t divider,
}
bool PeriodicOperationDivider::checkAndIncrement() {
if(counter >= divider) {
bool opNecessary = check();
if(opNecessary) {
if(resetAutomatically) {
counter = 0;
}
return true;
return opNecessary;
}
counter ++;
return opNecessary;
}
bool PeriodicOperationDivider::check() {
if(counter >= divider) {
return true;
}
return false;
}
void PeriodicOperationDivider::resetCounter() {
counter = 0;
}