Browse Source

V2.1.6:
1,修改控制器内阻校准指令,增加写入存储标志;
2,参数生成界面增加导入样机测试记录你文件功能;
3,参数生成界面增加锁,防止误触。

Dail 1 year ago
parent
commit
2c030cee66

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 51 - 3
Welling_Motor_Debug_Tool/GenerateParams.Designer.cs

@@ -129,6 +129,9 @@
             this.label41 = new System.Windows.Forms.Label();
             this.button_ChangeModelFile = new System.Windows.Forms.Button();
             this.button_DeletModelFile = new System.Windows.Forms.Button();
+            this.button_LoadFile = new System.Windows.Forms.Button();
+            this.label39 = new System.Windows.Forms.Label();
+            this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.tabControl1.SuspendLayout();
             this.tabPage_Simple.SuspendLayout();
             this.groupBox5.SuspendLayout();
@@ -140,6 +143,7 @@
             this.groupBox1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
             this.statusStrip1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             this.SuspendLayout();
             // 
             // button_ExportParams
@@ -185,6 +189,7 @@
             this.tabPage_Simple.Controls.Add(this.groupBox4);
             this.tabPage_Simple.Controls.Add(this.groupBox3);
             this.tabPage_Simple.Controls.Add(this.groupBox2);
+            this.tabPage_Simple.Controls.Add(this.label39);
             this.tabPage_Simple.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
             this.tabPage_Simple.Location = new System.Drawing.Point(4, 30);
             this.tabPage_Simple.Name = "tabPage_Simple";
@@ -674,6 +679,7 @@
             // tabPage_Advance
             // 
             this.tabPage_Advance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.tabPage_Advance.Controls.Add(this.pictureBox1);
             this.tabPage_Advance.Controls.Add(this.richTextBox_AdvanceParams);
             this.tabPage_Advance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
             this.tabPage_Advance.Location = new System.Drawing.Point(4, 30);
@@ -688,7 +694,8 @@
             this.richTextBox_AdvanceParams.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
             this.richTextBox_AdvanceParams.Location = new System.Drawing.Point(6, 6);
             this.richTextBox_AdvanceParams.Name = "richTextBox_AdvanceParams";
-            this.richTextBox_AdvanceParams.Size = new System.Drawing.Size(472, 630);
+            this.richTextBox_AdvanceParams.ReadOnly = true;
+            this.richTextBox_AdvanceParams.Size = new System.Drawing.Size(421, 600);
             this.richTextBox_AdvanceParams.TabIndex = 0;
             this.richTextBox_AdvanceParams.Text = "";
             // 
@@ -1057,7 +1064,7 @@
             this.label_Server_ComStatus.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
             this.label_Server_ComStatus.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label_Server_ComStatus.ForeColor = System.Drawing.Color.White;
-            this.label_Server_ComStatus.Location = new System.Drawing.Point(841, 738);
+            this.label_Server_ComStatus.Location = new System.Drawing.Point(734, 738);
             this.label_Server_ComStatus.Name = "label_Server_ComStatus";
             this.label_Server_ComStatus.Size = new System.Drawing.Size(106, 21);
             this.label_Server_ComStatus.TabIndex = 20;
@@ -1102,7 +1109,7 @@
             // 
             // button_ModeRefresh
             // 
-            this.button_ModeRefresh.BackColor = System.Drawing.Color.Teal;
+            this.button_ModeRefresh.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
             this.button_ModeRefresh.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.button_ModeRefresh.ForeColor = System.Drawing.Color.White;
             this.button_ModeRefresh.Location = new System.Drawing.Point(750, 13);
@@ -1233,12 +1240,48 @@
             this.button_DeletModelFile.UseVisualStyleBackColor = false;
             this.button_DeletModelFile.Click += new System.EventHandler(this.button_DeletModelFile_Click);
             // 
