Procházet zdrojové kódy

1,增加自动更新按钮,解决离线使用是打开慢的问题;
2,删除发送进入5S协议指令,新版本UART控制器不需要配置协议,考虑还原提高兼容性;
3,部分工序增加延时,解决通信异常问题;
4,调整MOS校准位置,解决MOS校准完成后软件复位导致写入的参数未保存的问题。

Dail před 11 měsíci
rodič
revize
eec7560c6e

binární
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 1 - 1
Welling_Motor_Debug_Tool/LocalInfo.cs

@@ -12,7 +12,7 @@ namespace Welling_Motor_Debug_Tool
         public string LocalDataPath = "C:\\Temp\\MotorTestTool\\DataLog\\"; //本地数据文件路径
         public string LocalLogPath = "C:\\Temp\\MotorTestTool\\Log\\"; //本地日志文件路径
         public string PC_InfoFileName = "PC_Info.txt";//计算机信息
-        public string ConfigFileName = "Config2.ttcfg"; //配置文件
+        public string ConfigFileName = "Config3.ttcfg"; //配置文件
         public string NoteFileName = "Note.txt";
         public string SerialNumFileName1 = "serial1";//测试流水号
         public string SerialNumFileName2 = "serial2";//检验流水号

+ 39 - 5
Welling_Motor_Debug_Tool/mainForm.Designer.cs

@@ -130,6 +130,9 @@ namespace Welling_Motor_Debug_Tool
             this.生产记录数据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.版本ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.自动更新ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.打开ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.关闭ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.本机信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.累计运行时间ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -1504,6 +1507,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.关于ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.版本ToolStripMenuItem,
+            this.自动更新ToolStripMenuItem,
             this.本机信息ToolStripMenuItem,
             this.帮助ToolStripMenuItem,
             this.累计运行时间ToolStripMenuItem});
@@ -1519,6 +1523,31 @@ namespace Welling_Motor_Debug_Tool
             this.版本ToolStripMenuItem.Text = "版本信息";
             this.版本ToolStripMenuItem.Click += new System.EventHandler(this.版本ToolStripMenuItem_Click);
             // 
+            // 自动更新ToolStripMenuItem
+            // 
+            this.自动更新ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.打开ToolStripMenuItem,
+            this.关闭ToolStripMenuItem});
+            this.自动更新ToolStripMenuItem.Name = "自动更新ToolStripMenuItem";
+            this.自动更新ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.自动更新ToolStripMenuItem.Text = "自动更新";
+            // 
+            // 打开ToolStripMenuItem
+            // 
+            this.打开ToolStripMenuItem.Checked = true;
+            this.打开ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.打开ToolStripMenuItem.Name = "打开ToolStripMenuItem";
+            this.打开ToolStripMenuItem.Size = new System.Drawing.Size(112, 26);
+            this.打开ToolStripMenuItem.Text = "打开";
+            this.打开ToolStripMenuItem.Click += new System.EventHandler(this.打开ToolStripMenuItem_Click);
+            // 
+            // 关闭ToolStripMenuItem
+            // 
+            this.关闭ToolStripMenuItem.Name = "关闭ToolStripMenuItem";
+            this.关闭ToolStripMenuItem.Size = new System.Drawing.Size(112, 26);
+            this.关闭ToolStripMenuItem.Text = "关闭";
+            this.关闭ToolStripMenuItem.Click += new System.EventHandler(this.关闭ToolStripMenuItem_Click);
+            // 
             // 本机信息ToolStripMenuItem
             // 
             this.本机信息ToolStripMenuItem.Name = "本机信息ToolStripMenuItem";
@@ -5343,6 +5372,7 @@ namespace Welling_Motor_Debug_Tool
             this.comboBox_FacModeCfgFile.Name = "comboBox_FacModeCfgFile";
             this.comboBox_FacModeCfgFile.Size = new System.Drawing.Size(697, 29);
             this.comboBox_FacModeCfgFile.TabIndex = 8;
+            this.comboBox_FacModeCfgFile.MouseHover += new System.EventHandler(this.comboBox_FacModeCfgFile_MouseHover_1);
             // 
             // comboBox_FacModeCfgDate
             // 
