Pacemaker code Implementation for SFWRENG 3K04
Dependencies: FXOS8700Q Queue mbed-rtos mbed
Fork of Pacemaker by
Diff: genData.cpp
- Revision:
- 20:bfd23a6845bb
- Parent:
- 1:fbba2687ddfe
--- a/genData.cpp Thu Nov 24 01:10:08 2016 +0000 +++ b/genData.cpp Thu Nov 24 03:26:14 2016 +0000 @@ -4,7 +4,7 @@ genData::genData(){ p_hysteresis = false; - p_hysteresisInterval = 0; + p_hysteresisRateLimit = 0; p_lowerRateLimit = 0; p_upperRateLimit = 0; p_AVdelay = 0; @@ -22,48 +22,79 @@ return p_hysteresis; } -void genData::chngHystInterval(double val){ - p_hysteresisInterval = val; +int genData::chngHystRL(double val){ + if(val >= 30 && val <= 175){ + p_hysteresisRateLimit = val; + return 1; + }else{ + return 0; + } } -double genData::getHystInterval(){ - return p_hysteresisInterval; +double genData::getHystRL(){ + return p_hysteresisRateLimit; } -void genData::chngLRL(double val){ - p_lowerRateLimit = val; +int genData::chngLRL(double val){ + if(val >= 30 && val <= 175){ + p_lowerRateLimit = val; + return 1; + }else{ + return 0; + } } double genData::getLRL(){ return p_lowerRateLimit; } -void genData::chngURL(double val){ - p_upperRateLimit = val; +int genData::chngURL(double val){ + if(val >= 50 && val <= 175){ + p_upperRateLimit = val; + return 1; + }else{ + return 0; + } } double genData::getURL(){ return p_upperRateLimit; } -void genData::chngAVdelay(double val){ - p_AVdelay = val; +int genData::chngAVdelay(double val){ + if(val >= 70 && val <= 300){ + p_AVdelay = val; + return 1; + }else{ + return 0; + } } double genData::getAVdelay(){ return p_AVdelay; } -void genData::chngAVdelayOffset(double val){ - p_AVdelayOffset = val; +int genData::chngAVdelayOffset(double val){ + if(val >= -10 && val <= -100){ + p_AVdelayOffset = val; + return 1; + }else{ + return 0; + } } double genData::getAVdelayOffset(){ return p_AVdelayOffset; } -void genData::chngRSmooth(double val){ - p_rateSmoothing = val; +int genData::chngRSmooth(double val){ + + if(val >= 3 && val <= 25){ + p_rateSmoothing = val; + return 1; + }else{ + return 0; + } } double genData::getRSmooth(){