+            // button_LoadFile
+            // 
+            this.button_LoadFile.BackColor = System.Drawing.Color.Teal;
+            this.button_LoadFile.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.button_LoadFile.ForeColor = System.Drawing.Color.White;
+            this.button_LoadFile.Location = new System.Drawing.Point(868, 220);
+            this.button_LoadFile.Name = "button_LoadFile";
+            this.button_LoadFile.Size = new System.Drawing.Size(149, 45);
+            this.button_LoadFile.TabIndex = 27;
+            this.button_LoadFile.Text = "导入样机记录";
+            this.button_LoadFile.UseVisualStyleBackColor = false;
+            this.button_LoadFile.Click += new System.EventHandler(this.button_LoadFile_Click);
+            // 
+            // label39
+            // 
+            this.label39.AutoSize = true;
+            this.label39.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label39.ForeColor = System.Drawing.Color.Red;
+            this.label39.Location = new System.Drawing.Point(11, 569);
+            this.label39.Name = "label39";
+            this.label39.Size = new System.Drawing.Size(449, 25);
+            this.label39.TabIndex = 0;
+            this.label39.Text = "注意:简易参数界面内容在高级参数界面修改无效!\r\n";
+            // 
+            // pictureBox1
+            // 
+            this.pictureBox1.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+            this.pictureBox1.Location = new System.Drawing.Point(433, 6);
+            this.pictureBox1.Name = "pictureBox1";
+            this.pictureBox1.Size = new System.Drawing.Size(45, 45);
+            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+            this.pictureBox1.TabIndex = 9;
+            this.pictureBox1.TabStop = false;
+            this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
+            // 
             // GenerateParams
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
             this.ClientSize = new System.Drawing.Size(1034, 761);
+            this.Controls.Add(this.button_LoadFile);
             this.Controls.Add(this.button_DeletModelFile);
             this.Controls.Add(this.label41);
             this.Controls.Add(this.label40);
@@ -1271,6 +1314,7 @@
             this.Load += new System.EventHandler(this.GenerateParams_Load);
             this.tabControl1.ResumeLayout(false);
             this.tabPage_Simple.ResumeLayout(false);
+            this.tabPage_Simple.PerformLayout();
             this.groupBox5.ResumeLayout(false);
             this.groupBox5.PerformLayout();
             this.groupBox4.ResumeLayout(false);
@@ -1286,6 +1330,7 @@
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
             this.statusStrip1.ResumeLayout(false);
             this.statusStrip1.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -1392,5 +1437,8 @@
         private System.Windows.Forms.Label label41;
         private System.Windows.Forms.Button button_ChangeModelFile;
         private System.Windows.Forms.Button button_DeletModelFile;
+        private System.Windows.Forms.Button button_LoadFile;
+        private System.Windows.Forms.Label label39;
+        private System.Windows.Forms.PictureBox pictureBox1;
     }
 }

+ 318 - 1
Welling_Motor_Debug_Tool/GenerateParams.cs

@@ -25,6 +25,8 @@ namespace Welling_Motor_Debug_Tool
         string IP, Port, User, PassWD, ModelPath, CfgPath;
         //FTP
         ftp myFtp = new ftp();
+        //高级参数修改标志
+        bool WriteLockStatus = true;
 
         public GenerateParams()
         {
@@ -107,6 +109,10 @@ namespace Welling_Motor_Debug_Tool
                 }
                 richTextBox_Note.Text = richTextBox_Note.Text.Remove(richTextBox_Note.Text.Length - 1);
             }
+            //高级参数只读
+            richTextBox_AdvanceParams.ReadOnly = true;
+            pictureBox1.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+            WriteLockStatus = true;
         }
 
         private void radioButton_MIGIC_Click(object sender, EventArgs e)
@@ -366,6 +372,313 @@ namespace Welling_Motor_Debug_Tool
             }
         }
 