@@ -5384,11 +5414,11 @@ namespace Welling_Motor_Debug_Tool
             this.checkBox_FacMode_MosCal.CheckState = System.Windows.Forms.CheckState.Checked;
             this.checkBox_FacMode_MosCal.Enabled = false;
             this.checkBox_FacMode_MosCal.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.checkBox_FacMode_MosCal.Location = new System.Drawing.Point(6, 106);
+            this.checkBox_FacMode_MosCal.Location = new System.Drawing.Point(6, 54);
             this.checkBox_FacMode_MosCal.Name = "checkBox_FacMode_MosCal";
-            this.checkBox_FacMode_MosCal.Size = new System.Drawing.Size(104, 21);
+            this.checkBox_FacMode_MosCal.Size = new System.Drawing.Size(80, 21);
             this.checkBox_FacMode_MosCal.TabIndex = 8;
-            this.checkBox_FacMode_MosCal.Text = "MOS内阻校准";
+            this.checkBox_FacMode_MosCal.Text = "MOS校准";
             this.checkBox_FacMode_MosCal.UseVisualStyleBackColor = true;
             // 
             // pictureBox_WriteLock
@@ -5479,7 +5509,7 @@ namespace Welling_Motor_Debug_Tool
             this.checkBox_FacModeBMS.CheckState = System.Windows.Forms.CheckState.Checked;
             this.checkBox_FacModeBMS.Enabled = false;
             this.checkBox_FacModeBMS.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.checkBox_FacModeBMS.Location = new System.Drawing.Point(6, 80);
+            this.checkBox_FacModeBMS.Location = new System.Drawing.Point(6, 106);
             this.checkBox_FacModeBMS.Name = "checkBox_FacModeBMS";
             this.checkBox_FacModeBMS.Size = new System.Drawing.Size(78, 21);
             this.checkBox_FacModeBMS.TabIndex = 2;
@@ -5507,7 +5537,7 @@ namespace Welling_Motor_Debug_Tool
             this.checkBox_FacModeCfgWrite.CheckState = System.Windows.Forms.CheckState.Checked;
             this.checkBox_FacModeCfgWrite.Enabled = false;
             this.checkBox_FacModeCfgWrite.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.checkBox_FacModeCfgWrite.Location = new System.Drawing.Point(6, 54);
+            this.checkBox_FacModeCfgWrite.Location = new System.Drawing.Point(6, 80);
             this.checkBox_FacModeCfgWrite.Name = "checkBox_FacModeCfgWrite";
             this.checkBox_FacModeCfgWrite.Size = new System.Drawing.Size(75, 21);
             this.checkBox_FacModeCfgWrite.TabIndex = 1;
@@ -5696,6 +5726,7 @@ namespace Welling_Motor_Debug_Tool
             this.comboBox_CheckModeCfgFile.Name = "comboBox_CheckModeCfgFile";
             this.comboBox_CheckModeCfgFile.Size = new System.Drawing.Size(697, 29);
             this.comboBox_CheckModeCfgFile.TabIndex = 18;
+            this.comboBox_CheckModeCfgFile.MouseHover += new System.EventHandler(this.comboBox_CheckModeCfgFile_MouseHover_1);
             // 
             // groupBox31
             // 
@@ -7690,5 +7721,8 @@ namespace Welling_Motor_Debug_Tool
         private CheckBox checkBox_CheckModeMos;
         private Label label132;
         private Label label_CheckModeMos;
+        private ToolStripMenuItem 自动更新ToolStripMenuItem;
+        private ToolStripMenuItem 打开ToolStripMenuItem;
+        private ToolStripMenuItem 关闭ToolStripMenuItem;
     }
 }

+ 234 - 148
Welling_Motor_Debug_Tool/mainForm.cs

@@ -369,6 +369,9 @@ namespace Welling_Motor_Debug_Tool
                     //通信协议类型
                     cANToolStripMenuItem.Checked = (array_CfgInfo[50].ToString().Split(':')[1] == "True");
                     uARTToolStripMenuItem.Checked = !cANToolStripMenuItem.Checked;
