Skip to content

Commit cdc835e

Browse files
authored
Merge pull request #417 from open-ephys/issue-370
Improve error reporting for Neuropixels 1.0e/f
2 parents 1bf197c + 7fd150b commit cdc835e

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

OpenEphys.Onix1/ConfigureNeuropixelsV1e.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public override IObservable<ContextTask> Process(IObservable<ContextTask> source
145145
DS90UB9x.Set933I2CRate(device, 400e3);
146146

147147
// read probe metadata
148-
var probeMetadata = new NeuropixelsV1eMetadata(serializer);
148+
var probeMetadata = new NeuropixelsV1eMetadata(device);
149149

150150
// issue full mux reset to the probe
151151
var gpo10Config = NeuropixelsV1e.DefaultGPO10Config;

OpenEphys.Onix1/NeuropixelsV1eMetadata.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
namespace OpenEphys.Onix1
44
{
5-
class NeuropixelsV1eMetadata
5+
class NeuropixelsV1eMetadata : I2CRegisterContext
66
{
77
const uint OFFSET_ID = 0;
88
const uint OFFSET_VERSION = 10;
99
const uint OFFSET_REVISION = 11;
1010
const uint OFFSET_FLEXPN = 20;
1111
const uint OFFSET_PROBEPN = 40;
1212

13-
public NeuropixelsV1eMetadata(I2CRegisterContext serializer)
13+
public NeuropixelsV1eMetadata(DeviceContext deviceContext)
14+
: base(deviceContext, NeuropixelsV1.FlexEepromI2CAddress)
1415
{
15-
var flexI2C = new I2CRegisterContext(serializer, NeuropixelsV1.FlexEepromI2CAddress);
1616
try
1717
{
18-
var sn = flexI2C.ReadBytes(OFFSET_ID, 8);
18+
var sn = ReadBytes(OFFSET_ID, 8);
1919
ProbeSerialNumber = BitConverter.ToUInt64(sn, 0);
20-
Version = flexI2C.ReadByte(OFFSET_VERSION);
21-
Revision = flexI2C.ReadByte(OFFSET_REVISION);
22-
PartNumber = flexI2C.ReadString(OFFSET_FLEXPN, 20);
23-
ProbePartNumber = flexI2C.ReadString(OFFSET_PROBEPN, 20);
20+
Version = ReadByte(OFFSET_VERSION);
21+
Revision = ReadByte(OFFSET_REVISION);
22+
PartNumber = ReadString(OFFSET_FLEXPN, 20);
23+
ProbePartNumber = ReadString(OFFSET_PROBEPN, 20);
2424
}
2525
catch (oni.ONIException ex)
2626
{
27-
throw new InvalidOperationException("Could not communicate with probe. Ensure that the " +
27+
throw new InvalidOperationException("Could not communicate with probe at address " + deviceContext.Address + " . Ensure that the " +
2828
"flex connection is properly seated.", ex);
2929
}
3030
}

OpenEphys.Onix1/NeuropixelsV1fMetadata.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace OpenEphys.Onix1
44
{
5-
class NeuropixelsV1fMetadata : I2CRegisterContext
5+
class NeuropixelsV1fMetadata : I2CRegisterContext
66
{
77
const uint OFFSET_ID = 0;
88
const uint OFFSET_VERSION = 10;
@@ -24,7 +24,7 @@ public NeuropixelsV1fMetadata(DeviceContext deviceContext)
2424
}
2525
catch (oni.ONIException ex)
2626
{
27-
throw new InvalidOperationException("Could not communicate with probe. Ensure that the " +
27+
throw new InvalidOperationException("Could not communicate with probe at address " + deviceContext.Address + " . Ensure that the " +
2828
"flex connection is properly seated.", ex);
2929
}
3030
}

0 commit comments

Comments
 (0)