Bläddra i källkod

1、修改配置模式、助力档位、大灯开关的事件为下拉关闭,解决连接仪表是频繁切换;
2、串口数据解析周期改为20ms;
3、助力参数增加2bytes填充,解决内存对齐问题;
4、助力参数曲线参数删减为1条,并修改为4bytes;
5、增加OBC界面。

dail 3 år sedan
förälder
incheckning
4508609679

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 530 - 40
Welling_Motor_Debug_Tool/Form1.Designer.cs

@@ -43,7 +43,6 @@ namespace Welling_Motor_Debug_Tool
             this.配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.写入存储ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.工具箱ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.显示曲线ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.记录数据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.一键查询ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.计算器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -116,18 +115,20 @@ namespace Welling_Motor_Debug_Tool
             this.button_ReadControlParam = new System.Windows.Forms.Button();
             this.richTextBox_ControlParam = new System.Windows.Forms.RichTextBox();
             this.tabPage_SensorParam = new System.Windows.Forms.TabPage();
+            this.comboBox_TorqueSet = new System.Windows.Forms.ComboBox();
             this.label29 = new System.Windows.Forms.Label();
             this.textBox_Load = new System.Windows.Forms.TextBox();
             this.label27 = new System.Windows.Forms.Label();
-            this.textBox_LoadNum = new System.Windows.Forms.TextBox();
             this.label26 = new System.Windows.Forms.Label();
             this.button_Write_Cal = new System.Windows.Forms.Button();
             this.button_WriteSensorParam = new System.Windows.Forms.Button();
             this.button_ReadSensorParam = new System.Windows.Forms.Button();
             this.richTextBox_SensorParam = new System.Windows.Forms.RichTextBox();
             this.tabPage_AssistParam = new System.Windows.Forms.TabPage();
+            this.label47 = new System.Windows.Forms.Label();
+            this.comboBox_AssistTorque = new System.Windows.Forms.ComboBox();
+            this.comboBox_AssistCadence = new System.Windows.Forms.ComboBox();
             this.label25 = new System.Windows.Forms.Label();
-            this.textBox_AssistNum = new System.Windows.Forms.TextBox();
             this.button_WriteAssistParam = new System.Windows.Forms.Button();
             this.button_ReadAssistParam = new System.Windows.Forms.Button();
             this.richTextBox_AssistParam = new System.Windows.Forms.RichTextBox();
@@ -202,6 +203,40 @@ namespace Welling_Motor_Debug_Tool
             this.label44 = new System.Windows.Forms.Label();
             this.label45 = new System.Windows.Forms.Label();
             this.label46 = new System.Windows.Forms.Label();
+            this.tabPage_OBC = new System.Windows.Forms.TabPage();
+            this.comboBox1 = new System.Windows.Forms.ComboBox();
+            this.checkBox1 = new System.Windows.Forms.CheckBox();
+            this.button1 = new System.Windows.Forms.Button();
+            this.button3 = new System.Windows.Forms.Button();
+            this.button4 = new System.Windows.Forms.Button();
+            this.groupBox10 = new System.Windows.Forms.GroupBox();
+            this.groupBox11 = new System.Windows.Forms.GroupBox();
+            this.checkBox3 = new System.Windows.Forms.CheckBox();
+            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
+            this.groupBox12 = new System.Windows.Forms.GroupBox();
+            this.richTextBox2 = new System.Windows.Forms.RichTextBox();
+            this.groupBox13 = new System.Windows.Forms.GroupBox();
+            this.richTextBox3 = new System.Windows.Forms.RichTextBox();
+            this.button6 = new System.Windows.Forms.Button();
+            this.groupBox14 = new System.Windows.Forms.GroupBox();
+            this.button2 = new System.Windows.Forms.Button();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.textBox2 = new System.Windows.Forms.TextBox();
+            this.textBox3 = new System.Windows.Forms.TextBox();
+            this.label48 = new System.Windows.Forms.Label();
+            this.label49 = new System.Windows.Forms.Label();
+            this.textBox4 = new System.Windows.Forms.TextBox();
+            this.label50 = new System.Windows.Forms.Label();
+            this.label51 = new System.Windows.Forms.Label();
+            this.groupBox15 = new System.Windows.Forms.GroupBox();
+            this.textBox5 = new System.Windows.Forms.TextBox();
+            this.textBox6 = new System.Windows.Forms.TextBox();
+            this.textBox7 = new System.Windows.Forms.TextBox();
+            this.textBox8 = new System.Windows.Forms.TextBox();
+            this.label52 = new System.Windows.Forms.Label();
+            this.label53 = new System.Windows.Forms.Label();
+            this.label54 = new System.Windows.Forms.Label();
+            this.label55 = new System.Windows.Forms.Label();
             this.menuStrip_Set.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -224,6 +259,13 @@ namespace Welling_Motor_Debug_Tool
             this.groupBox5.SuspendLayout();
             this.groupBox4.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+            this.tabPage_OBC.SuspendLayout();
+            this.groupBox10.SuspendLayout();
+            this.groupBox11.SuspendLayout();
+            this.groupBox12.SuspendLayout();
+            this.groupBox13.SuspendLayout();
+            this.groupBox14.SuspendLayout();
+            this.groupBox15.SuspendLayout();
             this.SuspendLayout();
             // 
             // menuStrip_Set
@@ -271,6 +313,7 @@ namespace Welling_Motor_Debug_Tool
             // toolStripComboBox_ComNum
             // 
             this.toolStripComboBox_ComNum.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.toolStripComboBox_ComNum.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.toolStripComboBox_ComNum.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.toolStripComboBox_ComNum.Name = "toolStripComboBox_ComNum";
             this.toolStripComboBox_ComNum.Size = new System.Drawing.Size(121, 29);
@@ -286,6 +329,7 @@ namespace Welling_Motor_Debug_Tool
             // toolStripComboBox_Baudrate
             // 
             this.toolStripComboBox_Baudrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.toolStripComboBox_Baudrate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.toolStripComboBox_Baudrate.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.toolStripComboBox_Baudrate.Items.AddRange(new object[] {
             "9600",
@@ -320,7 +364,6 @@ namespace Welling_Motor_Debug_Tool
             // 工具箱ToolStripMenuItem
             // 
             this.工具箱ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.显示曲线ToolStripMenuItem,
             this.记录数据ToolStripMenuItem,
             this.一键查询ToolStripMenuItem,
             this.计算器ToolStripMenuItem});
