From 96e29ac0aa62f9f9a99f594ab878af66b295ef4c Mon Sep 17 00:00:00 2001 From: Ragot Pierre Date: Wed, 31 May 2023 13:47:58 +0200 Subject: [PATCH 1/5] Update MobiFlightPin.cs to extend pin number limit Extended max pin number from the 255 limit with byte. Hopefully the only reference / limit --- MobiFlight/MobiFlightPin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MobiFlight/MobiFlightPin.cs b/MobiFlight/MobiFlightPin.cs index bec423dc7..261ad0b83 100644 --- a/MobiFlight/MobiFlightPin.cs +++ b/MobiFlight/MobiFlightPin.cs @@ -6,7 +6,7 @@ namespace MobiFlight public class MobiFlightPin { [XmlAttribute] - public byte Pin { get; set; } + public uint Pin { get; set; } [XmlAttribute] public bool isAnalog = false; [XmlAttribute] From 6f4988a32dd6ccfac67598eb366901a550971c3d Mon Sep 17 00:00:00 2001 From: Ragot Pierre Date: Wed, 31 May 2023 16:08:29 +0200 Subject: [PATCH 2/5] Update README.md Changed RunTests badge to local repo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5bbe382e..da91e5d4e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![RunTests](https://github.com/MobiFlight/MobiFlight-Connector/actions/workflows/ci.yml/badge.svg)](https://github.com/MobiFlight/MobiFlight-Connector/actions/workflows/ci.yml) +[![RunTests](https://github.com/Ragot-Pierre/MobiFlight-Connector/actions/workflows/ci.yml/badge.svg)](https://github.com/Ragot-Pierre/MobiFlight-Connector/actions/workflows/ci.yml) # Readme # From 7ed6c814a05af781219272757d379c1e9c6bc182 Mon Sep 17 00:00:00 2001 From: Pierre RAGOT Date: Wed, 31 May 2023 20:35:05 +0200 Subject: [PATCH 3/5] Improved UI handling of pins numbers over 255 --- Base/ComboBoxHelper.cs | 10 ++-- MobiFlight/MobiFlightModule.cs | 66 +++++++++++------------ Properties/Settings.Designer.cs | 36 ++++++------- UI/Panels/Device/MFAnalogPanel.cs | 2 +- UI/Panels/Device/MFButtonPanel.cs | 2 +- UI/Panels/Device/MFOutputPanel.cs | 2 +- UI/Panels/Device/MFServoPanel.Designer.cs | 2 +- UI/Panels/Output/DisplayPinPanel.cs | 2 +- 8 files changed, 61 insertions(+), 61 deletions(-) diff --git a/Base/ComboBoxHelper.cs b/Base/ComboBoxHelper.cs index 3810c57eb..2904d0774 100644 --- a/Base/ComboBoxHelper.cs +++ b/Base/ComboBoxHelper.cs @@ -65,8 +65,8 @@ static public bool BindMobiFlightFreePins(ComboBox comboBox, List // Deep-clone list as 'Used' list List UsablePins = Pins.ConvertAll(pin => new MobiFlightPin(pin)); // Mark current pin as free - if (UsablePins.Exists(x => x.Pin == byte.Parse(CurrentPin))) - UsablePins.Find(x => x.Pin == byte.Parse(CurrentPin)).Used = false; + if (UsablePins.Exists(x => x.Pin == uint.Parse(CurrentPin))) + UsablePins.Find(x => x.Pin == uint.Parse(CurrentPin)).Used = false; if (analogOnly == true) { @@ -79,7 +79,7 @@ static public bool BindMobiFlightFreePins(ComboBox comboBox, List comboBox.ValueMember = "Pin"; // Restore the original item selection - comboBox.SelectedValue = byte.Parse(CurrentPin); + comboBox.SelectedValue = uint.Parse(CurrentPin); return false; } @@ -91,8 +91,8 @@ static public void reassignPin(ComboBox comboBox, List pinList, r // and the new one as used) // - an updated pin list is associated to the ComboBox string after = comboBox.SelectedItem.ToString(); - byte nBefore = byte.Parse(signalPin); - byte nAfter = byte.Parse(after); + uint nBefore = uint.Parse(signalPin); + uint nAfter = uint.Parse(after); try { if (signalPin != after) { // Pin 0 is used for the stepper. diff --git a/MobiFlight/MobiFlightModule.cs b/MobiFlight/MobiFlightModule.cs index 7832d1daf..399b92aad 100644 --- a/MobiFlight/MobiFlightModule.cs +++ b/MobiFlight/MobiFlightModule.cs @@ -266,7 +266,7 @@ public void Connect() } // Create Serial Port object - int baudRate = 115200; + int baudRate = 460800; //baudRate = 57600; _transportLayer = new SerialTransport() //_transportLayer = new SerialPortManager @@ -1246,7 +1246,7 @@ public List GetPins(bool FreeOnly = false, bool ExcludeI2CDevices List ResultPins = new List(); ResultPins.AddRange(Board.Pins.Select(x => new MobiFlightPin(x))); - List usedPins = new List(); + List usedPins = new List(); foreach (Config.BaseDevice device in Config.Items) { @@ -1254,39 +1254,39 @@ public List GetPins(bool FreeOnly = false, bool ExcludeI2CDevices switch (device.Type) { case DeviceType.LedModule: - usedPins.Add(Convert.ToByte((device as LedModule).ClkPin)); - usedPins.Add(Convert.ToByte((device as LedModule).ClsPin)); - usedPins.Add(Convert.ToByte((device as LedModule).DinPin)); + usedPins.Add(Convert.ToUInt32((device as LedModule).ClkPin)); + usedPins.Add(Convert.ToUInt32((device as LedModule).ClsPin)); + usedPins.Add(Convert.ToUInt32((device as LedModule).DinPin)); break; case DeviceType.Stepper: - usedPins.Add(Convert.ToByte((device as Stepper).Pin1)); - usedPins.Add(Convert.ToByte((device as Stepper).Pin2)); - usedPins.Add(Convert.ToByte((device as Stepper).Pin3)); - usedPins.Add(Convert.ToByte((device as Stepper).Pin4)); + usedPins.Add(Convert.ToUInt32((device as Stepper).Pin1)); + usedPins.Add(Convert.ToUInt32((device as Stepper).Pin2)); + usedPins.Add(Convert.ToUInt32((device as Stepper).Pin3)); + usedPins.Add(Convert.ToUInt32((device as Stepper).Pin4)); // We don't have to set the default 0 pin (for none auto zero) if ((device as MobiFlight.Config.Stepper).BtnPin != "0") - usedPins.Add(Convert.ToByte((device as Stepper).BtnPin)); + usedPins.Add(Convert.ToUInt32((device as Stepper).BtnPin)); break; case DeviceType.Servo: - usedPins.Add(Convert.ToByte((device as Servo).DataPin)); + usedPins.Add(Convert.ToUInt32((device as Servo).DataPin)); break; case DeviceType.Button: - usedPins.Add(Convert.ToByte((device as Button).Pin)); + usedPins.Add(Convert.ToUInt32((device as Button).Pin)); break; case DeviceType.Encoder: - usedPins.Add(Convert.ToByte((device as Config.Encoder).PinLeft)); - usedPins.Add(Convert.ToByte((device as Config.Encoder).PinRight)); + usedPins.Add(Convert.ToUInt32((device as Config.Encoder).PinLeft)); + usedPins.Add(Convert.ToUInt32((device as Config.Encoder).PinRight)); break; case DeviceType.InputShiftRegister: - usedPins.Add(Convert.ToByte((device as InputShiftRegister).ClockPin)); - usedPins.Add(Convert.ToByte((device as InputShiftRegister).DataPin)); - usedPins.Add(Convert.ToByte((device as InputShiftRegister).LatchPin)); + usedPins.Add(Convert.ToUInt32((device as InputShiftRegister).ClockPin)); + usedPins.Add(Convert.ToUInt32((device as InputShiftRegister).DataPin)); + usedPins.Add(Convert.ToUInt32((device as InputShiftRegister).LatchPin)); break; case DeviceType.LcdDisplay: @@ -1298,40 +1298,40 @@ public List GetPins(bool FreeOnly = false, bool ExcludeI2CDevices // Statically add correct I2C pins foreach (MobiFlightPin pin in Board.Pins.FindAll(x => x.isI2C)) { - if (usedPins.Contains(Convert.ToByte(pin.Pin))) continue; - usedPins.Add(Convert.ToByte(pin.Pin)); + if (usedPins.Contains(Convert.ToUInt32(pin.Pin))) continue; + usedPins.Add(Convert.ToUInt32(pin.Pin)); } break; case DeviceType.Output: - usedPins.Add(Convert.ToByte((device as Output).Pin)); + usedPins.Add(Convert.ToUInt32((device as Output).Pin)); break; case DeviceType.AnalogInput: - usedPins.Add(Convert.ToByte((device as AnalogInput).Pin)); + usedPins.Add(Convert.ToUInt32((device as AnalogInput).Pin)); break; case DeviceType.ShiftRegister: - usedPins.Add(Convert.ToByte((device as ShiftRegister).ClockPin)); - usedPins.Add(Convert.ToByte((device as ShiftRegister).LatchPin)); - usedPins.Add(Convert.ToByte((device as ShiftRegister).DataPin)); + usedPins.Add(Convert.ToUInt32((device as ShiftRegister).ClockPin)); + usedPins.Add(Convert.ToUInt32((device as ShiftRegister).LatchPin)); + usedPins.Add(Convert.ToUInt32((device as ShiftRegister).DataPin)); break; case DeviceType.InputMultiplexer: - usedPins.Add(Convert.ToByte((device as InputMultiplexer).DataPin)); - usedPins.Add(Convert.ToByte((device as InputMultiplexer).Selector.PinSx[0])); - usedPins.Add(Convert.ToByte((device as InputMultiplexer).Selector.PinSx[1])); - usedPins.Add(Convert.ToByte((device as InputMultiplexer).Selector.PinSx[2])); - usedPins.Add(Convert.ToByte((device as InputMultiplexer).Selector.PinSx[3])); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).DataPin)); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).Selector.PinSx[0])); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).Selector.PinSx[1])); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).Selector.PinSx[2])); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).Selector.PinSx[3])); break; // If the multiplexerDriver is to be handled as a regular device // but explicitly defined by its own config line, following 'case' is required: //case DeviceType.MultiplexerDriver: - // usedPins.Add(Convert.ToByte((device as MultiplexerDriver).PinSx[0])); - // usedPins.Add(Convert.ToByte((device as MultiplexerDriver).PinSx[1])); - // usedPins.Add(Convert.ToByte((device as MultiplexerDriver).PinSx[2])); - // usedPins.Add(Convert.ToByte((device as MultiplexerDriver).PinSx[3])); + // usedPins.Add(Convert.ToUInt32((device as MultiplexerDriver).PinSx[0])); + // usedPins.Add(Convert.ToUInt32((device as MultiplexerDriver).PinSx[1])); + // usedPins.Add(Convert.ToUInt32((device as MultiplexerDriver).PinSx[2])); + // usedPins.Add(Convert.ToUInt32((device as MultiplexerDriver).PinSx[3])); // break; default: diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index d2f109a03..ca4190af3 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Ce code a été généré par un outil. +// Version du runtime :4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si +// le code est régénéré. // //------------------------------------------------------------------------------ @@ -12,7 +12,7 @@ namespace MobiFlight.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -395,19 +395,6 @@ public bool LogJoystickAxis { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("\r\n")] - public global::System.Collections.Specialized.StringCollection RecentFiles { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["RecentFiles"])); - } - set { - this["RecentFiles"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] @@ -455,5 +442,18 @@ public bool AutoRetrigger { this["AutoRetrigger"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("\r\n")] + public global::System.Collections.Specialized.StringCollection RecentFiles { + get { + return ((global::System.Collections.Specialized.StringCollection)(this["RecentFiles"])); + } + set { + this["RecentFiles"] = value; + } + } } } diff --git a/UI/Panels/Device/MFAnalogPanel.cs b/UI/Panels/Device/MFAnalogPanel.cs index f10dd6a42..5060e3c9c 100644 --- a/UI/Panels/Device/MFAnalogPanel.cs +++ b/UI/Panels/Device/MFAnalogPanel.cs @@ -42,7 +42,7 @@ public MFAnalogPanel(MobiFlight.Config.AnalogInput analogDevice, List Pins): ComboBoxHelper.BindMobiFlightFreePins(mfPinComboBox, Pins, button.Pin); this.button = button; - mfPinComboBox.SelectedValue = byte.Parse(button.Pin); + mfPinComboBox.SelectedValue = uint.Parse(button.Pin); textBox1.Text = button.Name; ////setValues(); diff --git a/UI/Panels/Device/MFOutputPanel.cs b/UI/Panels/Device/MFOutputPanel.cs index 7e80abefd..259534bb6 100644 --- a/UI/Panels/Device/MFOutputPanel.cs +++ b/UI/Panels/Device/MFOutputPanel.cs @@ -47,7 +47,7 @@ private void value_Changed(object sender, EventArgs e) private bool isPwmPin() { bool result = false; - byte bPin = byte.Parse(mfPinComboBox.SelectedItem.ToString()); + uint bPin = uint.Parse(mfPinComboBox.SelectedItem.ToString()); var pin = MobiFlightBoard.Pins.Find(x => (x.Pin == bPin)); return pin.isPWM; } diff --git a/UI/Panels/Device/MFServoPanel.Designer.cs b/UI/Panels/Device/MFServoPanel.Designer.cs index 7b6c42497..69caf7bbb 100644 --- a/UI/Panels/Device/MFServoPanel.Designer.cs +++ b/UI/Panels/Device/MFServoPanel.Designer.cs @@ -62,7 +62,7 @@ private void InitializeComponent() this.mfPinComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.mfPinComboBox.FormattingEnabled = true; this.mfPinComboBox.Location = new System.Drawing.Point(18, 19); - this.mfPinComboBox.MaxLength = 2; + this.mfPinComboBox.MaxLength = 5; this.mfPinComboBox.Name = "mfPinComboBox"; this.mfPinComboBox.Size = new System.Drawing.Size(45, 21); this.mfPinComboBox.TabIndex = 13; diff --git a/UI/Panels/Output/DisplayPinPanel.cs b/UI/Panels/Output/DisplayPinPanel.cs index 0057bcb03..3c25abb27 100644 --- a/UI/Panels/Output/DisplayPinPanel.cs +++ b/UI/Panels/Output/DisplayPinPanel.cs @@ -181,7 +181,7 @@ private void displayPinComboBox_SelectedIndexChanged(object sender, EventArgs e) foreach (var item in Module.GetConnectedDevices(pin)) { pwmPinPanel.Enabled = pwmPinPanel.Visible = Module.getPwmPins() - .Find(x => x.Pin == (byte)(item as MobiFlightOutput).Pin) != null; + .Find(x => x.Pin == (uint)(item as MobiFlightOutput).Pin) != null; return; } } From e76a19469245407d7d9e83b0590f8d3c70b6762e Mon Sep 17 00:00:00 2001 From: Ragot Pierre Date: Fri, 19 Apr 2024 23:00:20 +0200 Subject: [PATCH 4/5] Changed max pin number Changed "byte" definitions to "uint" for more than 255 pin per module --- Base/ComboBoxHelper.cs | 10 ++--- MobiFlight/MobiFlightModule.cs | 68 ++++++++++++++--------------- UI/Panels/Output/DisplayPinPanel.cs | 2 +- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Base/ComboBoxHelper.cs b/Base/ComboBoxHelper.cs index a8804df97..08da3d4f7 100644 --- a/Base/ComboBoxHelper.cs +++ b/Base/ComboBoxHelper.cs @@ -80,8 +80,8 @@ static public bool BindMobiFlightFreePins(ComboBox comboBox, List // Deep-clone list as 'Used' list List UsablePins = Pins.ConvertAll(pin => new MobiFlightPin(pin)); // Mark current pin (if any specified) as free - if (CurrentPin != "" && UsablePins.Exists(x => x.Pin == byte.Parse(CurrentPin))) { - UsablePins.Find(x => x.Pin == byte.Parse(CurrentPin)).Used = false; + if (CurrentPin != "" && UsablePins.Exists(x => x.Pin == uint.Parse(CurrentPin))) { + UsablePins.Find(x => x.Pin == uint.Parse(CurrentPin)).Used = false; } if (analogOnly == true) @@ -96,7 +96,7 @@ static public bool BindMobiFlightFreePins(ComboBox comboBox, List // Restore the original item selection (if any) if (CurrentPin != "") { - var pinNo = byte.Parse(CurrentPin); + var pinNo = uint.Parse(CurrentPin); try { comboBox.SelectedValue = pinNo; } @@ -126,7 +126,7 @@ static public void reassignPin(string newPin, List pinList, ref s } static public void freePin(List pinList, string currentPin) { - byte nBefore = byte.Parse(currentPin); + uint nBefore = uint.Parse(currentPin); try { MobiFlightPin p; p = pinList.Find(x => x.Pin == nBefore); @@ -145,7 +145,7 @@ static public void assignPin(List pinList, ref string newPin) MobiFlightPin p = null; if (newPin != "") { // A desired pin is specified: seek it - byte newPinNo = byte.Parse(newPin); + uint newPinNo = uint.Parse(newPin); p = pinList.Find(x => x.Pin == newPinNo); if (p == null) throw new Exception("Nonexistent pin number"); } diff --git a/MobiFlight/MobiFlightModule.cs b/MobiFlight/MobiFlightModule.cs index 4d8cddc43..64db52a95 100644 --- a/MobiFlight/MobiFlightModule.cs +++ b/MobiFlight/MobiFlightModule.cs @@ -1323,7 +1323,7 @@ public List GetPins(bool FreeOnly = false, bool ExcludeI2CDevices List ResultPins = new List(); ResultPins.AddRange(Board.Pins.Select(x => new MobiFlightPin(x))); - List usedPins = new List(); + List usedPins = new List(); foreach (Config.BaseDevice device in Config.Items) { @@ -1331,43 +1331,43 @@ public List GetPins(bool FreeOnly = false, bool ExcludeI2CDevices switch (device.Type) { case DeviceType.LedModule: - usedPins.Add(Convert.ToByte((device as LedModule).ClkPin)); + usedPins.Add(Convert.ToUInt32((device as LedModule).ClkPin)); if ((device as LedModule).ModelType == LedModule.MODEL_TYPE_MAX72xx) { if ((device as LedModule).ClsPin != "") - usedPins.Add(Convert.ToByte((device as LedModule).ClsPin)); + usedPins.Add(Convert.ToUInt32((device as LedModule).ClsPin)); } - usedPins.Add(Convert.ToByte((device as LedModule).DinPin)); + usedPins.Add(Convert.ToUInt32((device as LedModule).DinPin)); break; case DeviceType.Stepper: - usedPins.Add(Convert.ToByte((device as Stepper).Pin1)); - usedPins.Add(Convert.ToByte((device as Stepper).Pin2)); - usedPins.Add(Convert.ToByte((device as Stepper).Pin3)); - usedPins.Add(Convert.ToByte((device as Stepper).Pin4)); + usedPins.Add(Convert.ToUInt32((device as Stepper).Pin1)); + usedPins.Add(Convert.ToUInt32((device as Stepper).Pin2)); + usedPins.Add(Convert.ToUInt32((device as Stepper).Pin3)); + usedPins.Add(Convert.ToUInt32((device as Stepper).Pin4)); // We don't have to set the default 0 pin (for none auto zero) if ((device as MobiFlight.Config.Stepper).BtnPin != "0") - usedPins.Add(Convert.ToByte((device as Stepper).BtnPin)); + usedPins.Add(Convert.ToUInt32((device as Stepper).BtnPin)); break; case DeviceType.Servo: - usedPins.Add(Convert.ToByte((device as Servo).DataPin)); + usedPins.Add(Convert.ToUInt32((device as Servo).DataPin)); break; case DeviceType.Button: - usedPins.Add(Convert.ToByte((device as Button).Pin)); + usedPins.Add(Convert.ToUInt32((device as Button).Pin)); break; case DeviceType.Encoder: - usedPins.Add(Convert.ToByte((device as Config.Encoder).PinLeft)); - usedPins.Add(Convert.ToByte((device as Config.Encoder).PinRight)); + usedPins.Add(Convert.ToUInt32((device as Config.Encoder).PinLeft)); + usedPins.Add(Convert.ToUInt32((device as Config.Encoder).PinRight)); break; case DeviceType.InputShiftRegister: - usedPins.Add(Convert.ToByte((device as InputShiftRegister).ClockPin)); - usedPins.Add(Convert.ToByte((device as InputShiftRegister).DataPin)); - usedPins.Add(Convert.ToByte((device as InputShiftRegister).LatchPin)); + usedPins.Add(Convert.ToUInt32((device as InputShiftRegister).ClockPin)); + usedPins.Add(Convert.ToUInt32((device as InputShiftRegister).DataPin)); + usedPins.Add(Convert.ToUInt32((device as InputShiftRegister).LatchPin)); break; case DeviceType.LcdDisplay: @@ -1379,44 +1379,44 @@ public List GetPins(bool FreeOnly = false, bool ExcludeI2CDevices // Statically add correct I2C pins foreach (MobiFlightPin pin in Board.Pins.FindAll(x => x.isI2C)) { - if (usedPins.Contains(Convert.ToByte(pin.Pin))) continue; - usedPins.Add(Convert.ToByte(pin.Pin)); + if (usedPins.Contains(Convert.ToUInt32(pin.Pin))) continue; + usedPins.Add(Convert.ToUInt32(pin.Pin)); } break; case DeviceType.Output: - usedPins.Add(Convert.ToByte((device as Output).Pin)); + usedPins.Add(Convert.ToUInt32((device as Output).Pin)); break; case DeviceType.AnalogInput: - usedPins.Add(Convert.ToByte((device as AnalogInput).Pin)); + usedPins.Add(Convert.ToUInt32((device as AnalogInput).Pin)); break; case DeviceType.ShiftRegister: - usedPins.Add(Convert.ToByte((device as ShiftRegister).ClockPin)); - usedPins.Add(Convert.ToByte((device as ShiftRegister).LatchPin)); - usedPins.Add(Convert.ToByte((device as ShiftRegister).DataPin)); + usedPins.Add(Convert.ToUInt32((device as ShiftRegister).ClockPin)); + usedPins.Add(Convert.ToUInt32((device as ShiftRegister).LatchPin)); + usedPins.Add(Convert.ToUInt32((device as ShiftRegister).DataPin)); break; case DeviceType.InputMultiplexer: - usedPins.Add(Convert.ToByte((device as InputMultiplexer).DataPin)); - usedPins.Add(Convert.ToByte((device as InputMultiplexer).Selector.PinSx[0])); - usedPins.Add(Convert.ToByte((device as InputMultiplexer).Selector.PinSx[1])); - usedPins.Add(Convert.ToByte((device as InputMultiplexer).Selector.PinSx[2])); - usedPins.Add(Convert.ToByte((device as InputMultiplexer).Selector.PinSx[3])); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).DataPin)); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).Selector.PinSx[0])); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).Selector.PinSx[1])); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).Selector.PinSx[2])); + usedPins.Add(Convert.ToUInt32((device as InputMultiplexer).Selector.PinSx[3])); break; case DeviceType.CustomDevice: - (device as CustomDevice).ConfiguredPins.ForEach(p => usedPins.Add(Convert.ToByte((p)))); + (device as CustomDevice).ConfiguredPins.ForEach(p => usedPins.Add(Convert.ToUInt32((p)))); break; // If the multiplexerDriver is to be handled as a regular device // but explicitly defined by its own config line, following 'case' is required: //case DeviceType.MultiplexerDriver: - // usedPins.Add(Convert.ToByte((device as MultiplexerDriver).PinSx[0])); - // usedPins.Add(Convert.ToByte((device as MultiplexerDriver).PinSx[1])); - // usedPins.Add(Convert.ToByte((device as MultiplexerDriver).PinSx[2])); - // usedPins.Add(Convert.ToByte((device as MultiplexerDriver).PinSx[3])); + // usedPins.Add(Convert.ToUInt32((device as MultiplexerDriver).PinSx[0])); + // usedPins.Add(Convert.ToUInt32((device as MultiplexerDriver).PinSx[1])); + // usedPins.Add(Convert.ToUInt32((device as MultiplexerDriver).PinSx[2])); + // usedPins.Add(Convert.ToUInt32((device as MultiplexerDriver).PinSx[3])); // break; default: @@ -1425,7 +1425,7 @@ public List GetPins(bool FreeOnly = false, bool ExcludeI2CDevices } // Mark all the used pins as used in the result list. - foreach (byte pinNo in usedPins) + foreach (uint pinNo in usedPins) { MobiFlightPin pin = ResultPins.Find(resultPin => resultPin.Pin == pinNo); if (pin != null) pin.Used = true; diff --git a/UI/Panels/Output/DisplayPinPanel.cs b/UI/Panels/Output/DisplayPinPanel.cs index 7a361fa6d..4afa32cac 100644 --- a/UI/Panels/Output/DisplayPinPanel.cs +++ b/UI/Panels/Output/DisplayPinPanel.cs @@ -182,7 +182,7 @@ private void displayPinComboBox_SelectedIndexChanged(object sender, EventArgs e) { pwmPinPanel.Enabled = pwmPinPanel.Visible = Module.getPwmPins() - .Find(x => x.Pin == (byte)(item as MobiFlightOutput).Pin) != null; + .Find(x => x.Pin == (uint)(item as MobiFlightOutput).Pin) != null; return; } } From 9b8deba57f4e8353273fd32448dd55c4e9f39ecc Mon Sep 17 00:00:00 2001 From: Ragot Pierre Date: Tue, 23 Apr 2024 13:40:07 +0200 Subject: [PATCH 5/5] Update README.md Reversed github links to original MobiFlight repo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da91e5d4e..a5bbe382e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![RunTests](https://github.com/Ragot-Pierre/MobiFlight-Connector/actions/workflows/ci.yml/badge.svg)](https://github.com/Ragot-Pierre/MobiFlight-Connector/actions/workflows/ci.yml) +[![RunTests](https://github.com/MobiFlight/MobiFlight-Connector/actions/workflows/ci.yml/badge.svg)](https://github.com/MobiFlight/MobiFlight-Connector/actions/workflows/ci.yml) # Readme #