@@ -125,11 +125,12 @@ public PortName Port
125125 /// Supplying higher voltages may result in damage.
126126 /// </para>
127127 /// </remarks>
128- [ Description ( "If defined, it will override automated voltage discovery and apply the specified voltage" +
129- "to the headstage. Warning: this device requires 5.5V to 6.0V for proper operation. " +
130- "Supplying higher voltages may result in damage to the headstage." ) ]
128+ [ Description ( "If defined, it will override automated voltage discovery and apply the specified voltage " +
129+ "to the headstage. Warning: this device requires 5.5V to 6.0V, measured at the headstage, " +
130+ "for proper operation. Supplying higher voltages may result in damage to the headstage." ) ]
131131 [ Category ( ConfigurationCategory ) ]
132- public double ? PortVoltage
132+ [ TypeConverter ( typeof ( PortVoltageConverter ) ) ]
133+ public AutoPortVoltage PortVoltage
133134 {
134135 get => PortControl . PortVoltage ;
135136 set => PortControl . PortVoltage = value ;
@@ -147,34 +148,38 @@ internal override IEnumerable<IDeviceConfiguration> GetDevices()
147148
148149 class ConfigureHeadstage64PortController : ConfigurePortController
149150 {
150- protected override bool ConfigurePortVoltage ( DeviceContext device )
151+ protected override bool ConfigurePortVoltage ( DeviceContext device , out double voltage )
151152 {
152153 // WONTFIX: It takes a huge amount of time to get to 0, almost 10 seconds. The best we can do
153154 // at the moment is drive port voltage to minimum which is an active process and then settle
154155 // from there to zero volts. This requires a hardware revision that discharges the headstage
155156 // between cycles to fix.
156- const uint MinVoltage = 33 ;
157- const uint MaxVoltage = 60 ;
158- const uint VoltageOffset = 34 ;
159- const uint VoltageIncrement = 02 ;
157+ const double MinVoltage = 3.3 ;
158+ const double MaxVoltage = 6.0 ;
159+ const double VoltageOffset = 3.4 ;
160+ const double VoltageIncrement = 0.2 ;
160161
161162 // Start with highest voltage and ramp it down to find lowest lock voltage
162- var voltage = MaxVoltage ;
163+ voltage = MaxVoltage ;
163164 for ( ; voltage >= MinVoltage ; voltage -= VoltageIncrement )
164165 {
165- device . WriteRegister ( PortController . PORTVOLTAGE , voltage ) ;
166+ device . WriteRegister ( PortController . PORTVOLTAGE , ( uint ) ( 10 * voltage ) ) ;
166167 Thread . Sleep ( 200 ) ;
167168 if ( ! CheckLinkState ( device ) )
168169 {
169- if ( voltage == MaxVoltage ) return false ;
170+ if ( voltage == MaxVoltage )
171+ {
172+ return false ;
173+ }
170174 else break ;
171175 }
172176 }
173177
174- device . WriteRegister ( PortController . PORTVOLTAGE , MinVoltage ) ;
178+ device . WriteRegister ( PortController . PORTVOLTAGE , ( uint ) ( 10 * MinVoltage ) ) ;
175179 device . WriteRegister ( PortController . PORTVOLTAGE , 0 ) ;
176180 Thread . Sleep ( 1000 ) ;
177- device . WriteRegister ( PortController . PORTVOLTAGE , voltage + VoltageOffset ) ;
181+ voltage += VoltageOffset ;
182+ device . WriteRegister ( PortController . PORTVOLTAGE , ( uint ) ( 10 * voltage ) ) ;
178183 Thread . Sleep ( 200 ) ;
179184 return CheckLinkState ( device ) ;
180185 }
0 commit comments