Pārlūkot izejas kodu

1、整车信息中增加前后灯电压设置;
2、增加修改力矩传感器参数相关指令。

dail 3 gadi atpakaļ
vecāks
revīzija
a970a8b7f6

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 49 - 35
Welling_Motor_Debug_Tool/Form1.Designer.cs

@@ -247,6 +247,7 @@ 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.button_WriteTqSensorParam = new System.Windows.Forms.Button();
             this.menuStrip_Set.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -309,7 +310,7 @@ namespace Welling_Motor_Debug_Tool
             // 刷新ToolStripMenuItem
             // 
             this.刷新ToolStripMenuItem.Name = "刷新ToolStripMenuItem";
-            this.刷新ToolStripMenuItem.Size = new System.Drawing.Size(128, 26);
+            this.刷新ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.刷新ToolStripMenuItem.Text = "刷新";
             this.刷新ToolStripMenuItem.Click += new System.EventHandler(this.刷新ToolStripMenuItem_Click);
             // 
@@ -318,7 +319,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(128, 26);
+            this.端口号ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.端口号ToolStripMenuItem.Text = "端口号";
             // 
             // toolStripComboBox_ComNum
@@ -334,7 +335,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(128, 26);
+            this.波特率ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.波特率ToolStripMenuItem.Text = "波特率";
             // 
             // toolStripComboBox_Baudrate
@@ -352,7 +353,7 @@ namespace Welling_Motor_Debug_Tool
             // 连接ToolStripMenuItem
             // 
             this.连接ToolStripMenuItem.Name = "连接ToolStripMenuItem";
-            this.连接ToolStripMenuItem.Size = new System.Drawing.Size(128, 26);
+            this.连接ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.连接ToolStripMenuItem.Text = "连接";
             this.连接ToolStripMenuItem.Click += new System.EventHandler(this.连接ToolStripMenuItem_Click);
             // 
@@ -368,7 +369,7 @@ namespace Welling_Motor_Debug_Tool
             // 写入存储ToolStripMenuItem
             // 
             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 = "存储执行";
             this.写入存储ToolStripMenuItem.Click += new System.EventHandler(this.写入存储ToolStripMenuItem_Click);
             // 
@@ -386,20 +387,20 @@ namespace Welling_Motor_Debug_Tool
             // 记录数据ToolStripMenuItem
             // 
             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 = "记录数据";
             this.记录数据ToolStripMenuItem.Click += new System.EventHandler(this.记录数据ToolStripMenuItem_Click);
             // 
             // 一键查询ToolStripMenuItem
             // 
             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 = "一键查询";
             // 
             // 计算器ToolStripMenuItem
             // 
             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 = "计算器";
             this.计算器ToolStripMenuItem.Click += new System.EventHandler(this.计算器ToolStripMenuItem_Click);
             // 
@@ -416,13 +417,13 @@ namespace Welling_Motor_Debug_Tool
             // 帮助ToolStripMenuItem
             // 
             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 = "查看帮助";
             // 
             // 版本ToolStripMenuItem
             // 
             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 = "版本信息";
             // 
             // statusStrip1
@@ -464,7 +465,7 @@ namespace Welling_Motor_Debug_Tool
             // label24
             // 
             this.label24.AutoSize = true;
-            this.label24.Location = new System.Drawing.Point(150, 152);
+            this.label24.Location = new System.Drawing.Point(161, 152);
             this.label24.Name = "label24";
             this.label24.Size = new System.Drawing.Size(24, 21);
             this.label24.TabIndex = 6;
@@ -481,7 +482,7 @@ namespace Welling_Motor_Debug_Tool
             0});
             this.numericUpDown_SpeedAdj.Name = "numericUpDown_SpeedAdj";
             this.numericUpDown_SpeedAdj.ReadOnly = true;
-            this.numericUpDown_SpeedAdj.Size = new System.Drawing.Size(59, 28);
+            this.numericUpDown_SpeedAdj.Size = new System.Drawing.Size(73, 28);
             this.numericUpDown_SpeedAdj.TabIndex = 5;
             this.numericUpDown_SpeedAdj.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             this.numericUpDown_SpeedAdj.Value = new decimal(new int[] {
@@ -511,7 +512,7 @@ namespace Welling_Motor_Debug_Tool
             "OFF"});
             this.comboBox_LightSwitch.Location = new System.Drawing.Point(85, 109);
             this.comboBox_LightSwitch.Name = "comboBox_LightSwitch";
