Counter: setInit(): fix. Init can't be set to lower of down_lim or higher of up_lim

This commit is contained in:
Evgenii Meshcheriakov 2022-10-19 09:58:59 +03:00
parent 4b1ef018dd
commit 290c73f358

View File

@ -50,7 +50,15 @@ Counter::Counter (unsigned int down, unsigned int up)
}
void
Counter::setInit (unsigned int i)
Counter::setInit (unsigned int newInit)
{
init = i;
if(newInit > up_lim){
init = up_lim;
}
else if(newInit < down_lim){
init = down_lim;
}
else{
init = newInit;
}
}