dd пре 2 месеци
родитељ
комит
65dfaada54

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 161 - 79
Welling_Motor_Debug_Tool/mainForm.cs

@@ -6237,9 +6237,10 @@ namespace Welling_Motor_Debug_Tool
             }
             //测试记录
             LogSaveFileName = LogSavePath + "\\" + ProductInfo + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + "_测试记录" + ".log";
-            string file_str = "";
-            file_str += "测试计算机:\r\n" + label_Computername.Text + "\r\n";            
-            file_str += "测试时间:\r\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n\r\n";
+            string file_str = ""; 
+            file_str += "计算机名称:\r\n" + label_Computername.Text + "\r\n";
+            file_str += "软件运行时间:\r\n" + stopwatch.ElapsedMilliseconds.ToString() + " ms" + "\r\n";
+            file_str += "系统时间:\r\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n\r\n";
             file_str += "检验记录:\r\n" + richTextBox_FacModeLog.Text.Replace("\n", "\r\n") + "\r\n\r\n";
             file_str += "检验结果:\r\n" + label_FacModeResult.Text + "\r\n\r\n";
             file_str += Local_HdInformation;
@@ -6426,7 +6427,14 @@ namespace Welling_Motor_Debug_Tool
             mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
             ACK_WaitCnt = 0;
             richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "等待控制器返回Boot信息……" + "\r\n");
-            while (ACK_WaitCnt <= 20); //10s,等待开机成功,联动装置盒控制器接口波特率需等待5s接口自动切换为9600
+            while (ACK_WaitCnt <= 20) //10s,等待开机成功,联动装置盒控制器接口波特率需等待5s接口自动切换为9600
+            {
+                if (!uARTToolStripMenuItem.Checked) //CAN接口不考虑联动装置盒切换为Boot波特率
+                {
+                    if (BootInfo != string.Empty)
+                        break;
+                }
+            }
             
             //检查BOOT版本
             if (BootInfo != string.Empty)
@@ -6548,7 +6556,14 @@ namespace Welling_Motor_Debug_Tool
                     mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
                     ACK_WaitCnt = 0;
                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "等待控制器返回Boot信息……" + "\r\n");
-                    while (ACK_WaitCnt <= 20);
+                    while (ACK_WaitCnt <= 20)
+                    {
+                        if (!uARTToolStripMenuItem.Checked) //CAN接口不考虑联动装置盒切换为Boot波特率
+                        {
+                            if (BootInfo != string.Empty)
+                                break;
+                        }
+                    }
 
                     //获取Boot版本信息
                     if (BootInfo != string.Empty)
@@ -7077,7 +7092,11 @@ namespace Welling_Motor_Debug_Tool
                         mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2210, ModeArray);
                         WriteACK = false;
                         ACK_WaitCnt = 0;
-                        while (ACK_WaitCnt <= 2); //1s
+                        while (ACK_WaitCnt <= 2) //1s
+                        {
+                            if (WriteACK == true)
+                                break;
+                        }
                         if (WriteACK == true)
                         {
                             richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "型号写入成功" + "\r\n");
@@ -7087,7 +7106,11 @@ namespace Welling_Motor_Debug_Tool
                             richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "写入型号,第1次重发" + "\r\n");
                             mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2210, ModeArray);                                                       
                             ACK_WaitCnt = 0;
-                            while (ACK_WaitCnt <= 2) ; //1s
+                            while (ACK_WaitCnt <= 2) //1s
+                            {
+                                if (WriteACK == true)
+                                    break;
+                            }
                             if (WriteACK == true)
                             {
                                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "型号写入成功" + "\r\n");
@@ -7097,7 +7120,11 @@ namespace Welling_Motor_Debug_Tool
                                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "写入型号,第2次重发" + "\r\n");
                                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2210, ModeArray);
                                 ACK_WaitCnt = 0;
-                                while (ACK_WaitCnt <= 2) ; //1s
+                                while (ACK_WaitCnt <= 2) //1s
+                                {
+                                    if (WriteACK == true)
+                                        break;
+                                }
                                 if (WriteACK == true)
                                 {
                                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "型号写入成功" + "\r\n");
@@ -7137,7 +7164,11 @@ namespace Welling_Motor_Debug_Tool
                         mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2310, SNArray);
                         WriteACK = false;
                         ACK_WaitCnt = 0;
