File tree Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,6 @@ public class ContextTask : IDisposable
7676 readonly string contextDriver = DefaultDriver ;
7777 readonly int contextIndex = DefaultIndex ;
7878
79- private oni . Hub controllerHub ;
80-
8179 /// <summary>
8280 /// Initializes a new instance of the <see cref="ContextTask"/> class.
8381 /// </summary>
@@ -96,13 +94,11 @@ internal ContextTask(string driver, int index)
9694 contextIndex = index ;
9795 ctx = new oni . Context ( contextDriver , contextIndex ) ;
9896 Initialize ( ) ;
99- controllerHub = GetHub ( 0 ) ;
100- uint versionMajor ;
101- GenericHelper . GetVersionComponents ( controllerHub . FirmwareVersion , out versionMajor , out _ ) ;
102- if ( versionMajor != 2 )
97+ var ( major , _) = GenericHelper . GetFirmwareVersionComponents ( GetHub ( 0 ) . FirmwareVersion ) ;
98+ if ( major != 2 )
10399 {
104- throw new NotSupportedException ( "This library requires version 2.x of the ONIX firmware."
105- + "Please update it . Instructions can be found in "
100+ throw new NotSupportedException ( "This library requires version 2.x of the ONIX firmware. "
101+ + "Please perform a firmware update to use this library . Instructions can be found at "
106102 + "https://open-ephys.github.io/onix-docs/Hardware%20Guide/PCIe%20Host/updating-firmware.html" ) ;
107103 }
108104 }
Original file line number Diff line number Diff line change @@ -8,15 +8,13 @@ public static uint GetHubAddressFromDeviceAddress(uint deviceAddress)
88 }
99
1010 /// <summary>
11- /// Gets the version components from a 16-bit version register value
11+ /// Gets 8-bit version components from a 16-bit version register value
1212 /// </summary>
13- /// <param name="rawVersion">Raw 16-bit version</param>
14- /// <param name="major">Contains the major component extracted from <paramref name="rawVersion"/></param>
15- /// <param name="minor">Contains the minor component extracted from <paramref name="rawVersion"/></param>
16- public static void GetVersionComponents ( uint rawVersion , out uint major , out uint minor )
13+ /// <param name="version">Register value containing a 16-bit firmware version number.</param>
14+ /// <returns> A tuple containing the 8-bit major and minor version components.</returns>
15+ internal static ( byte major , byte minor ) GetFirmwareVersionComponents ( uint version )
1716 {
18- major = ( rawVersion >> 8 ) & 0xFF ;
19- minor = rawVersion & 0xFF ;
17+ return ( ( byte ) ( ( version >> 8 ) & 0xFF ) , ( byte ) ( version & 0xFF ) ) ;
2018 }
2119 }
2220}
You can’t perform that action at this time.
0 commit comments