Prechádzať zdrojové kódy

批量读取和写入CDL参数

Ye Jin 9 mesiacov pred
rodič
commit
63a5782b7a

BIN
MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/.vs/MOTINOVA_CDL_TestTool/v16/.suo


+ 32 - 6
MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/Form1.Designer.cs

@@ -60,6 +60,8 @@
             this.label3 = new System.Windows.Forms.Label();
             this.serialPort1 = new System.IO.Ports.SerialPort(this.components);
             this.timer1 = new System.Windows.Forms.Timer(this.components);
+            this.button_ReadAll = new System.Windows.Forms.Button();
+            this.button_WriteAll = new System.Windows.Forms.Button();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.SuspendLayout();
@@ -73,7 +75,7 @@
             this.groupBox1.Controls.Add(this.label1);
             this.groupBox1.Location = new System.Drawing.Point(13, 13);
             this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(200, 261);
+            this.groupBox1.Size = new System.Drawing.Size(200, 293);
             this.groupBox1.TabIndex = 0;
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "Port Settings";
@@ -131,7 +133,9 @@
             // 
             this.groupBox2.Controls.Add(this.button_CTFCheck);
             this.groupBox2.Controls.Add(this.button_Reset);
+            this.groupBox2.Controls.Add(this.button_ReadAll);
             this.groupBox2.Controls.Add(this.button_ReadCANBaudrate);
+            this.groupBox2.Controls.Add(this.button_WriteAll);
             this.groupBox2.Controls.Add(this.button_WriteCANBaudrate);
             this.groupBox2.Controls.Add(this.button_WriteMode);
             this.groupBox2.Controls.Add(this.button_WriteAppUartBaudrate);
@@ -152,14 +156,14 @@
             this.groupBox2.Controls.Add(this.label3);
             this.groupBox2.Location = new System.Drawing.Point(220, 13);
             this.groupBox2.Name = "groupBox2";
-            this.groupBox2.Size = new System.Drawing.Size(462, 261);
+            this.groupBox2.Size = new System.Drawing.Size(462, 293);
             this.groupBox2.TabIndex = 1;
             this.groupBox2.TabStop = false;
             this.groupBox2.Text = "CDL-Properties";
             // 
             // button_CTFCheck
             // 
-            this.button_CTFCheck.Location = new System.Drawing.Point(181, 220);
+            this.button_CTFCheck.Location = new System.Drawing.Point(241, 259);
             this.button_CTFCheck.Name = "button_CTFCheck";
             this.button_CTFCheck.Size = new System.Drawing.Size(97, 28);
             this.button_CTFCheck.TabIndex = 2;
@@ -169,7 +173,7 @@
             // 
             // button_Reset
             // 
-            this.button_Reset.Location = new System.Drawing.Point(353, 220);
+            this.button_Reset.Location = new System.Drawing.Point(353, 259);
             this.button_Reset.Name = "button_Reset";
             this.button_Reset.Size = new System.Drawing.Size(77, 28);
             this.button_Reset.TabIndex = 2;
@@ -385,12 +389,32 @@
             this.timer1.Interval = 20;
             this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
             // 
+            // button_ReadAll
+            // 
+            this.button_ReadAll.Location = new System.Drawing.Point(261, 219);
+            this.button_ReadAll.Name = "button_ReadAll";
+            this.button_ReadAll.Size = new System.Drawing.Size(77, 28);
+            this.button_ReadAll.TabIndex = 2;
+            this.button_ReadAll.Text = "Read All";
+            this.button_ReadAll.UseVisualStyleBackColor = true;
+            this.button_ReadAll.Click += new System.EventHandler(this.button_ReadAll_Click);
+            // 
+            // button_WriteAll
+            // 
+            this.button_WriteAll.Location = new System.Drawing.Point(353, 219);
+            this.button_WriteAll.Name = "button_WriteAll";
+            this.button_WriteAll.Size = new System.Drawing.Size(77, 28);
+            this.button_WriteAll.TabIndex = 2;
+            this.button_WriteAll.Text = "Write All";
+            this.button_WriteAll.UseVisualStyleBackColor = true;
+            this.button_WriteAll.Click += new System.EventHandler(this.button_WriteAll_Click);
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.ClientSize = new System.Drawing.Size(710, 286);
+            this.ClientSize = new System.Drawing.Size(746, 318);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox1);
             this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -400,7 +424,7 @@
             this.MaximizeBox = false;
             this.Name = "Form1";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "MOTINOVA_CDL_TestTool_V1.1_20240906";
