فهرست منبع

力矩传感器标定过程增加判断。

Deyauo 5 ماه پیش
والد
کامیت
cf531ad826

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 1 - 0
Welling_Motor_Debug_Tool/Scan.Designer.cs

@@ -58,6 +58,7 @@
             this.textBox_Scan.Name = "textBox_Scan";
             this.textBox_Scan.Size = new System.Drawing.Size(462, 33);
             this.textBox_Scan.TabIndex = 1;
+            this.textBox_Scan.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox_Scan_KeyUp);
             // 
             // button_Enter
             // 

+ 6 - 0
Welling_Motor_Debug_Tool/Scan.cs

@@ -31,5 +31,11 @@ namespace Welling_Motor_Debug_Tool
         {
             System.Diagnostics.Process.Start("osk.exe");
         }
+
+        private void textBox_Scan_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+                this.Close();
+        }
     }
 }

+ 1 - 1
Welling_Motor_Debug_Tool/Welling_Motor_Debug_Tool.csproj

@@ -62,7 +62,7 @@
     <GenerateManifests>true</GenerateManifests>
   </PropertyGroup>
   <PropertyGroup>
-    <SignManifests>true</SignManifests>
+    <SignManifests>false</SignManifests>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="NPOI, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">

+ 107 - 36
Welling_Motor_Debug_Tool/mainForm.Designer.cs

@@ -407,7 +407,12 @@ namespace Welling_Motor_Debug_Tool
             this.textBox_MOS_R1 = new System.Windows.Forms.TextBox();
             this.textBox_MOS_K1 = new System.Windows.Forms.TextBox();
             this.groupBox20 = new System.Windows.Forms.GroupBox();
-            this.textBox10 = new System.Windows.Forms.TextBox();
+            this.label1_TorqueCal1 = new System.Windows.Forms.Label();
+            this.label1_TorqueCal2 = new System.Windows.Forms.Label();
+            this.label1_TorqueCal3 = new System.Windows.Forms.Label();
+            this.label1_TorqueCal4 = new System.Windows.Forms.Label();
+            this.label1_TorqueCal0 = new System.Windows.Forms.Label();
+            this.textBox_FacModeSensorCal0 = new System.Windows.Forms.TextBox();
             this.button_FacModeSensorRead = new System.Windows.Forms.Button();
             this.textBox_FacModeSensorADC0 = new System.Windows.Forms.TextBox();
             this.textBox_FacModeSensorADC4 = new System.Windows.Forms.TextBox();
@@ -1524,7 +1529,7 @@ namespace Welling_Motor_Debug_Tool
             // 版本ToolStripMenuItem
             // 
             this.版本ToolStripMenuItem.Name = "版本ToolStripMenuItem";
-            this.版本ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.版本ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.版本ToolStripMenuItem.Text = "版本信息";
             this.版本ToolStripMenuItem.Click += new System.EventHandler(this.版本ToolStripMenuItem_Click);
             // 
@@ -1534,7 +1539,7 @@ namespace Welling_Motor_Debug_Tool
             this.打开ToolStripMenuItem,
             this.关闭ToolStripMenuItem});
             this.自动更新ToolStripMenuItem.Name = "自动更新ToolStripMenuItem";
-            this.自动更新ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.自动更新ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.自动更新ToolStripMenuItem.Text = "自动更新";
             // 
             // 打开ToolStripMenuItem
@@ -1556,14 +1561,14 @@ namespace Welling_Motor_Debug_Tool
             // 本机信息ToolStripMenuItem
             // 
             this.本机信息ToolStripMenuItem.Name = "本机信息ToolStripMenuItem";
-            this.本机信息ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.本机信息ToolStripMenuItem.Size = new System.Drawing.Size(144, 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(180, 26);
+            this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.帮助ToolStripMenuItem.Text = "查看帮助";
             this.帮助ToolStripMenuItem.Click += new System.EventHandler(this.帮助ToolStripMenuItem_Click);
             // 
@@ -1572,7 +1577,7 @@ namespace Welling_Motor_Debug_Tool
             this.累计运行时间ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripMenuItem_RunTime});
             this.累计运行时间ToolStripMenuItem.Name = "累计运行时间ToolStripMenuItem";
-            this.累计运行时间ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.累计运行时间ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.累计运行时间ToolStripMenuItem.Text = "运行时间";
             this.累计运行时间ToolStripMenuItem.MouseHover += new System.EventHandler(this.累计运行时间ToolStripMenuItem_MouseHover);
             // 
@@ -2003,7 +2008,8 @@ namespace Welling_Motor_Debug_Tool
             "4",
             "5",
             "6",
