op divider additional features
This commit is contained in:
1 parent
f0f7388c0d
commit
29e701d14d
2 files changed
+23
-3
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user