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; } }