-            this.comboBox_LightSwitch.Size = new System.Drawing.Size(89, 29);
+            this.comboBox_LightSwitch.Size = new System.Drawing.Size(100, 29);
             this.comboBox_LightSwitch.TabIndex = 3;
             this.comboBox_LightSwitch.SelectionChangeCommitted += new System.EventHandler(this.comboBox_GearSt_SelectionChangeCommitted);
             // 
@@ -540,7 +541,7 @@ namespace Welling_Motor_Debug_Tool
             "Walk"});
             this.comboBox_GearSt.Location = new System.Drawing.Point(85, 70);
             this.comboBox_GearSt.Name = "comboBox_GearSt";
-            this.comboBox_GearSt.Size = new System.Drawing.Size(89, 29);
+            this.comboBox_GearSt.Size = new System.Drawing.Size(100, 29);
             this.comboBox_GearSt.TabIndex = 1;
             this.comboBox_GearSt.SelectionChangeCommitted += new System.EventHandler(this.comboBox_GearSt_SelectionChangeCommitted);
             // 
@@ -555,7 +556,7 @@ namespace Welling_Motor_Debug_Tool
             "配置模式"});
             this.comboBox_WorkMode.Location = new System.Drawing.Point(85, 31);
             this.comboBox_WorkMode.Name = "comboBox_WorkMode";
-            this.comboBox_WorkMode.Size = new System.Drawing.Size(89, 29);
+            this.comboBox_WorkMode.Size = new System.Drawing.Size(100, 29);
             this.comboBox_WorkMode.TabIndex = 1;
             this.comboBox_WorkMode.SelectionChangeCommitted += new System.EventHandler(this.comboBox_WorkMode_SelectionChangeCommitted);
             // 
@@ -1129,6 +1130,7 @@ 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.button_WriteTqSensorParam);
             this.tabPage_SensorParam.Controls.Add(this.comboBox_TorqueSet);
             this.tabPage_SensorParam.Controls.Add(this.label29);
             this.tabPage_SensorParam.Controls.Add(this.textBox_Load);
@@ -1155,15 +1157,15 @@ namespace Welling_Motor_Debug_Tool
             "2",
             "3",
             "4"});
-            this.comboBox_TorqueSet.Location = new System.Drawing.Point(820, 38);
+            this.comboBox_TorqueSet.Location = new System.Drawing.Point(861, 12);
             this.comboBox_TorqueSet.Name = "comboBox_TorqueSet";
-            this.comboBox_TorqueSet.Size = new System.Drawing.Size(89, 29);
+            this.comboBox_TorqueSet.Size = new System.Drawing.Size(59, 29);
             this.comboBox_TorqueSet.TabIndex = 9;
             // 
             // label29
             // 
             this.label29.BackColor = System.Drawing.Color.Silver;
-            this.label29.Location = new System.Drawing.Point(808, 192);
+            this.label29.Location = new System.Drawing.Point(808, 146);
             this.label29.Name = "label29";
             this.label29.Size = new System.Drawing.Size(112, 1);
             this.label29.TabIndex = 7;
@@ -1171,38 +1173,38 @@ namespace Welling_Motor_Debug_Tool
             // textBox_Load
             // 
             this.textBox_Load.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
-            this.textBox_Load.Location = new System.Drawing.Point(808, 97);
+            this.textBox_Load.Location = new System.Drawing.Point(861, 52);
             this.textBox_Load.Name = "textBox_Load";
-            this.textBox_Load.Size = new System.Drawing.Size(112, 28);
+            this.textBox_Load.Size = new System.Drawing.Size(59, 28);
             this.textBox_Load.TabIndex = 6;
             this.textBox_Load.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             // 
             // label27
             // 
             this.label27.AutoSize = true;
-            this.label27.Location = new System.Drawing.Point(827, 70);
+            this.label27.Location = new System.Drawing.Point(808, 45);
             this.label27.Name = "label27";
-            this.label27.Size = new System.Drawing.Size(74, 21);
+            this.label27.Size = new System.Drawing.Size(42, 42);
             this.label27.TabIndex = 5;
-            this.label27.Text = "负载N.m";
+            this.label27.Text = "负载\r\nN.m";
             // 
             // label26
             // 
             this.label26.AutoSize = true;
-            this.label26.Location = new System.Drawing.Point(827, 9);
+            this.label26.Location = new System.Drawing.Point(808, 16);
             this.label26.Name = "label26";