@@ -329,12 +372,6 @@ namespace Welling_Motor_Debug_Tool
             this.工具箱ToolStripMenuItem.Size = new System.Drawing.Size(70, 25);
             this.工具箱ToolStripMenuItem.Text = "工具箱";
             // 
-            // 显示曲线ToolStripMenuItem
-            // 
-            this.显示曲线ToolStripMenuItem.Name = "显示曲线ToolStripMenuItem";
-            this.显示曲线ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
-            this.显示曲线ToolStripMenuItem.Text = "显示曲线";
-            // 
             // 记录数据ToolStripMenuItem
             // 
             this.记录数据ToolStripMenuItem.Name = "记录数据ToolStripMenuItem";
@@ -455,6 +492,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.comboBox_LightSwitch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
             this.comboBox_LightSwitch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.comboBox_LightSwitch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.comboBox_LightSwitch.FormattingEnabled = true;
             this.comboBox_LightSwitch.Items.AddRange(new object[] {
             "ON",
@@ -463,7 +501,7 @@ namespace Welling_Motor_Debug_Tool
             this.comboBox_LightSwitch.Name = "comboBox_LightSwitch";
             this.comboBox_LightSwitch.Size = new System.Drawing.Size(89, 29);
             this.comboBox_LightSwitch.TabIndex = 3;
-            this.comboBox_LightSwitch.SelectedIndexChanged += new System.EventHandler(this.comboBox_GearSt_SelectedIndexChanged);
+            this.comboBox_LightSwitch.SelectionChangeCommitted += new System.EventHandler(this.comboBox_GearSt_SelectionChangeCommitted);
             // 
             // label3
             // 
@@ -478,6 +516,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.comboBox_GearSt.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
             this.comboBox_GearSt.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.comboBox_GearSt.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.comboBox_GearSt.FormattingEnabled = true;
             this.comboBox_GearSt.Items.AddRange(new object[] {
             "0",
@@ -491,12 +530,13 @@ namespace Welling_Motor_Debug_Tool
             this.comboBox_GearSt.Name = "comboBox_GearSt";
             this.comboBox_GearSt.Size = new System.Drawing.Size(89, 29);
             this.comboBox_GearSt.TabIndex = 1;
-            this.comboBox_GearSt.SelectedIndexChanged += new System.EventHandler(this.comboBox_GearSt_SelectedIndexChanged);
+            this.comboBox_GearSt.SelectionChangeCommitted += new System.EventHandler(this.comboBox_GearSt_SelectionChangeCommitted);
             // 
             // comboBox_WorkMode
             // 
             this.comboBox_WorkMode.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
             this.comboBox_WorkMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.comboBox_WorkMode.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.comboBox_WorkMode.FormattingEnabled = true;
             this.comboBox_WorkMode.Items.AddRange(new object[] {
             "运行模式",
@@ -505,7 +545,7 @@ namespace Welling_Motor_Debug_Tool
             this.comboBox_WorkMode.Name = "comboBox_WorkMode";
             this.comboBox_WorkMode.Size = new System.Drawing.Size(89, 29);
             this.comboBox_WorkMode.TabIndex = 1;
-            this.comboBox_WorkMode.SelectedIndexChanged += new System.EventHandler(this.comboBox_WorkMode_SelectedIndexChanged);
+            this.comboBox_WorkMode.SelectionChangeCommitted += new System.EventHandler(this.comboBox_WorkMode_SelectionChangeCommitted);
             // 
             // label2
             // 
@@ -935,6 +975,7 @@ namespace Welling_Motor_Debug_Tool
             this.tabControl1.Controls.Add(this.tabPage_DebugParam);
             this.tabControl1.Controls.Add(this.tabPage_RecordInfo);
             this.tabControl1.Controls.Add(this.tabPage_OtherInfo);
+            this.tabControl1.Controls.Add(this.tabPage_OBC);
             this.tabControl1.Location = new System.Drawing.Point(10, 27);
             this.tabControl1.Name = "tabControl1";
             this.tabControl1.SelectedIndex = 0;
@@ -1076,10 +1117,10 @@ namespace Welling_Motor_Debug_Tool
             // tabPage_SensorParam
             // 
             this.tabPage_SensorParam.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.tabPage_SensorParam.Controls.Add(this.comboBox_TorqueSet);
             this.tabPage_SensorParam.Controls.Add(this.label29);
             this.tabPage_SensorParam.Controls.Add(this.textBox_Load);
             this.tabPage_SensorParam.Controls.Add(this.label27);
-            this.tabPage_SensorParam.Controls.Add(this.textBox_LoadNum);
             this.tabPage_SensorParam.Controls.Add(this.label26);
             this.tabPage_SensorParam.Controls.Add(this.button_Write_Cal);
             this.tabPage_SensorParam.Controls.Add(this.button_WriteSensorParam);
@@ -1091,6 +1132,22 @@ namespace Welling_Motor_Debug_Tool
             this.tabPage_SensorParam.TabIndex = 3;
             this.tabPage_SensorParam.Text = "传感器参数";
             // 
+            // comboBox_TorqueSet
+            // 
+            this.comboBox_TorqueSet.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
+            this.comboBox_TorqueSet.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.comboBox_TorqueSet.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.comboBox_TorqueSet.FormattingEnabled = true;
+            this.comboBox_TorqueSet.Items.AddRange(new object[] {
+            "1",
+            "2",
+            "3",
+            "4"});
+            this.comboBox_TorqueSet.Location = new System.Drawing.Point(820, 38);
+            this.comboBox_TorqueSet.Name = "comboBox_TorqueSet";
+            this.comboBox_TorqueSet.Size = new System.Drawing.Size(89, 29);
+            this.comboBox_TorqueSet.TabIndex = 9;
+            // 
             // label29
             // 
             this.label29.BackColor = System.Drawing.Color.Silver;
@@ -1117,15 +1174,6 @@ namespace Welling_Motor_Debug_Tool
             this.label27.TabIndex = 5;
             this.label27.Text = "负载N.m";
             // 
-            // textBox_LoadNum
-            // 
-            this.textBox_LoadNum.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
-            this.textBox_LoadNum.Location = new System.Drawing.Point(808, 36);
-            this.textBox_LoadNum.Name = "textBox_LoadNum";
-            this.textBox_LoadNum.Size = new System.Drawing.Size(112, 28);
-            this.textBox_LoadNum.TabIndex = 4;
-            this.textBox_LoadNum.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
             // label26
             // 
             this.label26.AutoSize = true;
@@ -1180,8 +1228,10 @@ namespace Welling_Motor_Debug_Tool
             // tabPage_AssistParam
             // 
             this.tabPage_AssistParam.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.tabPage_AssistParam.Controls.Add(this.label47);
+            this.tabPage_AssistParam.Controls.Add(this.comboBox_AssistTorque);
+            this.tabPage_AssistParam.Controls.Add(this.comboBox_AssistCadence);
             this.tabPage_AssistParam.Controls.Add(this.label25);
-            this.tabPage_AssistParam.Controls.Add(this.textBox_AssistNum);
             this.tabPage_AssistParam.Controls.Add(this.button_WriteAssistParam);
             this.tabPage_AssistParam.Controls.Add(this.button_ReadAssistParam);
             this.tabPage_AssistParam.Controls.Add(this.richTextBox_AssistParam);
@@ -1191,23 +1241,69 @@ namespace Welling_Motor_Debug_Tool
             this.tabPage_AssistParam.TabIndex = 4;
             this.tabPage_AssistParam.Text = "助力参数";
             // 
+            // label47
+            // 
+            this.label47.AutoSize = true;
+            this.label47.Location = new System.Drawing.Point(827, 36);
+            this.label47.Name = "label47";
+            this.label47.Size = new System.Drawing.Size(74, 42);
+            this.label47.TabIndex = 9;
+            this.label47.Text = "助力转矩\r\n曲线编号";
+            // 
+            // comboBox_AssistTorque
+            // 
+            this.comboBox_AssistTorque.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
+            this.comboBox_AssistTorque.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.comboBox_AssistTorque.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.comboBox_AssistTorque.FormattingEnabled = true;
+            this.comboBox_AssistTorque.Items.AddRange(new object[] {
+            "1",
+            "2",
+            "3",
+            "4",
+            "5",
+            "6",
+            "7",
+            "8",
+            "9",
+            "10",
+            "11",
+            "12",
+            "13",
+            "14",
+            "15"});
+            this.comboBox_AssistTorque.Location = new System.Drawing.Point(820, 81);
+            this.comboBox_AssistTorque.Name = "comboBox_AssistTorque";
+            this.comboBox_AssistTorque.Size = new System.Drawing.Size(89, 29);
+            this.comboBox_AssistTorque.TabIndex = 8;
+            this.comboBox_AssistTorque.SelectionChangeCommitted += new System.EventHandler(this.comboBox_AssistTorque_SelectionChangeCommitted);
+            // 
+            // comboBox_AssistCadence
+            // 
+            this.comboBox_AssistCadence.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
+            this.comboBox_AssistCadence.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.comboBox_AssistCadence.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.comboBox_AssistCadence.FormattingEnabled = true;
+            this.comboBox_AssistCadence.Items.AddRange(new object[] {
+            "1",
+            "2",
+            "3",
+            "4",
+            "5"});
+            this.comboBox_AssistCadence.Location = new System.Drawing.Point(820, 158);
+            this.comboBox_AssistCadence.Name = "comboBox_AssistCadence";
+            this.comboBox_AssistCadence.Size = new System.Drawing.Size(89, 29);
+            this.comboBox_AssistCadence.TabIndex = 7;
+            this.comboBox_AssistCadence.SelectionChangeCommitted += new System.EventHandler(this.comboBox_AssistCadence_SelectionChangeCommitted);
+            // 
             // label25
             // 
             this.label25.AutoSize = true;
-            this.label25.Location = new System.Drawing.Point(811, 145);
+            this.label25.Location = new System.Drawing.Point(827, 113);
             this.label25.Name = "label25";
-            this.label25.Size = new System.Drawing.Size(106, 21);
+            this.label25.Size = new System.Drawing.Size(74, 42);
             this.label25.TabIndex = 2;
-            this.label25.Text = "助力参数编号";
-            // 
-            // textBox_AssistNum
-            // 
-            this.textBox_AssistNum.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
-            this.textBox_AssistNum.Location = new System.Drawing.Point(824, 169);
-            this.textBox_AssistNum.Name = "textBox_AssistNum";
-            this.textBox_AssistNum.Size = new System.Drawing.Size(80, 28);
-            this.textBox_AssistNum.TabIndex = 5;
-            this.textBox_AssistNum.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            this.label25.Text = "助力踏频\r\n曲线编号";
             // 
             // button_WriteAssistParam
             // 
@@ -1977,6 +2073,354 @@ namespace Welling_Motor_Debug_Tool
             this.label46.Size = new System.Drawing.Size(1, 15);
             this.label46.TabIndex = 15;
             // 
+            // tabPage_OBC
+            // 
+            this.tabPage_OBC.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.tabPage_OBC.Controls.Add(this.groupBox15);
+            this.tabPage_OBC.Controls.Add(this.groupBox14);
+            this.tabPage_OBC.Controls.Add(this.groupBox13);
+            this.tabPage_OBC.Controls.Add(this.groupBox12);
+            this.tabPage_OBC.Controls.Add(this.groupBox11);
+            this.tabPage_OBC.Controls.Add(this.groupBox10);
+            this.tabPage_OBC.Location = new System.Drawing.Point(4, 30);
+            this.tabPage_OBC.Name = "tabPage_OBC";
+            this.tabPage_OBC.Size = new System.Drawing.Size(937, 315);
+            this.tabPage_OBC.TabIndex = 8;
+            this.tabPage_OBC.Text = "模拟仪表";
+            // 
+            // comboBox1
+            // 
+            this.comboBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
+            this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.comboBox1.FormattingEnabled = true;
+            this.comboBox1.Items.AddRange(new object[] {
+            "0",
+            "1",
+            "2",
+            "3",
+            "4",
+            "5",
+            "Walk"});
+            this.comboBox1.Location = new System.Drawing.Point(6, 27);
+            this.comboBox1.Name = "comboBox1";
+            this.comboBox1.Size = new System.Drawing.Size(89, 29);
+            this.comboBox1.TabIndex = 4;
+            // 
+            // checkBox1
+            // 
+            this.checkBox1.AutoSize = true;
+            this.checkBox1.Location = new System.Drawing.Point(133, 29);
+            this.checkBox1.Name = "checkBox1";
+            this.checkBox1.Size = new System.Drawing.Size(61, 25);
+            this.checkBox1.TabIndex = 5;
+            this.checkBox1.Text = "启动";
+            this.checkBox1.UseVisualStyleBackColor = true;
+            // 
+            // button1
+            // 
+            this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
+            this.button1.Location = new System.Drawing.Point(119, 264);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 35);
+            this.button1.TabIndex = 6;
+            this.button1.Text = "读取";
+            this.button1.UseVisualStyleBackColor = false;
+            // 
+            // button3
+            // 
+            this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
+            this.button3.Location = new System.Drawing.Point(219, 40);
+            this.button3.Name = "button3";
+            this.button3.Size = new System.Drawing.Size(75, 35);
+            this.button3.TabIndex = 6;
+            this.button3.Text = "读取";
+            this.button3.UseVisualStyleBackColor = false;
+            // 
+            // button4
+            // 
+            this.button4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
+            this.button4.Location = new System.Drawing.Point(219, 96);
+            this.button4.Name = "button4";
+            this.button4.Size = new System.Drawing.Size(75, 35);
+            this.button4.TabIndex = 6;
+            this.button4.Text = "清除";
+            this.button4.UseVisualStyleBackColor = false;
+            // 
+            // groupBox10
+            // 
+            this.groupBox10.Controls.Add(this.comboBox1);
+            this.groupBox10.Controls.Add(this.checkBox1);
+            this.groupBox10.Location = new System.Drawing.Point(4, 4);
+            this.groupBox10.Name = "groupBox10";
+            this.groupBox10.Size = new System.Drawing.Size(200, 64);
+            this.groupBox10.TabIndex = 10;
+            this.groupBox10.TabStop = false;
+            this.groupBox10.Text = "控制电机档位";
+            // 
+            // groupBox11
+            // 
+            this.groupBox11.Controls.Add(this.richTextBox1);
+            this.groupBox11.Controls.Add(this.checkBox3);
+            this.groupBox11.Location = new System.Drawing.Point(4, 74);
+            this.groupBox11.Name = "groupBox11";
+            this.groupBox11.Size = new System.Drawing.Size(200, 235);
+            this.groupBox11.TabIndex = 11;
+            this.groupBox11.TabStop = false;
+            this.groupBox11.Text = "读取电池运行信息";
+            // 
+            // checkBox3
+            // 
+            this.checkBox3.AutoSize = true;
+            this.checkBox3.Location = new System.Drawing.Point(133, 204);
+            this.checkBox3.Name = "checkBox3";
+            this.checkBox3.Size = new System.Drawing.Size(61, 25);
+            this.checkBox3.TabIndex = 5;
+            this.checkBox3.Text = "启动";
+            this.checkBox3.UseVisualStyleBackColor = true;
+            // 
+            // richTextBox1
+            // 
+            this.richTextBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.richTextBox1.Location = new System.Drawing.Point(6, 27);
+            this.richTextBox1.Name = "richTextBox1";
+            this.richTextBox1.Size = new System.Drawing.Size(188, 161);
+            this.richTextBox1.TabIndex = 12;
+            this.richTextBox1.Text = "";
+            // 
+            // groupBox12
+            // 
+            this.groupBox12.Controls.Add(this.richTextBox2);
+            this.groupBox12.Controls.Add(this.button1);
+            this.groupBox12.Location = new System.Drawing.Point(210, 4);
+            this.groupBox12.Name = "groupBox12";
+            this.groupBox12.Size = new System.Drawing.Size(200, 305);
+            this.groupBox12.TabIndex = 13;
+            this.groupBox12.TabStop = false;
+            this.groupBox12.Text = "查询用户参数";
+            // 
+            // richTextBox2
+            // 
+            this.richTextBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.richTextBox2.Location = new System.Drawing.Point(6, 27);
+            this.richTextBox2.Name = "richTextBox2";
+            this.richTextBox2.Size = new System.Drawing.Size(188, 231);
+            this.richTextBox2.TabIndex = 12;
+            this.richTextBox2.Text = "";
+            // 
+            // groupBox13
+            // 
+            this.groupBox13.Controls.Add(this.richTextBox3);
+            this.groupBox13.Controls.Add(this.button6);
+            this.groupBox13.Location = new System.Drawing.Point(416, 4);
+            this.groupBox13.Name = "groupBox13";
+            this.groupBox13.Size = new System.Drawing.Size(200, 305);
+            this.groupBox13.TabIndex = 14;
+            this.groupBox13.TabStop = false;
+            this.groupBox13.Text = "设置用户参数";
+            // 
+            // richTextBox3
+            // 
+            this.richTextBox3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.richTextBox3.Location = new System.Drawing.Point(6, 27);
+            this.richTextBox3.Name = "richTextBox3";
+            this.richTextBox3.Size = new System.Drawing.Size(188, 231);
+            this.richTextBox3.TabIndex = 12;
+            this.richTextBox3.Text = "";
+            // 
+            // button6
+            // 
+            this.button6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
+            this.button6.Location = new System.Drawing.Point(119, 264);
+            this.button6.Name = "button6";
+            this.button6.Size = new System.Drawing.Size(75, 35);
+            this.button6.TabIndex = 6;
+            this.button6.Text = "写入";
+            this.button6.UseVisualStyleBackColor = false;
+            // 
+            // groupBox14
+            // 
+            this.groupBox14.Controls.Add(this.button2);
+            this.groupBox14.Controls.Add(this.textBox1);
+            this.groupBox14.Controls.Add(this.textBox2);
+            this.groupBox14.Controls.Add(this.textBox3);
+            this.groupBox14.Controls.Add(this.label48);
+            this.groupBox14.Controls.Add(this.label49);
+            this.groupBox14.Controls.Add(this.textBox4);
+            this.groupBox14.Controls.Add(this.label50);
+            this.groupBox14.Controls.Add(this.label51);
+            this.groupBox14.Location = new System.Drawing.Point(622, 4);
+            this.groupBox14.Name = "groupBox14";
+            this.groupBox14.Size = new System.Drawing.Size(303, 150);
+            this.groupBox14.TabIndex = 13;
+            this.groupBox14.TabStop = false;
+            this.groupBox14.Text = "版本信息";
+            // 
+            // button2
+            // 
+            this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
+            this.button2.Location = new System.Drawing.Point(219, 81);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(75, 62);
+            this.button2.TabIndex = 2;
+            this.button2.Text = "查询";
+            this.button2.UseVisualStyleBackColor = false;
+            // 
+            // textBox1
+            // 
+            this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.textBox1.Location = new System.Drawing.Point(56, 114);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(158, 28);
+            this.textBox1.TabIndex = 1;
+            // 
+            // textBox2
+            // 
+            this.textBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.textBox2.Location = new System.Drawing.Point(56, 84);
+            this.textBox2.Name = "textBox2";
+            this.textBox2.Size = new System.Drawing.Size(158, 28);
+            this.textBox2.TabIndex = 1;
+            // 
+            // textBox3
+            // 
+            this.textBox3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.textBox3.Location = new System.Drawing.Point(56, 54);
+            this.textBox3.Name = "textBox3";
+            this.textBox3.Size = new System.Drawing.Size(158, 28);
+            this.textBox3.TabIndex = 1;
+            // 
+            // label48
+            // 
+            this.label48.AutoSize = true;
+            this.label48.Location = new System.Drawing.Point(6, 118);
+            this.label48.Name = "label48";
+            this.label48.Size = new System.Drawing.Size(35, 21);
+            this.label48.TabIndex = 0;
+            this.label48.Text = "FW";
+            // 
+            // label49
+            // 
+            this.label49.AutoSize = true;
+            this.label49.Location = new System.Drawing.Point(6, 88);
+            this.label49.Name = "label49";
+            this.label49.Size = new System.Drawing.Size(38, 21);
+            this.label49.TabIndex = 0;
+            this.label49.Text = "HW";
+            // 
+            // textBox4
+            // 
+            this.textBox4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.textBox4.Location = new System.Drawing.Point(56, 24);
+            this.textBox4.Name = "textBox4";
+            this.textBox4.Size = new System.Drawing.Size(158, 28);
+            this.textBox4.TabIndex = 1;
+            // 
+            // label50
+            // 
+            this.label50.AutoSize = true;
+            this.label50.Location = new System.Drawing.Point(6, 58);
+            this.label50.Name = "label50";
+            this.label50.Size = new System.Drawing.Size(32, 21);
+            this.label50.TabIndex = 0;
+            this.label50.Text = "SN";
+            // 
+            // label51
+            // 
+            this.label51.AutoSize = true;
+            this.label51.Location = new System.Drawing.Point(7, 28);
+            this.label51.Name = "label51";
+            this.label51.Size = new System.Drawing.Size(42, 21);
+            this.label51.TabIndex = 0;
+            this.label51.Text = "型号";
+            // 
+            // groupBox15
+            // 
+            this.groupBox15.Controls.Add(this.textBox5);
+            this.groupBox15.Controls.Add(this.button3);
+            this.groupBox15.Controls.Add(this.textBox6);
+            this.groupBox15.Controls.Add(this.button4);
+            this.groupBox15.Controls.Add(this.label55);
+            this.groupBox15.Controls.Add(this.textBox7);
+            this.groupBox15.Controls.Add(this.label54);
+            this.groupBox15.Controls.Add(this.textBox8);
+            this.groupBox15.Controls.Add(this.label52);
+            this.groupBox15.Controls.Add(this.label53);
+            this.groupBox15.Location = new System.Drawing.Point(622, 160);
+            this.groupBox15.Name = "groupBox15";
+            this.groupBox15.Size = new System.Drawing.Size(303, 149);
+            this.groupBox15.TabIndex = 14;
+            this.groupBox15.TabStop = false;
+            this.groupBox15.Text = "骑行历史";
+            // 
+            // textBox5
+            // 
+            this.textBox5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.textBox5.Location = new System.Drawing.Point(104, 117);
+            this.textBox5.Name = "textBox5";
+            this.textBox5.Size = new System.Drawing.Size(110, 28);
+            this.textBox5.TabIndex = 3;
+            // 
+            // textBox6
+            // 
+            this.textBox6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.textBox6.Location = new System.Drawing.Point(104, 87);
+            this.textBox6.Name = "textBox6";
+            this.textBox6.Size = new System.Drawing.Size(110, 28);
+            this.textBox6.TabIndex = 4;
+            // 
+            // textBox7
+            // 
+            this.textBox7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.textBox7.Location = new System.Drawing.Point(104, 57);
+            this.textBox7.Name = "textBox7";
+            this.textBox7.Size = new System.Drawing.Size(110, 28);
+            this.textBox7.TabIndex = 5;
+            // 
+            // textBox8
+            // 
+            this.textBox8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.textBox8.Location = new System.Drawing.Point(104, 27);
+            this.textBox8.Name = "textBox8";
+            this.textBox8.Size = new System.Drawing.Size(110, 28);
+            this.textBox8.TabIndex = 6;
+            // 
+            // label52
+            // 
+            this.label52.AutoSize = true;
+            this.label52.Location = new System.Drawing.Point(7, 31);
+            this.label52.Name = "label52";
+            this.label52.Size = new System.Drawing.Size(76, 21);
+            this.label52.TabIndex = 0;
+            this.label52.Text = "TRIP里程";
+            // 
+            // label53
+            // 
+            this.label53.AutoSize = true;
+            this.label53.Location = new System.Drawing.Point(6, 61);
+            this.label53.Name = "label53";
+            this.label53.Size = new System.Drawing.Size(76, 21);
+            this.label53.TabIndex = 0;
+            this.label53.Text = "TRIP时间";
+            // 
+            // label54
+            // 
+            this.label54.AutoSize = true;
+            this.label54.Location = new System.Drawing.Point(6, 91);
+            this.label54.Name = "label54";
+            this.label54.Size = new System.Drawing.Size(80, 21);
+            this.label54.TabIndex = 0;
+            this.label54.Text = "ODO里程";
+            // 
+            // label55
+            // 
+            this.label55.AutoSize = true;
+            this.label55.Location = new System.Drawing.Point(6, 121);
+            this.label55.Name = "label55";
+            this.label55.Size = new System.Drawing.Size(86, 21);
+            this.label55.TabIndex = 0;
+            this.label55.Text = "ODOr时间";
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@@ -2005,7 +2449,7 @@ namespace Welling_Motor_Debug_Tool
             this.MaximizeBox = false;
             this.Name = "Form1";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "Welling中置电机调试工具V1.0.1";
+            this.Text = "Welling中置电机调试工具V1.0.2";
             this.Load += new System.EventHandler(this.Form1_Load);
             this.menuStrip_Set.ResumeLayout(false);
             this.menuStrip_Set.PerformLayout();
@@ -2040,6 +2484,17 @@ namespace Welling_Motor_Debug_Tool
             this.groupBox4.ResumeLayout(false);
             this.groupBox4.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+            this.tabPage_OBC.ResumeLayout(false);
+            this.groupBox10.ResumeLayout(false);
+            this.groupBox10.PerformLayout();
+            this.groupBox11.ResumeLayout(false);
+            this.groupBox11.PerformLayout();
+            this.groupBox12.ResumeLayout(false);
+            this.groupBox13.ResumeLayout(false);
+            this.groupBox14.ResumeLayout(false);
+            this.groupBox14.PerformLayout();
+            this.groupBox15.ResumeLayout(false);
+            this.groupBox15.PerformLayout();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -2051,7 +2506,6 @@ namespace Welling_Motor_Debug_Tool
         private ToolStripMenuItem 端口号ToolStripMenuItem;
         private ToolStripMenuItem 波特率ToolStripMenuItem;
         private ToolStripMenuItem 工具箱ToolStripMenuItem;
-        private ToolStripMenuItem 显示曲线ToolStripMenuItem;
         private ToolStripMenuItem 记录数据ToolStripMenuItem;
         private ToolStripMenuItem 一键查询ToolStripMenuItem;
         private ToolStripMenuItem 关于ToolStripMenuItem;
@@ -2152,11 +2606,9 @@ namespace Welling_Motor_Debug_Tool
         private Button button_ReadSensorParam;
         private RichTextBox richTextBox_SensorParam;
         private Label label25;
-        private TextBox textBox_AssistNum;
         private PictureBox pictureBox1;
         private TextBox textBox_Load;
         private Label label27;
-        private TextBox textBox_LoadNum;
         private Label label26;
         private Label label29;
         private GroupBox groupBox4;
@@ -2216,5 +2668,43 @@ namespace Welling_Motor_Debug_Tool
         private Label label44;
         private Label label45;
         private Label label46;
+        private Label label47;
+        private ComboBox comboBox_AssistTorque;
+        private ComboBox comboBox_AssistCadence;
+        private ComboBox comboBox_TorqueSet;
+        private TabPage tabPage_OBC;
+        private CheckBox checkBox1;
+        public ComboBox comboBox1;
+        private GroupBox groupBox15;
+        private TextBox textBox5;
+        private Button button3;
+        private TextBox textBox6;
+        private Button button4;
+        private Label label55;
+        private TextBox textBox7;
+        private Label label54;
+        private TextBox textBox8;
+        private Label label52;
+        private Label label53;
+        private GroupBox groupBox14;
+        private Button button2;
+        private TextBox textBox1;
+        private TextBox textBox2;
+        private TextBox textBox3;
+        private Label label48;
+        private Label label49;
+        private TextBox textBox4;
+        private Label label50;
+        private Label label51;
+        private GroupBox groupBox13;
+        private RichTextBox richTextBox3;
+        private Button button6;
+        private GroupBox groupBox12;
+        private RichTextBox richTextBox2;
+        private Button button1;
+        private GroupBox groupBox11;
+        private RichTextBox richTextBox1;
+        private CheckBox checkBox3;
+        private GroupBox groupBox10;
     }
 }

+ 146 - 51
Welling_Motor_Debug_Tool/Form1.cs

@@ -53,7 +53,7 @@ namespace Welling_Motor_Debug_Tool
             //创建定时器,定时读取串口数据
             System.Timers.Timer timer_ReadSerial = new System.Timers.Timer();
             timer_ReadSerial.Enabled = true;
-            timer_ReadSerial.Interval = 50;
+            timer_ReadSerial.Interval = 20;
             timer_ReadSerial.Elapsed += new System.Timers.ElapsedEventHandler(this.timer_ReadSerial_Tick);
             timer_ReadSerial.Start();
             while (true)
@@ -364,7 +364,7 @@ namespace Welling_Motor_Debug_Tool
                             }
                             break;
                         }
-                    case 0xB528://控制器参数
+                    case 0xB528://传感器参数
                         {
                             unchecked
                             {
@@ -380,16 +380,30 @@ namespace Welling_Motor_Debug_Tool
                             }
                             break;
                         }
-                    case 0xB668://助力参数
+                    case 0xB64C://助力参数
                         {
                             unchecked
                             {
                                 this.Invoke((EventHandler)(delegate
                                 {
                                     richTextBox_AssistParam.Clear();
+                                    int index_1 = myParams.AssistParam.IndexOf("转矩曲线.a");
+                                    int index_2 = myParams.AssistParam.IndexOf("踏频曲线.d");
                                     for (int i = 0; i < myParams.AssistParam.Count; i++)
                                     {
-                                        richTextBox_AssistParam.AppendText(myParams.AssistParam[i] + "=" + Convert.ToString(Data[2 * i + 1] * 256 + Data[2 * i]) + ", ");
+                                        if (i < index_1) //数据占用2bytes
+                                        {
+                                            richTextBox_AssistParam.AppendText(myParams.AssistParam[i] + "=" + Convert.ToString(Data[2 * i + 1] * 256 + Data[2 * i]) + ", ");
+                                        }
+                                        else if (i <= index_2) //数据占用4bytes
+                                        {
+                                            richTextBox_AssistParam.AppendText(myParams.AssistParam[i] + "=" + Convert.ToString((Data[4 * i - 5] << 24) + (Data[4 * i - 6] << 16) + (Data[4 * i - 7] << 8) + Data[4 * i - 8]) + ", ");
+                                        }
+                                        else //数据占用2bytes
+                                        {
+                                            richTextBox_AssistParam.AppendText(myParams.AssistParam[i] + "=" + Convert.ToString(Data[2 * i + 17] * 256 + Data[2 * i + 16]) + ", ");
+                                        }
+
                                     }
                                     richTextBox_AssistParam.Text = richTextBox_AssistParam.Text.Substring(0, richTextBox_AssistParam.Text.Length - 2);
                                 }));
@@ -682,40 +696,6 @@ namespace Welling_Motor_Debug_Tool
             toolStripComboBox_ComNum.SelectedIndex = toolStripComboBox_ComNum.Items.Count > 0 ? 0 : -1;
         }
 
-        /// <summary>
-        /// 工作模式选择事件
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void comboBox_WorkMode_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            var RunMode = new byte[1];
-            if (comboBox_WorkMode.Text == "配置模式")
-                RunMode[0] = 0x01;
-            else
-                RunMode[0] = 0x00;
-            mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x1901, RunMode);
-        }
-
-        /// <summary>
-        /// 助力档位选择事件
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void comboBox_GearSt_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            var CtrlCode = new byte[2];
-            if (comboBox_GearSt.SelectedIndex == 6)//档位
-                CtrlCode[0] = 0x22;
-            else
-                CtrlCode[0] = (byte)comboBox_GearSt.SelectedIndex;
-            if (comboBox_LightSwitch.SelectedIndex == 0)//车灯
-                CtrlCode[1] = 0xF1;
-            else
-                CtrlCode[1] = 0xF0;
-            mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2802, CtrlCode);
-        }
-
         /// <summary>
         /// 转速调节事件
         /// </summary>