-            "7"});
+            "7",
+            "8"});
             this.comboBox_TailLightMode.Location = new System.Drawing.Point(932, 14);
             this.comboBox_TailLightMode.Name = "comboBox_TailLightMode";
             this.comboBox_TailLightMode.Size = new System.Drawing.Size(55, 29);
@@ -4353,9 +4359,9 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.groupBox22.Controls.Add(this.button_FacModeLightSW);
             this.groupBox22.Controls.Add(this.button_FacModeMotorRun);
-            this.groupBox22.Location = new System.Drawing.Point(190, 3);
+            this.groupBox22.Location = new System.Drawing.Point(218, 3);
             this.groupBox22.Name = "groupBox22";
-            this.groupBox22.Size = new System.Drawing.Size(198, 178);
+            this.groupBox22.Size = new System.Drawing.Size(170, 96);
             this.groupBox22.TabIndex = 10;
             this.groupBox22.TabStop = false;
             this.groupBox22.Text = "驱动测试";
@@ -4364,7 +4370,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.button_FacModeLightSW.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
             this.button_FacModeLightSW.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.button_FacModeLightSW.Location = new System.Drawing.Point(15, 38);
+            this.button_FacModeLightSW.Location = new System.Drawing.Point(12, 38);
             this.button_FacModeLightSW.Name = "button_FacModeLightSW";
             this.button_FacModeLightSW.Size = new System.Drawing.Size(75, 45);
             this.button_FacModeLightSW.TabIndex = 20;
@@ -4376,7 +4382,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.button_FacModeMotorRun.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
             this.button_FacModeMotorRun.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.button_FacModeMotorRun.Location = new System.Drawing.Point(103, 38);
+            this.button_FacModeMotorRun.Location = new System.Drawing.Point(88, 38);
             this.button_FacModeMotorRun.Name = "button_FacModeMotorRun";
             this.button_FacModeMotorRun.Size = new System.Drawing.Size(75, 45);
             this.button_FacModeMotorRun.TabIndex = 16;
@@ -4614,7 +4620,12 @@ namespace Welling_Motor_Debug_Tool
             // 
             // groupBox20
             // 
-            this.groupBox20.Controls.Add(this.textBox10);
+            this.groupBox20.Controls.Add(this.label1_TorqueCal1);
+            this.groupBox20.Controls.Add(this.label1_TorqueCal2);
+            this.groupBox20.Controls.Add(this.label1_TorqueCal3);
+            this.groupBox20.Controls.Add(this.label1_TorqueCal4);
+            this.groupBox20.Controls.Add(this.label1_TorqueCal0);
+            this.groupBox20.Controls.Add(this.textBox_FacModeSensorCal0);
             this.groupBox20.Controls.Add(this.button_FacModeSensorRead);
             this.groupBox20.Controls.Add(this.textBox_FacModeSensorADC0);
             this.groupBox20.Controls.Add(this.textBox_FacModeSensorADC4);
@@ -4631,21 +4642,76 @@ namespace Welling_Motor_Debug_Tool
             this.groupBox20.Controls.Add(this.textBox_FacModeSensorCal2);
             this.groupBox20.Location = new System.Drawing.Point(3, 109);
             this.groupBox20.Name = "groupBox20";
-            this.groupBox20.Size = new System.Drawing.Size(181, 203);
+            this.groupBox20.Size = new System.Drawing.Size(209, 203);
             this.groupBox20.TabIndex = 8;
             this.groupBox20.TabStop = false;
             this.groupBox20.Text = "力矩标定";
             // 