+                    //自动更新开关
+                    打开ToolStripMenuItem.Checked = (array_CfgInfo[54].ToString().Split(':')[1] == "True");
+                    关闭ToolStripMenuItem.Checked = !打开ToolStripMenuItem.Checked;
                 }
                 catch (System.Exception)
                 {
@@ -804,11 +807,16 @@ namespace Welling_Motor_Debug_Tool
 
             //检查版本,自动更新
             do
-            {
+            {                
+                if (打开ToolStripMenuItem.Checked == false)//关闭自动更新
+                {
+                    break;
+                }
                 //检查网络状态
                 if (myFtp.CheckFtp() == false)
                 {
-                    break; ;
+                    MessageBoxTimeOut.Show("网络断开,自动更新失败!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    break;
                 }
                 else
                 {
@@ -3477,7 +3485,7 @@ namespace Welling_Motor_Debug_Tool
             ToolTip toolTip1 = new ToolTip();
 
             // 设置显示样式
-            toolTip1.AutoPopDelay = 30000;//提示信息的可见时间
+            toolTip1.AutoPopDelay = 3000;//提示信息的可见时间
             toolTip1.InitialDelay = 50;//事件触发多久后出现提示
             toolTip1.ReshowDelay = 50;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
             toolTip1.ShowAlways = true;//是否显示提示框
@@ -5281,6 +5289,9 @@ namespace Welling_Motor_Debug_Tool
             CfgFileInfo += "[ProtocolType]" + "\r\n";
             CfgFileInfo += "CAN:" + cANToolStripMenuItem.Checked.ToString() + "\r\n";
             CfgFileInfo += "UART:" + uARTToolStripMenuItem.Checked.ToString() + "\r\n";
+            CfgFileInfo += "\r\n";
+            CfgFileInfo += "[AutoUpdate]" + "\r\n";
+            CfgFileInfo += "AutoUpdate:" + 打开ToolStripMenuItem.Checked.ToString() + "\r\n";
 
             System.IO.File.WriteAllText(FileName, CfgFileInfo);
         }
@@ -5932,7 +5943,8 @@ namespace Welling_Motor_Debug_Tool
             //变量定义
             var Code = new byte[255];//发送的指令数据                      
             
-            label_FacModeStatus.Text = "开始测试";
+            label_FacModeStatus.Text = "开始测试"; 
+            BootInfo = "";
             Delay_ms(500);
             label_FacModeStatus.Text = "系统开机";
             
@@ -5947,8 +5959,7 @@ namespace Welling_Motor_Debug_Tool
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2505, Code);
                 Delay_ms(500);
             }
-            //发送开机指令            
-            BootInfo = "";
+            //发送开机指令                        
             //确保测试前先关机,发送关机指令再发送开机指令
             Code[0] = 0xF0;
             mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
@@ -5977,12 +5988,13 @@ namespace Welling_Motor_Debug_Tool
                 FacMode_Stop(false);
                 return;
             }
-                                    
+
             //系统清除
             if (checkBox_FacModeSysClear.Checked)
             {
                 do
                 {
+                    #if false
                     if (uARTToolStripMenuItem.Checked)//UART控制器默认按照5S协议收发数据
                     {
                         Code[0] = 0x00;//5S协议
@@ -5993,7 +6005,8 @@ namespace Welling_Motor_Debug_Tool
                         Delay_ms(500);
                         richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送指令进入5S协议" + "\r\n");
                     }
-                    
+                    #endif
+
                     //发送系统清除指令    
                     label_FacModeStatus.Text = "系统清除";
                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "系统清除" + "\r\n");
@@ -6026,7 +6039,8 @@ namespace Welling_Motor_Debug_Tool
                         FacMode_Stop(false);
                         return;
                     }
-                    
+
+                    BootInfo = "";
                     //UART控制器发送复位指令把联动装置盒控制器接口波特率改为57600
                     if (uARTToolStripMenuItem.Checked)
                     {
@@ -6040,21 +6054,20 @@ namespace Welling_Motor_Debug_Tool
                     }
                     //系统重新开机
                     label_FacModeStatus.Text = "重新开机";
-                    BootInfo = "";
                     //确保测试前先关机,发送关机指令再发送开机指令
-                    BootInfo = "";
                     Code[0] = 0xF0;
                     mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
                     Delay_ms(1500);
                     Code[0] = 0xF1;
                     mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
                     ACK_WaitCnt = 0;
-                    while (ACK_WaitCnt <= 10); //5s
+                    while (ACK_WaitCnt <= 20); //10s
 
                     //获取Boot版本信息
                     if (BootInfo != string.Empty)
                     {
                         richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "重新开机成功"  + "\r\n");
+                        Delay_ms(500);
                     }
                     else
                     {
@@ -6077,6 +6090,7 @@ namespace Welling_Motor_Debug_Tool
                 Delay_ms(500);
             }
 
