Skip to content

Commit 7fbe97b

Browse files
committed
gyro update
1 parent d90e9ff commit 7fbe97b

File tree

4 files changed

+13
-33
lines changed

4 files changed

+13
-33
lines changed

Shimmer32FeetAPI/ShimmerSDBT32Feet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ public void SdConfigWrite()
890890
file.WriteLine("gs_range=" + GetGSRRange());
891891
file.WriteLine("exp_power=" + (GetExpPower() ? 1 : 0));
892892
file.WriteLine("gyro_range=" + GetGyroRange());
893-
file.WriteLine("gyro_samplingrate=" + GetMpu9150SamplingRate());
893+
file.WriteLine("gyro_samplingrate=" + GetGyroSamplingRate());
894894
file.WriteLine("acc_range=" + GetAccelRange());
895895
file.WriteLine("acc_lpm=" + GetAccelLPBit());
896896
file.WriteLine("acc_hrm=" + GetAccelHRBit());

ShimmerAPI/ShimmerAPI/ShimmerBluetooth.cs

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public abstract class ShimmerBluetooth : ShimmerDevice
129129
protected int MagGain;
130130
protected int LNAccelRange;
131131
protected int AccelSamplingRate;
132-
protected int Mpu9150SamplingRate;
132+
protected int GyroSamplingRate;
133133
protected int AltAccelSamplingRate;
134134
protected int AltMagSamplingRate;
135135
protected long ConfigSetupByte0; // for Shimmer2
@@ -2239,7 +2239,7 @@ public void InterpretInquiryResponseShimmer3R(List<byte> packet)
22392239
GyroRange = (int)((ConfigSetupByte0 >> 16) & 0x03);
22402240
MagGain = (int)((ConfigSetupByte0 >> 21) & 0x07);
22412241
AccelSamplingRate = (int)((ConfigSetupByte0 >> 4) & 0xF);
2242-
Mpu9150SamplingRate = (int)((ConfigSetupByte0 >> 8) & 0xFF);
2242+
GyroSamplingRate = (int)((ConfigSetupByte0 >> 8) & 0xFF);
22432243
magSamplingRate = (int)((ConfigSetupByte0 >> 18) & 0x07);
22442244
PressureResolution = (int)((ConfigSetupByte0 >> 28) & 0x03);
22452245
GSRRange = (int)((ConfigSetupByte0 >> 25) & 0x07);
@@ -2275,12 +2275,12 @@ public void InterpretInquiryResponseShimmer3R(List<byte> packet)
22752275
{
22762276
LowPowerAccelEnabled = true;
22772277
}
2278-
/*
2279-
if ((Mpu9150SamplingRate == 0xFF && ADCRawSamplingRateValue < 3200))
2278+
2279+
if (GyroSamplingRate == 0x01)
22802280
{
22812281
LowPowerGyroEnabled = true;
22822282
}
2283-
*/
2283+
22842284
}
22852285

22862286

@@ -2313,7 +2313,7 @@ public void InterpretInquiryResponseShimmer3(List<byte> packet)
23132313
GyroRange = (int)((ConfigSetupByte0 >> 16) & 0x03);
23142314
MagGain = (int)((ConfigSetupByte0 >> 21) & 0x07);
23152315
AccelSamplingRate = (int)((ConfigSetupByte0 >> 4) & 0xF);
2316-
Mpu9150SamplingRate = (int)((ConfigSetupByte0 >> 8) & 0xFF);
2316+
GyroSamplingRate = (int)((ConfigSetupByte0 >> 8) & 0xFF);
23172317
magSamplingRate = (int)((ConfigSetupByte0 >> 18) & 0x07);
23182318
PressureResolution = (int)((ConfigSetupByte0 >> 28) & 0x03);
23192319
GSRRange = (int)((ConfigSetupByte0 >> 25) & 0x07);
@@ -2332,32 +2332,12 @@ public void InterpretInquiryResponseShimmer3(List<byte> packet)
23322332
LowPowerAccelEnabled = true;
23332333
}
23342334

