소스 검색

参数检验增加位置传感器校准判断。

Dail 8 달 전
부모
커밋
8e0a022d05

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 2 - 1
Welling_Motor_Debug_Tool/Version.cs

@@ -19,7 +19,8 @@ namespace Welling_Motor_Debug_Tool
         string ChangeLog = "修改记录:\r\n" +
             "V" + mainForm.Version + "\r\n" +
             "1,生成配置参数时增加导出EXCEL和PDF功能;\r\n" +
-            "2,剎把检测前判断电机是否停止,避免误判。\r\n" +            
+            "2,剎把检测前判断电机是否停止,避免误判;\r\n" +
+            "3,参数检验增加位置校准判断。\r\n" +
             "\r\n" +
             "V2.3.0\r\n" +
             "1,针对位置磁环增加校准功能,支持手动校准和量产模式自动校准;\r\n" +

+ 18 - 2
Welling_Motor_Debug_Tool/Welling_Motor_Debug_Tool.csproj

@@ -12,6 +12,7 @@
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Deterministic>true</Deterministic>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
     <PublishUrl>publish\</PublishUrl>
     <Install>true</Install>
     <InstallFrom>Disk</InstallFrom>
@@ -22,10 +23,11 @@
     <UpdatePeriodically>false</UpdatePeriodically>
     <UpdateRequired>false</UpdateRequired>
     <MapFileExtensions>true</MapFileExtensions>
-    <ApplicationRevision>0</ApplicationRevision>
+    <AutorunEnabled>true</AutorunEnabled>
+    <ApplicationRevision>1</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
-    <IsWebBootstrapper>false</IsWebBootstrapper>
     <UseApplicationTrust>false</UseApplicationTrust>
+    <PublishWizardCompleted>true</PublishWizardCompleted>
     <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -50,6 +52,18 @@
   <PropertyGroup>
     <ApplicationIcon>motor.ico</ApplicationIcon>
   </PropertyGroup>
+  <PropertyGroup>
+    <ManifestCertificateThumbprint>E42E0482442085295FBE5872EED38E0B0382DE59</ManifestCertificateThumbprint>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ManifestKeyFile>Welling_Motor_Debug_Tool_TemporaryKey.pfx</ManifestKeyFile>
+  </PropertyGroup>
+  <PropertyGroup>
+    <GenerateManifests>true</GenerateManifests>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignManifests>true</SignManifests>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="NPOI, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
       <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.dll</HintPath>
@@ -156,6 +170,7 @@
     </EmbeddedResource>
     <EmbeddedResource Include="mainForm.resx">
       <DependentUpon>mainForm.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
@@ -189,6 +204,7 @@
       <DependentUpon>Settings.settings</DependentUpon>
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
     </Compile>
+    <None Include="Welling_Motor_Debug_Tool_TemporaryKey.pfx" />
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config" />

+ 56 - 10
Welling_Motor_Debug_Tool/mainForm.Designer.cs

@@ -654,6 +654,9 @@ namespace Welling_Motor_Debug_Tool
             this.label124 = new System.Windows.Forms.Label();
             this.label46 = new System.Windows.Forms.Label();
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
+            this.checkBox_CheckModeAngle = new System.Windows.Forms.CheckBox();
+            this.label_CheckModeAngle = new System.Windows.Forms.Label();
+            this.label157 = new System.Windows.Forms.Label();
             this.menuStrip_Set.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -6143,6 +6146,8 @@ namespace Welling_Motor_Debug_Tool
             // 
             // groupBox31
             // 
+            this.groupBox31.Controls.Add(this.label157);
+            this.groupBox31.Controls.Add(this.label_CheckModeAngle);
             this.groupBox31.Controls.Add(this.label132);
             this.groupBox31.Controls.Add(this.label_CheckModeMos);
             this.groupBox31.Controls.Add(this.label148);