-            // textBox10
-            // 
-            this.textBox10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
-            this.textBox10.Location = new System.Drawing.Point(6, 35);
-            this.textBox10.Name = "textBox10";
-            this.textBox10.ReadOnly = true;
-            this.textBox10.Size = new System.Drawing.Size(47, 28);
-            this.textBox10.TabIndex = 16;
-            this.textBox10.Text = "0";
-            this.textBox10.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // label1_TorqueCal1
+            // 
+            this.label1_TorqueCal1.BackColor = System.Drawing.Color.Red;
+            this.label1_TorqueCal1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1_TorqueCal1.ForeColor = System.Drawing.SystemColors.ControlText;
+            this.label1_TorqueCal1.Location = new System.Drawing.Point(181, 75);
+            this.label1_TorqueCal1.Name = "label1_TorqueCal1";
+            this.label1_TorqueCal1.Size = new System.Drawing.Size(15, 15);
+            this.label1_TorqueCal1.TabIndex = 21;
+            this.label1_TorqueCal1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
+            // label1_TorqueCal2
+            // 
+            this.label1_TorqueCal2.BackColor = System.Drawing.Color.Red;
+            this.label1_TorqueCal2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1_TorqueCal2.ForeColor = System.Drawing.SystemColors.ControlText;
+            this.label1_TorqueCal2.Location = new System.Drawing.Point(181, 108);
+            this.label1_TorqueCal2.Name = "label1_TorqueCal2";
+            this.label1_TorqueCal2.Size = new System.Drawing.Size(15, 15);
+            this.label1_TorqueCal2.TabIndex = 20;
+            this.label1_TorqueCal2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
+            // label1_TorqueCal3
+            // 
+            this.label1_TorqueCal3.BackColor = System.Drawing.Color.Red;
+            this.label1_TorqueCal3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1_TorqueCal3.ForeColor = System.Drawing.SystemColors.ControlText;
+            this.label1_TorqueCal3.Location = new System.Drawing.Point(181, 141);
+            this.label1_TorqueCal3.Name = "label1_TorqueCal3";
+            this.label1_TorqueCal3.Size = new System.Drawing.Size(15, 15);
+            this.label1_TorqueCal3.TabIndex = 19;
+            this.label1_TorqueCal3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
+            // label1_TorqueCal4
+            // 
+            this.label1_TorqueCal4.BackColor = System.Drawing.Color.Red;
+            this.label1_TorqueCal4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1_TorqueCal4.ForeColor = System.Drawing.SystemColors.ControlText;
+            this.label1_TorqueCal4.Location = new System.Drawing.Point(181, 174);
+            this.label1_TorqueCal4.Name = "label1_TorqueCal4";
+            this.label1_TorqueCal4.Size = new System.Drawing.Size(15, 15);
+            this.label1_TorqueCal4.TabIndex = 18;
+            this.label1_TorqueCal4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
+            // label1_TorqueCal0
+            // 
+            this.label1_TorqueCal0.BackColor = System.Drawing.Color.Red;
+            this.label1_TorqueCal0.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1_TorqueCal0.ForeColor = System.Drawing.SystemColors.ControlText;
+            this.label1_TorqueCal0.Location = new System.Drawing.Point(181, 41);
+            this.label1_TorqueCal0.Name = "label1_TorqueCal0";
+            this.label1_TorqueCal0.Size = new System.Drawing.Size(15, 15);
+            this.label1_TorqueCal0.TabIndex = 17;
+            this.label1_TorqueCal0.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            // 
+            // textBox_FacModeSensorCal0
+            // 
+            this.textBox_FacModeSensorCal0.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
+            this.textBox_FacModeSensorCal0.Location = new System.Drawing.Point(6, 35);
+            this.textBox_FacModeSensorCal0.Name = "textBox_FacModeSensorCal0";
+            this.textBox_FacModeSensorCal0.ReadOnly = true;
+            this.textBox_FacModeSensorCal0.Size = new System.Drawing.Size(47, 28);
+            this.textBox_FacModeSensorCal0.TabIndex = 16;
+            this.textBox_FacModeSensorCal0.Text = "0";
+            this.textBox_FacModeSensorCal0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             // 
             // button_FacModeSensorRead
             // 
@@ -4802,9 +4868,9 @@ namespace Welling_Motor_Debug_Tool
             this.groupBox24.Controls.Add(this.textBox_ODO_TIME);
             this.groupBox24.Controls.Add(this.label126);
             this.groupBox24.Controls.Add(this.label119);
-            this.groupBox24.Location = new System.Drawing.Point(189, 187);
+            this.groupBox24.Location = new System.Drawing.Point(218, 109);
             this.groupBox24.Name = "groupBox24";
-            this.groupBox24.Size = new System.Drawing.Size(199, 125);
+            this.groupBox24.Size = new System.Drawing.Size(170, 203);
             this.groupBox24.TabIndex = 7;
             this.groupBox24.TabStop = false;
             this.groupBox24.Text = "骑行信息";
@@ -4812,7 +4878,7 @@ namespace Welling_Motor_Debug_Tool
             // button_ReadRideLog
             // 
             this.button_ReadRideLog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.button_ReadRideLog.Location = new System.Drawing.Point(63, 92);
+            this.button_ReadRideLog.Location = new System.Drawing.Point(16, 167);
             this.button_ReadRideLog.Name = "button_ReadRideLog";
             this.button_ReadRideLog.Size = new System.Drawing.Size(60, 29);
             this.button_ReadRideLog.TabIndex = 16;
@@ -4823,7 +4889,7 @@ namespace Welling_Motor_Debug_Tool
             // button_WriteRideLog
             // 
             this.button_WriteRideLog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