+            #if false
             if (uARTToolStripMenuItem.Checked)//UART控制器默认按照5S协议收发数据
             {
                 Code[0] = 0x00;//5S协议
@@ -6087,7 +6101,7 @@ namespace Welling_Motor_Debug_Tool
                 Delay_ms(500);
                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送指令进入5S协议" + "\r\n");
             }
-            
+            #endif
 
             //检查是否有故障
             if (textBox_ErrorCode.Text.Contains("H"))
@@ -6102,6 +6116,138 @@ namespace Welling_Motor_Debug_Tool
                 return;
             }
 
+            //MOS内阻校准
+            if (checkBox_FacMode_MosCal.Checked)
+            {
+                label_FacModeStatus.Text = "MOS内阻校准";
+                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "开始MOS内阻校准" + "\r\n");
+                Delay_ms(500);
+                //提示进行负载切换
+                if (MessageBox.Show("电阻负载切换完成,开始校准?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
+                {
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "取消MOS内阻校准" + "\r\n");
+                    label_FacModeStatus.Text = "存在故障!";
+                    label_FacModeResult.BackColor = Color.Red;
+                    label_FacModeResult.Text = "测试异常";
+                    Delay_ms(500);
+                    //存储异常并上传
+                    FacMode_Stop(false);
+                    return;
+                }
+                //确认后发送校准指令
+                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送校准指令" + "\r\n");
+                string[] K = toolStripTextBox_MosCalK.Text.Split(',');
+                Code[0] = (byte)((写入存储ToolStripMenuItem.Checked) ? 0x01 : 0x00);
+                ushort uwDataTemp = 0;
+                uwDataTemp = Convert.ToUInt16(K[0]);
+                Code[2] = (byte)(uwDataTemp & 0xFF);
+                Code[3] = (byte)(uwDataTemp >> 8);
+                uwDataTemp = Convert.ToUInt16(K[1]);
+                Code[4] = (byte)(uwDataTemp & 0xFF);
+                Code[5] = (byte)(uwDataTemp >> 8);
+                uwDataTemp = Convert.ToUInt16(K[2]);
+                Code[6] = (byte)(uwDataTemp & 0xFF);
+                Code[7] = (byte)(uwDataTemp >> 8);
+                uwDataTemp = Convert.ToUInt16(K[3]);
+                Code[8] = (byte)(uwDataTemp & 0xFF);
+                Code[9] = (byte)(uwDataTemp >> 8);
+                uwDataTemp = Convert.ToUInt16(K[4]);
+                Code[10] = (byte)(uwDataTemp & 0xFF);
+                Code[11] = (byte)(uwDataTemp >> 8);
+                mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4A12, Code);
+                WriteACK = false;
+                WriteCnt = 0;
+                ACK_WaitCnt = 0;
+                while (ACK_WaitCnt <= 6) ; //3s
+                if (WriteACK == true)
+                {
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻校准完成" + "\r\n");
+                }
+                else
+                {
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻校准异常" + "\r\n");
+                    label_FacModeStatus.Text = "存在故障!";
+                    label_FacModeResult.BackColor = Color.Red;
+                    label_FacModeResult.Text = "测试异常";
+                    Delay_ms(500);
+                    //存储异常并上传
+                    FacMode_Stop(false);
+                    return;
+                }
+                #if false
+                //因控制器复位需发送指令重新进入5S协议
+                if (uARTToolStripMenuItem.Checked)//UART控制器默认按照5S协议收发数据
+                {
+                    Code[0] = 0x00;//5S协议
+                    Code[1] = 0x00;
+                    mySerialProcess.SendCmd((ushort)0x7FF, (byte)0x16, (ushort)0x7702, Code);
+                    Delay_ms(500);
+                    mySerialProcess.SendCmd((ushort)0x7FF, (byte)0x16, (ushort)0x7702, Code);
+                    Delay_ms(500);
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送指令进入5S协议" + "\r\n");
+                }
+                #endif
+                //读取显示校准返回数据
+                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取MOS内阻校准结果" + "\r\n");
+                foreach (Control c in groupBox21.Controls)
+                {
+                    if (c is TextBox)
+                        c.Text = "";
+                }
+                mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4B00, null);
+                ACK_WaitCnt = 0;
+                while (ACK_WaitCnt <= 2) ; //1s
+                if ((textBox_MOS_R1.Text == string.Empty) || (textBox_MOS_R2.Text == string.Empty) || (textBox_MOS_R3.Text == string.Empty))
+                {
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取MOS内阻校准结果异常" + "\r\n");
+                    label_FacModeStatus.Text = "存在故障!";
+                    label_FacModeResult.BackColor = Color.Red;
+                    label_FacModeResult.Text = "测试异常";
+                    Delay_ms(500);
+                    //存储异常并上传
+                    FacMode_Stop(false);
+                    return;
+                }
+                else
+                {
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻:" + textBox_MOS_R1.Text + " " + textBox_MOS_R2.Text + " " + textBox_MOS_R3.Text + "\r\n");
+                }
+                //与校准返回数据对比
+                string[] MOS_R1_Th = toolStripTextBox_MOS1.Text.Split(',');
+                string[] MOS_R2_Th = toolStripTextBox_MOS2.Text.Split(',');
+                string[] MOS_R3_Th = toolStripTextBox_MOS3.Text.Split(',');
+                if ((Convert.ToUInt16(textBox_MOS_R1.Text) >= Convert.ToUInt16(MOS_R1_Th[0])) && (Convert.ToUInt16(textBox_MOS_R1.Text) <= Convert.ToUInt16(MOS_R1_Th[1])) &&
+                    (Convert.ToUInt16(textBox_MOS_R2.Text) >= Convert.ToUInt16(MOS_R2_Th[0])) && (Convert.ToUInt16(textBox_MOS_R2.Text) <= Convert.ToUInt16(MOS_R2_Th[1])) &&
+                    (Convert.ToUInt16(textBox_MOS_R3.Text) >= Convert.ToUInt16(MOS_R3_Th[0])) && (Convert.ToUInt16(textBox_MOS_R3.Text) <= Convert.ToUInt16(MOS_R3_Th[1]))
+                    )
+                {
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻校准合格" + "\r\n");
+                    label_FacModeMosCal.BackColor = Color.Green;
+                    //提示切换负载
+                    MessageBox.Show("请将负载切换回电机!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                }
+                else
+                {
+                    //提示切换负载
+                    MessageBox.Show("请将负载切换回电机!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻校准超范围" + "\r\n");
+                    label_FacModeStatus.Text = "存在故障!";
+                    label_FacModeResult.BackColor = Color.Red;
+                    label_FacModeResult.Text = "测试异常";
+                    Delay_ms(500);
+                    //存储异常并上传
+                    FacMode_Stop(false);
+                    return;
+                }
+            }
+            else
+            {
+                label_FacModeMosCal.BackColor = Color.Yellow;
+                label_FacModeStatus.Text = "跳过MOS内阻校准!";
+                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "跳过MOS内阻校准" + "\r\n");
+                Delay_ms(500);
+            }
+
             //参数写入
             if (checkBox_FacModeCfgWrite.Checked)
             {
@@ -6292,7 +6438,7 @@ namespace Welling_Motor_Debug_Tool
                     for (int i = 0; i < CmdList.Count; i++)
                     {
                         mySerialProcess.mySerial.Write(CmdList[i], 0, CmdList[i].Length);
-                        Thread.Sleep(200);
+                        Thread.Sleep(500);
                     }
                     //判断写入是否完整
                     if (CmdNum == WriteCnt)
@@ -6303,7 +6449,7 @@ namespace Welling_Motor_Debug_Tool
                     }
                     else
                     {
-                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "参数写入失败" + "\r\n");
+                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "参数写入失败," + "共" + CmdNum.ToString() + "条指令," + "写入成功" + WriteCnt.ToString() + "条" + "\r\n");
                         label_FacModeStatus.Text = "存在故障!";
                         label_FacModeResult.BackColor = Color.Red;
                         label_FacModeResult.Text = "测试异常";
