Просмотр исходного кода

解决几个参数符号问题。

Dail 1 год назад
Родитель
Сommit
ff0992985f

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


BIN
Welling_Motor_Debug_Tool/Images/logo1.png


BIN
Welling_Motor_Debug_Tool/Images/title.png


BIN
Welling_Motor_Debug_Tool/Images/ttium.bmp


+ 48 - 0
Welling_Motor_Debug_Tool/Info.cs

@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.Drawing;
+
+namespace Welling_Motor_Debug_Tool
+{
+    class Class_TorqueData
+    {
+        public static string String = "";
+        public static int Data = 0;
+    }
+
+    class Class_CadenceData
+    {
+        public static string String = "";
+        public static int Data = 0;
+    }
+
+    class Class_CurrentData
+    {
+        public static string String = "";
+        public static int Data = 0;
+    }
+
+    class Class_MotorSpeed
+    {
+        public static string String = "";
+        public static int Data = 0;
+    }
+
+    class Class_MotorTemp
+    {
+        public static string String = "";
+        public static int Data = 0;
+    }
+
+    class Class_Motor_Ver
+    {
+        public static string HW = "---";
+        public static string FW = "---";
+        public static string Mode = "---";
+        public static string SN = "---";
+        public static string Special = "---";
+    }
+
+}

BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool.pdb


+ 27 - 22
Welling_Motor_Debug_Tool/mainForm.Designer.cs

@@ -606,7 +606,7 @@ namespace Welling_Motor_Debug_Tool
             this.连接ToolStripMenuItem,
             this.toolStripSeparator1,
             this.其它配置项ToolStripMenuItem});
-            this.端口连接ToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
+            this.端口连接ToolStripMenuItem.ForeColor = System.Drawing.Color.White;
             this.端口连接ToolStripMenuItem.Name = "端口连接ToolStripMenuItem";
             this.端口连接ToolStripMenuItem.Size = new System.Drawing.Size(86, 25);
             this.端口连接ToolStripMenuItem.Text = "端口设置";
@@ -614,7 +614,7 @@ namespace Welling_Motor_Debug_Tool
             // 刷新ToolStripMenuItem
             // 
             this.刷新ToolStripMenuItem.Name = "刷新ToolStripMenuItem";
-            this.刷新ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
+            this.刷新ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.刷新ToolStripMenuItem.Text = "刷新";
             this.刷新ToolStripMenuItem.Click += new System.EventHandler(this.刷新ToolStripMenuItem_Click);
             // 
@@ -623,7 +623,7 @@ namespace Welling_Motor_Debug_Tool
             this.端口号ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripComboBox_ComNum});
             this.端口号ToolStripMenuItem.Name = "端口号ToolStripMenuItem";
-            this.端口号ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
+            this.端口号ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.端口号ToolStripMenuItem.Text = "端口号";
             this.端口号ToolStripMenuItem.Click += new System.EventHandler(this.ConfigFileSave_Click);
             // 
@@ -641,7 +641,7 @@ namespace Welling_Motor_Debug_Tool
             this.波特率ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripComboBox_Baudrate});
             this.波特率ToolStripMenuItem.Name = "波特率ToolStripMenuItem";
-            this.波特率ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
+            this.波特率ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.波特率ToolStripMenuItem.Text = "波特率";
             // 
             // toolStripComboBox_Baudrate
@@ -660,14 +660,14 @@ namespace Welling_Motor_Debug_Tool
             // 连接ToolStripMenuItem
             // 
             this.连接ToolStripMenuItem.Name = "连接ToolStripMenuItem";
-            this.连接ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
+            this.连接ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.连接ToolStripMenuItem.Text = "连接";
             this.连接ToolStripMenuItem.Click += new System.EventHandler(this.连接ToolStripMenuItem_Click);
             // 
             // toolStripSeparator1
             // 
             this.toolStripSeparator1.Name = "toolStripSeparator1";
-            this.toolStripSeparator1.Size = new System.Drawing.Size(157, 6);
+            this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
             // 
             // 其它配置项ToolStripMenuItem
             // 
@@ -676,7 +676,7 @@ namespace Welling_Motor_Debug_Tool
             this.断开关机ToolStripMenuItem,
             this.识别通讯盒ToolStripMenuItem});
             this.其它配置项ToolStripMenuItem.Name = "其它配置项ToolStripMenuItem";
-            this.其它配置项ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
+            this.其它配置项ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.其它配置项ToolStripMenuItem.Text = "其它配置项";
             // 
             // 连接开机ToolStripMenuItem