-            this.button_WriteRideLog.Location = new System.Drawing.Point(129, 92);
+            this.button_WriteRideLog.Location = new System.Drawing.Point(92, 167);
             this.button_WriteRideLog.Name = "button_WriteRideLog";
             this.button_WriteRideLog.Size = new System.Drawing.Size(60, 29);
             this.button_WriteRideLog.TabIndex = 17;
@@ -4834,7 +4900,7 @@ namespace Welling_Motor_Debug_Tool
             // textBox_TRIP_KM
             // 
             this.textBox_TRIP_KM.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
-            this.textBox_TRIP_KM.Location = new System.Drawing.Point(63, 60);
+            this.textBox_TRIP_KM.Location = new System.Drawing.Point(16, 120);
             this.textBox_TRIP_KM.Name = "textBox_TRIP_KM";
             this.textBox_TRIP_KM.Size = new System.Drawing.Size(60, 28);
             this.textBox_TRIP_KM.TabIndex = 15;
@@ -4843,7 +4909,7 @@ namespace Welling_Motor_Debug_Tool
             // textBox_TRIP_TIME
             // 
             this.textBox_TRIP_TIME.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
-            this.textBox_TRIP_TIME.Location = new System.Drawing.Point(129, 60);
+            this.textBox_TRIP_TIME.Location = new System.Drawing.Point(92, 120);
             this.textBox_TRIP_TIME.Name = "textBox_TRIP_TIME";
             this.textBox_TRIP_TIME.Size = new System.Drawing.Size(60, 28);
             this.textBox_TRIP_TIME.TabIndex = 15;
@@ -4852,7 +4918,7 @@ namespace Welling_Motor_Debug_Tool
             // textBox_ODO_KM
             // 
             this.textBox_ODO_KM.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
-            this.textBox_ODO_KM.Location = new System.Drawing.Point(63, 30);
+            this.textBox_ODO_KM.Location = new System.Drawing.Point(16, 55);
             this.textBox_ODO_KM.Name = "textBox_ODO_KM";
             this.textBox_ODO_KM.Size = new System.Drawing.Size(60, 28);
             this.textBox_ODO_KM.TabIndex = 15;
@@ -4861,7 +4927,7 @@ namespace Welling_Motor_Debug_Tool
             // textBox_ODO_TIME
             // 
             this.textBox_ODO_TIME.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
-            this.textBox_ODO_TIME.Location = new System.Drawing.Point(129, 30);
+            this.textBox_ODO_TIME.Location = new System.Drawing.Point(92, 55);
             this.textBox_ODO_TIME.Name = "textBox_ODO_TIME";
             this.textBox_ODO_TIME.Size = new System.Drawing.Size(60, 28);
             this.textBox_ODO_TIME.TabIndex = 15;
@@ -4870,7 +4936,7 @@ namespace Welling_Motor_Debug_Tool
             // label126
             // 
             this.label126.AutoSize = true;
-            this.label126.Location = new System.Drawing.Point(6, 64);
+            this.label126.Location = new System.Drawing.Point(24, 91);
             this.label126.Name = "label126";
             this.label126.Size = new System.Drawing.Size(44, 21);
             this.label126.TabIndex = 3;
@@ -4879,7 +4945,7 @@ namespace Welling_Motor_Debug_Tool
             // label119
             // 
             this.label119.AutoSize = true;
-            this.label119.Location = new System.Drawing.Point(6, 34);
+            this.label119.Location = new System.Drawing.Point(22, 26);
             this.label119.Name = "label119";
             this.label119.Size = new System.Drawing.Size(48, 21);
             this.label119.TabIndex = 3;
@@ -4890,7 +4956,7 @@ namespace Welling_Motor_Debug_Tool
             this.groupBox19.Controls.Add(this.button_FacModeInit);
             this.groupBox19.Location = new System.Drawing.Point(3, 3);
             this.groupBox19.Name = "groupBox19";
-            this.groupBox19.Size = new System.Drawing.Size(181, 96);
+            this.groupBox19.Size = new System.Drawing.Size(209, 96);
             this.groupBox19.TabIndex = 7;
             this.groupBox19.TabStop = false;
             this.groupBox19.Text = "初始化";
@@ -4901,7 +4967,7 @@ namespace Welling_Motor_Debug_Tool
             this.button_FacModeInit.ForeColor = System.Drawing.Color.White;
             this.button_FacModeInit.Location = new System.Drawing.Point(26, 38);
             this.button_FacModeInit.Name = "button_FacModeInit";
-            this.button_FacModeInit.Size = new System.Drawing.Size(126, 45);
+            this.button_FacModeInit.Size = new System.Drawing.Size(149, 45);
             this.button_FacModeInit.TabIndex = 0;
             this.button_FacModeInit.Text = "初始化";
             this.button_FacModeInit.UseVisualStyleBackColor = false;
