Skip to content

Commit 04d884c

Browse files
marknolanclaude
andcommitted
DEV-793 Fix GSR on second-generation SR61 (HW gate + gen-2 feedback resistors)
Validated against a 33k/100k/470k fixed-resistor sweep on a real SR61-5 (DEV-793 datasets B4a-c, FW v2.00.013): 1) doesHwSupportGsr() now includes SR61 minor >= 5, mirroring the firmware's ShimBrd_isGsrSupportedForHwVersion (SR62 any / SR68 >= 5 / SR61 >= 5). Previously SR61-5/6 GSR recordings parsed to nothing. 2) SensorGSRVerisense now selects the second-generation DC-GSR feedback-resistor set (21/150/562/1740 kOhm) for SR61 as well as Pulse+ - with the Shimmer3 set (40.2/287/1000/3300 kOhm) the computed resistance was ~1.9x high, which also masqueraded as range-boundary clamping for the 33k and 470k recordings. Post-fix readings are within 0.8-1.5% of the fitted resistors across ranges 0-2. 3) GSR + LSM6DSV compatibility lists now include the Verisense IMU (SR61) hardware id; runtime gates (doesHwSupportGsr / isPayloadDesignV13orAbove) keep gen-1 SR61 units excluded. Known sub-1% difference vs C#/TS: those use a 0.4986 V GSR reference for gen-2 where this driver uses 0.5 V (~0.3% in resistance) - below resistor tolerance, left unchanged for now. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 47a74d5 commit 04d884c

3 files changed

Lines changed: 22 additions & 8 deletions

File tree

ShimmerDriver/src/main/java/com/shimmerresearch/driver/Configuration.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,14 +2721,17 @@ public static class CompatibilityInfoForMaps{
27212721
public static final List<ShimmerVerObject> listOfCompatibleVersionInfoVbatt = Arrays.asList(
27222722
svoVerisenseDevBrd, svoVerisenseImu, svoVerisensePpg0, svoVerisensePpg1, svoVerisenseGsrPlus, svoVerisensePulsePlus);
27232723

2724+
// SR61 (Verisense IMU) carries GSR from minor rev 5 (second-generation); the
2725+
// runtime minor-rev gating is in VerisenseDevice.doesHwSupportGsr() which
2726+
// mirrors the firmware's ShimBrd_isGsrSupportedForHwVersion.
27242727
public static final List<ShimmerVerObject> listOfCompatibleVersionInfoGsr = Arrays.asList(
2725-
svoVerisenseGsrPlus, svoVerisensePulsePlus);
2728+
svoVerisenseGsrPlus, svoVerisensePulsePlus, svoVerisenseImu);
27262729

2727-
// Second-generation IMU: LSM6DSV (accel/gyro) + LIS2MDL (mag), SR68-9/10.
2728-
// TODO refine to HW minor >= 9 once compat supports minor gating; matching all
2729-
// Pulse+ is acceptable for now as gen-1 Pulse+ carries no LSM6DSV.
2730+
// Second-generation IMU: LSM6DSV (accel/gyro) + LIS2MDL (mag), SR68-9/10 and
2731+
// SR61-5/6. TODO refine to HW minor gating once compat supports it; the
2732+
// runtime isPayloadDesignV13orAbove() gate protects gen-1 units meanwhile.
27302733
public static final List<ShimmerVerObject> listOfCompatibleVersionInfoLSM6DSV = Arrays.asList(
2731-
svoVerisensePulsePlus);
2734+
svoVerisensePulsePlus, svoVerisenseImu);
27322735
}
27332736

27342737
}

ShimmerDriver/src/main/java/com/shimmerresearch/verisense/VerisenseDevice.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,11 @@ public boolean doesHwSupportMax30002() {
12951295
public boolean doesHwSupportGsr() {
12961296
int hwId = getHardwareVersion();
12971297
int hwRev = getExpansionBoardRev();
1298-
return (hwId==HW_ID.VERISENSE_GSR_PLUS || (hwId==HW_ID.VERISENSE_PULSE_PLUS && hwRev >=5));
1298+
// Mirrors the firmware's ShimBrd_isGsrSupportedForHwVersion (shimmer_boards.c):
1299+
// SR62 (any), SR68 minor >= 5, SR61 minor >= 5 (second-generation IMU carries GSR).
1300+
return (hwId==HW_ID.VERISENSE_GSR_PLUS
1301+
|| (hwId==HW_ID.VERISENSE_PULSE_PLUS && hwRev >=5)
1302+
|| (hwId==HW_ID.VERISENSE_IMU && hwRev >=5));
12991303
}
13001304

13011305
public CalibDetailsKinematic getCurrentCalibDetails(int sensorId) {

ShimmerDriver/src/main/java/com/shimmerresearch/verisense/sensors/SensorGSRVerisense.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,15 @@ public static GSR_RANGE getForConfigValue(int configValue) {
113113
//--------- Constructors for this class start --------------
114114
public SensorGSRVerisense(ShimmerVerObject svo) {
115115
super(svo);
116-
117-
if (svo.getHardwareVersion() == HW_ID.VERISENSE_PULSE_PLUS) {
116+
117+
// The Pulse+ (SR68) and the second-generation Verisense IMU (SR61-5/6) share the
118+
// same DC-based GSR front-end with its own feedback-resistor set; the GSR+ (SR62)
119+
// uses the Shimmer3 values. An SR61 only gets this sensor class registered when
120+
// VerisenseDevice.doesHwSupportGsr() has already confirmed HW minor >= 5, so no
121+
// minor-revision check is needed here. Verified against a 33k/100k/470k resistor
122+
// sweep on an SR61-5 (DEV-793 datasets B4a-c).
123+
if (svo.getHardwareVersion() == HW_ID.VERISENSE_PULSE_PLUS
124+
|| svo.getHardwareVersion() == HW_ID.VERISENSE_IMU) {
118125
setCurrentGsrRefResistorsKohms(VERISENSE_PULSE_PLUS_GSR_REF_RESISTORS_KOHMS);
119126
setCurrentGsrUncalLimitRange3(VERISENSE_PULSE_PLUS_GSR_UNCAL_LIMIT_RANGE3);
120127
}

0 commit comments

Comments
 (0)