-                        while (ACK_WaitCnt <= 2); //1s
+                        while (ACK_WaitCnt <= 2) //1s
+                        {
+                            if (WriteACK == true)
+                                break;
+                        }
                         if (WriteACK == true)
                         {
                             richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "SN写入成功" + "\r\n");
@@ -7147,7 +7178,11 @@ namespace Welling_Motor_Debug_Tool
                             richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "写入SN,第1次重发" + "\r\n");
                             mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2310, SNArray);
                             ACK_WaitCnt = 0;
-                            while (ACK_WaitCnt <= 2) ; //1s
+                            while (ACK_WaitCnt <= 2) //1s
+                            {
+                                if (WriteACK == true)
+                                    break;
+                            }
                             if (WriteACK == true)
                             {
                                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "SN写入成功" + "\r\n");
@@ -7157,7 +7192,11 @@ namespace Welling_Motor_Debug_Tool
                                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "写入SN,第2次重发" + "\r\n");
                                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2310, SNArray);
                                 ACK_WaitCnt = 0;
-                                while (ACK_WaitCnt <= 2) ; //1s
+                                while (ACK_WaitCnt <= 2) //1s
+                                {
+                                    if (WriteACK == true)
+                                        break;
+                                }
                                 if (WriteACK == true)
                                 {
                                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "SN写入成功" + "\r\n");
@@ -7244,7 +7283,11 @@ namespace Welling_Motor_Debug_Tool
                         mySerialProcess.mySerial.Write(CmdList[i], 0, CmdList[i].Length);
                         WriteACK = false;
                         ACK_WaitCnt = 0;
-                        while (ACK_WaitCnt <= 2) ; //1s
+                        while (ACK_WaitCnt <= 2)  //1s
+                        {
+                            if (WriteACK == true)
+                                break;
+                        }
                         if (WriteACK == true)
                         {
                             richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "第" + (i + 1).ToString() + "条指令写入正常" + "\r\n");
@@ -7255,7 +7298,11 @@ namespace Welling_Motor_Debug_Tool
                             mySerialProcess.mySerial.Write(CmdList[i], 0, CmdList[i].Length);
                             WriteACK = false;
                             ACK_WaitCnt = 0;
-                            while (ACK_WaitCnt <= 2) ; //1s
+                            while (ACK_WaitCnt <= 2) //1s
+                            {
+                                if (WriteACK == true)
+                                    break;
+                            }
                             if (WriteACK == true)
                             {
                                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "第" + (i + 1).ToString() + "条指令写入正常" + "\r\n");
@@ -7266,7 +7313,11 @@ namespace Welling_Motor_Debug_Tool
                                 mySerialProcess.mySerial.Write(CmdList[i], 0, CmdList[i].Length);
                                 WriteACK = false;
                                 ACK_WaitCnt = 0;
-                                while (ACK_WaitCnt <= 2) ; //1s
+                                while (ACK_WaitCnt <= 2) //1s
+                                {
+                                    if (WriteACK == true)
+                                        break;
+                                }
                                 if (WriteACK == true)
                                 {
                                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "第" + (i + 1).ToString() + "条指令写入正常" + "\r\n");
@@ -7798,29 +7849,25 @@ namespace Welling_Motor_Debug_Tool
             //踏频检测
             if (checkBox_FacCad.Checked)
             {
-                label_FacModeStatus.Text = "踏频传感器检测!";
-                //发送指令进入配置模式
-                do
+                if ((中置电机MIGIC_ToolStripMenuItem.Checked == true) || (中置电机VP_ToolStripMenuItem.Checked == true))
                 {
-                    if (textBox_RunInfo_Vol.Text != "---") //已进入配置模式,不重新发送
-                    {
-                        break;
-                    }
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "进入配置模式" + "\r\n");
-                    Code[0] = 0x01;
-                    mySerialProcess.SendCmdWithoutNotice((ushort)0x751, (byte)0x16, (ushort)0x1901, Code);
-                    WriteACK = false;
-                    ACK_WaitCnt = 0;
-                    while (ACK_WaitCnt <= 2) ; //1s
-                    if (textBox_RunInfo_Vol.Text != "---")
-                    {
-                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "已进入配置模式" + "\r\n");
-                        Delay_ms(500);
-                    }
-                    else
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "中置电机不重复检测踏频" + "\r\n");
+                }
+                else
+                {
+                    label_FacModeStatus.Text = "踏频传感器检测!";
+
+                    //发送指令进入配置模式
+                    do
                     {
-                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "进入配置模式,第1次重发" + "\r\n");
+                        if (textBox_RunInfo_Vol.Text != "---") //已进入配置模式,不重新发送
+                        {
+                            break;
+                        }
+                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "进入配置模式" + "\r\n");
+                        Code[0] = 0x01;
                         mySerialProcess.SendCmdWithoutNotice((ushort)0x751, (byte)0x16, (ushort)0x1901, Code);