@@ -7820,7 +7886,7 @@ namespace Welling_Motor_Debug_Tool
         private TextBox textBox_FacModeSensorCal3;
         private TextBox textBox_FacModeSensorCal1;
         private TextBox textBox_FacModeSensorCal2;
-        private TextBox textBox10;
+        private TextBox textBox_FacModeSensorCal0;
         private Button button_FacModeSensorRead;
         private TextBox textBox_FacModeSensorADC0;
         private TextBox textBox_FacModeSensorADC4;
@@ -8239,5 +8305,10 @@ namespace Welling_Motor_Debug_Tool
         private CheckBox checkBox_CheckModeAngle;
         private Label label157;
         private Label label_CheckModeAngle;
+        private Label label1_TorqueCal0;
+        private Label label1_TorqueCal1;
+        private Label label1_TorqueCal2;
+        private Label label1_TorqueCal3;
+        private Label label1_TorqueCal4;
     }
 }

+ 142 - 23
Welling_Motor_Debug_Tool/mainForm.cs

@@ -24,7 +24,7 @@ namespace Welling_Motor_Debug_Tool
     {
         #region 变量定义
         //版本号
-        public static string Version = "2.4.0";
+        public static string Version = "2.4.1";
         //串口实例
         Serial_Process mySerialProcess = new Serial_Process();
         string PortNumSave = "";
@@ -62,7 +62,6 @@ namespace Welling_Motor_Debug_Tool
         ArrayList array_CfgInfo = new ArrayList();
         //写入参数返回标志和计数
         public bool WriteACK = false;
-        public ushort WriteCnt = 0;
         public ushort ACK_WaitCnt = 0;
         //写入参数返回提示标志
         public bool ACK_DisFlag = true;
@@ -887,6 +886,8 @@ namespace Welling_Motor_Debug_Tool
 
         private void MainForm_Load(object sender, System.EventArgs e)
         {
+            timer_500ms.Start();
+
             //页面初始化
             label_BuildTime.Text = "编译时间:" + System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString("yyyy-MM-dd HH:mm:ss");
             label_Computername.Text = System.Environment.UserName;
@@ -1451,7 +1452,6 @@ namespace Welling_Motor_Debug_Tool
                                     }
                                     //应答标志置位
                                     WriteACK = true;
-                                    WriteCnt++;
                                 }));
                             }
                             break;
@@ -1542,11 +1542,13 @@ namespace Welling_Motor_Debug_Tool
                                     }
                                     richTextBox_SensorParam.Text = richTextBox_SensorParam.Text.Substring(0, richTextBox_SensorParam.Text.Length - 2);
                                     //更新生产模式页面传感器零点和标定值
-                                    textBox_FacModeSensorADC0.Text = (Data[1] * 256 + Data[0]).ToString();
+                                    textBox_FacModeSensorADC0.Text = (Data[9] * 256 + Data[8]).ToString();
                                     textBox_FacModeSensorADC1.Text = (Data[15] * 256 + Data[14]).ToString();
                                     textBox_FacModeSensorADC2.Text = (Data[19] * 256 + Data[18]).ToString();
                                     textBox_FacModeSensorADC3.Text = (Data[23] * 256 + Data[22]).ToString();
                                     textBox_FacModeSensorADC4.Text = (Data[27] * 256 + Data[26]).ToString();
+
+                                    WriteACK = true;
                                 }));
                             }
                             break;
@@ -4218,6 +4220,33 @@ namespace Welling_Motor_Debug_Tool
             textBox_FacModeSensorADC3.Text = "";
             textBox_FacModeSensorADC4.Text = "";
             mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null);