@@ -6346,132 +6492,6 @@ namespace Welling_Motor_Debug_Tool
                 Delay_ms(500);
             }
 
-            //MOS内阻校准
-            if (checkBox_FacMode_MosCal.Checked)
-            {
-                label_FacModeStatus.Text = "MOS内阻校准";
-                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "开始MOS内阻校准" + "\r\n");
-                Delay_ms(500);
-                //提示进行负载切换
-                if (MessageBox.Show("电阻负载切换完成,开始校准?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
-                {
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "取消MOS内阻校准" + "\r\n");
-                    label_FacModeStatus.Text = "存在故障!";
-                    label_FacModeResult.BackColor = Color.Red;
-                    label_FacModeResult.Text = "测试异常";
-                    Delay_ms(500);
-                    //存储异常并上传
-                    FacMode_Stop(false);
-                    return;
-                }
-                //确认后发送校准指令
-                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送校准指令" + "\r\n");
-                string[] K = toolStripTextBox_MosCalK.Text.Split(',');
-                Code[0] = (byte)((写入存储ToolStripMenuItem.Checked) ? 0x01 : 0x00);
-                ushort uwDataTemp = 0;
-                uwDataTemp = Convert.ToUInt16(K[0]);
-                Code[2] = (byte)(uwDataTemp & 0xFF);
-                Code[3] = (byte)(uwDataTemp >> 8);
-                uwDataTemp = Convert.ToUInt16(K[1]);
-                Code[4] = (byte)(uwDataTemp & 0xFF);
-                Code[5] = (byte)(uwDataTemp >> 8);
-                uwDataTemp = Convert.ToUInt16(K[2]);
-                Code[6] = (byte)(uwDataTemp & 0xFF);
-                Code[7] = (byte)(uwDataTemp >> 8);
-                uwDataTemp = Convert.ToUInt16(K[3]);
-                Code[8] = (byte)(uwDataTemp & 0xFF);
-                Code[9] = (byte)(uwDataTemp >> 8);
-                uwDataTemp = Convert.ToUInt16(K[4]);
-                Code[10] = (byte)(uwDataTemp & 0xFF);
-                Code[11] = (byte)(uwDataTemp >> 8);
-                mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4A12, Code);
-                WriteACK = false;
-                WriteCnt = 0;
-                ACK_WaitCnt = 0;
-                while (ACK_WaitCnt <= 6) ; //3s
-                if (WriteACK == true)
-                {
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻校准完成" + "\r\n");
-                }
-                else
-                {
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻校准异常" + "\r\n");
-                    label_FacModeStatus.Text = "存在故障!";
-                    label_FacModeResult.BackColor = Color.Red;
-                    label_FacModeResult.Text = "测试异常";
-                    Delay_ms(500);
-                    //存储异常并上传
-                    FacMode_Stop(false);
-                    return;
-                }                
-                //因控制器复位需发送指令重新进入5S协议
-                if (uARTToolStripMenuItem.Checked)//UART控制器默认按照5S协议收发数据
-                {
-                    Code[0] = 0x00;//5S协议
-                    Code[1] = 0x00;
-                    mySerialProcess.SendCmd((ushort)0x7FF, (byte)0x16, (ushort)0x7702, Code);
-                    Delay_ms(500);
-                    mySerialProcess.SendCmd((ushort)0x7FF, (byte)0x16, (ushort)0x7702, Code);
-                    Delay_ms(500);
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送指令进入5S协议" + "\r\n");
-                }
-                //读取显示校准返回数据
-                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取MOS内阻校准结果" + "\r\n");
-                foreach (Control c in groupBox21.Controls)
-                {
-                    if (c is TextBox)
-                        c.Text = "";
-                }
-                mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4B00, null);
-                ACK_WaitCnt = 0;
-                while (ACK_WaitCnt <= 2) ; //1s
-                if ((textBox_MOS_R1.Text == string.Empty) || (textBox_MOS_R2.Text == string.Empty) || (textBox_MOS_R3.Text == string.Empty))
-                {
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取MOS内阻校准结果异常" + "\r\n");
-                    label_FacModeStatus.Text = "存在故障!";
-                    label_FacModeResult.BackColor = Color.Red;
-                    label_FacModeResult.Text = "测试异常";
-                    Delay_ms(500);
-                    //存储异常并上传
-                    FacMode_Stop(false);
-                    return;
-                }
-                else
-                {
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻:" + textBox_MOS_R1.Text + " " + textBox_MOS_R2.Text + " " + textBox_MOS_R3.Text + "\r\n");
-                }
-                //与校准返回数据对比
-                string[] MOS_R1_Th = toolStripTextBox_MOS1.Text.Split(',');
-                string[] MOS_R2_Th = toolStripTextBox_MOS2.Text.Split(',');
-                string[] MOS_R3_Th = toolStripTextBox_MOS3.Text.Split(',');
-                if ((Convert.ToUInt16(textBox_MOS_R1.Text) >= Convert.ToUInt16(MOS_R1_Th[0])) && (Convert.ToUInt16(textBox_MOS_R1.Text) <= Convert.ToUInt16(MOS_R1_Th[1])) &&
-                    (Convert.ToUInt16(textBox_MOS_R2.Text) >= Convert.ToUInt16(MOS_R2_Th[0])) && (Convert.ToUInt16(textBox_MOS_R2.Text) <= Convert.ToUInt16(MOS_R2_Th[1])) &&
-                    (Convert.ToUInt16(textBox_MOS_R3.Text) >= Convert.ToUInt16(MOS_R3_Th[0])) && (Convert.ToUInt16(textBox_MOS_R3.Text) <= Convert.ToUInt16(MOS_R3_Th[1]))
-                    )
-                {
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻校准合格" + "\r\n");
-                    label_FacModeMosCal.BackColor = Color.Green;
-                }
-                else
-                {
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "MOS内阻校准超范围" + "\r\n");
-                    label_FacModeStatus.Text = "存在故障!";
-                    label_FacModeResult.BackColor = Color.Red;
-                    label_FacModeResult.Text = "测试异常";
-                    Delay_ms(500);
-                    //存储异常并上传
-                    FacMode_Stop(false);
-                    return;
-                }
-            }
-            else
-            {
-                label_FacModeMosCal.BackColor = Color.Yellow;
-                label_FacModeStatus.Text = "跳过MOS内阻校准!";
-                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "跳过MOS内阻校准" + "\r\n");
-                Delay_ms(500);
-            }
-
             //基础功能检测
             if (checkBox_FacBaseFucTest.Checked)
             {
@@ -6480,10 +6500,9 @@ namespace Welling_Motor_Debug_Tool
                 //确认负载位置
                 if (checkBox_FacMode_MosCal.Checked)
                 {
-                    if (MessageBox.Show("请确认负载是否切换回电机?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
+                    if (MessageBox.Show("请再次确认负载是否切换回电机?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                     {
-                        if (MessageBox.Show("再次确认负载是否切换回电机?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
-                            richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "负载已切换为电机,继续测试" + "\r\n");
+                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "负载已切换为电机,继续测试" + "\r\n");
                     }
                     else
                     {
@@ -6572,6 +6591,7 @@ namespace Welling_Motor_Debug_Tool
                     var Data = new byte[1];
                     Data[0] = (byte)100;
                     mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2C01, Data);
+                    Delay_ms(500);
                     //启动电机进入WALK模式
                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "基础功能检测,进入WALK" + "\r\n");
                     Code[0] = 0x22;
@@ -6593,7 +6613,7 @@ namespace Welling_Motor_Debug_Tool
                         return;
                     }
                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "已进入WALK,开始检测" + "\r\n");
-#endif                    
+#endif
                     Delay_ms(3000);
                 } while (false);
 
@@ -6703,6 +6723,7 @@ namespace Welling_Motor_Debug_Tool
                     var Data = new byte[1];
                     Data[0] = (byte)0;
                     mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2C01, Data);