@@ -6167,7 +6172,7 @@ namespace Welling_Motor_Debug_Tool
             this.label132.AutoSize = true;
             this.label132.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label132.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label132.Location = new System.Drawing.Point(6, 202);
+            this.label132.Location = new System.Drawing.Point(6, 172);
             this.label132.Name = "label132";
             this.label132.Size = new System.Drawing.Size(70, 20);
             this.label132.TabIndex = 18;
@@ -6179,7 +6184,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeMos.BackColor = System.Drawing.Color.Red;
             this.label_CheckModeMos.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label_CheckModeMos.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label_CheckModeMos.Location = new System.Drawing.Point(108, 202);
+            this.label_CheckModeMos.Location = new System.Drawing.Point(108, 172);
             this.label_CheckModeMos.Name = "label_CheckModeMos";
             this.label_CheckModeMos.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeMos.TabIndex = 19;
@@ -6190,7 +6195,7 @@ namespace Welling_Motor_Debug_Tool
             this.label148.AutoSize = true;
             this.label148.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label148.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label148.Location = new System.Drawing.Point(6, 100);
+            this.label148.Location = new System.Drawing.Point(6, 88);
             this.label148.Name = "label148";
             this.label148.Size = new System.Drawing.Size(65, 20);
             this.label148.TabIndex = 16;
@@ -6202,7 +6207,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeSN.BackColor = System.Drawing.Color.Red;
             this.label_CheckModeSN.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label_CheckModeSN.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label_CheckModeSN.Location = new System.Drawing.Point(108, 100);
+            this.label_CheckModeSN.Location = new System.Drawing.Point(108, 88);
             this.label_CheckModeSN.Name = "label_CheckModeSN";
             this.label_CheckModeSN.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeSN.TabIndex = 17;
@@ -6213,7 +6218,7 @@ namespace Welling_Motor_Debug_Tool
             this.label154.AutoSize = true;
             this.label154.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label154.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label154.Location = new System.Drawing.Point(6, 168);
+            this.label154.Location = new System.Drawing.Point(6, 144);
             this.label154.Name = "label154";
             this.label154.Size = new System.Drawing.Size(65, 20);
             this.label154.TabIndex = 12;
@@ -6225,7 +6230,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeTorque.BackColor = System.Drawing.Color.Red;
             this.label_CheckModeTorque.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label_CheckModeTorque.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label_CheckModeTorque.Location = new System.Drawing.Point(108, 168);
+            this.label_CheckModeTorque.Location = new System.Drawing.Point(108, 144);
             this.label_CheckModeTorque.Name = "label_CheckModeTorque";
             this.label_CheckModeTorque.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeTorque.TabIndex = 13;
@@ -6236,7 +6241,7 @@ namespace Welling_Motor_Debug_Tool
             this.label156.AutoSize = true;
             this.label156.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label156.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label156.Location = new System.Drawing.Point(6, 134);
+            this.label156.Location = new System.Drawing.Point(6, 116);
             this.label156.Name = "label156";
             this.label156.Size = new System.Drawing.Size(65, 20);
             this.label156.TabIndex = 12;
@@ -6248,7 +6253,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeCfg.BackColor = System.Drawing.Color.Red;
             this.label_CheckModeCfg.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label_CheckModeCfg.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label_CheckModeCfg.Location = new System.Drawing.Point(108, 134);
+            this.label_CheckModeCfg.Location = new System.Drawing.Point(108, 116);
             this.label_CheckModeCfg.Name = "label_CheckModeCfg";
             this.label_CheckModeCfg.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeCfg.TabIndex = 13;
@@ -6282,7 +6287,7 @@ namespace Welling_Motor_Debug_Tool
             this.label160.AutoSize = true;
             this.label160.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label160.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label160.Location = new System.Drawing.Point(6, 66);
+            this.label160.Location = new System.Drawing.Point(6, 60);
             this.label160.Name = "label160";
             this.label160.Size = new System.Drawing.Size(65, 20);
             this.label160.TabIndex = 8;