+            //零点判断
+            label1_TorqueCal0.BackColor = Color.Red;
+            WriteACK = false;
+            ACK_WaitCnt = 0;
+            Delay_ms(200);
+            if (WriteACK == true) //力矩读取正常
+            {
+                WriteACK = false;
+                //获取零点
+                ushort ZeroNew;
+                ZeroNew = (ushort)Convert.ToUInt16(textBox_FacModeSensorADC0.Text);                
+                //比较零点
+                if ((ZeroNew <= TorqueParamsForm.Zero.Max) && (ZeroNew >= TorqueParamsForm.Zero.Min))                    
+                {
+                    label1_TorqueCal0.BackColor = Color.Green;
+                }
+                else
+                {
+                    MessageBoxTimeOut.Show("力矩传感器零点超范围!\r\n" + "最新零点:" + ZeroNew.ToString(), "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
+
+            }
+            else //力矩读取不正常
+            {
+                MessageBoxTimeOut.Show("读取力矩传感器数据失败!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+            }
+
         }
 
         /// <summary>
@@ -4242,6 +4271,33 @@ namespace Welling_Motor_Debug_Tool
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4104, ConfigParam);
                 Delay_ms(200);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null);
+                //标定1判断
+                label1_TorqueCal1.BackColor = Color.Red;
+                WriteACK = false;
+                ACK_WaitCnt = 0;
+                Delay_ms(200);
+                if (WriteACK == true) //力矩读取正常
+                {
+                    WriteACK = false;
+                    //获取标定1
+                    ushort K1_T, K1;
+                    K1_T = (ushort)(Convert.ToUInt16(textBox_FacModeSensorCal1.Text) * 10);
+                    K1 = (ushort)(Convert.ToUInt16(textBox_FacModeSensorADC1.Text));
+                    //比较标定1
+                    if ((K1_T == TorqueParamsForm.K1.T) && (K1 <= TorqueParamsForm.K1.Max) && (K1 >= TorqueParamsForm.K1.Min))
+                    {
+                        label1_TorqueCal1.BackColor = Color.Green;
+                    }
+                    else
+                    {
+                        MessageBoxTimeOut.Show("力矩传感器标定1超范围!\r\n" + "加载扭矩:" + K1_T.ToString() + "\r\n标定值:" + K1.ToString(), "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    }
+
+                }
+                else //力矩读取不正常
+                {
+                    MessageBoxTimeOut.Show("读取力矩传感器数据失败!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
             }
             catch (Exception)
             {
@@ -4272,6 +4328,33 @@ namespace Welling_Motor_Debug_Tool
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4104, ConfigParam);
                 Delay_ms(200);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null);
+                //标定2判断
+                label1_TorqueCal2.BackColor = Color.Red;
+                WriteACK = false;
+                ACK_WaitCnt = 0;
+                Delay_ms(200);
+                if (WriteACK == true) //力矩读取正常
+                {
+                    WriteACK = false;
+                    //获取标定2
+                    ushort K2_T, K2;
+                    K2_T = (ushort)(Convert.ToUInt16(textBox_FacModeSensorCal2.Text) * 10);
+                    K2 = (ushort)(Convert.ToUInt16(textBox_FacModeSensorADC2.Text));
+                    //比较标定1
+                    if ((K2_T == TorqueParamsForm.K2.T) && (K2 <= TorqueParamsForm.K2.Max) && (K2 >= TorqueParamsForm.K2.Min))
+                    {
+                        label1_TorqueCal2.BackColor = Color.Green;
+                    }
+                    else
+                    {
+                        MessageBoxTimeOut.Show("力矩传感器标定2超范围!\r\n" + "加载扭矩:" + K2_T.ToString() + "\r\n标定值:" + K2.ToString(), "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    }
+
+                }
+                else //力矩读取不正常
+                {
+                    MessageBoxTimeOut.Show("读取力矩传感器数据失败!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
             }
             catch (Exception)
             {
@@ -4303,6 +4386,33 @@ namespace Welling_Motor_Debug_Tool
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4104, ConfigParam);
                 Delay_ms(200);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null);
+                //标定3判断
+                label1_TorqueCal3.BackColor = Color.Red;
+                WriteACK = false;
+                ACK_WaitCnt = 0;
+                Delay_ms(200);
+                if (WriteACK == true) //力矩读取正常
+                {
+                    WriteACK = false;
+                    //获取标定3
+                    ushort K3_T, K3;
+                    K3_T = (ushort)(Convert.ToUInt16(textBox_FacModeSensorCal3.Text) * 10);
+                    K3 = (ushort)(Convert.ToUInt16(textBox_FacModeSensorADC3.Text));
+                    //比较标定1
+                    if ((K3_T == TorqueParamsForm.K3.T) && (K3 <= TorqueParamsForm.K3.Max) && (K3 >= TorqueParamsForm.K3.Min))
+                    {
+                        label1_TorqueCal3.BackColor = Color.Green;
+                    }
+                    else
+                    {
+                        MessageBoxTimeOut.Show("力矩传感器标定3超范围!\r\n" + "加载扭矩:" + K3_T.ToString() + "\r\n标定值:" + K3.ToString(), "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    }
+
+                }
+                else //力矩读取不正常
+                {
+                    MessageBoxTimeOut.Show("读取力矩传感器数据失败!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
             }
             catch (Exception)
             {
@@ -4312,7 +4422,7 @@ namespace Welling_Motor_Debug_Tool
             }
         }
         /// <summary>
-        /// 生产模式传感器标定3
+        /// 生产模式传感器标定4
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
@@ -4324,6 +4434,7 @@ namespace Welling_Motor_Debug_Tool
             ushort uwDataTemp = 0;
             try
             {
+                WriteACK = false;
                 uwDataTemp = 4;//负载序号
                 ConfigParam[0] = (byte)(uwDataTemp & 0xFF);
                 ConfigParam[1] = (byte)(uwDataTemp >> 8);
@@ -4333,6 +4444,32 @@ namespace Welling_Motor_Debug_Tool
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4104, ConfigParam);
                 Delay_ms(200);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null);
+                //标定4判断
+                label1_TorqueCal4.BackColor = Color.Red;
+                WriteACK = false;
+                ACK_WaitCnt = 0;
+                Delay_ms(200);
+                if (WriteACK == true) //力矩读取正常
+                {
+                    //获取标定4
+                    ushort K4_T, K4;
+                    K4_T = (ushort)(Convert.ToUInt16(textBox_FacModeSensorCal4.Text) * 10);
+                    K4 = (ushort)(Convert.ToUInt16(textBox_FacModeSensorADC4.Text));
+                    //比较标定1
+                    if ((K4_T == TorqueParamsForm.K4.T) && (K4 <= TorqueParamsForm.K4.Max) && (K4 >= TorqueParamsForm.K4.Min))
+                    {
+                        label1_TorqueCal4.BackColor = Color.Green;
+                    }
+                    else
+                    {
+                        MessageBoxTimeOut.Show("力矩传感器标定4超范围!\r\n" + "加载扭矩:" + K4_T.ToString() + "\r\n标定值:" + K4.ToString(), "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    }
+
+                }
+                else //力矩读取不正常
+                {
+                    MessageBoxTimeOut.Show("读取力矩传感器数据失败!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
             }
             catch (Exception)
             {
@@ -6087,7 +6224,6 @@ namespace Welling_Motor_Debug_Tool
                     
                     mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2605, Code);
                     WriteACK = false;
-                    WriteCnt = 0;
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 6); //3s
 
@@ -6255,7 +6391,6 @@ namespace Welling_Motor_Debug_Tool
                 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)
@@ -6623,7 +6758,6 @@ namespace Welling_Motor_Debug_Tool
                         
                         mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2210, ModeArray);
                         WriteACK = false;
-                        WriteCnt = 0;
                         ACK_WaitCnt = 0;
                         while (ACK_WaitCnt <= 2); //1s
                         if (WriteACK == true)
@@ -6684,7 +6818,6 @@ namespace Welling_Motor_Debug_Tool
                         }
                         mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2310, SNArray);
                         WriteACK = false;
-                        WriteCnt = 0;
                         ACK_WaitCnt = 0;
                         while (ACK_WaitCnt <= 2); //1s
                         if (WriteACK == true)
@@ -6787,7 +6920,6 @@ namespace Welling_Motor_Debug_Tool
                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "读取完成," + "共" + CmdNum.ToString() + "条指令," + "开始写入" + "\r\n");
                     Delay_ms(500);
                     //开始写入
-                    WriteCnt = 0;
                     for (int i = 0; i < CmdList.Count; i++)
                     {
                         richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "写入第" + (i + 1).ToString() + "条指令" + "\r\n");
@@ -6903,7 +7035,6 @@ namespace Welling_Motor_Debug_Tool
                     Code[0] = 0x01;
                     mySerialProcess.SendCmdWithoutNotice((ushort)0x751, (byte)0x16, (ushort)0x1901, Code);
                     WriteACK = false;
-                    WriteCnt = 0;
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 2); //1s
                     if (textBox_RunInfo_Vol.Text != "---")
@@ -6953,7 +7084,6 @@ namespace Welling_Motor_Debug_Tool
                     richTextBox_DebugParam.Clear();
                     mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4500, null);
                     WriteACK = false;
-                    WriteCnt = 0;
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 2); //1s
 