2335-
if ((Mpu9150SamplingRate == 0xFF && ADCRawSamplingRateValue < 3200))
2335+
if ((GyroSamplingRate == 0xFF && ADCRawSamplingRateValue < 3200))
23362336
{
23372337
LowPowerGyroEnabled = true;
23382338
}
23392339
}
23402340

2341-
if (HardwareVersion == (int)ShimmerBluetooth.ShimmerVersion.SHIMMER3R)
2342-
{
2343-
if (magSamplingRate == 0) //3200 us the raw ADC value and not in HZ
2344-
{
2345-
LowPowerMagEnabled = true;
2346-
}
2347-
2348-
if ((AccelSamplingRate == 1))
2349-
{
2350-
LowPowerAccelEnabled = true;
2351-
}
2352-
/*
2353-
if ((Mpu9150SamplingRate == 0xFF && ADCRawSamplingRateValue < 3200))
2354-
{
2355-
LowPowerGyroEnabled = true;
2356-
}
2357-
*/
2358-
}
2359-
2360-
23612341
NumberofChannels = (int)packet[6];
23622342
BufferSize = (int)packet[7];
23632343
ListofSensorChannels.Clear();
@@ -5414,9 +5394,9 @@ public int GetMpu9150AccelRange()
54145394
{
54155395
return Mpu9150AccelRange;
54165396
}
5417-
public int GetMpu9150SamplingRate()
5397+
public int GetGyroSamplingRate()
54185398
{
5419-
return Mpu9150SamplingRate;
5399+
return GyroSamplingRate;
54205400
}
54215401

54225402
public int GetAccelRange()
@@ -6376,7 +6356,7 @@ protected void WriteGyroSamplingRate(int rate)
63766356
{
63776357
if (HardwareVersion == (int)ShimmerVersion.SHIMMER3 || HardwareVersion == (int)ShimmerVersion.SHIMMER3R)
63786358
{
6379-
Mpu9150SamplingRate = rate;
6359+
GyroSamplingRate = rate;
63806360
mTempIntValue = rate;
63816361
WriteBytes(new byte[2] { (byte)PacketTypeShimmer3.SET_MPU9150_SAMPLING_RATE_COMMAND, (byte)rate }, 0, 2);
63826362
System.Threading.Thread.Sleep(200);

ShimmerAPI/ShimmerAPI/ShimmerLogAndStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ public void SdConfigWrite()
12071207
file.WriteLine("gs_range=" + GetGSRRange());
12081208
file.WriteLine("exp_power=" + (GetExpPower() ? 1 : 0));
12091209
file.WriteLine("gyro_range=" + GetGyroRange());
1210-
file.WriteLine("gyro_samplingrate=" + GetMpu9150SamplingRate());
1210+
file.WriteLine("gyro_samplingrate=" + GetGyroSamplingRate());
12111211
file.WriteLine("acc_range=" + GetAccelRange());
12121212
file.WriteLine("acc_lpm=" + GetAccelLPBit());
12131213
file.WriteLine("acc_hrm=" + GetAccelHRBit());

ShimmerAPI/ShimmerAPI/ShimmerSDBT.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ public void SdConfigWrite()
976976
file.WriteLine("gs_range=" + GetGSRRange());
977977
file.WriteLine("exp_power=" + (GetExpPower() ? 1 : 0));
978978
file.WriteLine("gyro_range=" + GetGyroRange());
979-
file.WriteLine("gyro_samplingrate=" + GetMpu9150SamplingRate());
979+
file.WriteLine("gyro_samplingrate=" + GetGyroSamplingRate());
980980
file.WriteLine("acc_range=" + GetAccelRange());
981981
file.WriteLine("acc_lpm=" + GetAccelLPBit());
982982
file.WriteLine("acc_hrm=" + GetAccelHRBit());

0 commit comments

Comments
 (0)