+                    Delay_ms(500);
 #if false //通过修改调试模式停止电机
                     //获取调试信息
                     string DebugDefaultInfo = "";
@@ -6842,7 +6863,6 @@ namespace Welling_Motor_Debug_Tool
             else
             {
                 label_FacModeTq.BackColor = Color.Yellow;
-                label_FacModeCad.BackColor = Color.Yellow;
                 label_FacModeStatus.Text = "跳过力矩检测!";
                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "跳过力矩检测" + "\r\n");
                 Delay_ms(500);
@@ -6915,7 +6935,6 @@ namespace Welling_Motor_Debug_Tool
             }
             else
             {
-                label_FacModeTq.BackColor = Color.Yellow;
                 label_FacModeCad.BackColor = Color.Yellow;
                 label_FacModeStatus.Text = "跳过踏频检测!";
                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "跳过踏频检测" + "\r\n");
@@ -7045,6 +7064,7 @@ namespace Welling_Motor_Debug_Tool
                 var Data = new byte[1];
                 Data[0] = (byte)100;
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2C01, Data);
+                Delay_ms(500);
                 //启动电机进入WALK模式
                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "剎把检测,进入WALK" + "\r\n");
                 Code[0] = 0x22;
@@ -7550,7 +7570,7 @@ namespace Welling_Motor_Debug_Tool
             Code[0] = 0xF1;
             mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
             ACK_WaitCnt = 0;