+        /// <summary>
+        /// 导入样机生产记录文件,可用于生成模板
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void button_LoadFile_Click(object sender, EventArgs e)
+        {
+            comboBox_ModelFile.SelectedIndex = -1;
+            button_ExportParams.Enabled = true;
+            //高级参数只读
+            richTextBox_AdvanceParams.ReadOnly = true;
+            pictureBox1.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+            WriteLockStatus = true;
+            //打开对话框选择文件
+            OpenFileDialog ofd = new OpenFileDialog();
+            ofd.Title = "请选择样机测试记录文件";
+            ofd.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
+            ofd.Filter = "文本文件(*.txt)|*.txt";
+            ofd.Multiselect = false;
+            if (ofd.ShowDialog() == DialogResult.OK)
+            {
+                //打开文件
+                StreamReader objReader = new StreamReader(ofd.FileName);
+                string sLine = "";
+                ArrayList array_CfgInfo = new ArrayList();
+                array_CfgInfo.Clear();
+                while (sLine != null)
+                {
+                    sLine = objReader.ReadLine();
+                    array_CfgInfo.Add(sLine);
+                }
+                objReader.Close();
+                //转换为模板显示
+                try
+                {
+                    string fileInfo = "";
+                    fileInfo += "#说明\r\n";
+                    fileInfo += "#0表示命令无效,1开启该命令的参数写入\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[型号],1\r\n";
+                    fileInfo += "电机型号," + array_CfgInfo[5].ToString().Split(new string[] { ": " }, StringSplitOptions.None)[1] + "\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[SN号],0\r\n";
+                    fileInfo += "电机SN," + "\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[校验码],0\r\n";
+                    fileInfo += "校验码," + "\r\n";
+                    fileInfo += "\r\n";
+
+                    if (array_CfgInfo[71].ToString().Length <= 6)
+                    {
+                        fileInfo += "[自定义1],0\r\n";
+                        fileInfo += "自定义字符串1," + "\r\n";
+                        fileInfo += "\r\n";
+                    }
+                    else
+                    {
+                        fileInfo += "[自定义1],1\r\n";
+                        fileInfo += "自定义字符串1," + array_CfgInfo[71].ToString().Split(new string[] { ": " }, StringSplitOptions.None)[1] + "\r\n";
+                        fileInfo += "\r\n";
+                    }
+
+                    if (array_CfgInfo[72].ToString().Length <= 6)
+                    {
+                        fileInfo += "[自定义2],0\r\n";
+                        fileInfo += "自定义字符串2," + "\r\n";
+                        fileInfo += "\r\n";
+                    }
+                    else
+                    {
+                        fileInfo += "[自定义2],1\r\n";
+                        fileInfo += "自定义字符串2," + array_CfgInfo[72].ToString().Split(new string[] { ": " }, StringSplitOptions.None)[1] + "\r\n";
+                        fileInfo += "\r\n";
+                    }
+
+                    if (array_CfgInfo[73].ToString().Length <= 6)
+                    {
+                        fileInfo += "[自定义3],0\r\n";
+                        fileInfo += "自定义字符串3," + "\r\n";
+                        fileInfo += "\r\n";
+                    }
+                    else
+                    {
+                        fileInfo += "[自定义3],1\r\n";
+                        fileInfo += "自定义字符串3," + array_CfgInfo[73].ToString().Split(new string[] { ": " }, StringSplitOptions.None)[1] + "\r\n";
+                        fileInfo += "\r\n";
+                    }
+
+                    fileInfo += "[生产信息],1\r\n";
+                    fileInfo += "生产商," + "\r\n";
+                    fileInfo += "生产地," + "\r\n";
+                    fileInfo += "生产日期," + "\r\n";
+                    fileInfo += "产品标识," + "\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[马达信息],1\r\n";
+                    fileInfo += "存储标志,1\r\n";
+                    fileInfo += array_CfgInfo[13].ToString().Replace('=',',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[整车参数],1\r\n";
+                    fileInfo += "存储标志,1\r\n";
+                    fileInfo += array_CfgInfo[16].ToString().Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[控制参数],1\r\n";
+                    fileInfo += "存储标志,1\r\n";
+                    fileInfo += array_CfgInfo[19].ToString().Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[力矩传感器参数],1\r\n";
+                    fileInfo += "存储标志,1\r\n";
+                    fileInfo += array_CfgInfo[22].ToString().Split(new string[] { ", 力矩传感器踏频脉冲数" }, StringSplitOptions.None)[0].Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[其它传感器参数],1\r\n";
+                    fileInfo += "存储标志,1\r\n";
+                    fileInfo += ("力矩传感器踏频脉冲数" + array_CfgInfo[22].ToString().Split(new string[] { ", 力矩传感器踏频脉冲数" }, StringSplitOptions.None)[1]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[助力参数],1\r\n";
+                    fileInfo += "存储标志,1\r\n";
+                    fileInfo += "空,0\r\n";
+                    fileInfo += array_CfgInfo[25].ToString().Split(new string[] { ", 助力转矩曲线编号" }, StringSplitOptions.None)[0].Replace('=', ',').Replace(" ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[25].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[27].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[29].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[31].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[33].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[35].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[37].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[39].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[41].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[43].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[45].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[47].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[49].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[51].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("转矩曲线.a" + array_CfgInfo[53].ToString().Split(new string[] { "转矩曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 踏频曲线.a" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("踏频曲线.a" + array_CfgInfo[25].ToString().Split(new string[] { "踏频曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 助力启动阈值" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("踏频曲线.a" + array_CfgInfo[27].ToString().Split(new string[] { "踏频曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 助力启动阈值" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("踏频曲线.a" + array_CfgInfo[29].ToString().Split(new string[] { "踏频曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 助力启动阈值" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("踏频曲线.a" + array_CfgInfo[31].ToString().Split(new string[] { "踏频曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 助力启动阈值" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("踏频曲线.a" + array_CfgInfo[33].ToString().Split(new string[] { "踏频曲线.a" }, StringSplitOptions.None)[1].Split(new string[] { ", 助力启动阈值" }, StringSplitOptions.None)[0]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += ("助力启动阈值" + array_CfgInfo[25].ToString().Split(new string[] { "助力启动阈值" }, StringSplitOptions.None)[1]).Replace('=', ',').Replace(", ", "\r\n") + "\r\n";
+                    fileInfo += "\r\n";
+
+                    fileInfo += "[调试参数],1\r\n";
+                    fileInfo += "存储标志,1\r\n";
+                    fileInfo += array_CfgInfo[56].ToString().Replace('=', ',').Replace(", ", "\r\n") + "\r\n";                    
+
+
+                    //加载高级界面
+                    richTextBox_AdvanceParams.Clear();
+                    richTextBox_AdvanceParams.AppendText(fileInfo);
+
+                    //加载简易界面
+                    do //基础参数界面
+                    {
+                        //内容转换行
+                        ArrayList arrText = new ArrayList(fileInfo.Split(new string[] { "\r\n" }, StringSplitOptions.None));//创建一个动态数组                        
+                        //建立字典,存放并获取每个命令的行号
+                        Dictionary<string, int> DicRowNum = new Dictionary<string, int>();
+                        DicRowNum.Add("[整车参数]", 0);
+                        DicRowNum.Add("[控制参数]", 0);
+                        DicRowNum.Add("[助力参数]", 0);
+                        DicRowNum.Add("[调试参数]", 0);
+                        DicRowNum.Add("[生产信息]", 0);
+                        Dictionary<string, int> __dict = new Dictionary<string, int>(DicRowNum);
+                        foreach (KeyValuePair<string, int> item in __dict)
+                        {
+                            foreach (string cmd in arrText)
+                            {
+                                if (cmd.Contains(item.Key))
+                                {
+                                    DicRowNum[item.Key] = arrText.IndexOf(cmd);
+                                    break;
+                                }
+                            }
+                        }
+                        //遍历加载
+                        foreach (string index in DicRowNum.Keys)
+                        {
+                            int rowNum = DicRowNum[index]; //行号
+                            switch (index)
+                            {
+                                case "[整车参数]":
+                                    {
+                                        //轮胎周长
+                                        textBox_BikeWheel.Text = arrText[rowNum + 2].ToString().Split(',')[1];
+                                        //转把限速
+                                        textBox_BikeThroSpeed.Text = arrText[rowNum + 4].ToString().Split(',')[1];
+                                        //推行限速
+                                        textBox_BikeWalkSpeed.Text = arrText[rowNum + 5].ToString().Split(',')[1];
+                                        //前牙盘
+                                        textBox_BikeFrontT.Text = arrText[rowNum + 6].ToString().Split(',')[1];
+                                        //后牙盘
+                                        textBox_BikeRealB.Text = arrText[rowNum + 7].ToString().Split(',')[1];
+                                        //前灯电压
+                                        ushort LightParams = Convert.ToUInt16(arrText[rowNum + 10].ToString().Split(',')[1]);
+                                        if ((LightParams & 0x00FF) == 6)
+                                            comboBox_BikeVolF.SelectedIndex = 0;
+                                        else if ((LightParams & 0x00FF) == 12)
+                                            comboBox_BikeVolF.SelectedIndex = 1;
+                                        else
+                                            comboBox_BikeVolF.SelectedIndex = -1;
+                                        //后灯电压
+                                        if (((LightParams >> 8) & 0x0F) == 6)
+                                            comboBox_BikeVolB.SelectedIndex = 0;
+                                        else if (((LightParams >> 8) & 0x0F) == 12)
+                                            comboBox_BikeVolB.SelectedIndex = 1;
+                                        else
+                                            comboBox_BikeVolB.SelectedIndex = -1;
+                                        //后灯模式c
+                                        comboBox_BikeModeB.SelectedIndex = (LightParams >> 12) - 1;
+                                        //启动模式
+                                        comboBox_BikeStartMode.SelectedIndex = Convert.ToUInt16(arrText[rowNum + 12].ToString().Split(',')[1]) - 1;
+                                        //开机延迟
+                                        ushort PowerOnOffParams = Convert.ToUInt16(arrText[rowNum + 13].ToString().Split(',')[1]);
+                                        textBox_BikePowerOnTime.Text = (PowerOnOffParams >> 12).ToString();
+                                        //关机延迟
+                                        textBox_BikePowerOffTime.Text = ((PowerOnOffParams >> 8) & 0x0F).ToString();
+                                        //自动关机
+                                        textBox_BikeAutoOffTime.Text = (PowerOnOffParams & 0x00FF).ToString();
+                                        break;
+                                    }
+                                case "[控制参数]":
+                                    {
+                                        //峰值电流
+                                        textBox_MotorMaxCurr.Text = arrText[rowNum + 4].ToString().Split(',')[1];
+                                        //过压保护
+                                        textBox_MotorOV.Text = arrText[rowNum + 6].ToString().Split(',')[1];
+                                        //欠压保护
+                                        textBox_MotorUV.Text = arrText[rowNum + 7].ToString().Split(',')[1];
+                                        break;
+                                    }
+                                case "[助力参数]":
+                                    {
+                                        //限速起始
+                                        textBox_AssistSpeedBegin.Text = arrText[rowNum + 92].ToString().Split(',')[1];
+                                        //限速结束
+                                        textBox_AssistSpeedEnd.Text = arrText[rowNum + 93].ToString().Split(',')[1];
+                                        break;
+                                    }
+                                case "[调试参数]":
+                                    {
+                                        //运行模式
+                                        if ((Convert.ToUInt16(arrText[rowNum + 2].ToString().Split(',')[1]) >= 4) && (Convert.ToUInt16(arrText[rowNum + 2].ToString().Split(',')[1]) <= 6))
+                                        {
+                                            comboBox_SysRunMode.SelectedIndex = Convert.ToUInt16(arrText[rowNum + 2].ToString().Split(',')[1]) - 4;
+                                        }
+                                        else
+                                            comboBox_SysRunMode.SelectedIndex = -1;
+                                        //旋转方向
+                                        comboBox_SysDir.SelectedIndex = Convert.ToUInt16(arrText[rowNum + 5].ToString().Split(',')[1]);
+                                        //功率限幅
+                                        textBox_SysPowerLimit.Text = arrText[rowNum + 23].ToString().Split(',')[1];
+                                        break;
+                                    }
+                                case "[生产信息]":
+                                    {
+                                        //生产商
+                                        textBox_ProductMac.Text = arrText[rowNum + 1].ToString().Split(',')[1];
+                                        //生产地
+                                        textBox_ProductAddr.Text = arrText[rowNum + 2].ToString().Split(',')[1];
+                                        //生产日期
+                                        textBox_ProductDate.Text = DateTime.Now.ToString("yyyy-MM-dd").Replace("-", "");
+                                        //生产标识
+                                        textBox_ProductTag.Text = arrText[rowNum + 4].ToString().Split(',')[1];
+                                        break;
+                                    }
+                                default: break;
+
+                            }
+                        }
+                    } while (false);
+
+                    MessageBox.Show("导入完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show("导入错误,请检查导入文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
+            }
+
+        }
+
+        private void pictureBox1_Click(object sender, EventArgs e)
+        {
+            if (WriteLockStatus == true)
+            {
+                richTextBox_AdvanceParams.ReadOnly = false;
+                pictureBox1.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Unlock;
+                WriteLockStatus = !WriteLockStatus;
+            }
+            else
+            {
+                richTextBox_AdvanceParams.ReadOnly = true;
+                pictureBox1.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+                WriteLockStatus = !WriteLockStatus;
+            }
+        }
+
         private void GenerateParams_Load(object sender, EventArgs e)
         {
             //更新版本信息
@@ -418,7 +731,7 @@ namespace Welling_Motor_Debug_Tool
             }
             else
             {
-                label_Server_ComStatus.Text = "网络已连接";
+                label_Server_ComStatus.Text = "网络已连接:" + IP;
                 label_ServerStatus.BackColor = Color.Green;
             }
 
@@ -457,6 +770,10 @@ namespace Welling_Motor_Debug_Tool
         private void comboBox_ModelFile_SelectedIndexChanged(object sender, EventArgs e)
         {            
             button_ExportParams.Enabled = true;
+            //高级参数只读
+            richTextBox_AdvanceParams.ReadOnly = true;
+            pictureBox1.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+            WriteLockStatus = true;
 
             //下载文件
             if (System.IO.File.Exists(localInfo.LocalPath + "\\" + comboBox_ModelFile.Text))//本地存在选定文件,先删除本地

+ 4 - 1
Welling_Motor_Debug_Tool/GenerateParams.resx

@@ -117,11 +117,14 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <metadata name="tabPage_Advance.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>28</value>
+    <value>25</value>
   </metadata>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

+ 1 - 1
Welling_Motor_Debug_Tool/Login.Designer.cs

@@ -41,10 +41,10 @@
             // 
             // comboBox_User
             // 
-            this.comboBox_User.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.comboBox_User.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.comboBox_User.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
             this.comboBox_User.FormattingEnabled = true;
+            this.comboBox_User.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;            
             this.comboBox_User.Location = new System.Drawing.Point(89, 65);
             this.comboBox_User.Name = "comboBox_User";
             this.comboBox_User.Size = new System.Drawing.Size(171, 35);

+ 4 - 18
Welling_Motor_Debug_Tool/Version.Designer.cs

@@ -34,7 +34,6 @@
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
             this.button_CheckVersion = new System.Windows.Forms.Button();
             this.richTextBox_Log = new System.Windows.Forms.RichTextBox();
-            this.label2 = new System.Windows.Forms.Label();
             this.statusStrip1 = new System.Windows.Forms.StatusStrip();
             this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
@@ -90,26 +89,15 @@
             // 
             // richTextBox_Log
             // 
+            this.richTextBox_Log.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
             this.richTextBox_Log.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.richTextBox_Log.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
-            this.richTextBox_Log.Location = new System.Drawing.Point(14, 124);
+            this.richTextBox_Log.Location = new System.Drawing.Point(14, 81);
             this.richTextBox_Log.Name = "richTextBox_Log";
             this.richTextBox_Log.ReadOnly = true;
-            this.richTextBox_Log.Size = new System.Drawing.Size(352, 200);
+            this.richTextBox_Log.Size = new System.Drawing.Size(352, 243);
             this.richTextBox_Log.TabIndex = 20;
-            this.richTextBox_Log.Text = "V2.1.6\n修改控制器内阻校准指令,增加写入存储标志。";
-            // 
-            // label2
-            // 
-            this.label2.AutoSize = true;
-            this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
-            this.label2.Location = new System.Drawing.Point(14, 91);
-            this.label2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(79, 20);
-            this.label2.TabIndex = 0;
-            this.label2.Text = "修订记录:";
+            this.richTextBox_Log.Text = "";
             // 
             // statusStrip1
             // 
@@ -139,7 +127,6 @@
             this.Controls.Add(this.richTextBox_Log);
             this.Controls.Add(this.button_CheckVersion);
             this.Controls.Add(this.pictureBox2);
-            this.Controls.Add(this.label2);
             this.Controls.Add(this.label_BT);
             this.Controls.Add(this.label_Ver);
             this.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -165,7 +152,6 @@
         private System.Windows.Forms.PictureBox pictureBox2;
         private System.Windows.Forms.Button button_CheckVersion;
         private System.Windows.Forms.RichTextBox richTextBox_Log;
-        private System.Windows.Forms.Label label2;
         private System.Windows.Forms.StatusStrip statusStrip1;
         private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
     }

+ 11 - 0
Welling_Motor_Debug_Tool/Version.cs

@@ -14,6 +14,14 @@ namespace Welling_Motor_Debug_Tool
 {
     public partial class Version : Form
     {
+        //修改记录
+        string ChangeLog = "修改记录:\r\n" +
+            "V2.1.6\r\n" +
+            "1,修改控制器内阻校准指令,增加写入存储标志;\r\n" +
+            "2,参数生成界面增加导入样机测试记录你文件功能;\r\n" +
+            "3,参数生成界面增加锁,防止误触。\r\n"
+            ;
+
         //存储路径文件
         LocalInfo localInfo = new LocalInfo();
         //服务器配置
@@ -32,6 +40,9 @@ namespace Welling_Motor_Debug_Tool
             label_Ver.Text = "版本: V" + mainForm.Version;
             label_BT.Text = "编译时间:" + System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString("yyyy-MM-dd HH:mm:ss");
 
+            //修改日志
+            richTextBox_Log.AppendText(ChangeLog);
+
             //导入网络配置
             if (System.IO.File.Exists(localInfo.LocalPath + localInfo.ConfigFileName)) //存在配置文件,导入配置信息
             {

BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool_V2.1.6.exe


BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferences.cache


+ 15 - 15
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.FileListAbsolute.txt

@@ -54,21 +54,6 @@ D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug
 D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache
 D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe
 D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.pdb
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe.config
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.pdb
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.AssemblyReference.cache
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.SuggestedBindingRedirects.cache
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.GenerateParams.resources
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Login.resources
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.mainForm.resources
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Properties.Resources.resources
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Scan.resources
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.TorqueParams.resources
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.GenerateResource.cache
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.pdb
 C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe.config
 C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe
 C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.pdb
@@ -83,4 +68,19 @@ C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Too
 C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache
 C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe
 C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.pdb
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe.config
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.pdb
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.AssemblyReference.cache
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.SuggestedBindingRedirects.cache
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.GenerateParams.resources
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Login.resources
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.mainForm.resources
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Properties.Resources.resources
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Scan.resources
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.TorqueParams.resources
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Version.resources
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.GenerateResource.cache
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.pdb

BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.GenerateResource.cache


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.exe


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.pdb