@@ -1385,7 +1385,7 @@ else if(responseCommand==SAMPLING_RATE_RESPONSE) {
13851385 }
13861386 }
13871387 }
1388- else if (getHardwareVersion ()== HW_ID . SHIMMER_3 || getHardwareVersion ()== HW_ID . SHIMMER_3R ) {
1388+ else if (isShimmerGen3or3R () ) {
13891389 byte [] bufferSR = readBytes (2 , responseCommand ); //read the sampling rate
13901390 if (bufferSR !=null ){
13911391 setSamplingRateShimmer (convertSamplingRateBytesToFreq (bufferSR [0 ], bufferSR [1 ], getSamplingClockFreq ()));
@@ -1430,7 +1430,7 @@ else if(responseCommand==FW_VERSION_RESPONSE){
14301430 }
14311431
14321432 else if (responseCommand ==ALL_CALIBRATION_RESPONSE ) {
1433- if (getHardwareVersion ()== HW_ID . SHIMMER_3 || getHardwareVersion ()== HW_ID . SHIMMER_3R ) {
1433+ if (isShimmerGen3or3R () ) {
14341434 processAccelCalReadBytes ();
14351435 processGyroCalReadBytes ();
14361436 processMagCalReadBytes ();
@@ -2112,7 +2112,7 @@ else if(bytearray[1]==EXG_CHIP_INDEX.CHIP2.ordinal()){ //1 = CHIP 2
21122112 }
21132113 else if (currentCommand ==SET_SENSORS_COMMAND ) {
21142114 mEnabledSensors =tempEnabledSensors ;
2115- if (getHardwareVersion ()== HW_ID . SHIMMER_3 || getHardwareVersion ()== HW_ID . SHIMMER_3R ){
2115+ if (isShimmerGen3or3R () ){
21162116 checkExgResolutionFromEnabledSensorsVar ();
21172117 }
21182118 byteStack .clear (); // Always clear the packetStack after setting the sensors, this is to ensure a fresh start
@@ -3301,7 +3301,7 @@ public void readPressureCalibrationCoefficients() {
33013301 writeInstruction (GET_BMP180_CALIBRATION_COEFFICIENTS_COMMAND );
33023302 }
33033303 }
3304- }else if (getHardwareVersion ()== HW_ID .SHIMMER_3R ) {
3304+ } else if (getHardwareVersion () == HW_ID .SHIMMER_3R ) {
33053305 writeInstruction (GET_PRESSURE_CALIBRATION_COEFFICIENTS_COMMAND );
33063306 }
33073307 }
@@ -3364,8 +3364,7 @@ public void readBtFwVersion() {
33643364 * @param rate it is a value between 0 and 255; 6 = 1152Hz, 77 = 102.56Hz, 255 = 31.25Hz
33653365 */
33663366 public void writeGyroSamplingRate (int rate ) {
3367- if (getHardwareVersion ()==HW_ID .SHIMMER_3
3368- || getHardwareVersion ()==HW_ID .SHIMMER_3R ){
3367+ if (isShimmerGen3or3R ()){
33693368 mTempIntValue =rate ;
33703369 writeInstruction (new byte []{SET_MPU9150_SAMPLING_RATE_COMMAND , (byte )rate });
33713370 }
@@ -3408,7 +3407,7 @@ public void writeEnabledSensors(long enabledSensors) {
34083407 byte firstByte =(byte )(enabledSensors & 0xFF );
34093408
34103409 //write(new byte[]{SET_SENSORS_COMMAND,(byte) lowByte, highByte});
3411- if (getHardwareVersion ()== HW_ID . SHIMMER_3 || getHardwareVersion ()== HW_ID . SHIMMER_3R ){
3410+ if (isShimmerGen3or3R () ){
34123411 byte thirdByte =(byte )((enabledSensors & 0xFF0000 )>>16 );
34133412 writeInstruction (new byte []{SET_SENSORS_COMMAND ,(byte ) firstByte ,(byte ) secondByte ,(byte ) thirdByte });
34143413 }
@@ -3515,7 +3514,7 @@ public void writeMagSamplingRate(int rate) {
35153514 * Used to retrieve the data rate of the Accelerometer on Shimmer 3
35163515 */
35173516 public void readAccelSamplingRate () {
3518- if (getHardwareVersion ()== HW_ID . SHIMMER_3 || getHardwareVersion ()== HW_ID . SHIMMER_3R ){
3517+ if (isShimmerGen3or3R () ){
35193518 writeInstruction (GET_ACCEL_SAMPLING_RATE_COMMAND );
35203519 }
35213520 }
@@ -3525,8 +3524,7 @@ public void readAccelSamplingRate() {
35253524 * @param rate it is a value between 1 and 7; 1 = 1 Hz; 2 = 10 Hz; 3 = 25 Hz; 4 = 50 Hz; 5 = 100 Hz; 6 = 200 Hz; 7 = 400 Hz
35263525 */
35273526 public void writeAccelSamplingRate (int rate ) {
3528- if (getHardwareVersion ()==HW_ID .SHIMMER_3
3529- || getHardwareVersion ()==HW_ID .SHIMMER_3R ){
3527+ if (isShimmerGen3or3R ()){
35303528 mTempIntValue =rate ;
35313529 writeInstruction (new byte []{SET_ACCEL_SAMPLING_RATE_COMMAND , (byte )rate });
35323530 }
@@ -3878,7 +3876,7 @@ public void readGyroRange() {
38783876 * @param range is a numeric value defining the desired gyroscope range.
38793877 */
38803878 public void writeGyroRange (int range ) {
3881- if (getHardwareVersion ()== HW_ID . SHIMMER_3 || getHardwareVersion ()== HW_ID . SHIMMER_3R ){
3879+ if (isShimmerGen3or3R () ){
38823880 writeInstruction (new byte []{SET_MPU9150_GYRO_RANGE_COMMAND , (byte )range });
38833881 setGyroRange ((int )range );
38843882 }
@@ -3916,8 +3914,7 @@ public void writeShimmerAndSensorsSamplingRate(double rate) {
39163914 int samplingByteValue = (int ) (1024 /getSamplingRateShimmer ()); //the equivalent hex setting
39173915 writeInstruction (new byte []{SET_SAMPLING_RATE_COMMAND , (byte )Math .rint (samplingByteValue ), 0x00 });
39183916 }
3919- else if (getHardwareVersion ()==HW_ID .SHIMMER_3
3920- || getHardwareVersion ()==HW_ID .SHIMMER_3R ) {
3917+ else if (isShimmerGen3or3R ()) {
39213918
39223919 writeMagSamplingRate (getMagRate ());
39233920 try {
@@ -4194,7 +4191,7 @@ public void readGSRRange() {
41944191 * @param range numeric value defining the desired GSR range. Valid range settings are 0 (10kOhm to 56kOhm), 1 (56kOhm to 220kOhm), 2 (220kOhm to 680kOhm), 3 (680kOhm to 4.7MOhm) and 4 (Auto Range).
41954192 */
41964193 public void writeGSRRange (int range ) {
4197- if (getHardwareVersion ()== HW_ID . SHIMMER_3 ){
4194+ if (isShimmerGen3or3R () ){
41984195 if (getFirmwareVersionCode ()!=1 || getFirmwareVersionInternal () >4 ){
41994196 writeInstruction (new byte []{SET_GSR_RANGE_COMMAND , (byte )range });
42004197 }
@@ -4279,7 +4276,7 @@ public void writeMagCalibrationParameters(byte[] calibrationParameters) {
42794276 }
42804277
42814278 public void writeWRAccelCalibrationParameters (byte [] calibrationParameters ) {
4282- if (getHardwareVersion ()== HW_ID . SHIMMER_3 ){
4279+ if (isShimmerGen3or3R () ){
42834280 cmdcalibrationParameters [0 ] = SET_LSM303DLHC_ACCEL_CALIBRATION_COMMAND ;
42844281 System .arraycopy (calibrationParameters , 0 , cmdcalibrationParameters , 1 , 21 );
42854282 writeInstruction (cmdcalibrationParameters );
@@ -5069,7 +5066,7 @@ else if((sensorToCheck & SENSOR_BATT) >0){
50695066 }
50705067 }
50715068
5072- else if (getHardwareVersion ()== HW_ID . SHIMMER_3 || getHardwareVersion ()== HW_ID . SHIMMER_3R ){
5069+ else if (isShimmerGen3or3R () ){
50735070
50745071 if ((sensorToCheck & SENSOR_GSR ) >0 ){
50755072 enabledSensors = disableBit (enabledSensors ,SENSOR_INT_ADC_A1 );
@@ -5501,7 +5498,7 @@ private long generateSensorBitmapForHardwareControl(long enabledSensors){
55015498 }
55025499 hardwareSensorBitmap = enabledSensors ;
55035500 }
5504- else if (getHardwareVersion ()== HW_ID . SHIMMER_3 || getHardwareVersion ()== HW_ID . SHIMMER_3R ){
5501+ else if (isShimmerGen3or3R () ){
55055502 if (((enabledSensors & 0xFF )& SENSOR_ACCEL ) > 0 ){
55065503 hardwareSensorBitmap = hardwareSensorBitmap |Configuration .Shimmer3 .SensorBitmap .SENSOR_A_ACCEL ;
55075504 }
@@ -5578,7 +5575,7 @@ public void toggleLed() {
55785575 @ Override
55795576 protected void checkBattery (){
55805577 if (mIsStreaming ){
5581- if ((getHardwareVersion ()== HW_ID . SHIMMER_3 || getHardwareVersion ()== HW_ID . SHIMMER_3R ) && getFirmwareVersionCode ()==FW_ID .LOGANDSTREAM ){
5578+ if ((isShimmerGen3or3R () ) && getFirmwareVersionCode ()==FW_ID .LOGANDSTREAM ){
55825579 if (!mWaitForAck ) {
55835580 if (mVSenseBattMA .getMean ()<mLowBattLimit *1000 *0.8 ) {
55845581 if (mCurrentLEDStatus !=2 ) {
0 commit comments