-            this.label26.Size = new System.Drawing.Size(74, 21);
+            this.label26.Size = new System.Drawing.Size(42, 21);
             this.label26.TabIndex = 3;
-            this.label26.Text = "标定序号";
+            this.label26.Text = "序号";
             // 
             // button_Write_Cal
             // 
-            this.button_Write_Cal.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
-            this.button_Write_Cal.Location = new System.Drawing.Point(808, 131);
+            this.button_Write_Cal.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128)))));
+            this.button_Write_Cal.Location = new System.Drawing.Point(808, 92);
             this.button_Write_Cal.Name = "button_Write_Cal";
             this.button_Write_Cal.Size = new System.Drawing.Size(112, 50);
             this.button_Write_Cal.TabIndex = 2;
-            this.button_Write_Cal.Text = "写入标定值";
+            this.button_Write_Cal.Text = "力矩传感器标定";
             this.button_Write_Cal.UseVisualStyleBackColor = false;
             this.button_Write_Cal.Click += new System.EventHandler(this.button_Write_Cal_Click);
             // 
@@ -1213,14 +1215,14 @@ namespace Welling_Motor_Debug_Tool
             this.button_WriteSensorParam.Name = "button_WriteSensorParam";
             this.button_WriteSensorParam.Size = new System.Drawing.Size(112, 50);
             this.button_WriteSensorParam.TabIndex = 2;
-            this.button_WriteSensorParam.Text = "写入参数";
+            this.button_WriteSensorParam.Text = "写入其它传感器参数";
             this.button_WriteSensorParam.UseVisualStyleBackColor = false;
             this.button_WriteSensorParam.Click += new System.EventHandler(this.button_WriteSensorParam_Click);
             // 
             // button_ReadSensorParam
             // 
             this.button_ReadSensorParam.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.button_ReadSensorParam.Location = new System.Drawing.Point(808, 203);
+            this.button_ReadSensorParam.Location = new System.Drawing.Point(808, 151);
             this.button_ReadSensorParam.Name = "button_ReadSensorParam";
             this.button_ReadSensorParam.Size = new System.Drawing.Size(112, 50);
             this.button_ReadSensorParam.TabIndex = 2;
@@ -1481,7 +1483,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             // button_Recovery
             // 
-            this.button_Recovery.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
+            this.button_Recovery.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
             this.button_Recovery.Location = new System.Drawing.Point(168, 26);
             this.button_Recovery.Name = "button_Recovery";
             this.button_Recovery.Size = new System.Drawing.Size(100, 60);
@@ -1492,7 +1494,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             // button_ClearLog
             // 
-            this.button_ClearLog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
+            this.button_ClearLog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
             this.button_ClearLog.Location = new System.Drawing.Point(168, 90);
             this.button_ClearLog.Name = "button_ClearLog";
             this.button_ClearLog.Size = new System.Drawing.Size(100, 60);
@@ -1538,7 +1540,7 @@ namespace Welling_Motor_Debug_Tool
             // button_ReadOnLine
             // 
             this.button_ReadOnLine.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.button_ReadOnLine.Location = new System.Drawing.Point(237, 24);
+            this.button_ReadOnLine.Location = new System.Drawing.Point(244, 24);
             this.button_ReadOnLine.Name = "button_ReadOnLine";
             this.button_ReadOnLine.Size = new System.Drawing.Size(50, 29);
             this.button_ReadOnLine.TabIndex = 2;
@@ -2502,7 +2504,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.pictureBox1.BackColor = System.Drawing.Color.DodgerBlue;
             this.pictureBox1.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Welling_Log;
-            this.pictureBox1.Location = new System.Drawing.Point(876, 1);
+            this.pictureBox1.Location = new System.Drawing.Point(882, 1);
             this.pictureBox1.Name = "pictureBox1";
             this.pictureBox1.Size = new System.Drawing.Size(91, 28);
             this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -2577,6 +2579,17 @@ namespace Welling_Motor_Debug_Tool
             this.label46.Size = new System.Drawing.Size(1, 15);
             this.label46.TabIndex = 15;
             // 
