Vasily Davydov d6219e4ef4 state-handler: #6 prepare for displaying values
Add internal fucntionality for:
- getBarPressure()
- getBarSpeed()
- displaySet(int, int)
2022-10-05 16:27:01 +03:00

46 lines
560 B
C++

/*
* Counter.cpp
*
* Created on: Sep 1, 2022
* Author: tylen
*/
#include "Counter.h"
void Counter::inc() {
if(init >= up_lim){
init = 0;
} else{
++init;
}
}
void Counter::dec() {
if(init <= 0){
init = up_lim;
} else{
--init;
}
}
int Counter::getCurrent(){
return this->init;
}
Counter::Counter(int i, int up) {
up_lim = up;
if(i > up){
init = up;
}else if(i < 0){
init = 0;
}else{
init = i;
}
}
void Counter::setInit(int i){
init = i;
}