-            while (ACK_WaitCnt <= 10) ; //5s            
+            while (ACK_WaitCnt <= 15) ; //7.5s            
 
             //检查BOOT版本
             if (BootInfo != string.Empty)
@@ -7571,6 +7591,7 @@ namespace Welling_Motor_Debug_Tool
                 return;
             }
 
+#if false
             if (uARTToolStripMenuItem.Checked)//UART控制器默认按照5S协议收发数据
             {
                 Code[0] = 0x00;//5S协议
@@ -7581,6 +7602,7 @@ namespace Welling_Motor_Debug_Tool
                 Delay_ms(500);
                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送指令进入5S协议" + "\r\n");
             }
+#endif
 
             //发送指令读取版本信息
             do
@@ -8926,5 +8948,69 @@ namespace Welling_Motor_Debug_Tool
                 File.WriteAllText(localInfo.LocalPath + localInfo.SerialNumFileName2, label_CheckModeSerial.Text);
             }
         }
+
+        /// <summary>
+        /// 打开自动更新
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            打开ToolStripMenuItem.Checked = true;
+            关闭ToolStripMenuItem.Checked = false;
+            ConfigFileSave(true, localInfo.LocalPath + localInfo.ConfigFileName);
+        }
+
+        /// <summary>
+        /// 关闭自动更新
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void 关闭ToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            打开ToolStripMenuItem.Checked = false;
+            关闭ToolStripMenuItem.Checked = true;
+            ConfigFileSave(true, localInfo.LocalPath + localInfo.ConfigFileName);
+        }
+
+        /// <summary>
+        /// 显示完整配置文件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void comboBox_FacModeCfgFile_MouseHover_1(object sender, EventArgs e)
+        {
+            // 创建the ToolTip 
+            ToolTip toolTip1 = new ToolTip();
+
+            // 设置显示样式
+            toolTip1.AutoPopDelay = 3000;//提示信息的可见时间
+            toolTip1.InitialDelay = 50;//事件触发多久后出现提示
+            toolTip1.ReshowDelay = 50;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
+            toolTip1.ShowAlways = true;//是否显示提示框
+
+            //  设置伴随的对象.
+            toolTip1.SetToolTip(this.comboBox_FacModeCfgFile, comboBox_FacModeCfgFile.Text);//设置故障内容显示
+        }
+
+        /// <summary>
+        /// 显示完整配置文件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void comboBox_CheckModeCfgFile_MouseHover_1(object sender, EventArgs e)
+        {
+            // 创建the ToolTip 
+            ToolTip toolTip1 = new ToolTip();
+
+            // 设置显示样式
+            toolTip1.AutoPopDelay = 3000;//提示信息的可见时间
+            toolTip1.InitialDelay = 50;//事件触发多久后出现提示
+            toolTip1.ReshowDelay = 50;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
+            toolTip1.ShowAlways = true;//是否显示提示框
+
+            //  设置伴随的对象.
+            toolTip1.SetToolTip(this.comboBox_CheckModeCfgFile, comboBox_CheckModeCfgFile.Text);//设置故障内容显示
+        }
     }
 }

binární
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.GenerateResource.cache


binární
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.exe


binární
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.pdb