+            // button_WriteTqSensorParam
+            // 
+            this.button_WriteTqSensorParam.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
+            this.button_WriteTqSensorParam.Location = new System.Drawing.Point(808, 205);
+            this.button_WriteTqSensorParam.Name = "button_WriteTqSensorParam";
+            this.button_WriteTqSensorParam.Size = new System.Drawing.Size(112, 50);
+            this.button_WriteTqSensorParam.TabIndex = 10;
+            this.button_WriteTqSensorParam.Text = "写入力矩传感器参数";
+            this.button_WriteTqSensorParam.UseVisualStyleBackColor = false;
+            this.button_WriteTqSensorParam.Click += new System.EventHandler(this.button_WriteTqSensorParam_Click);
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@@ -2874,5 +2887,6 @@ namespace Welling_Motor_Debug_Tool
         public ComboBox comboBox_OBC_LightSw;
         private Label label61;
         private Label label62;
+        private Button button_WriteTqSensorParam;
     }
 }

+ 64 - 14
Welling_Motor_Debug_Tool/Form1.cs

@@ -35,6 +35,12 @@ namespace Welling_Motor_Debug_Tool
         {
             //页面初始化
             label_BuildTime.Text= "编译时间:"+ System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString();
+            //下拉控件初始值设定
+            comboBox_WorkMode.SelectedIndex = 0;
+            comboBox_GearSt.SelectedIndex = 0;
+            comboBox_LightSwitch.SelectedIndex = 1;
+            comboBox_OBC_SetGearST.SelectedIndex = 0;
+            comboBox_OBC_LightSw.SelectedIndex = 1;
             //端口设置
             mySerialProcess.Init();
             toolStripComboBox_ComNum.Items.AddRange(mySerialProcess.refreshPort());
@@ -222,11 +228,13 @@ namespace Welling_Motor_Debug_Tool
                                     {
                                         textBox_RunInfo_GearSt.Text = "Walk";
                                         comboBox_GearSt.SelectedIndex = 6;
+                                        comboBox_OBC_SetGearST.SelectedIndex = 6;
                                     }
                                     else
                                     {
                                         textBox_RunInfo_GearSt.Text = Convert.ToString(DataTemp);
                                         comboBox_GearSt.SelectedIndex = DataTemp;
+                                        comboBox_OBC_SetGearST.SelectedIndex = DataTemp;
                                     }
                                     //大灯状态
                                     DataTemp = (ushort)(Data[14]);
@@ -234,11 +242,13 @@ namespace Welling_Motor_Debug_Tool
                                     {
                                         textBox_RunInfo_LightSwitch.Text = "OFF";
                                         comboBox_LightSwitch.SelectedIndex = 1;
+                                        comboBox_OBC_LightSw.SelectedIndex = 1;
                                     }
                                     else if (DataTemp == 0xF1)
                                     {
                                         textBox_RunInfo_LightSwitch.Text = "ON";
                                         comboBox_LightSwitch.SelectedIndex = 0;
+                                        comboBox_OBC_LightSw.SelectedIndex = 0;
                                     }
                                     //剩余电量
                                     DataTemp = (ushort)(Data[15]);
@@ -1277,14 +1287,22 @@ namespace Welling_Motor_Debug_Tool
                 ConfigParam[i] = 0;
             ConfigParam[0] = (byte)((写入存储ToolStripMenuItem.Checked) ? 0x01 : 0x00);
             ushort uwDataTemp = 0;
-            //传感器参数只写入最后2项
-            richTextBox_SensorParam.Text = richTextBox_SensorParam.Text.Substring(richTextBox_SensorParam.Text.LastIndexOf(", ", richTextBox_SensorParam.Text.LastIndexOf(", ") - 1) + 2);
+            //力矩传感器参数只写入前面14项与力矩传感器相关的参数
             string[] strDataTemp = richTextBox_SensorParam.Text.Split(new string[] { ", " }, StringSplitOptions.None);
+            int index = 0;
             try
             {
                 for (int i = 0; i < strDataTemp.Length; i++)
                 {
-                    uwDataTemp = Convert.ToUInt16(strDataTemp[i].Split('=')[1]);
+                    if (strDataTemp[i].Split('=')[0] == "踏频传感器一圈脉冲数")
+                    {
+                        index = i;
+                        break;
+                    }
+                }
+                for (int i = 0; i < (strDataTemp.Length - index); i++)
+                {
+                    uwDataTemp = Convert.ToUInt16(strDataTemp[i + index].Split('=')[1]);
                     ConfigParam[2 * i + 2] = (byte)uwDataTemp;
                     ConfigParam[2 * i + 3] = (byte)(uwDataTemp >> 8);
                 }
@@ -1912,7 +1930,7 @@ namespace Welling_Motor_Debug_Tool
                 if (!mySerialProcess.mySerial.IsOpen)
                 {
                     timer_1s.Enabled = false;
-                    MessageBox.Show("请先连接串口!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                    MessageBox.Show("串口未连接!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     timer_1s.Enabled = true;
                     checkBox_OBC_StartSetGearSt.Checked = false;
                     return;
@@ -1926,15 +1944,6 @@ namespace Welling_Motor_Debug_Tool
                     checkBox_OBC_StartSetGearSt.Checked = false;
                     return;
                 }
-                //检查串口是否打开
-                if (!mySerialProcess.mySerial.IsOpen)
-                {
-                    timer_1s.Enabled = false;
-                    MessageBox.Show("请检查是否打开串口!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
-                    timer_1s.Enabled = true;
-                    checkBox_OBC_StartSetGearSt.Checked = false;
-                    return;
-                }
             }
         }
 
@@ -2045,12 +2054,53 @@ namespace Welling_Motor_Debug_Tool
                 if (!mySerialProcess.mySerial.IsOpen)
                 {
                     timer_1s.Enabled = false;
-                    MessageBox.Show("请检查是否打开串口!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                    MessageBox.Show("串口未连接!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     timer_1s.Enabled = true;
                     checkBox_OBC_StartReadBMS.Checked = false;
                     return;
                 }
             }
         }
+
+        /// <summary>
+        /// 写入力矩传感器参数
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void button_WriteTqSensorParam_Click(object sender, EventArgs e)
+        {
+            var ConfigParam = new byte[46];
+            for (int i = 0; i < 14; i++)
+                ConfigParam[i] = 0;
+            ConfigParam[0] = (byte)((写入存储ToolStripMenuItem.Checked) ? 0x01 : 0x00);
+            ushort uwDataTemp = 0;
+            //力矩传感器参数只写入前面14项与力矩传感器相关的参数
+            string[] strDataTemp = richTextBox_SensorParam.Text.Split(new string[] { ", " }, StringSplitOptions.None);
+            int index = 0;
+            try
+            {
+                for (int i = 0; i < strDataTemp.Length; i++)
+                {
+                    if (strDataTemp[i].Split('=')[0] == "第四阶段转矩点采集值")
+                    {
+                        index = i;
+                        break;
+                    }
+                }
+                for (int i = 0; i < (index + 1); i++)
+                {
+                    uwDataTemp = Convert.ToUInt16(strDataTemp[i].Split('=')[1]);
+                    ConfigParam[2 * i + 2] = (byte)uwDataTemp;
+                    ConfigParam[2 * i + 3] = (byte)(uwDataTemp >> 8);
+                }
+                mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x472E, ConfigParam);
+            }
+            catch (Exception)
+            {
+                timer_1s.Enabled = false;
+                MessageBox.Show("数据格式不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                timer_1s.Enabled = true;
+            }
+        }
     }
 }

