Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,14 @@ public void generateCalibMap() {
updateCurrentAccelHighGCalibInUse();
}

@Override
public boolean isSensorUsingDefaultCal(int sensorId) {
if(sensorId==Configuration.Shimmer3.SENSOR_ID.SHIMMER_ADXL371_ACCEL_HIGHG){
return isUsingDefaultHighGAccelParam();
}
return false;
}

//--------- Optional methods to override in Sensor Class end --------

//--------- Sensor specific methods start --------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ public void generateCalibMap() {
updateCurrentMagCalibInUse();
}

@Override
public boolean isSensorUsingDefaultCal(int sensorId) {
if(sensorId==Configuration.Shimmer3.SENSOR_ID.SHIMMER_LIS2MDL_MAG){
return isUsingDefaultMagParam();
}
return false;
}

//--------- Optional methods to override in Sensor Class end --------

//--------- Sensor specific methods start --------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,14 @@ public void generateCalibMap() {

updateCurrentMagAltCalibInUse();
}

@Override
public boolean isSensorUsingDefaultCal(int sensorId) {
if(sensorId==Configuration.Shimmer3.SENSOR_ID.SHIMMER_LIS3MDL_MAG_ALT){
return isUsingDefaultMagAltParam();
}
return false;
}

// --------- Optional methods to override in Sensor Class end --------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class SensorLSM6DSV extends AbstractSensor{
private static final long serialVersionUID = -1336807717590498430L;
// LN ACCEL
protected int mSensorIdAccelLN = -1;
private int mAccelRange = 1;
private int mAccelRange = 0;
public boolean mIsUsingDefaultLNAccelParam = true;
public static final double[][] AlignmentMatrixLowNoiseAccelShimmer3r = {{-1,0,0},{0,1,0},{0,0,-1}};
public static final double[][] OffsetVectorLowNoiseAccelShimmer3r = {{0},{0},{0}};
Expand Down Expand Up @@ -99,7 +99,7 @@ public class SensorLSM6DSV extends AbstractSensor{

// GYRO
public boolean mIsUsingDefaultGyroParam = true;
private int mGyroRange = 1;
private int mGyroRange = 0;
protected int mLSM6DSVGyroAccelRate=0;
protected int mSensorIdGyro = -1;

Expand Down Expand Up @@ -272,7 +272,6 @@ public class LABEL_SENSOR_TILE{

// GYRO
public static final String[] ListofGyroRange = {"+/- 125dps","+/- 250dps","+/- 500dps","+/- 1000dps","+/- 2000dps","+/- 4000dps"};
//public static final Integer[] ListofLSM6DSVGyroRangeConfigValues = {0,1,4,5,3,6};
public static final Integer[] ListofLSM6DSVGyroRangeConfigValues = {0,1,2,3,4,5};
public static final String[] ListofLSM6DSVGyroRate={"Power-down","1.875Hz","7.5Hz","12.0Hz","30.0Hz","60.0Hz","120.0Hz","240.0Hz","480.0Hz","960.0Hz","1920.0Hz","3840.0Hz","7680.0Hz"};
public static final Double[] ListofLSM6DSVGyroRateDouble={0.0,1.875,7.5,12.0,30.0,60.0,120.0,240.0,480.0,960.0,1920.0,3840.0,7680.0};
Expand Down Expand Up @@ -549,6 +548,7 @@ public byte[] generateCalParamByteArrayAccelLn(){
public int getAccelRange(){
return mAccelRange;
}

public void setAccelRange(int accelRange){
setLSM6DSVAccelRange(accelRange);
}
Expand All @@ -560,6 +560,11 @@ public void setLSM6DSVAccelRange(int i){
}
}

public void setDefaultLSM6DSVAccelSensorConfig(boolean isSensorEnabled) {
if(isSensorEnabled) {
setLSM6DSVAccelRange(0);
}
}

//--------- LN Accel methods end --------------

Expand Down Expand Up @@ -787,6 +792,7 @@ public void generateSensorMap() {
public LinkedHashMap<String, Object> generateConfigMap() {
LinkedHashMap<String, Object> mapOfConfig = new LinkedHashMap<String, Object>();

mapOfConfig.put(SensorLSM6DSV.DatabaseConfigHandle.ACCEL_RANGE, getAccelRange());
mapOfConfig.put(SensorLSM6DSV.DatabaseConfigHandle.GYRO_RANGE, getGyroRange());
mapOfConfig.put(SensorLSM6DSV.DatabaseConfigHandle.GYRO_RATE, getLSM6DSVGyroAccelRate());

Expand All @@ -805,33 +811,35 @@ public LinkedHashMap<String, Object> generateConfigMap() {

@Override
public void parseConfigMap(LinkedHashMap<String, Object> mapOfConfigPerShimmer) {
//Analog Accel Calibration Configuration
parseCalibDetailsKinematicFromDb(mapOfConfigPerShimmer,
Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM6DSV_ACCEL_LN,
0,
SensorLSM6DSV.DatabaseConfigHandle.LIST_OF_CALIB_HANDLES_LN_ACC,
SensorLSM6DSV.DatabaseConfigHandle.LN_ACC_CALIB_TIME);

if(mapOfConfigPerShimmer.containsKey(DatabaseConfigHandle.ACCEL_RANGE)){
setAccelRange(((Double) mapOfConfigPerShimmer.get(DatabaseConfigHandle.ACCEL_RANGE)).intValue());
}
if(mapOfConfigPerShimmer.containsKey(DatabaseConfigHandle.GYRO_RATE)){
setLSM6DSVGyroAccelRate(((Double) mapOfConfigPerShimmer.get(DatabaseConfigHandle.GYRO_RATE)).intValue());
}
if(mapOfConfigPerShimmer.containsKey(DatabaseConfigHandle.GYRO_RANGE)){
setGyroRange(((Double) mapOfConfigPerShimmer.get(DatabaseConfigHandle.GYRO_RANGE)).intValue());
}

//LN Accel Calibration Configuration
parseCalibDetailsKinematicFromDb(mapOfConfigPerShimmer,
Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM6DSV_ACCEL_LN,
getAccelRange(),
SensorLSM6DSV.DatabaseConfigHandle.LIST_OF_CALIB_HANDLES_LN_ACC,
SensorLSM6DSV.DatabaseConfigHandle.LN_ACC_CALIB_TIME);

//Gyroscope Calibration Configuration
parseCalibDetailsKinematicFromDb(mapOfConfigPerShimmer,
mSensorIdGyro,
Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM6DSV_GYRO,
getGyroRange(),
SensorLSM6DSV.DatabaseConfigHandle.LIST_OF_CALIB_HANDLES_GYRO,
SensorLSM6DSV.DatabaseConfigHandle.GYRO_CALIB_TIME);
}

@Override
public void generateConfigOptionsMap() {
// No Configuration Needed for Accel

// For Gyro
// For Gyro & Accel
mConfigOptionsMap.clear();
addConfigOption(configOptionLSM6DSVGyroRange);
addConfigOption(configOptionLSM6DSVAccelRange);
Expand All @@ -846,7 +854,7 @@ public void generateSensorGroupMapping() {
mSensorGroupingMap.put(Configuration.Shimmer3.LABEL_SENSOR_TILE.LOW_NOISE_ACCEL_3R.ordinal(), sensorGroupLnAccelLSM6DSV);
mSensorGroupingMap.put(Configuration.Shimmer3.LABEL_SENSOR_TILE.GYRO_3R.ordinal(), new SensorGroupingDetails(
LABEL_SENSOR_TILE.GYRO,
Arrays.asList(mSensorIdGyro),
Arrays.asList(Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM6DSV_GYRO),
CompatibilityInfoForMaps.listOfCompatibleVersionInfoLSM6DSV));

super.updateSensorGroupingMap();
Expand Down Expand Up @@ -987,7 +995,7 @@ public void configBytesParse(ShimmerDevice shimmerDevice, byte[] configBytes, CO
if(configByteLayout instanceof ConfigByteLayoutShimmer3){
ConfigByteLayoutShimmer3 configByteLayoutCast = (ConfigByteLayoutShimmer3) configByteLayout;

setAccelRange((configBytes[configByteLayoutCast.idxConfigSetupByte3] >> configByteLayoutCast.bitShiftMPU9150AccelRange) & configByteLayoutCast.maskMPU9150AccelRange);
setLSM6DSVAccelRange((configBytes[configByteLayoutCast.idxConfigSetupByte3] >> configByteLayoutCast.bitShiftMPU9150AccelRange) & configByteLayoutCast.maskMPU9150AccelRange);

if (shimmerDevice.isConnected()){
getCurrentCalibDetailsAccelLn().mCalibReadSource=CALIB_READ_SOURCE.INFOMEM;
Expand Down Expand Up @@ -1057,7 +1065,7 @@ public Object setConfigValueUsingConfigLabel(Integer sensorId, String configLabe
case(GuiLabelConfigCommon.RANGE):
if(sensorId==mSensorIdGyro){
this.setConfigValueUsingConfigLabel(GuiLabelConfig.LSM6DSV_GYRO_RANGE, valueToSet);
}else if(sensorId==mSensorIdAccelLN){
} else if(sensorId==mSensorIdAccelLN){
this.setConfigValueUsingConfigLabel(GuiLabelConfig.LSM6DSV_ACCEL_RANGE, valueToSet);
}
break;
Expand Down Expand Up @@ -1102,7 +1110,7 @@ public Object getConfigValueUsingConfigLabel(Integer sensorId, String configLabe
case(GuiLabelConfigCommon.RANGE):
if(sensorId==mSensorIdGyro){
returnValue = this.getConfigValueUsingConfigLabel(GuiLabelConfig.LSM6DSV_GYRO_RANGE);
}else if(sensorId==mSensorIdAccelLN){
} else if(sensorId==mSensorIdAccelLN){
returnValue = this.getConfigValueUsingConfigLabel(GuiLabelConfig.LSM6DSV_ACCEL_RANGE);
}
break;
Expand All @@ -1126,13 +1134,14 @@ public void setSensorSamplingRate(double samplingRateHz) {
@Override
public boolean setDefaultConfigForSensor(int sensorId, boolean isSensorEnabled) {
if(mSensorMap.containsKey(sensorId)){
updateCurrentAccelLnCalibInUse();
if(sensorId==mSensorIdAccelLN) {
setDefaultLSM6DSVAccelSensorConfig(isSensorEnabled);
}
else if(sensorId==mSensorIdGyro) {
setDefaultLSM6DSVGyroSensorConfig(isSensorEnabled);
}
return true;
}
if(sensorId==mSensorIdGyro){
setDefaultLSM6DSVGyroSensorConfig(isSensorEnabled);
}

return false;
}

Expand Down Expand Up @@ -1168,6 +1177,7 @@ public boolean processResponse(int responseCommand, Object parsedResponse, COMMU
public void checkShimmerConfigBeforeConfiguring() {
if(!(isSensorEnabled(mSensorIdGyro) || isSensorEnabled(mSensorIdAccelLN))) {
setDefaultLSM6DSVGyroSensorConfig(false);
setDefaultLSM6DSVAccelSensorConfig(false);
}
}

Expand All @@ -1185,9 +1195,6 @@ public void initialise() {
updateCurrentAccelLnCalibInUse();
setCalibSensitivityScaleFactor(mSensorIdGyro, CALIBRATION_SCALE_FACTOR.ONE_HUNDRED);
updateCurrentGyroCalibInUse();

// Set CurrentValues (Fix Calibration Not Read)
// mCurrentCalibDetailsAccelLn.setCurrentValues(OffsetVectorLowNoiseAccelShimmer3r, SensitivityMatrixLowNoiseAccel2gShimmer3r, AlignmentMatrixLowNoiseAccelShimmer3r, false);
}

@Override
Expand Down Expand Up @@ -1222,7 +1229,7 @@ public boolean isSensorUsingDefaultCal(int sensorId) {
if(sensorId==Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM6DSV_ACCEL_LN){
return isUsingDefaultLNAccelParam();
}
if(sensorId==mSensorIdGyro){
else if(sensorId==Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM6DSV_GYRO){
return isUsingDefaultGyroParam();
}
return false;
Expand Down
Loading