@@ -7003,7 +7133,6 @@ namespace Welling_Motor_Debug_Tool
                     Code[1] = 0xF0;
                     mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2802, Code);
                     WriteACK = false;
-                    WriteCnt = 0;
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 2) ; //1s
                     if ((textBox_RunInfo_GearSt.Text != "WALK") || (Convert.ToInt32(textBox_RunInfo_MotorSpeed.Text.Split(' ')[0]) < 200))
@@ -7184,7 +7313,6 @@ namespace Welling_Motor_Debug_Tool
                     Code[1] = 0xF0;
                     mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2802, Code);
                     WriteACK = false;
-                    WriteCnt = 0;
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 2) ; //1s
                     if (textBox_RunInfo_GearSt.Text != "OFF")
@@ -7245,7 +7373,6 @@ namespace Welling_Motor_Debug_Tool
                     Code[0] = 0x01;
                     mySerialProcess.SendCmdWithoutNotice((ushort)0x751, (byte)0x16, (ushort)0x1901, Code);
                     WriteACK = false;
-                    WriteCnt = 0;
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 2) ; //1s
                     if (textBox_RunInfo_Vol.Text != "---")
@@ -7343,7 +7470,6 @@ namespace Welling_Motor_Debug_Tool
                     Code[0] = 0x01;
                     mySerialProcess.SendCmdWithoutNotice((ushort)0x751, (byte)0x16, (ushort)0x1901, Code);
                     WriteACK = false;