@@ -6294,7 +6299,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeFWVer.BackColor = System.Drawing.Color.Red;
             this.label_CheckModeFWVer.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label_CheckModeFWVer.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.label_CheckModeFWVer.Location = new System.Drawing.Point(108, 66);
+            this.label_CheckModeFWVer.Location = new System.Drawing.Point(108, 60);
             this.label_CheckModeFWVer.Name = "label_CheckModeFWVer";
             this.label_CheckModeFWVer.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeFWVer.TabIndex = 9;
@@ -6336,6 +6341,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             // groupBox29
             // 
+            this.groupBox29.Controls.Add(this.checkBox_CheckModeAngle);
             this.groupBox29.Controls.Add(this.checkBox_CheckModeMos);
             this.groupBox29.Controls.Add(this.pictureBox_ReadLock);
             this.groupBox29.Controls.Add(this.checkBox_CheckModeSN);
@@ -7431,6 +7437,43 @@ namespace Welling_Motor_Debug_Tool
             this.pictureBox2.TabIndex = 16;
             this.pictureBox2.TabStop = false;
             // 
+            // checkBox_CheckModeAngle
+            // 
+            this.checkBox_CheckModeAngle.AutoSize = true;
+            this.checkBox_CheckModeAngle.Checked = true;
+            this.checkBox_CheckModeAngle.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.checkBox_CheckModeAngle.Enabled = false;
+            this.checkBox_CheckModeAngle.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.checkBox_CheckModeAngle.Location = new System.Drawing.Point(7, 178);
+            this.checkBox_CheckModeAngle.Name = "checkBox_CheckModeAngle";
+            this.checkBox_CheckModeAngle.Size = new System.Drawing.Size(112, 24);
+            this.checkBox_CheckModeAngle.TabIndex = 10;
+            this.checkBox_CheckModeAngle.Text = "位置校准确认";
+            this.checkBox_CheckModeAngle.UseVisualStyleBackColor = true;
+            // 
+            // label_CheckModeAngle
+            // 
+            this.label_CheckModeAngle.BackColor = System.Drawing.Color.Red;
+            this.label_CheckModeAngle.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label_CheckModeAngle.ForeColor = System.Drawing.SystemColors.ControlText;
+            this.label_CheckModeAngle.Location = new System.Drawing.Point(108, 200);
+            this.label_CheckModeAngle.Name = "label_CheckModeAngle";
+            this.label_CheckModeAngle.Size = new System.Drawing.Size(35, 20);
+            this.label_CheckModeAngle.TabIndex = 20;
+            this.label_CheckModeAngle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
+            // label157
+            // 
+            this.label157.AutoSize = true;
+            this.label157.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label157.ForeColor = System.Drawing.SystemColors.ControlText;
+            this.label157.Location = new System.Drawing.Point(6, 200);
+            this.label157.Name = "label157";
+            this.label157.Size = new System.Drawing.Size(65, 20);
+            this.label157.TabIndex = 21;
+            this.label157.Text = "位置校准";
+            this.label157.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+            // 
             // mainForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@@ -8192,5 +8235,8 @@ namespace Welling_Motor_Debug_Tool
         private ToolStripTextBox toolStripTextBox_AngleAvgMax;
         private ToolStripMenuItem 零点偏差最大值ToolStripMenuItem;
         private ToolStripTextBox toolStripTextBox_AngleZeroMax;
+        private CheckBox checkBox_CheckModeAngle;
+        private Label label157;
+        private Label label_CheckModeAngle;
     }
 }

+ 112 - 11
Welling_Motor_Debug_Tool/mainForm.cs

