Pacemaker code Implementation for SFWRENG 3K04
Dependencies: FXOS8700Q Queue mbed-rtos mbed
Fork of Pacemaker by
Diff: chamberData.cpp
- Revision:
- 20:bfd23a6845bb
- Parent:
- 1:fbba2687ddfe
- Child:
- 27:f8deff828a00
diff -r d58e1e1a9a24 -r bfd23a6845bb chamberData.cpp --- a/chamberData.cpp Thu Nov 24 01:10:08 2016 +0000 +++ b/chamberData.cpp Thu Nov 24 03:26:14 2016 +0000 @@ -18,15 +18,21 @@ return mychamber; } -void chamberData::chngPaceAmp(double amp){ +int chamberData::chngPaceAmp(double amp){ if(mychamber == 'a'){ if(amp>3.2 || amp<0.5){ - pc->printf("\nThat value is not within range."); - }else p_PaceAmp = (amp-0)/(7-0); + return 0; + }else{ + p_PaceAmp = (amp-0)/(7-0); + return 1; + } }else{ if(amp>7 || amp<3.5){ - pc->printf("\nThat value is not within range."); - }else p_PaceAmp = (amp-0)/(7-0); + return 0; + }else{ + p_PaceAmp = (amp-0)/(7-0); + return 1; + } } } @@ -34,13 +40,21 @@ return p_PaceAmp; } -void chamberData::chngPaceWidth(double width){ +int chamberData::chngPaceWidth(double width){ if(mychamber == 'a'){ - if(width!=0.05){pc->printf("\nThat value is not within range."); - }else p_PaceWidth = width; + if(width!=0.05){ + return 0; + }else{ + p_PaceWidth = width; + return 1; + } }else{ - if(width>1.9 || width< 0.1){pc->printf("\nThat value is not within range."); - }else p_PaceWidth = width; + if(width>1.9 || width< 0.1){ + return 0; + }else{ + p_PaceWidth = width; + return 1; + } } } @@ -48,13 +62,21 @@ return p_PaceWidth; } -void chamberData::chngRP(double RP){ +int chamberData::chngRP(double RP){ if(mychamber == 'a'){ - if(RP>500 || RP<150){pc->printf("\nThat value is not within range."); - }else p_RP = RP; + if(RP>500 || RP<150){ + return 0; + }else{ + p_RP = RP; + return 1; + } }else{ - if(RP>500 || RP< 150){pc->printf("\nThat value is not within range."); - }else p_RP = RP; + if(RP>500 || RP< 150){ + return 0; + }else{ + p_RP = RP; + return 1; + } } } @@ -62,13 +84,21 @@ return p_RP; } -void chamberData::chngSensitivity(double sensitivity){ +int chamberData::chngSensitivity(double sensitivity){ if(mychamber == 'a'){ - if(sensitivity!=0.05 || sensitivity!= 0.25 || sensitivity!=0.75){pc->printf("\nThat value is not within range."); - }else p_Sensitivity = sensitivity; + if(sensitivity!=0.05 || sensitivity!= 0.25 || sensitivity!=0.75){ + return 0; + }else{ + p_Sensitivity = sensitivity; + return 1; + } }else{ - if(sensitivity>10 || sensitivity< 1){pc->printf("\nThat value is not within range."); - }else p_Sensitivity = sensitivity; + if(sensitivity>10 || sensitivity< 1){ + return 0; + }else{ + p_Sensitivity = sensitivity; + return 1; + } } }