@@ -714,7 +714,7 @@ namespace Welling_Motor_Debug_Tool
             this.服务器配置ToolStripMenuItem,
             this.生产信息ToolStripMenuItem,
             this.电机类型ToolStripMenuItem});
-            this.配置ToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
+            this.配置ToolStripMenuItem.ForeColor = System.Drawing.Color.White;
             this.配置ToolStripMenuItem.Name = "配置ToolStripMenuItem";
             this.配置ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
             this.配置ToolStripMenuItem.Text = "配置";
@@ -861,14 +861,13 @@ namespace Welling_Motor_Debug_Tool
             this.生产信息ToolStripMenuItem.Name = "生产信息ToolStripMenuItem";
             this.生产信息ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
             this.生产信息ToolStripMenuItem.Text = "生产信息";
-            this.生产信息ToolStripMenuItem.Click += new System.EventHandler(this.生产信息ToolStripMenuItem_Click);
             // 
             // 生产商ToolStripMenuItem
             // 
             this.生产商ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_MAC});
             this.生产商ToolStripMenuItem.Name = "生产商ToolStripMenuItem";
-            this.生产商ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.生产商ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.生产商ToolStripMenuItem.Text = "生产商";
             // 
             // toolStripTextBox_MAC
@@ -884,7 +883,7 @@ namespace Welling_Motor_Debug_Tool
             this.生产地ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBoxMACAddr});
             this.生产地ToolStripMenuItem.Name = "生产地ToolStripMenuItem";
-            this.生产地ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.生产地ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.生产地ToolStripMenuItem.Text = "生产地";
             // 
             // toolStripTextBoxMACAddr
@@ -900,7 +899,7 @@ namespace Welling_Motor_Debug_Tool
             this.生产日期ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_MACDate});
             this.生产日期ToolStripMenuItem.Name = "生产日期ToolStripMenuItem";
-            this.生产日期ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.生产日期ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.生产日期ToolStripMenuItem.Text = "生产日期";
             // 
             // toolStripTextBox_MACDate
@@ -916,7 +915,7 @@ namespace Welling_Motor_Debug_Tool
             this.产品标识ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_MACPD});
             this.产品标识ToolStripMenuItem.Name = "产品标识ToolStripMenuItem";
-            this.产品标识ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.产品标识ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.产品标识ToolStripMenuItem.Text = "产品标识";
             // 
             // toolStripTextBox_MACPD
@@ -960,7 +959,7 @@ namespace Welling_Motor_Debug_Tool
             this.页面保存ToolStripMenuItem,
             this.系统开关ToolStripMenuItem,
             this.指令调试ToolStripMenuItem});
-            this.工具箱ToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
+            this.工具箱ToolStripMenuItem.ForeColor = System.Drawing.Color.White;
             this.工具箱ToolStripMenuItem.Name = "工具箱ToolStripMenuItem";
             this.工具箱ToolStripMenuItem.Size = new System.Drawing.Size(70, 25);
             this.工具箱ToolStripMenuItem.Text = "工具箱";
@@ -968,21 +967,21 @@ namespace Welling_Motor_Debug_Tool
             // 运行信息记录ToolStripMenuItem
             // 
             this.运行信息记录ToolStripMenuItem.Name = "运行信息记录ToolStripMenuItem";
-            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(180, 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(176, 26);
+            this.计算器ToolStripMenuItem.Size = new System.Drawing.Size(180, 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(176, 26);
+            this.页面保存ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.页面保存ToolStripMenuItem.Text = "页面保存";
             this.页面保存ToolStripMenuItem.Click += new System.EventHandler(this.页面保存ToolStripMenuItem_Click);
             // 
@@ -992,7 +991,7 @@ namespace Welling_Motor_Debug_Tool
             this.开机ToolStripMenuItem,
             this.关机ToolStripMenuItem});
             this.系统开关ToolStripMenuItem.Name = "系统开关ToolStripMenuItem";
-            this.系统开关ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.系统开关ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.系统开关ToolStripMenuItem.Text = "电源控制";
             // 
             // 开机ToolStripMenuItem
@@ -1012,7 +1011,7 @@ namespace Welling_Motor_Debug_Tool
             // 指令调试ToolStripMenuItem
             // 
             this.指令调试ToolStripMenuItem.Name = "指令调试ToolStripMenuItem";
-            this.指令调试ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.指令调试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.指令调试ToolStripMenuItem.Text = "指令调试";
             // 
             // 关于ToolStripMenuItem