+            this.Text = "MOTINOVA_CDL_TestTool_V1.2_20241113";
             this.Load += new System.EventHandler(this.Form1_Load);
             this.groupBox1.ResumeLayout(false);
             this.groupBox1.PerformLayout();
@@ -442,6 +466,8 @@
         private System.Windows.Forms.Label label7;
         private System.Windows.Forms.Button button_Reset;
         private System.Windows.Forms.Button button_CTFCheck;
+        private System.Windows.Forms.Button button_ReadAll;
+        private System.Windows.Forms.Button button_WriteAll;
     }
 }
 

+ 74 - 1
MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/Form1.cs

@@ -21,6 +21,9 @@ namespace MOTINOVA_CDL_TestTool
         public static string m_strCheckBits = "None";
         public static bool g_blnIsOpen = false;
 
+        public int WriteAllAckCount = 0;
+        public bool WriteAllAckFlag = false;
+
         #endregion
 
         public Form1()
@@ -28,6 +31,20 @@ namespace MOTINOVA_CDL_TestTool
             InitializeComponent();
         }
 
+        public static bool Delay_Millisecond(int delayTime)
+        {
+            DateTime now = DateTime.Now;
+            int s;
+            do
+            {
+                TimeSpan spand = DateTime.Now - now;
+                s = spand.Milliseconds;
+                Application.DoEvents();
+            }
+            while (s < delayTime);
+            return true;
+        }
+
         private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
         {
             try
@@ -145,7 +162,22 @@ namespace MOTINOVA_CDL_TestTool
 
                                 Array.Copy(binary_data_1, 2, Temp, 0, 2);
                                 str = System.Text.Encoding.ASCII.GetString(Temp);
-                                MessageBox.Show(str);
+
+                                if(WriteAllAckFlag)
+                                {
+                                    WriteAllAckCount++;
+                                    if(WriteAllAckCount == 4)
+                                    {
+                                        MessageBox.Show(str);
+                                        WriteAllAckCount = 0;
+                                        WriteAllAckFlag = false;
+                                    }
+                                }
+                                else
+                                {
+                                    MessageBox.Show(str);
+                                }
+                                
 
                             }));
                         }
@@ -501,5 +533,46 @@ namespace MOTINOVA_CDL_TestTool
         {
             SendCmd((ushort)0x7FF, (byte)0x16, (ushort)0x6600, null);
         }
+
+        private void button_ReadAll_Click(object sender, EventArgs e)
+        {
+            button_ReadVersion_Click((object)(button_ReadVersion), null);
+
+            Delay_Millisecond(200);
+
+            button_ReadMode_Click((object)(button_ReadMode), null);
+
+            Delay_Millisecond(200);
+
+            button_ReadBootUartBaudrate_Click((object)(button_ReadBootUartBaudrate), null);
+
+            Delay_Millisecond(200);
+
+            button_ReadAppUartBaudrate_Click((object)(button_ReadAppUartBaudrate), null);
+
+            Delay_Millisecond(200);
+
+            button_ReadCANBaudrate_Click((object)(button_ReadCANBaudrate), null);
+        }
+
+        private void button_WriteAll_Click(object sender, EventArgs e)
+        {
+            WriteAllAckCount = 0;
+            WriteAllAckFlag = true;
+
+            button_WriteMode_Click((object)(button_WriteMode), null);
+
+            Delay_Millisecond(200);
+
+            button_WriteBootUartBaudrate_Click((object)(button_WriteBootUartBaudrate), null);
+
+            Delay_Millisecond(200);
+
+            button_WriteAppUartBaudrate_Click((object)(button_WriteAppUartBaudrate), null);
+
+            Delay_Millisecond(200);
+
+            button_WriteCANBaudrate_Click((object)(button_WriteCANBaudrate), null);
+        }
     }
 }

BIN
MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/bin/Debug/MOTINOVA_CDL_TestTool.exe


BIN
MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/obj/Debug/MOTINOVA_CDL_TestTool.csproj.AssemblyReference.cache


BIN
MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/obj/Debug/MOTINOVA_CDL_TestTool.csproj.GenerateResource.Cache


BIN
MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/MOTINOVA_CDL_TestTool/obj/Debug/MOTINOVA_CDL_TestTool.exe