From 84e6d600f410497e953964d5b7177cd1bb4de529 Mon Sep 17 00:00:00 2001 From: mandrolic Date: Sun, 20 Feb 2011 23:01:29 +0000 Subject: [PATCH] Configurator.Net: Transmitter calibration (In Progress) git-svn-id: https://arducopter.googlecode.com/svn/trunk@1700 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- .../ArducopterConfigurator.csproj | 18 ++ .../TransmitterChannelsVm.cs | 178 +++++++++++++++--- .../Configurator.Net/Views/AcroConfigView.cs | 3 +- .../Views/AltitudeHoldConfigView.cs | 4 +- .../Configurator.Net/Views/FlightDataView.cs | 5 +- .../Views/PositionHoldConfigView.cs | 5 +- .../Views/StableConfigView.cs | 5 +- .../Views/TransmitterChannelsView.Designer.cs | 88 ++++++++- .../Views/TransmitterChannelsView.cs | 5 +- .../Views/TransmitterChannelsView.resx | 139 ++++++++++++++ .../Configurator.Net/Views/ViewCommon.cs | 19 +- .../Views/controls/PropControl.Designer.cs | 45 +++++ .../Views/controls/PropControl.cs | 45 +++++ .../Views/controls/PropControl.resx | 120 ++++++++++++ .../controls/QuadPlanControl.Designer.cs | 55 ++++++ .../Views/controls/QuadPlanControl.cs | 51 +++++ .../Views/controls/QuadPlanControl.resx | 120 ++++++++++++ 17 files changed, 864 insertions(+), 41 deletions(-) create mode 100644 Configurator/Configurator.Net/Views/controls/PropControl.Designer.cs create mode 100644 Configurator/Configurator.Net/Views/controls/PropControl.cs create mode 100644 Configurator/Configurator.Net/Views/controls/PropControl.resx create mode 100644 Configurator/Configurator.Net/Views/controls/QuadPlanControl.Designer.cs create mode 100644 Configurator/Configurator.Net/Views/controls/QuadPlanControl.cs create mode 100644 Configurator/Configurator.Net/Views/controls/QuadPlanControl.resx diff --git a/Configurator/Configurator.Net/ArducopterConfigurator.csproj b/Configurator/Configurator.Net/ArducopterConfigurator.csproj index 873250a174..48df78bf21 100644 --- a/Configurator/Configurator.Net/ArducopterConfigurator.csproj +++ b/Configurator/Configurator.Net/ArducopterConfigurator.csproj @@ -54,6 +54,18 @@ + + Component + + + PropControl.cs + + + UserControl + + + QuadPlanControl.cs + UserControl @@ -192,6 +204,12 @@ + + PropControl.cs + + + QuadPlanControl.cs + PositionAltitudePidsView.cs diff --git a/Configurator/Configurator.Net/PresentationModels/TransmitterChannelsVm.cs b/Configurator/Configurator.Net/PresentationModels/TransmitterChannelsVm.cs index 85aa323f49..ba679f8465 100644 --- a/Configurator/Configurator.Net/PresentationModels/TransmitterChannelsVm.cs +++ b/Configurator/Configurator.Net/PresentationModels/TransmitterChannelsVm.cs @@ -6,6 +6,26 @@ namespace ArducopterConfigurator.PresentationModels { public class TransmitterChannelsVm : NotifyProperyChangedBase, IPresentationModel { + private const string CALIB_REFRESH = "J"; + private const string CALIB_UPDATE = "I"; + private const string STOP_UPDATES = "X"; + private const string START_UPDATES = "U"; + private const string WRITE_TO_EEPROM = "W"; + + private bool _isCalibrating; + + public bool IsCalibrating + { + get { return _isCalibrating; } + set + { + if (_isCalibrating == value) return; + _isCalibrating = value; + FirePropertyChanged("IsCalibrating"); + } + } + + private readonly string[] _propsInUpdateOrder = new[] { "Roll", // Aileron @@ -22,9 +42,105 @@ namespace ArducopterConfigurator.PresentationModels public TransmitterChannelsVm() { + StartCalibrationCommand = new DelegateCommand(_ => BeginCalibration(),_=>!IsCalibrating); + SaveCalibrationCommand = new DelegateCommand(_ => SaveCalibration(),_=> IsCalibrating); + + // todo: cancel calibration? + CancelCalibrationCommand = new DelegateCommand(_ => CancelCalibration(), _ => IsCalibrating); + + ResetCommand = new DelegateCommand(_ => ResetWatermarks()); } + + private void sendString(string str) + { + if (sendTextToApm != null) + sendTextToApm(this, new sendTextToApmEventArgs(str)); + } + + private void BeginCalibration() + { + ResetWatermarks(); + IsCalibrating = true; + + // send x command to stop jabber + sendString(STOP_UPDATES); + + // send command to clear the slope and offsets + // 11;0;1;0;1;0;1;0;1;0;1;0; + sendString("11;0;1;0;1;0;1;0;1;0;1;0;"); + + // continue the sensor + sendString(START_UPDATES); + + } + + + private void CancelCalibration() + { + IsCalibrating = false; + } + + private float GetScale(int min, int max) + { + var span = max - min; + return 1000F / span; + } + + private int GetOffset(int min, int max) + { + return 0 - (int) ((min * GetScale(min,max)-1000)); + } + + private void SaveCalibration() + { + // send values + // eg 1.17,-291.91,1.18,-271.76,1.19,-313.91,1.18,-293.63,1.66,-1009.9 + +// ch_roll_slope = readFloatSerial(); +// ch_roll_offset = readFloatSerial(); +// ch_pitch_slope = readFloatSerial(); +// ch_pitch_offset = readFloatSerial(); +// ch_yaw_slope = readFloatSerial(); +// ch_yaw_offset = readFloatSerial(); +// ch_throttle_slope = readFloatSerial(); +// ch_throttle_offset = readFloatSerial(); +// ch_aux_slope = readFloatSerial(); +// ch_aux_offset = readFloatSerial(); +// ch_aux2_slope = readFloatSerial(); +// ch_aux2_offset = readFloatSerial(); + + // From Configurator: + // 1.20,-331.74,1.20,-296.87,1.21,-350.73,1.19,-315.41,1.76,-1186.95,1.77,-1194.35 + + + + var vals = string.Format("{0:0.00};{1};{2:0.00};{3};{4:0.00};{5};{6:0.00};{7};{8:0.00};{9};{10:0.00};{11};", + GetScale(RollMin, RollMax), + GetOffset(RollMin, RollMax), + GetScale(PitchMin, PitchMax), + GetOffset(PitchMin, PitchMax), + GetScale(YawMin, YawMax), + GetOffset(YawMin, YawMax), + GetScale(ThrottleMin, ThrottleMax), + GetOffset(ThrottleMin, ThrottleMax), + GetScale(AuxMin, AuxMax), + GetOffset(AuxMin, AuxMax), + GetScale(ModeMin, ModeMax), + GetOffset(ModeMin, ModeMax) // this correct? + ); + + + + + + IsCalibrating = false; + + // save + //sendString(WRITE_TO_EEPROM); + } + private void ResetWatermarks() { ThrottleMin = ThrottleMax = Throttle; @@ -36,12 +152,45 @@ namespace ArducopterConfigurator.PresentationModels } public ICommand ResetCommand { get; private set; } + public ICommand StartCalibrationCommand { get; private set; } + public ICommand SaveCalibrationCommand { get; private set; } + public ICommand CancelCalibrationCommand { get; private set; } public int RollMidValue { get; set; } public int PitchMidValue { get; set; } public int YawMidValue { get; set; } + + public string Name + { + get { return "Transmitter Channels"; } + } + + public void Activate() + { + IsCalibrating = false; + sendString(START_UPDATES); + } + + public void DeActivate() + { + sendString(STOP_UPDATES); + } + + public event EventHandler updatedByApm; + + public void handleLineOfText(string strRx) + { + PropertyHelper.PopulatePropsFromUpdate(this, _propsInUpdateOrder, strRx, false); + + + } + + public event EventHandler sendTextToApm; + + #region bindables + private int _roll; public int Roll { @@ -273,6 +422,7 @@ namespace ArducopterConfigurator.PresentationModels } private int _auxMin; + public int AuxMin { get { return _auxMin; } @@ -284,34 +434,8 @@ namespace ArducopterConfigurator.PresentationModels } } - public string Name - { - get { return "Transmitter Channels"; } - } + #endregion - public void Activate() - { - if (sendTextToApm != null) - sendTextToApm(this, new sendTextToApmEventArgs("U")); - - } - public void DeActivate() - { - if (sendTextToApm != null) - sendTextToApm(this, new sendTextToApmEventArgs("X")); - - } - - public event EventHandler updatedByApm; - - public void handleLineOfText(string strRx) - { - PropertyHelper.PopulatePropsFromUpdate(this, _propsInUpdateOrder, strRx, false); - - - } - - public event EventHandler sendTextToApm; } } \ No newline at end of file diff --git a/Configurator/Configurator.Net/Views/AcroConfigView.cs b/Configurator/Configurator.Net/Views/AcroConfigView.cs index 909b8d3166..ff38e22b10 100644 --- a/Configurator/Configurator.Net/Views/AcroConfigView.cs +++ b/Configurator/Configurator.Net/Views/AcroConfigView.cs @@ -14,11 +14,12 @@ namespace ArducopterConfigurator.Views public AcroConfigView() { InitializeComponent(); - BindButtons(); } public override void SetDataContext(AcroModeConfigVm vm) { + BindButtons(vm); + AcroModeConfigVmBindingSource.DataSource = vm; if (Program.IsMonoRuntime) diff --git a/Configurator/Configurator.Net/Views/AltitudeHoldConfigView.cs b/Configurator/Configurator.Net/Views/AltitudeHoldConfigView.cs index b91b9f7cc8..f49259b78f 100644 --- a/Configurator/Configurator.Net/Views/AltitudeHoldConfigView.cs +++ b/Configurator/Configurator.Net/Views/AltitudeHoldConfigView.cs @@ -14,11 +14,13 @@ namespace ArducopterConfigurator.Views public AltitudeHoldConfigView() { InitializeComponent(); - BindButtons(); + } public override void SetDataContext(AltitudeHoldConfigVm vm) { + BindButtons(vm); + AltitudeHoldConfigBindingSource.DataSource = vm; if (Program.IsMonoRuntime) diff --git a/Configurator/Configurator.Net/Views/FlightDataView.cs b/Configurator/Configurator.Net/Views/FlightDataView.cs index fba8d50a87..c8f4ea7835 100644 --- a/Configurator/Configurator.Net/Views/FlightDataView.cs +++ b/Configurator/Configurator.Net/Views/FlightDataView.cs @@ -15,11 +15,14 @@ namespace ArducopterConfigurator.views public FlightDataView() { InitializeComponent(); - BindButtons(); + } public override void SetDataContext(SensorsVm vm) { + BindButtons(vm); + + FlightDataVmBindingSource.DataSource = vm; if (Program.IsMonoRuntime) diff --git a/Configurator/Configurator.Net/Views/PositionHoldConfigView.cs b/Configurator/Configurator.Net/Views/PositionHoldConfigView.cs index 354f552310..faa9c43ef7 100644 --- a/Configurator/Configurator.Net/Views/PositionHoldConfigView.cs +++ b/Configurator/Configurator.Net/Views/PositionHoldConfigView.cs @@ -12,11 +12,14 @@ namespace ArducopterConfigurator.Views public PositionHoldConfigView() { InitializeComponent(); - BindButtons(); + } public override void SetDataContext(PositionHoldConfigVm vm) { + BindButtons(vm); + + PositionHoldConfigBindingSource.DataSource = vm; if (Program.IsMonoRuntime) diff --git a/Configurator/Configurator.Net/Views/StableConfigView.cs b/Configurator/Configurator.Net/Views/StableConfigView.cs index 1cc51d29e7..b6aa724f8d 100644 --- a/Configurator/Configurator.Net/Views/StableConfigView.cs +++ b/Configurator/Configurator.Net/Views/StableConfigView.cs @@ -14,11 +14,14 @@ namespace ArducopterConfigurator.Views public StableConfigView() { InitializeComponent(); - BindButtons(); + } public override void SetDataContext(StableModeConfigVm vm) { + BindButtons(vm); + + StableModeConfigVmBindingSource.DataSource = vm; if (Program.IsMonoRuntime) diff --git a/Configurator/Configurator.Net/Views/TransmitterChannelsView.Designer.cs b/Configurator/Configurator.Net/Views/TransmitterChannelsView.Designer.cs index 51b7814759..b08bfa16a0 100644 --- a/Configurator/Configurator.Net/Views/TransmitterChannelsView.Designer.cs +++ b/Configurator/Configurator.Net/Views/TransmitterChannelsView.Designer.cs @@ -29,6 +29,7 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TransmitterChannelsView)); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.TransmitterChannelsBindingSource = new System.Windows.Forms.BindingSource(this.components); @@ -49,6 +50,12 @@ this.linearIndicatorControl5 = new ArducopterConfigurator.Views.controls.LinearIndicatorControl(); this.linearIndicatorControl6 = new ArducopterConfigurator.Views.controls.LinearIndicatorControl(); this.button1 = new System.Windows.Forms.Button(); + this.label12 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.button3 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.label6 = new System.Windows.Forms.Label(); + this.button4 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.TransmitterChannelsBindingSource)).BeginInit(); this.SuspendLayout(); // @@ -183,7 +190,7 @@ this.linearIndicatorControl3.MinWatermark = 0; this.linearIndicatorControl3.Name = "linearIndicatorControl3"; this.linearIndicatorControl3.Offset = 0; - this.linearIndicatorControl3.Size = new System.Drawing.Size(20, 111); + this.linearIndicatorControl3.Size = new System.Drawing.Size(14, 111); this.linearIndicatorControl3.TabIndex = 43; this.linearIndicatorControl3.Value = 1600; this.linearIndicatorControl3.WatermarkLineColor = System.Drawing.Color.Red; @@ -207,7 +214,7 @@ this.linearIndicatorControl1.MinWatermark = 0; this.linearIndicatorControl1.Name = "linearIndicatorControl1"; this.linearIndicatorControl1.Offset = 0; - this.linearIndicatorControl1.Size = new System.Drawing.Size(20, 111); + this.linearIndicatorControl1.Size = new System.Drawing.Size(14, 111); this.linearIndicatorControl1.TabIndex = 44; this.linearIndicatorControl1.Value = 1100; this.linearIndicatorControl1.WatermarkLineColor = System.Drawing.Color.Red; @@ -231,7 +238,7 @@ this.linearIndicatorControl2.MinWatermark = 0; this.linearIndicatorControl2.Name = "linearIndicatorControl2"; this.linearIndicatorControl2.Offset = 0; - this.linearIndicatorControl2.Size = new System.Drawing.Size(20, 57); + this.linearIndicatorControl2.Size = new System.Drawing.Size(14, 57); this.linearIndicatorControl2.TabIndex = 45; this.linearIndicatorControl2.Value = 1050; this.linearIndicatorControl2.WatermarkLineColor = System.Drawing.Color.Red; @@ -255,7 +262,7 @@ this.linearIndicatorControl4.MinWatermark = 0; this.linearIndicatorControl4.Name = "linearIndicatorControl4"; this.linearIndicatorControl4.Offset = 0; - this.linearIndicatorControl4.Size = new System.Drawing.Size(20, 57); + this.linearIndicatorControl4.Size = new System.Drawing.Size(14, 57); this.linearIndicatorControl4.TabIndex = 46; this.linearIndicatorControl4.Value = 1900; this.linearIndicatorControl4.WatermarkLineColor = System.Drawing.Color.Red; @@ -279,7 +286,7 @@ this.linearIndicatorControl5.MinWatermark = 0; this.linearIndicatorControl5.Name = "linearIndicatorControl5"; this.linearIndicatorControl5.Offset = 0; - this.linearIndicatorControl5.Size = new System.Drawing.Size(100, 20); + this.linearIndicatorControl5.Size = new System.Drawing.Size(100, 14); this.linearIndicatorControl5.TabIndex = 47; this.linearIndicatorControl5.Value = 1300; this.linearIndicatorControl5.WatermarkLineColor = System.Drawing.Color.Red; @@ -303,7 +310,7 @@ this.linearIndicatorControl6.MinWatermark = 0; this.linearIndicatorControl6.Name = "linearIndicatorControl6"; this.linearIndicatorControl6.Offset = 0; - this.linearIndicatorControl6.Size = new System.Drawing.Size(100, 20); + this.linearIndicatorControl6.Size = new System.Drawing.Size(100, 14); this.linearIndicatorControl6.TabIndex = 48; this.linearIndicatorControl6.Value = 1200; this.linearIndicatorControl6.WatermarkLineColor = System.Drawing.Color.Red; @@ -318,10 +325,73 @@ this.button1.Text = "Reset"; this.button1.UseVisualStyleBackColor = true; // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(304, 159); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(84, 13); + this.label12.TabIndex = 53; + this.label12.Text = "Save Calibration"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(304, 130); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(48, 13); + this.label11.TabIndex = 52; + this.label11.Text = "Calibrate"; + // + // button3 + // + this.button3.DataBindings.Add(new System.Windows.Forms.Binding("Tag", this.TransmitterChannelsBindingSource, "StartCalibrationCommand", true)); + this.button3.Image = ((System.Drawing.Image)(resources.GetObject("button3.Image"))); + this.button3.Location = new System.Drawing.Point(272, 123); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(26, 26); + this.button3.TabIndex = 51; + this.button3.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.DataBindings.Add(new System.Windows.Forms.Binding("Tag", this.TransmitterChannelsBindingSource, "SaveCalibrationCommand", true)); + this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image"))); + this.button2.Location = new System.Drawing.Point(272, 152); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(26, 26); + this.button2.TabIndex = 50; + this.button2.UseVisualStyleBackColor = true; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(304, 189); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(40, 13); + this.label6.TabIndex = 55; + this.label6.Text = "Cancel"; + // + // button4 + // + this.button4.DataBindings.Add(new System.Windows.Forms.Binding("Tag", this.TransmitterChannelsBindingSource, "CancelCalibrationCommand", true)); + this.button4.Image = ((System.Drawing.Image)(resources.GetObject("button4.Image"))); + this.button4.Location = new System.Drawing.Point(272, 182); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(26, 26); + this.button4.TabIndex = 54; + this.button4.UseVisualStyleBackColor = true; + // // TransmitterChannelsView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label6); + this.Controls.Add(this.button4); + this.Controls.Add(this.label12); + this.Controls.Add(this.label11); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.linearIndicatorControl6); this.Controls.Add(this.linearIndicatorControl5); @@ -371,5 +441,11 @@ private ArducopterConfigurator.Views.controls.LinearIndicatorControl linearIndicatorControl5; private ArducopterConfigurator.Views.controls.LinearIndicatorControl linearIndicatorControl6; private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Button button4; } } diff --git a/Configurator/Configurator.Net/Views/TransmitterChannelsView.cs b/Configurator/Configurator.Net/Views/TransmitterChannelsView.cs index a2f3c9281e..9a16a9901b 100644 --- a/Configurator/Configurator.Net/Views/TransmitterChannelsView.cs +++ b/Configurator/Configurator.Net/Views/TransmitterChannelsView.cs @@ -14,11 +14,14 @@ namespace ArducopterConfigurator.Views public TransmitterChannelsView() { InitializeComponent(); - BindButtons(); + } public override void SetDataContext(TransmitterChannelsVm vm) { + BindButtons(vm); + + TransmitterChannelsBindingSource.DataSource = vm; if (Program.IsMonoRuntime) diff --git a/Configurator/Configurator.Net/Views/TransmitterChannelsView.resx b/Configurator/Configurator.Net/Views/TransmitterChannelsView.resx index 240465f91c..6b19505ef3 100644 --- a/Configurator/Configurator.Net/Views/TransmitterChannelsView.resx +++ b/Configurator/Configurator.Net/Views/TransmitterChannelsView.resx @@ -120,4 +120,143 @@ 17, 17 + + + + R0lGODlhFgAVAIMAADJ/x+/3/5rA40qOzrPP6v///1mX0sHY7lGT0PT4/LfS68bb70qUzgAAAAAAAAAA + ACH/C05FVFNDQVBFMi4wAwEBAAAh+QQABwD/ACwAAAAAFgAVAAAIdAALCBxIsACAgggTDjyos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YWUcguegAMlGEYJLeFVgrgDYZ5RN/Ls4VukHxlFlWtGOnWmj5S8Zl74aAjVx7cJesNsKe0i + teg8YW+EZf8KTk8In+LC5/Og2tHCtkMjgiv42V8jifuRdK23Sd3VhkorCvjcOMMBYd9FRHR1ej34I4/w + B9yERLw180tSBO+pipuk7hEOEgUS50STsKU+iPHcKCbzLYzmQRrahzC1DVLfNkR9+wCGtjHSdurZmlXP + c7uNnGi8xn9S4RHZGLiTUQAAAABJRU5ErkJggg== + + \ No newline at end of file diff --git a/Configurator/Configurator.Net/Views/ViewCommon.cs b/Configurator/Configurator.Net/Views/ViewCommon.cs index 6a582a2b3b..2957c29bad 100644 --- a/Configurator/Configurator.Net/Views/ViewCommon.cs +++ b/Configurator/Configurator.Net/Views/ViewCommon.cs @@ -1,21 +1,24 @@ using System; +using System.ComponentModel; using System.Windows.Forms; using ArducopterConfigurator.PresentationModels; namespace ArducopterConfigurator.Views { // cannot be abstract due to vs2008 designer - public class ViewCommon : UserControl, IView where T : IPresentationModel + public class ViewCommon : UserControl, IView where T : IPresentationModel, INotifyPropertyChanged { public virtual void SetDataContext(T vm) { } - protected void BindButtons() + protected void BindButtons(T vm) { foreach (var c in this.Controls) if (c is Button) (c as Button).Click += btn_Click; + + vm.PropertyChanged += CheckCommandStates; } protected void btn_Click(object sender, EventArgs e) @@ -27,6 +30,18 @@ namespace ArducopterConfigurator.Views cmd.Execute(null); } + void CheckCommandStates(object sender, PropertyChangedEventArgs e) + { + foreach (var c in this.Controls) + { + var btn = c as Button; + if (btn == null) continue; + var cmd = btn.Tag as ICommand; + if (cmd != null) + btn.Enabled = cmd.CanExecute(null); + } + } + public Control Control { get { return this; } diff --git a/Configurator/Configurator.Net/Views/controls/PropControl.Designer.cs b/Configurator/Configurator.Net/Views/controls/PropControl.Designer.cs new file mode 100644 index 0000000000..1bc88b9a27 --- /dev/null +++ b/Configurator/Configurator.Net/Views/controls/PropControl.Designer.cs @@ -0,0 +1,45 @@ +namespace ArducopterConfigurator.Views.controls +{ + partial class PropControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // PropControl + // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Name = "PropControl"; + this.Size = new System.Drawing.Size(50, 50); + this.ResumeLayout(false); + + } + + #endregion + } +} diff --git a/Configurator/Configurator.Net/Views/controls/PropControl.cs b/Configurator/Configurator.Net/Views/controls/PropControl.cs new file mode 100644 index 0000000000..aeba4af351 --- /dev/null +++ b/Configurator/Configurator.Net/Views/controls/PropControl.cs @@ -0,0 +1,45 @@ +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace ArducopterConfigurator.Views.controls +{ + public partial class PropControl : Control + { + public PropControl() + { + InitializeComponent(); + + SetStyle(ControlStyles.OptimizedDoubleBuffer | + ControlStyles.AllPaintingInWmPaint | + ControlStyles.UserPaint | + ControlStyles.ResizeRedraw, true); + + InitializeComponent(); + } + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + g.SmoothingMode = SmoothingMode.AntiAlias; + g.Clear(BackColor); + +// var rect =new RectangleF(x, y + height - (barStart + barSize), width, barSize) +// +// using (var bg = new LinearGradientBrush(rect, _barLightColour, _barDarkColour, isVertical ? 0 : 90.0F, false)) +// g.FillRectangle(bg, rect); +// +// +// +// using (Pen p = new Pen(_borderColor, _borderWidth)) +// { +// p.Alignment = PenAlignment.Inset; +// p.LineJoin = LineJoin.Round; +// g.DrawLine(p, width, y, width, height); +// } + // var bmp = GenerateProcentBarBitmap(Width, Height, BackColor); + // g.DrawImage(bmp, 0, 0); + } + } +} diff --git a/Configurator/Configurator.Net/Views/controls/PropControl.resx b/Configurator/Configurator.Net/Views/controls/PropControl.resx new file mode 100644 index 0000000000..ff31a6db56 --- /dev/null +++ b/Configurator/Configurator.Net/Views/controls/PropControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Configurator/Configurator.Net/Views/controls/QuadPlanControl.Designer.cs b/Configurator/Configurator.Net/Views/controls/QuadPlanControl.Designer.cs new file mode 100644 index 0000000000..341c15c765 --- /dev/null +++ b/Configurator/Configurator.Net/Views/controls/QuadPlanControl.Designer.cs @@ -0,0 +1,55 @@ +namespace ArducopterConfigurator.Views.controls +{ + partial class QuadPlanControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.propControl1 = new ArducopterConfigurator.Views.controls.PropControl(); + this.SuspendLayout(); + // + // propControl1 + // + this.propControl1.Location = new System.Drawing.Point(49, 3); + this.propControl1.Name = "propControl1"; + this.propControl1.Size = new System.Drawing.Size(50, 50); + this.propControl1.TabIndex = 0; + // + // QuadPlanControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.propControl1); + this.Name = "QuadPlanControl"; + this.ResumeLayout(false); + + } + + #endregion + + private PropControl propControl1; + } +} diff --git a/Configurator/Configurator.Net/Views/controls/QuadPlanControl.cs b/Configurator/Configurator.Net/Views/controls/QuadPlanControl.cs new file mode 100644 index 0000000000..0a26356d3c --- /dev/null +++ b/Configurator/Configurator.Net/Views/controls/QuadPlanControl.cs @@ -0,0 +1,51 @@ +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +/* + * Starting point for this control: + * http://www.codeproject.com/KB/progress/iTunes_Bar.aspx + * + */ +namespace ArducopterConfigurator.Views.controls +{ + /// + /// + [ToolboxBitmap(typeof(System.Windows.Forms.ProgressBar))] + public partial class QuadPlanControl : UserControl + { + public QuadPlanControl() + { + SetStyle(ControlStyles.OptimizedDoubleBuffer | + ControlStyles.AllPaintingInWmPaint | + ControlStyles.UserPaint | + ControlStyles.ResizeRedraw, true); + + InitializeComponent(); + Width = 50; + Height = 50; + } + + + /// + /// Raises the event. + /// + /// A that contains the event data. + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + g.SmoothingMode = SmoothingMode.AntiAlias; + g.Clear(BackColor); + + //var bmp = GenerateProcentBarBitmap(Width, Height, BackColor); + //g.DrawImage(bmp, 0, 0); + } + + + + + + + } +} diff --git a/Configurator/Configurator.Net/Views/controls/QuadPlanControl.resx b/Configurator/Configurator.Net/Views/controls/QuadPlanControl.resx new file mode 100644 index 0000000000..ff31a6db56 --- /dev/null +++ b/Configurator/Configurator.Net/Views/controls/QuadPlanControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file