@@ -8782,11 +8782,18 @@ namespace Welling_Motor_Debug_Tool
                 }
                 catch (System.Exception)
                 {
-                    timer_500ms.Enabled = false;
-                    MessageBox.Show("参数检验失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
-                    timer_500ms.Enabled = true;
-                    ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                    richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "参数检验失败" + "\r\n");
+                    label_CheckModeStatus.Text = "存在故障!";
+                    label_CheckModeResult.BackColor = Color.Red;
+                    label_CheckModeResult.Text = "测试异常";
+                    Delay_ms(500);
+                    //存储异常并上传
+                    CheckMode_Stop(false);
+                    return;
                 }
+                label_CheckModeCfg.BackColor = Color.Green;
+                richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "参数检验正确" + "\r\n");
+                Delay_ms(500);
             }
             else
             {
@@ -8795,10 +8802,7 @@ namespace Welling_Motor_Debug_Tool
                 richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "跳过参数检验" + "\r\n");
                 Delay_ms(500);
             }
-            label_CheckModeCfg.BackColor = Color.Green;
-            richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "参数检验正确" + "\r\n");
-            Delay_ms(500);
-
+            
             //读取力矩传感器
             do
             {
@@ -8808,19 +8812,19 @@ namespace Welling_Motor_Debug_Tool
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, 0x4000, null);
                 ACK_WaitCnt = 0;
                 while (ACK_WaitCnt <= 2) ; //1s
-                if (CmdRevStrTemp == "---")
+                if (CmdRevStrTemp == string.Empty)
                 {
                     richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取力矩传感器标定数据,第1次重发" + "\r\n");
                     mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, 0x4000, null);
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 2) ; //1s
-                    if (CmdRevStrTemp == "---")
+                    if (CmdRevStrTemp == string.Empty)
                     {
                         richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取力矩传感器标定数据,第2次重发" + "\r\n");
                         mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, 0x4000, null);
                         ACK_WaitCnt = 0;
                         while (ACK_WaitCnt <= 2) ; //1s
-                        if (CmdRevStrTemp == "---")
+                        if (CmdRevStrTemp == string.Empty)
                         {
                             richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "力矩传感器读取失败" + "\r\n");
                             label_CheckModeStatus.Text = "存在故障!";
@@ -8839,6 +8843,18 @@ namespace Welling_Motor_Debug_Tool
                 ushort MaxTorque;
                 ushort K1_T, K1, K2_T, K2, K3_T, K3, K4_T, K4;
                 byte[] DataArray = mySerialProcess.HexStringToBytes(CmdRevStrTemp, true);
+                ushort Cmd = (ushort)((DataArray[0] << 8) + DataArray[1]);
+                if (Cmd != 0xB528)
+                {
+                    richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "力矩传感器参数错误,CMD: 0x" + Convert.ToString(Cmd, 16).PadLeft(2, '0').ToUpper() + "\r\n");
+                    label_CheckModeStatus.Text = "存在故障!";
+                    label_CheckModeResult.BackColor = Color.Red;
+                    label_CheckModeResult.Text = "测试异常";
+                    Delay_ms(500);
+                    //存储异常并上传
+                    CheckMode_Stop(false);
+                    return;
+                }
                 ZeroInit = (ushort)((DataArray[3] << 8) + DataArray[2]);
                 Zero1 = (ushort)((DataArray[5] << 8) + DataArray[4]);
                 Zero2 = (ushort)((DataArray[7] << 8) + DataArray[6]);
@@ -8980,6 +8996,91 @@ namespace Welling_Motor_Debug_Tool
                 }
             } while (false);
 