@@ -952,20 +932,23 @@ namespace Welling_Motor_Debug_Tool
         /// <param name="e"></param>
         private void button_ReadAssistParam_Click(object sender, EventArgs e)
         {
-            var ConfigParam = new byte[2];
+            var ConfigParam = new byte[4];
             int AssistNum = 0;
             try
             {
-                AssistNum = Convert.ToInt32(textBox_AssistNum.Text);
-                richTextBox_AssistParam.Clear();
+                AssistNum = Convert.ToInt32(comboBox_AssistTorque.Text);
                 ConfigParam[0] = (byte)(AssistNum & 0xFF);
                 ConfigParam[1] = (byte)(AssistNum >> 8);
-                mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4302, ConfigParam);
+                AssistNum = Convert.ToInt32(comboBox_AssistCadence.Text);
+                ConfigParam[2] = (byte)(AssistNum & 0xFF);
+                ConfigParam[3] = (byte)(AssistNum >> 8);
+                richTextBox_AssistParam.Clear();
+                mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4304, ConfigParam);
             }
             catch (Exception)
             {
                 timer_1s.Enabled = false;
-                MessageBox.Show("助力参数编号格式不对","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
+                MessageBox.Show("请选择助力参数编号!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
                 timer_1s.Enabled = true;
             }
             
@@ -978,21 +961,53 @@ namespace Welling_Motor_Debug_Tool
         /// <param name="e"></param>
         private void button_WriteAssistParam_Click(object sender, EventArgs e)
         {
-            var ConfigParam = new byte[106];
-            for (int i = 0; i < 106; i++)
+            var ConfigParam = new byte[80];
+            for (int i = 0; i < 80; i++)
                 ConfigParam[i] = 0;
             ConfigParam[0] = (byte)((写入存储ToolStripMenuItem.Checked) ? 0x01 : 0x00);
-            ushort uwDataTemp = 0;
+            ulong ulDataTemp = 0;
             string[] strDataTemp = richTextBox_AssistParam.Text.Split(new string[] { ", " }, StringSplitOptions.None);
+            int index_1 = 0, index_2 = 0;
             try
             {
                 for (int i = 0; i < strDataTemp.Length; i++)
                 {
-                    uwDataTemp = Convert.ToUInt16(strDataTemp[i].Split('=')[1]);
-                    ConfigParam[2 * i + 2] = (byte)uwDataTemp;
-                    ConfigParam[2 * i + 3] = (byte)(uwDataTemp >> 8);
+                    if (strDataTemp[i].Split('=')[0] == "转矩曲线.a")
+                    {
+                        index_1 = i;
+                        break;
+                    }                       
+                }
+                for (int i = 0; i < strDataTemp.Length; i++)
+                {
+                    if (strDataTemp[i].Split('=')[0] == "踏频曲线.d")
+                    {
+                        index_2 = i;
+                        break;
+                    }                    
                 }
-                mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x446A, ConfigParam);
+                for (int i = 0; i < strDataTemp.Length; i++)
+                {
+                    ulDataTemp = Convert.ToUInt32(strDataTemp[i].Split('=')[1]);
+                    if (i < index_1)
+                    {
+                        ConfigParam[2 * i + 4] = (byte)ulDataTemp;
+                        ConfigParam[2 * i + 5] = (byte)(ulDataTemp >> 8);
+                    }
+                    else if (i <= index_2)
+                    {
+                        ConfigParam[4 * i - 4] = (byte)ulDataTemp;
+                        ConfigParam[4 * i - 3] = (byte)(ulDataTemp >> 8);
+                        ConfigParam[4 * i - 2] = (byte)(ulDataTemp >> 16);
+                        ConfigParam[4 * i - 1] = (byte)(ulDataTemp >> 24);
+                    }
+                    else
+                    {
+                        ConfigParam[2 * i + 20] = (byte)ulDataTemp;
+                        ConfigParam[2 * i + 21] = (byte)(ulDataTemp >> 8);
+                    }  
+                }
+                mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4450, ConfigParam);
             }
             catch (Exception)
             {
@@ -1079,7 +1094,7 @@ namespace Welling_Motor_Debug_Tool
             ushort uwDataTemp = 0;
             try
             {
-                uwDataTemp = Convert.ToUInt16(textBox_LoadNum.Text);//负载序号
+                uwDataTemp = Convert.ToUInt16(comboBox_TorqueSet.Text);//负载序号
                 ConfigParam[0] = (byte)(uwDataTemp & 0xFF);
                 ConfigParam[1] = (byte)(uwDataTemp >> 8);
                 uwDataTemp = (ushort)(decimal.Parse(textBox_Load.Text) * 10); ;//负载值0.1Nm
@@ -1670,5 +1685,85 @@ namespace Welling_Motor_Debug_Tool
             }
 
         }
+
+        /// <summary>
+        /// 修改写入的助力力矩曲线编号
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void comboBox_AssistTorque_SelectionChangeCommitted(object sender, EventArgs e)
+        {
+            try
+            {
+                int DataNum = Convert.ToInt32(comboBox_AssistTorque.Text);
+                int index_1 = richTextBox_AssistParam.Text.IndexOf("助力转矩曲线编号=") + "助力转矩曲线编号=".Length;
+                int index_2 = richTextBox_AssistParam.Text.IndexOf("助力踏频曲线编号");
+                richTextBox_AssistParam.Select(index_1, index_2 - index_1);
+                richTextBox_AssistParam.SelectedText = Convert.ToString(DataNum) + ", ";
+            }
+            catch (Exception)
+            {
+                timer_1s.Enabled = false;
+                MessageBox.Show("数据格式不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                timer_1s.Enabled = true;
+            }
+        }
+
+        /// <summary>
+        /// 修改写入的助力踏频曲线编号
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void comboBox_AssistCadence_SelectionChangeCommitted(object sender, EventArgs e)
+        {
+            try
+            {
+                int DataNum = Convert.ToInt32(comboBox_AssistCadence.Text);
+                int index_1 = richTextBox_AssistParam.Text.IndexOf("助力踏频曲线编号=") + "助力踏频曲线编号=".Length;
+                int index_2 = richTextBox_AssistParam.Text.IndexOf("转矩曲线.a");
+                richTextBox_AssistParam.Select(index_1, index_2 - index_1);
+                richTextBox_AssistParam.SelectedText = Convert.ToString(DataNum) + ", ";
+            }
+            catch (Exception)
+            {
+                timer_1s.Enabled = false;
+                MessageBox.Show("数据格式不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                timer_1s.Enabled = true;
+            }
+        }
+
+        /// <summary>
+        /// 工作模式选择事件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void comboBox_WorkMode_SelectionChangeCommitted(object sender, EventArgs e)
+        {
+            var RunMode = new byte[1];
+            if (comboBox_WorkMode.Text == "配置模式")
+                RunMode[0] = 0x01;
+            else
+                RunMode[0] = 0x00;
+            mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x1901, RunMode);
+        }
+
+        /// <summary>
+        /// 助力档位选择事件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void comboBox_GearSt_SelectionChangeCommitted(object sender, EventArgs e)
+        {
+            var CtrlCode = new byte[2];
+            if (comboBox_GearSt.SelectedIndex == 6)//档位
+                CtrlCode[0] = 0x22;
+            else
+                CtrlCode[0] = (byte)comboBox_GearSt.SelectedIndex;
+            if (comboBox_LightSwitch.SelectedIndex == 0)//车灯
+                CtrlCode[1] = 0xF1;
+            else
+                CtrlCode[1] = 0xF0;
+            mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x2802, CtrlCode);
+        }
     }
 }