+ 2 - 2
Welling_Motor_Debug_Tool/Params.cs

@@ -10,8 +10,8 @@ namespace Welling_Motor_Debug_Tool
     {
         public List<string> MotorParma = new List<string> { "极对数","电阻","d轴电感","q轴电感","永磁体磁链","Id最大值","Id最小值",
                                                             "额定转速","额定功率","额定电流","额定电压","惯量","最大转矩"};
-        public List<string> BikeParma = new List<string> { "轮径", "电控传动比", "助力最大限速", "推行模式限速", "前牙盘T数", "后牙盘T数", 
-                                                           "助力方案1", "助力方案2" };
+        public List<string> BikeParma = new List<string> { "轮径", "电控传动比", "助力最大限速", "推行模式限速", "前牙盘T数", "后牙盘T数",
+                                                           "助力方案1", "助力方案2", "前后灯电压" };
         public List<string> ControlParma = new List<string> {"位置传感器零点","位置传感器当前零点","峰值电流","电流保护阈值","最高档电压保护阈值","最高档欠压保护阈值",
                                                              "超速保护阈值","温度保护阈值","温度保护恢复阈值","温度降额启动阈值"};
         public List<string> AssistParam = new List<string> { "零速启动增益", "巡航启动增益", "助力转矩曲线编号", "助力踏频曲线编号",

BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool.pdb


BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool_202206211945.exe


BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


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