+                        WriteACK = false;
                         ACK_WaitCnt = 0;
                         while (ACK_WaitCnt <= 2) ; //1s
                         if (textBox_RunInfo_Vol.Text != "---")
@@ -7830,7 +7877,7 @@ namespace Welling_Motor_Debug_Tool
                         }
                         else
                         {
-                            richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "进入配置模式,第2次重发" + "\r\n");
+                            richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "进入配置模式,第1次重发" + "\r\n");
                             mySerialProcess.SendCmdWithoutNotice((ushort)0x751, (byte)0x16, (ushort)0x1901, Code);
                             ACK_WaitCnt = 0;
                             while (ACK_WaitCnt <= 2) ; //1s
@@ -7841,48 +7888,60 @@ namespace Welling_Motor_Debug_Tool
                             }
                             else
                             {
-                                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "进入配置模式异常" + "\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") + "->" + "进入配置模式,第2次重发" + "\r\n");
+                                mySerialProcess.SendCmdWithoutNotice((ushort)0x751, (byte)0x16, (ushort)0x1901, Code);
+                                ACK_WaitCnt = 0;
+                                while (ACK_WaitCnt <= 2) ; //1s
+                                if (textBox_RunInfo_Vol.Text != "---")
+                                {
+                                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "已进入配置模式" + "\r\n");
+                                    Delay_ms(500);
+                                }
+                                else
+                                {
+                                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "进入配置模式异常" + "\r\n");
+                                    label_FacModeStatus.Text = "存在故障!";
+                                    label_FacModeResult.BackColor = Color.Red;
+                                    label_FacModeResult.Text = "测试异常";
+                                    Delay_ms(500);
+                                    //存储异常并上传
+                                    FacMode_Stop(false);
+                                    return;
+                                }
                             }
                         }
+                    } while (false);
+                    ushort Max = 0, Cadence = 0;
+                    //提示输入踏频信号
+                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "10s内模拟踏频信号输入" + "\r\n");
+                    ACK_WaitCnt = 0;
+                    while (ACK_WaitCnt <= 20) //10s
+                    {
+                        //获取踏频                           
+                        Cadence = (ushort)Convert.ToInt16(textBox_RunInfo_Cadence.Text.Split(' ')[0]);
+                        if (Cadence > Max)
+                            Max = Cadence;
+                        if ((Max <= Convert.ToDouble(toolStripTextBox_ThCad.Text.Split(',')[1])) &&
+                            (Max >= Convert.ToDouble(toolStripTextBox_ThCad.Text.Split(',')[0])) &&
+                            (ACK_WaitCnt >= 6)) //3s内有踏频值达到阈值
+                        {
+                            label_FacModeCad.BackColor = Color.Green;
+                            richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "踏频传感器正常" + " " + Max.ToString() + " rpm" + "\r\n");
+                            break;
+                        }
                     }
-                } while (false);
-                ushort Max = 0, Cadence = 0;
-                //提示输入踏频信号
-                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "10s内模拟踏频信号输入" + "\r\n");
-                ACK_WaitCnt = 0;
-                while (ACK_WaitCnt <= 20) //10s
-                {
-                    //获取踏频                           
-                    Cadence = (ushort)Convert.ToInt16(textBox_RunInfo_Cadence.Text.Split(' ')[0]);
-                    if (Cadence > Max)
-                        Max = Cadence;
-                    if ((Max <= Convert.ToDouble(toolStripTextBox_ThCad.Text.Split(',')[1])) &&
-                        (Max >= Convert.ToDouble(toolStripTextBox_ThCad.Text.Split(',')[0])) &&
-                        (ACK_WaitCnt >= 6)) //3s内有踏频值达到阈值
+                    if (ACK_WaitCnt >= 20)
                     {
-                        label_FacModeCad.BackColor = Color.Green;
-                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "踏频传感器正常" + " " + Max.ToString() + " rpm" + "\r\n");
-                        break;
+                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "踏频传感器异常" + " " + textBox_RunInfo_Cadence.Text + "\r\n");
+                        label_FacModeStatus.Text = "存在故障!";
+                        label_FacModeResult.BackColor = Color.Red;
+                        label_FacModeResult.Text = "测试异常";
+                        Delay_ms(500);
+                        //存储异常并上传
+                        FacMode_Stop(false);
+                        return;
                     }