@@ -1020,7 +1019,7 @@ namespace Welling_Motor_Debug_Tool
             this.关于ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.帮助ToolStripMenuItem,
             this.版本ToolStripMenuItem});
-            this.关于ToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
+            this.关于ToolStripMenuItem.ForeColor = System.Drawing.Color.White;
             this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
             this.关于ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
             this.关于ToolStripMenuItem.Text = "关于";
@@ -1555,7 +1554,7 @@ namespace Welling_Motor_Debug_Tool
             this.button_Write_Cal.Name = "button_Write_Cal";
             this.button_Write_Cal.Size = new System.Drawing.Size(126, 50);
             this.button_Write_Cal.TabIndex = 2;
-            this.button_Write_Cal.Text = "力矩传感器标定";
+            this.button_Write_Cal.Text = "力矩传感器\r\n标定";
             this.button_Write_Cal.UseVisualStyleBackColor = false;
             this.button_Write_Cal.Click += new System.EventHandler(this.button_Write_Cal_Click);
             // 
@@ -5092,6 +5091,7 @@ namespace Welling_Motor_Debug_Tool
             // label43
             // 
             this.label43.BackColor = System.Drawing.Color.Silver;
+            this.label43.ForeColor = System.Drawing.Color.White;
             this.label43.Location = new System.Drawing.Point(223, 623);
             this.label43.Name = "label43";
             this.label43.Size = new System.Drawing.Size(1, 15);
@@ -5100,6 +5100,7 @@ namespace Welling_Motor_Debug_Tool
             // label44
             // 
             this.label44.BackColor = System.Drawing.Color.Silver;
+            this.label44.ForeColor = System.Drawing.Color.White;
             this.label44.Location = new System.Drawing.Point(399, 623);
             this.label44.Name = "label44";
             this.label44.Size = new System.Drawing.Size(1, 15);
@@ -5108,6 +5109,7 @@ namespace Welling_Motor_Debug_Tool
             // label45
             // 
             this.label45.BackColor = System.Drawing.Color.Silver;
+            this.label45.ForeColor = System.Drawing.Color.White;
             this.label45.Location = new System.Drawing.Point(646, 623);
             this.label45.Name = "label45";
             this.label45.Size = new System.Drawing.Size(1, 15);
@@ -5116,6 +5118,7 @@ namespace Welling_Motor_Debug_Tool
             // label96
             // 
             this.label96.BackColor = System.Drawing.Color.Silver;
+            this.label96.ForeColor = System.Drawing.Color.White;
             this.label96.Location = new System.Drawing.Point(530, 623);
             this.label96.Name = "label96";
             this.label96.Size = new System.Drawing.Size(1, 15);
@@ -5153,7 +5156,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.label_Computername.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
             this.label_Computername.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
-            this.label_Computername.ForeColor = System.Drawing.Color.Silver;
+            this.label_Computername.ForeColor = System.Drawing.Color.White;
             this.label_Computername.Location = new System.Drawing.Point(700, 4);
             this.label_Computername.Name = "label_Computername";
             this.label_Computername.Size = new System.Drawing.Size(190, 21);
@@ -5163,6 +5166,7 @@ namespace Welling_Motor_Debug_Tool
             // label46
             // 
             this.label46.BackColor = System.Drawing.Color.Silver;
+            this.label46.ForeColor = System.Drawing.Color.White;
             this.label46.Location = new System.Drawing.Point(692, 7);
             this.label46.Name = "label46";
             this.label46.Size = new System.Drawing.Size(1, 15);
@@ -5408,6 +5412,7 @@ namespace Welling_Motor_Debug_Tool
             this.textBox_ErrorCode.ReadOnly = true;
             this.textBox_ErrorCode.Size = new System.Drawing.Size(85, 28);
             this.textBox_ErrorCode.TabIndex = 25;
+            this.textBox_ErrorCode.MouseHover += new System.EventHandler(this.textBox_ErrorCode_MouseHover);
             // 
             // label55
             // 

+ 26 - 8
Welling_Motor_Debug_Tool/mainForm.cs

