diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c61271..8bde1cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,6 @@ on: jobs: build_and_publish: - uses: open-ephys/github-actions/.github/workflows/build.yml@main + uses: open-ephys/github-actions/.github/workflows/build_dotnet_publish_nuget.yml@main secrets: NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }} diff --git a/Directory.Build.props b/Directory.Build.props index 78f1dc1..28d8209 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,7 +13,7 @@ LICENSE true icon.png - 0.3.1 + 0.3.2 10.0 strict diff --git a/OpenEphys.Miniscope/LegacyUclaMiniscope.cs b/OpenEphys.Miniscope/LegacyUclaMiniscope.cs index f51f21b..f8ef298 100644 --- a/OpenEphys.Miniscope/LegacyUclaMiniscope.cs +++ b/OpenEphys.Miniscope/LegacyUclaMiniscope.cs @@ -12,7 +12,7 @@ namespace OpenEphys.Miniscope public class LegacyUclaMiniscope : Source { - // NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues + // NB: Needs a unique name, even though its a class member, for de/serialization without issues public enum FrameRateLegacy { Fps5 = 0x11, diff --git a/OpenEphys.Miniscope/UclaMiniCam.cs b/OpenEphys.Miniscope/UclaMiniCam.cs index b211f4b..135da2b 100644 --- a/OpenEphys.Miniscope/UclaMiniCam.cs +++ b/OpenEphys.Miniscope/UclaMiniCam.cs @@ -11,7 +11,7 @@ namespace OpenEphys.Miniscope [Description("Produces a data sequence from a UCLA MiniCAM behavioral monitoring camera.")] public class UclaMiniCam : Source { - // NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues + // NB: Needs a unique name, even though its a class member, for de/serialization without issues public enum GainMiniCam { Low = 8, @@ -26,14 +26,15 @@ public enum GainMiniCam // Percent -> register scale factor for setting illumination LED brightness // TODO: Actual value is 0.31. However, if the DAQ is USB powered, using this value - // causes link instabilities even with a short, high-quality, nomimal-gauge SMA cable. - const double LedBrigthnessScaleFactor = 0.26; + // causes link instabilities even with a short, high-quality, nominal-gauge SMA cable. + const double LedBrightnessScaleFactor = 0.26; [Editor("OpenEphys.Miniscope.Design.UclaMiniCamIndexEditor, OpenEphys.Miniscope.Design", typeof(UITypeEditor))] [Description("The index of the camera from which to acquire images.")] public int Index { get; set; } = 0; - [Range(0, 26)] // + [Range(0, 100)] + [Precision(1, 0.1)] [Editor(DesignTypes.SliderEditor, typeof(UITypeEditor))] [Description("LED brightness (percent of max).")] public double LedBrightness { get; set; } = 0; @@ -43,7 +44,7 @@ public enum GainMiniCam [Description("Frames captured per second.")] [Range(5, 47)] - [Editor(DesignTypes.SliderEditor, typeof(UITypeEditor))] + [Editor(DesignTypes.NumericUpDownEditor, typeof(UITypeEditor))] public int FramesPerSecond { get; set; } = 30; // State @@ -51,7 +52,7 @@ public enum GainMiniCam readonly object captureLock = new object(); AbusedUvcRegisters originalState; - // NB: Camera regiser (ab)uses + // NB: Camera register (ab)uses // CaptureProperty.Saturation -> Start acquisition // CaptureProperty.Gamma -> Inverted state of trigger input (3.3 -> Gamma = 0, 0V -> Gamma != 0) // CaptureProperty.Contrast -> DAQ Frame number @@ -70,7 +71,7 @@ static internal AbusedUvcRegisters IssueStartCommands(Capture capture) var cgs = Helpers.ReadConfigurationRegisters(capture); // Magik configuration sequence (configures SERDES and chip default states) - Helpers.SendConfig(capture, Helpers.CreateCommand(192, 7, 176)); // Provide deserializwer with serializer address + Helpers.SendConfig(capture, Helpers.CreateCommand(192, 7, 176)); // Provide deserializer with serializer address Helpers.SendConfig(capture, Helpers.CreateCommand(192, 34, 2)); // Speed up i2c bus timer to 50us max Helpers.SendConfig(capture, Helpers.CreateCommand(192, 32, 10)); // Decrease BCC timeout, units in 2 ms Helpers.SendConfig(capture, Helpers.CreateCommand(176, 15, 2)); // Speed up I2c bus timer to 50u Max @@ -78,7 +79,7 @@ static internal AbusedUvcRegisters IssueStartCommands(Capture capture) Helpers.SendConfig(capture, Helpers.CreateCommand(192, 8, 186, 108)); // Set aliases for MT9P031 and LM3509 Helpers.SendConfig(capture, Helpers.CreateCommand(192, 16, 186, 108)); // Set aliases for MT9P031 and LM3509 Helpers.SendConfig(capture, Helpers.CreateCommand(186, 3, 5, 255)); // Set height to 1535 rows - Helpers.SendConfig(capture, Helpers.CreateCommand(186, 4, 7, 255)); // Set width to 2047 colums + Helpers.SendConfig(capture, Helpers.CreateCommand(186, 4, 7, 255)); // Set width to 2047 columns Helpers.SendConfig(capture, Helpers.CreateCommand(186, 34, 0, 17)); // 2x subsamp and binning 1 Helpers.SendConfig(capture, Helpers.CreateCommand(186, 35, 0, 17)); // 2x subsamp and binning 2 Helpers.SendConfig(capture, Helpers.CreateCommand(186, 32, 0, 96)); // Set column binning to summing instead of averaging @@ -129,7 +130,7 @@ public UclaMiniCam() if (LedBrightness != lastLedBrightness || !initialized) { - var scaled = LedBrigthnessScaleFactor * LedBrightness; + var scaled = LedBrightnessScaleFactor * LedBrightness; Helpers.SendConfig(capture, Helpers.CreateCommand(108, 160, (byte)scaled)); lastLedBrightness = LedBrightness; } diff --git a/OpenEphys.Miniscope/UclaMiniscopeV3.cs b/OpenEphys.Miniscope/UclaMiniscopeV3.cs index 7672b64..d0ca6a2 100644 --- a/OpenEphys.Miniscope/UclaMiniscopeV3.cs +++ b/OpenEphys.Miniscope/UclaMiniscopeV3.cs @@ -11,7 +11,7 @@ namespace OpenEphys.Miniscope [Description("Produces a image sequence acquired from a UCLA Miniscope V3.")] public class UclaMiniscopeV3 : Source { - // NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues + // NB: Needs a unique name, even though its a class member, for de/serialization without issues public enum GainV3 { Low = 225, @@ -19,7 +19,7 @@ public enum GainV3 High = 36 }; - // NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues + // NB: Needs a unique name, even though its a class member, for de/serialization without issues public enum FrameRateV3 { Fps10, diff --git a/OpenEphys.Miniscope/UclaMiniscopeV4.cs b/OpenEphys.Miniscope/UclaMiniscopeV4.cs index e7777d8..4c16525 100644 --- a/OpenEphys.Miniscope/UclaMiniscopeV4.cs +++ b/OpenEphys.Miniscope/UclaMiniscopeV4.cs @@ -12,23 +12,7 @@ namespace OpenEphys.Miniscope [Description("Produces a data sequence from a UCLA Miniscope V4.")] public class UclaMiniscopeV4 : Source { - // NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues - public enum GainV4 - { - Low = 225, - Medium = 228, - High = 36, - }; - // NB: Needs a unique name, even though its a class member, for de/serilizaiton without issues - public enum FrameRateV4 - { - Fps10 = 39 & 0x000000FF | 16 << 8, - Fps15 = 26 & 0x000000FF | 11 << 8, - Fps20 = 19 & 0x000000FF | 136 << 8, - Fps25 = 15 & 0x000000FF | 160 << 8, - Fps30 = 12 & 0x000000FF | 228 << 8, - }; // Frame size const int Width = 608; @@ -41,19 +25,23 @@ public enum FrameRateV4 [Description("The index of the camera from which to acquire images.")] public int Index { get; set; } = 0; + [Precision(1, 0.1)] [Range(0, 100)] [Editor(DesignTypes.SliderEditor, typeof(UITypeEditor))] [Description("Excitation LED brightness (percent of max).")] public double LedBrightness { get; set; } = 0; + [Precision(1, 0.1)] [Range(-100, 100)] [Editor(DesignTypes.SliderEditor, typeof(UITypeEditor))] [Description("Electro-wetting lens focal plane adjustment (percent of range around nominal).")] public double Focus { get; set; } = 0; + [TypeConverter(typeof(GainV4TypeConverter))] [Description("Image sensor gain setting.")] public GainV4 SensorGain { get; set; } = GainV4.Low; + [TypeConverter(typeof(FrameRateV4TypeConverter))] [Description("Frames captured per second.")] public FrameRateV4 FramesPerSecond { get; set; } = FrameRateV4.Fps30; @@ -258,4 +246,61 @@ public override IObservable Generate() return source; } } + + // NB: Needs a unique name, even though its a class member, for de/serialization without issues + public enum GainV4 + { + Low = 225, + Medium = 228, + High = 36, + } + + class GainV4TypeConverter : EnumConverter + { + internal GainV4TypeConverter() + : base(typeof(GainV4)) + { + } + + public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + { + return new StandardValuesCollection(new[] + { + GainV4.Low, + GainV4.Medium, + GainV4.High, + }); + } + } + + // NB: Needs a unique name, even though its a class member, for de/serialization without issues + public enum FrameRateV4 + { + Fps10 = 39 & 0x000000FF | 16 << 8, + Fps15 = 26 & 0x000000FF | 11 << 8, + Fps20 = 19 & 0x000000FF | 136 << 8, + Fps25 = 15 & 0x000000FF | 160 << 8, + Fps30 = 12 & 0x000000FF | 228 << 8, + }; + + + class FrameRateV4TypeConverter : EnumConverter + { + internal FrameRateV4TypeConverter() + : base(typeof(FrameRateV4)) + { + } + + public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + { + return new StandardValuesCollection(new[] + { + FrameRateV4.Fps10, + FrameRateV4.Fps15, + FrameRateV4.Fps20, + FrameRateV4.Fps25, + FrameRateV4.Fps30, + }); + } + } }