+ 5 - 18
Welling_Motor_Debug_Tool/Params.cs

@@ -14,24 +14,11 @@ namespace Welling_Motor_Debug_Tool
                                                            "助力方案1", "助力方案2" };
         public List<string> ControlParma = new List<string> {"位置传感器零点","位置传感器当前零点","峰值电流","电流保护阈值","最高档电压保护阈值","最高档欠压保护阈值",
                                                              "超速保护阈值","温度保护阈值","温度保护恢复阈值","温度降额启动阈值"};
-        public List<string> AssistParam = new List<string> { "零速启动增益", "巡航启动增益", "助力曲线编号", "档位一.转矩曲线.a.H (整数部分) ",
-                                                             "档位一.转矩曲线.a.L (小数部分) ", "档位一.转矩曲线.b.H(整数部分) ",
-                                                             "档位一.转矩曲线.b.L(小数部分) ", "档位一.转矩曲线.c.H(整数部分) ",
-                                                             "档位一.转矩曲线.c.L(小数部分) ", "档位二.转矩曲线.a.H(整数部分) ",
-                                                             "档位二.转矩曲线.a.L(小数部分) ", "档位二.转矩曲线.b.H(整数部分) ",
-                                                             "档位二.转矩曲线.b.L(小数部分) ", "档位二.转矩曲线.c.H(整数部分) ",
-                                                             "档位二.转矩曲线.c.L(小数部分) ", "档位三.转矩曲线.a.H(整数部分) ",
-                                                             "档位三.转矩曲线.a.L(小数部分) ", "档位三.转矩曲线.b.H(整数部分) ",
-                                                             "档位三.转矩曲线.b.L(小数部分) ", "档位三.转矩曲线.c.H(整数部分) ",
-                                                             "档位三.转矩曲线.c.L(小数部分) ", "档位四.转矩曲线.a.H(整数部分) ",
-                                                             "档位四.转矩曲线.a.L(小数部分) ", "档位四.转矩曲线.b.H(整数部分) ",
-                                                             "档位四.转矩曲线.b.L(小数部分) ", "档位四.转矩曲线.c.H(整数部分) ",
-                                                             "档位四.转矩曲线.c.L(小数部分) ", "档位五.转矩曲线.a.H(整数部分) ",
-                                                             "档位五.转矩曲线.a.L(小数部分) ", "档位五.转矩曲线.b.H(整数部分) ",
-                                                             "档位五.转矩曲线.b.L(小数部分) ", "档位五.转矩曲线.c.H(整数部分) ",
-                                                             "档位五.转矩曲线.c.L(小数部分) ", "全档位.踏频曲线.a", "全档位.踏频曲线.b",
-                                                             "全档位.踏频曲线.c", "助力启动阈值", "助力停止阈值", "启动时电流增长阶梯",
-                                                             "启动对应踏频圈数", "转矩滤波对应踏频脉冲数", "待速转速", "待速最大电流",
+        public List<string> AssistParam = new List<string> { "零速启动增益", "巡航启动增益", "助力转矩曲线编号", "助力踏频曲线编号",
+                                                             "转矩曲线.a", "转矩曲线.b","转矩曲线.c","转矩曲线.d",
+                                                             "踏频曲线.a", "踏频曲线.b","踏频曲线.c","踏频曲线.d",
+                                                             "助力启动阈值", "助力停止阈值", "启动时电流增长阶梯",
+                                                             "启动对应踏频脉冲数", "转矩滤波对应踏频脉冲数", "待速转速", "待速最大电流",
                                                              "车速限幅启动阈值", "车速限幅停止阈值" };
         public List<string> DebugParam = new List<string> { "转速指令","整体运行模式(电机、整机、MTB、CTB) ","位置获取模式",
                                                             "磁链观测器带宽","磁链观测器m","惯量","电流环控制器带宽","电流环控制器m",

BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool.exe


BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool.pdb


BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool_202205251934.exe


BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool_202205271411.exe


BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool_202205271934.exe


BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


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

@@ -9,3 +9,14 @@ D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\Welling_M
 D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe
 D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.pdb
 D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Form1.resources
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe.config
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.pdb
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.AssemblyReference.cache
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.SuggestedBindingRedirects.cache
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Form1.resources
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Properties.Resources.resources
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.GenerateResource.cache
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe
+D:\SoftDesign\20171216_PC_MortorTest\MOTINOVA_MC_Test\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.pdb

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