+            //读取位置校准参数
+            do
+            {
+                if (checkBox_CheckModeAngle.Checked)
+                {
+                    richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取位置校准数据" + "\r\n");
+                    //发送指令读取位置
+                    CmdRevStrTemp = "";
+                    mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x3E00, null);
+                    ACK_WaitCnt = 0;
+                    while (ACK_WaitCnt <= 2) ; //1s
+                    if (CmdRevStrTemp == string.Empty)
+                    {
+                        richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取位置校准数据,第1次重发" + "\r\n");
+                        mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, 0x3E00, null);
+                        ACK_WaitCnt = 0;
+                        while (ACK_WaitCnt <= 2) ; //1s
+                        if (CmdRevStrTemp == string.Empty)
+                        {
+                            richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取位置校准数据,第2次重发" + "\r\n");
+                            mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, 0x3E00, null);
+                            ACK_WaitCnt = 0;
+                            while (ACK_WaitCnt <= 2) ; //1s
+                            if (CmdRevStrTemp == string.Empty)
+                            {
+                                richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "位置校准数据读取失败" + "\r\n");
+                                label_CheckModeStatus.Text = "存在故障!";
+                                label_CheckModeResult.BackColor = Color.Red;
+                                label_CheckModeResult.Text = "测试异常";
+                                Delay_ms(500);
+                                //存储异常并上传
+                                CheckMode_Stop(false);
+                                return;
+                            }
+                        }
+                    }
+                    richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "位置校准数据读取成功" + "\r\n");
+                    //取零点数据
+                    UInt16 AngleZero_Init = 0, AngleZero_Cur = 0;
+                    byte[] DataArray = mySerialProcess.HexStringToBytes(CmdRevStrTemp, true);
+                    ushort Cmd = (ushort)((DataArray[0] << 8) + DataArray[1]);
+                    if (Cmd != 0xB420)
+                    {
+                        richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "位置传感器参数错误,CMD: 0x" + Convert.ToString(Cmd, 16).PadLeft(2, '0').ToUpper() + "\r\n");
+                        label_CheckModeStatus.Text = "存在故障!";
+                        label_CheckModeResult.BackColor = Color.Red;
+                        label_CheckModeResult.Text = "测试异常";
+                        Delay_ms(500);
+                        //存储异常并上传
+                        CheckMode_Stop(false);
+                        return;
+                    }
+                    AngleZero_Init = (ushort)((DataArray[3] << 8) + DataArray[2]);
+                    AngleZero_Cur = (ushort)((DataArray[5] << 8) + DataArray[4]);
+                    richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "位置出厂零点: " + AngleZero_Init.ToString() + ",位置当前零点: " + AngleZero_Cur.ToString() + "\r\n");                    
+                    int AngleZeroDiff = Math.Abs(AngleZero_Cur - AngleZero_Init);
+                    int AngleZeroTH = Convert.ToInt32(textBox_AngleZeroTh.Text);
+                    richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "位置零点校准值: " + AngleZeroDiff.ToString() + ",判断阈值: " + AngleZeroTH.ToString() + "\r\n");
+                    //判断
+                    if (AngleZeroDiff <= AngleZeroTH)
+                    {
+                        richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "位置传感器校准合格" + "\r\n");
+                        label_CheckModeAngle.BackColor = Color.Green;
+                    }
+                    else
+                    {
+                        richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "位置传感器校准超范围" + "\r\n");
+                        label_CheckModeStatus.Text = "存在故障!";
+                        label_CheckModeResult.BackColor = Color.Red;
+                        label_CheckModeResult.Text = "测试异常";
+                        Delay_ms(500);
+                        //存储异常并上传
+                        CheckMode_Stop(false);
+                        return;
+                    }
+                }
+                else
+                {
+                    label_CheckModeAngle.BackColor = Color.Yellow;
+                    label_CheckModeStatus.Text = "跳过位置传感器校准检验";
+                    richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "跳过位置传感器校准检验" + "\r\n");
+                    Delay_ms(500);                    
+                }
+            } while (false);
+
             //测试合格
             richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "测试结束" + "\r\n");
             label_CheckModeStatus.Text = "测试结束!";

+ 4 - 0
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.FileListAbsolute.txt

@@ -107,3 +107,7 @@ D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Spire.License.dll
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Microsoft.mshtml.dll
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Spire.License.xml
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe.manifest
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.application
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe.manifest
+D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.application

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