-                    WriteCnt = 0;
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 2) ; //1s
                     if (textBox_RunInfo_Vol.Text != "---")
@@ -7441,7 +7567,6 @@ namespace Welling_Motor_Debug_Tool
                     Code[0] = 0x01;
                     mySerialProcess.SendCmdWithoutNotice((ushort)0x751, (byte)0x16, (ushort)0x1901, Code);
                     WriteACK = false;
-                    WriteCnt = 0;
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 2) ; //1s
                     if (textBox_RunInfo_Vol.Text != "---")
@@ -7491,7 +7616,6 @@ namespace Welling_Motor_Debug_Tool
                 Code[1] = 0xF0;
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2802, Code);
                 WriteACK = false;
-                WriteCnt = 0;
                 ACK_WaitCnt = 0;
                 while (ACK_WaitCnt <= 2) ; //1s
                 if (textBox_RunInfo_GearSt.Text != "TURBO")
@@ -7582,7 +7706,6 @@ namespace Welling_Motor_Debug_Tool
                     Code[0] = 0x01;
                     mySerialProcess.SendCmdWithoutNotice((ushort)0x751, (byte)0x16, (ushort)0x1901, Code);
                     WriteACK = false;
-                    WriteCnt = 0;
                     ACK_WaitCnt = 0;
                     while (ACK_WaitCnt <= 2) ; //1s
                     if (textBox_RunInfo_Vol.Text != "---")
@@ -7662,7 +7785,6 @@ namespace Welling_Motor_Debug_Tool
                 Code[1] = 0xF0;
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2802, Code);
                 WriteACK = false;
-                WriteCnt = 0;
                 ACK_WaitCnt = 0;
                 while (ACK_WaitCnt <= 2) ; //1s
                 if ((textBox_RunInfo_GearSt.Text != "WALK") || (Convert.ToInt32(textBox_RunInfo_MotorSpeed.Text.Split(' ')[0]) < 500))
@@ -7717,7 +7839,6 @@ namespace Welling_Motor_Debug_Tool
                 Code[1] = 0xF0;
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2802, Code);
                 WriteACK = false;
-                WriteCnt = 0;
                 ACK_WaitCnt = 0;
                 while (ACK_WaitCnt <= 2) ; //1s
                 if (textBox_RunInfo_GearSt.Text != "OFF")
@@ -7767,7 +7888,6 @@ namespace Welling_Motor_Debug_Tool
                 Code[1] = 0xF1;
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2802, Code);
                 WriteACK = false;
-                WriteCnt = 0;
                 ACK_WaitCnt = 0;
                 while (ACK_WaitCnt <= 2) ; //1s
                 if (textBox_RunInfo_LightSwitch.Text != "ON")
@@ -7822,7 +7942,6 @@ namespace Welling_Motor_Debug_Tool
                 Code[1] = 0xF0;
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2802, Code);
                 WriteACK = false;
-                WriteCnt = 0;
                 ACK_WaitCnt = 0;
                 while (ACK_WaitCnt <= 2) ; //1s
                 if (textBox_RunInfo_LightSwitch.Text != "OFF")

BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.Properties.Resources.resources


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


+ 1 - 1
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-441adacf67438a11f7c49778bb4c20fa25df26fd58c5cada2f9c92d0e618d81a
+764a16b72b9a762637c098319b83307eb05991ef

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

@@ -111,3 +111,19 @@ D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_
 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
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe.manifest
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.application
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Microsoft.mshtml.dll
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\NPOI.pdb
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\NPOI.xml
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\NPOI.OOXML.pdb
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\NPOI.OOXML.xml
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\NPOI.OpenXml4Net.pdb
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\NPOI.OpenXml4Net.xml
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\NPOI.OpenXmlFormats.pdb
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Spire.License.xml
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Spire.Pdf.xml
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Spire.XLS.xml
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe.manifest
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.application
+C:\Users\hero\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.CopyComplete

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