Skip to content

Commit 0fdccb9

Browse files
committed
Exception message for case of automatic voltage failure
- Provides advice about what to do in the case that the automatic voltage algorithm fails
1 parent db9bbb6 commit 0fdccb9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

OpenEphys.Onix1/AutoPortVoltage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class AutoPortVoltage
1616
public double? Requested { get; set; }
1717

1818
/// <summary>
19-
/// Gets or sets the currently applied port voltage
19+
/// Gets or sets the last applied port voltage
2020
/// </summary>
2121
[XmlIgnore]
2222
public double? Applied { get; internal set; }

OpenEphys.Onix1/ConfigurePortController.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,18 @@ public override IObservable<ContextTask> Process(IObservable<ContextTask> source
7777

7878
if (!serdesLock)
7979
{
80-
dispose();
8180
var port = (PortName)deviceAddress;
8281
var portString = port.GetType()
8382
.GetField(port.ToString())?
8483
.GetCustomAttribute<DescriptionAttribute>()?
8584
.Description ?? "Address " + deviceAddress.ToString();
86-
throw new InvalidOperationException($"Unable to acquire communication lock on {portString}.");
85+
var appliedVoltage = PortVoltage.Applied;
86+
var message = portVoltage.Requested.HasValue ?
87+
$"Unable to acquire communication lock on {portString}" :
88+
$"Unable to acquire communication lock on {portString}. You may need to manually specify a PortVoltage greater than {PortVoltage.Applied} volts, the maximum automatic value for this device.";
89+
90+
dispose();
91+
throw new InvalidOperationException(message);
8792
}
8893

8994
return Disposable.Create(dispose);

0 commit comments

Comments
 (0)