Skip to content

Commit 965f4cb

Browse files
committed
Add 1 second delay before applying port voltage to headstage-64
- During a restart, the headstage is turned off and then on again very rapidly. This seems to cause the serializer not to be completely shut down and to be in an indeterminate state. To combat this, I've simply added a delay before the first voltage to turn the headstage on is applied.
1 parent c22cf83 commit 965f4cb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

OpenEphys.Onix1/ConfigureHeadstage64.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,17 @@ internal override IEnumerable<IDeviceConfiguration> GetDevices()
148148

149149
class ConfigureHeadstage64PortController : ConfigurePortController
150150
{
151+
152+
protected override bool ConfigurePortVoltageOverride(DeviceContext device, double voltage)
153+
{
154+
// NB: Wait for 1 second to discharge the headstage in the case that they have e.g. just
155+
// restarted the workflow automatically with nearly no delay from the last run.
156+
Thread.Sleep(1000);
157+
device.WriteRegister(PortController.PORTVOLTAGE, (uint)(voltage * 10));
158+
Thread.Sleep(500);
159+
return CheckLinkState(device);
160+
}
161+
151162
protected override bool ConfigurePortVoltage(DeviceContext device, out double voltage)
152163
{
153164
// WONTFIX: It takes a huge amount of time to get to 0, almost 10 seconds. The best we can do
@@ -159,6 +170,10 @@ protected override bool ConfigurePortVoltage(DeviceContext device, out double vo
159170
const double VoltageOffset = 3.4;
160171
const double VoltageIncrement = 0.2;
161172

173+
// NB: Wait for 1 second to discharge the headstage in the case that they have e.g. just
174+
// restarted the workflow automatically with nearly no delay from the last run.
175+
Thread.Sleep(1000);
176+
162177
// Start with highest voltage and ramp it down to find lowest lock voltage
163178
voltage = MaxVoltage;
164179
for (; voltage >= MinVoltage; voltage -= VoltageIncrement)

0 commit comments

Comments
 (0)