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 @@ -2156,7 +2156,12 @@ else if (isEXGUsingDefaultThreeUnipolarConfiguration()){
}
if(SensorGSR.sensorGsrRef.mListOfChannelsRef.contains(SensorGSR.channelGsrAdc.mObjectClusterName)){
objectCluster.addUncalDataToMap(SensorGSR.channelGsrAdc, gsrAdcValueUnCal);
objectCluster.addCalDataToMap(SensorGSR.channelGsrAdc, SensorADC.calibrateMspAdcChannelToMillivolts(gsrAdcValueUnCal));
if(isShimmerGen3R()){
objectCluster.addCalDataToMap(SensorGSR.channelGsrAdc, SensorADC.calibrateMspAdcChannelToMillivolts3r(gsrAdcValueUnCal));
}
else {
objectCluster.addCalDataToMap(SensorGSR.channelGsrAdc, SensorADC.calibrateMspAdcChannelToMillivolts(gsrAdcValueUnCal));
}
}

objectCluster.addDataToMap(mainGsrSignalName,CHANNEL_TYPE.UNCAL.toString(),CHANNEL_UNITS.NO_UNITS,gsrAdcValueUnCal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public static class DatabaseChannelHandlesCommon{

public SENSORS mSensorType = null;
protected String mSensorName = "";
protected static ShimmerVerObject mShimmerVerObject = new ShimmerVerObject();
protected ShimmerVerObject mShimmerVerObject = new ShimmerVerObject();

protected static boolean mEnableCalibration = true;
protected boolean mIsDebugOutput = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,46 +631,55 @@ public boolean processResponse(int responseCommand, Object parsedResponse, COMMU
public static double calibrateMspAdcChannelToMillivolts(double unCalData){
return calibrateAdcChannelToMillivolts(unCalData, MICROCONTROLLER_ADC_PROPERTIES.SHIMMER2R3_3V0);
}

public static double calibrateMspAdcChannelToMillivolts3r(double unCalData){
return calibrateAdcChannelToMillivolts3r(unCalData, MICROCONTROLLER_ADC_PROPERTIES.SHIMMER2R3_3V0);
}

public static double calibrateAdcChannelToMillivolts(double unCalData, MICROCONTROLLER_ADC_PROPERTIES microcontrollerAdcProperties){
double calData;
if(mShimmerVerObject.isShimmerGen3R()){
calData = calibrateU14AdcValueToMillivolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
}
else {
calData = calibrateU12AdcValueToMillivolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
}
double calData = calibrateU12AdcValueToMillivolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
return calData;
}

public static double calibrateAdcChannelToMillivolts3r(double unCalData, MICROCONTROLLER_ADC_PROPERTIES microcontrollerAdcProperties){
double calData = calibrateU14AdcValueToMillivolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
return calData;
}

public double calibrateMspAdcChannelToVolts(double unCalData){
public static double calibrateMspAdcChannelToVolts(double unCalData){
return calibrateAdcChannelToVolts(unCalData, MICROCONTROLLER_ADC_PROPERTIES.SHIMMER2R3_3V0);
}

public static double calibrateMspAdcChannelToVolts3r(double unCalData){
return calibrateAdcChannelToVolts(unCalData, MICROCONTROLLER_ADC_PROPERTIES.SHIMMER2R3_3V0);
}

public static double calibrateAdcChannelToVolts(double unCalData, MICROCONTROLLER_ADC_PROPERTIES microcontrollerAdcProperties){
double calData;
if(mShimmerVerObject.isShimmerGen3R()){
calData = calibrateU14AdcValueToVolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
}
else {
calData = calibrateU12AdcValueToVolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
}
double calData = calibrateU12AdcValueToVolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);

return calData;
}

public static double calibrateAdcChannelToVolts3r(double unCalData, MICROCONTROLLER_ADC_PROPERTIES microcontrollerAdcProperties){
double calData = calibrateU14AdcValueToVolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
return calData;
}

public static int uncalibrateMspAdcChannelFromVolts(double unCalData){
return uncalibrateAdcChannelFromVolts(unCalData, MICROCONTROLLER_ADC_PROPERTIES.SHIMMER2R3_3V0);
}

public static int uncalibrateMspAdcChannelFromVolts3r(double unCalData){
return uncalibrateAdcChannelFromVolts3r(unCalData, MICROCONTROLLER_ADC_PROPERTIES.SHIMMER2R3_3V0);
}

public static int uncalibrateAdcChannelFromVolts(double unCalData, MICROCONTROLLER_ADC_PROPERTIES microcontrollerAdcProperties){
int calData;
if(mShimmerVerObject.isShimmerGen3R()){
calData = uncalibrateU14AdcValueFromVolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
}
else {
calData = uncalibrateU12AdcValueFromVolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
}

int calData = uncalibrateU12AdcValueFromVolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
return calData;
}

public static int uncalibrateAdcChannelFromVolts3r(double unCalData, MICROCONTROLLER_ADC_PROPERTIES microcontrollerAdcProperties){
int calData = uncalibrateU12AdcValueFromVolts(unCalData, microcontrollerAdcProperties.offset, microcontrollerAdcProperties.vRefP, microcontrollerAdcProperties.gain);
return calData;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,13 @@ public ObjectCluster processDataCustom(SensorDetails sensorDetails, byte[] senso
}
if(sensorDetails.mListOfChannels.contains(channelGsrAdc)){
objectCluster.addUncalData(channelGsrAdc, gsrAdcValueUnCal);
objectCluster.addCalData(channelGsrAdc, SensorADC.calibrateAdcChannelToMillivolts(gsrAdcValueUnCal, microcontrollerAdcProperties));
if (mShimmerVerObject.isShimmerGen3R()) {
objectCluster.addCalData(channelGsrAdc, SensorADC.calibrateAdcChannelToMillivolts3r(gsrAdcValueUnCal, microcontrollerAdcProperties));
}
else {
objectCluster.addCalData(channelGsrAdc, SensorADC.calibrateAdcChannelToMillivolts(gsrAdcValueUnCal, microcontrollerAdcProperties));
}

objectCluster.incrementIndexKeeper();
}

Expand Down