-                }
-                if (ACK_WaitCnt >= 20)
-                {
-                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "踏频传感器异常" + " " + textBox_RunInfo_Cadence.Text + "\r\n");
-                    label_FacModeStatus.Text = "存在故障!";
-                    label_FacModeResult.BackColor = Color.Red;
-                    label_FacModeResult.Text = "测试异常";
-                    Delay_ms(500);
-                    //存储异常并上传
-                    FacMode_Stop(false);
-                    return;
-                }
+                }                
             }
             else
             {
@@ -8484,7 +8543,7 @@ namespace Welling_Motor_Debug_Tool
                 richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "导出电机存储参数" + "\r\n");
                 //读取一次马达参数
                 richTextBox_MotorParam.Clear();
-                if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x3A00, null)) break; ;
+                if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x3A00, null)) break;
                 Delay_ms(100);
                 Params += "[马达参数]" + "\r\n" + richTextBox_MotorParam.Text + "\r\n";
                 Params += "\r\n";
@@ -8680,8 +8739,9 @@ namespace Welling_Motor_Debug_Tool
             //测试记录
             LogSaveFileName = LogSavePath + "\\" + ProductInfo + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + "_测试记录" + ".log";
             string file_str = "";
-            file_str += "测试计算机:\r\n" + label_Computername.Text + "\r\n";
-            file_str += "测试时间:\r\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n\r\n";
+            file_str += "计算机名称:\r\n" + label_Computername.Text + "\r\n";
+            file_str += "软件运行时间:\r\n" + stopwatch.ElapsedMilliseconds.ToString() + " ms" + "\r\n";
+            file_str += "系统时间:\r\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n\r\n";
             file_str += "检验记录:\r\n" + richTextBox_CheckModeLog.Text.Replace("\n", "\r\n") + "\r\n\r\n";
             file_str += "检验结果:\r\n" + label_CheckModeResult.Text + "\r\n\r\n";
             file_str += Local_HdInformation;
@@ -8865,7 +8925,14 @@ namespace Welling_Motor_Debug_Tool
             mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
             ACK_WaitCnt = 0;
             richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "等待控制器返回Boot信息……" + "\r\n");
-            while (ACK_WaitCnt <= 20);
+            while (ACK_WaitCnt <= 20)
+            {
+                if (!uARTToolStripMenuItem.Checked) //CAN接口不考虑联动装置盒切换为Boot波特率
+                {
+                    if (BootInfo != string.Empty)
+                        break;
+                }
+            }
 
             //检查BOOT版本
             if (BootInfo != string.Empty)
@@ -9225,7 +9292,12 @@ namespace Welling_Motor_Debug_Tool
                         }                           
                         else
                             mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)myParams.ConfigCheckReadCmd[key], null);
-                        Delay_ms(500);
+                        ACK_WaitCnt = 0;
+                        while (ACK_WaitCnt <= 4) //2s
+                        {
+                            if (CmdRevStrTemp != string.Empty)
+                                break;
+                        }                        
                         if (CmdRevStrTemp == string.Empty)
                         {
                             richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送读" + key + "指令,第1次重发" + "\r\n");
@@ -9252,7 +9324,12 @@ namespace Welling_Motor_Debug_Tool
                             }
                             else
                                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)myParams.ConfigCheckReadCmd[key], null);
-                            Delay_ms(500);
+                            ACK_WaitCnt = 0;
+                            while (ACK_WaitCnt <= 4) //2s
+                            {
+                                if (CmdRevStrTemp != string.Empty)
+                                    break;
+                            }
                             if (CmdRevStrTemp == string.Empty)
                             {
                                 richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送读" + key + "指令,第2次重发" + "\r\n");
@@ -9279,7 +9356,12 @@ namespace Welling_Motor_Debug_Tool
                                 }
                                 else
                                     mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)myParams.ConfigCheckReadCmd[key], null);
-                                Delay_ms(500);
+                                ACK_WaitCnt = 0;
+                                while (ACK_WaitCnt <= 4) //2s
+                                {
+                                    if (CmdRevStrTemp != string.Empty)
+                                        break;
+                                }
                                 if (CmdRevStrTemp == string.Empty)
                                 {
                                     richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + key + "指令读取失败" + "\r\n");

BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.AssemblyReference.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