@@ -857,7 +857,10 @@ namespace Welling_Motor_Debug_Tool
                                     richTextBox_MotorParam.Clear();
                                     for (int i = 0; i < myParams.MotorParma.Count; i++)
                                     {
-                                        richTextBox_MotorParam.AppendText(myParams.MotorParma[i] + "=" + Convert.ToString((short)(Data[2 * i + 1] * 256 + Data[2 * i])) + ", ");
+                                        if (i == 6)
+                                            richTextBox_MotorParam.AppendText(myParams.MotorParma[i] + "=" + Convert.ToString((short)(Data[2 * i + 1] * 256 + Data[2 * i])) + ", ");
+                                        else
+                                            richTextBox_MotorParam.AppendText(myParams.MotorParma[i] + "=" + Convert.ToString((ushort)(Data[2 * i + 1] * 256 + Data[2 * i])) + ", ");
                                     }
                                     richTextBox_MotorParam.Text = richTextBox_MotorParam.Text.Substring(0, richTextBox_MotorParam.Text.Length - 2);
                                 }));
@@ -873,19 +876,24 @@ namespace Welling_Motor_Debug_Tool
                                     richTextBox_BikeParam.Clear();
                                     for (int i = 0; i < myParams.BikeParma.Count; i++)
                                     {
-                                        richTextBox_BikeParam.AppendText(myParams.BikeParma[i] + "=" + Convert.ToString((short)(Data[2 * i + 1] * 256 + Data[2 * i])) + ", ");
-                                        if (i == 8) //更新前后灯参数
+                                        if (i == 9)                                        
+                                            richTextBox_BikeParam.AppendText(myParams.BikeParma[i] + "=" + Convert.ToString((short)(Data[2 * i + 1] * 256 + Data[2 * i])) + ", ");                                        
+                                        else
+                                            richTextBox_BikeParam.AppendText(myParams.BikeParma[i] + "=" + Convert.ToString((ushort)(Data[2 * i + 1] * 256 + Data[2 * i])) + ", ");
+                                        //更新前后灯参数
+                                        if (i == 8) 
                                         {
                                             comboBox_TailLightMode.SelectedIndex = ((Data[2 * i + 1] >> 4) & 0x0F) - 1;
                                             comboBox_TailLightVol.SelectedIndex = ((Data[2 * i + 1] & 0x0F) == 6) ? 0 : 1;
                                             comboBox_FrontLightVol.SelectedIndex = ((Data[2 * i] & 0x0F) == 6) ? 0 : 1;
                                         }
-                                        else if (i == 11) //更新开关机参数
+                                        //更新开关机参数
+                                        else if (i == 11) 
                                         {
                                             textBox_PowerOnDelay.Text = Convert.ToString((Data[2 * i + 1] >> 4) & 0x0F);
                                             textBox_PowerOffDelay.Text = Convert.ToString(Data[2 * i + 1] & 0x0F);
                                             textBox_AutoPowerOff.Text = Convert.ToString(Data[2 * i]);
-                                        }
+                                        }                                            
                                     }
                                     richTextBox_BikeParam.Text = richTextBox_BikeParam.Text.Substring(0, richTextBox_BikeParam.Text.Length - 2);                                   
                                     //更新生产模式中整车参数
@@ -2029,14 +2037,24 @@ namespace Welling_Motor_Debug_Tool
                 ConfigParam[i] = 0;
             ConfigParam[0] = (byte)((写入存储ToolStripMenuItem.Checked) ? 0x01 : 0x00);
             short wDataTemp = 0;
+            ushort DataTemp = 0;
             string[] strDataTemp = richTextBox_MotorParam.Text.Split(new string[] { ", "},StringSplitOptions.None);
             try
             {
                 for (int i = 0; i < strDataTemp.Length; i++)
                 {
-                    wDataTemp = Convert.ToInt16(strDataTemp[i].Split('=')[1]);
-                    ConfigParam[2 * i + 2] = (byte)wDataTemp;
-                    ConfigParam[2 * i + 3] = (byte)(wDataTemp >> 8);
+                    if (i == 6)
+                    {
+                        wDataTemp = Convert.ToInt16(strDataTemp[i].Split('=')[1]);
+                        ConfigParam[2 * i + 2] = (byte)wDataTemp;
+                        ConfigParam[2 * i + 3] = (byte)(wDataTemp >> 8);
+                    }
+                    else
+                    {
+                        DataTemp = Convert.ToUInt16(strDataTemp[i].Split('=')[1]);
+                        ConfigParam[2 * i + 2] = (byte)DataTemp;
+                        ConfigParam[2 * i + 3] = (byte)(DataTemp >> 8);
+                    }                    
                 }
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x3B28, ConfigParam);
             }

BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferences.cache


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.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