Dependents: SEL_Device_Monitor
counterMinMax.cpp
- Committer:
- masterkookus
- Date:
- 2019-10-02
- Revision:
- 0:162461305b81
File content as of revision 0:162461305b81:
#include "counterMinMax.h" counterMinMax::counterMinMax(int nominalVal, bool useMinLimit, int loVal, bool useMaxLimit, int hiVal) { nomVal = nominalVal; maxLim=useMinLimit; minLim=useMaxLimit; minLimVal = loVal; maxLimVal = hiVal; } void counterMinMax::putVal(int newval) { if (maxLim) { if (newval>maxLimVal) { return; } } if (minLim) { if (newval<minLimVal) { return; } } if (maxSet==false) { maxVal=newval; maxSet=true; } else { if (newval>maxVal) { maxVal=newval; } } if (minSet==false) { minVal=newval; minSet=true; } else { if (newval<minVal) { minVal=newval; } } } int counterMinMax::getMin(void) { return minVal; } int counterMinMax::getMax(void) { return maxVal; } void counterMinMax::resetNum(void) { maxVal=0; minVal=0; minSet=false; maxSet=false; }