Quellcode durchsuchen

V2.5.3
1,生成参数功能增加VP电机;
2,电机类型增加中置VP电机,并修改对应的配置文件;
3,登录账户增加中置VP电机,测试时远程存储路径同步调整为MV_VP_TEST;
4,增加小牙盘标签格式;
5,针对小牙盘力矩传感器动态标定,发送加载指令后延迟2s读取标定数据;
6,针对中置电机基础功能检验时判断踏频值。

dd vor 3 Monaten
Ursprung
Commit
a12697df32

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 19 - 4
Welling_Motor_Debug_Tool/GenerateParams.Designer.cs

@@ -135,6 +135,7 @@
             this.radioButton_HUB_FCT = new System.Windows.Forms.RadioButton();
             this.checkBox_SyncFac = new System.Windows.Forms.CheckBox();
             this.groupBox6 = new System.Windows.Forms.GroupBox();
+            this.radioButton_VP = new System.Windows.Forms.RadioButton();
             this.tabControl1.SuspendLayout();
             this.tabPage_Simple.SuspendLayout();
             this.groupBox5.SuspendLayout();
@@ -1162,7 +1163,7 @@
             // 
             this.radioButton_HUB.AutoSize = true;
             this.radioButton_HUB.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
-            this.radioButton_HUB.Location = new System.Drawing.Point(16, 61);
+            this.radioButton_HUB.Location = new System.Drawing.Point(16, 94);
             this.radioButton_HUB.Name = "radioButton_HUB";
             this.radioButton_HUB.Size = new System.Drawing.Size(62, 25);
             this.radioButton_HUB.TabIndex = 24;
@@ -1283,7 +1284,7 @@
             // 
             this.radioButton_HUB_FCT.AutoSize = true;
             this.radioButton_HUB_FCT.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
-            this.radioButton_HUB_FCT.Location = new System.Drawing.Point(16, 92);
+            this.radioButton_HUB_FCT.Location = new System.Drawing.Point(16, 126);
             this.radioButton_HUB_FCT.Name = "radioButton_HUB_FCT";
             this.radioButton_HUB_FCT.Size = new System.Drawing.Size(98, 25);
             this.radioButton_HUB_FCT.TabIndex = 24;
@@ -1304,17 +1305,30 @@
             // 
             // groupBox6
             // 
+            this.groupBox6.Controls.Add(this.radioButton_VP);
             this.groupBox6.Controls.Add(this.radioButton_MIGIC);
             this.groupBox6.Controls.Add(this.radioButton_HUB);
             this.groupBox6.Controls.Add(this.radioButton_HUB_FCT);
             this.groupBox6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
-            this.groupBox6.Location = new System.Drawing.Point(868, 463);
+            this.groupBox6.Location = new System.Drawing.Point(868, 432);
             this.groupBox6.Name = "groupBox6";
-            this.groupBox6.Size = new System.Drawing.Size(149, 127);
+            this.groupBox6.Size = new System.Drawing.Size(149, 158);
             this.groupBox6.TabIndex = 29;
             this.groupBox6.TabStop = false;
             this.groupBox6.Text = "配置类型";
             // 
+            // radioButton_VP
+            // 
+            this.radioButton_VP.AutoSize = true;
+            this.radioButton_VP.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.radioButton_VP.Location = new System.Drawing.Point(16, 62);
+            this.radioButton_VP.Name = "radioButton_VP";
+            this.radioButton_VP.Size = new System.Drawing.Size(49, 25);
+            this.radioButton_VP.TabIndex = 25;
+            this.radioButton_VP.Text = "VP";
+            this.radioButton_VP.UseVisualStyleBackColor = true;
+            this.radioButton_VP.Click += new System.EventHandler(this.radioButton_VP_Click);
+            // 
             // GenerateParams
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@@ -1485,5 +1499,6 @@
         private System.Windows.Forms.RadioButton radioButton_HUB_FCT;
         private System.Windows.Forms.CheckBox checkBox_SyncFac;
         private System.Windows.Forms.GroupBox groupBox6;
+        private System.Windows.Forms.RadioButton radioButton_VP;
     }
 }

+ 23 - 7
Welling_Motor_Debug_Tool/GenerateParams.cs

@@ -30,7 +30,7 @@ namespace Welling_Motor_Debug_Tool
         //存储路径文件
         LocalInfo localInfo = new LocalInfo();
         //服务器配置
-        string IP, Port, User, PassWD, ModelPath, CfgPath;
+        string IP, Port, User, PassWD, ModelPath;
         //离线标志
         bool Offline_Flag = false;
         //FTP
@@ -133,6 +133,14 @@ namespace Welling_Motor_Debug_Tool
             comboBox_SysRunMode.Items.Add("MTB");
         }
 
+        private void radioButton_VP_Click(object sender, EventArgs e)
+        {
+            textBox_ProductTag.Text = "MM_MV1";
+            comboBox_SysRunMode.Items.Clear();
+            comboBox_SysRunMode.Items.Add("NONE");
+            comboBox_SysRunMode.Items.Add("力矩");            
+        }
+
         private void radioButton_HUB_Click(object sender, EventArgs e)
         {
             textBox_ProductTag.Text = "GF_250_1";
@@ -150,7 +158,7 @@ namespace Welling_Motor_Debug_Tool
 
         private void comboBox_SysRunMode_Click(object sender, EventArgs e)
         {
-            if ((radioButton_MIGIC.Checked | radioButton_HUB.Checked | radioButton_HUB_FCT.Checked) == false)
+            if ((radioButton_MIGIC.Checked | radioButton_VP.Checked | radioButton_HUB.Checked | radioButton_HUB_FCT.Checked) == false)
             {
                 MessageBox.Show("请选择产品类型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
@@ -979,7 +987,7 @@ namespace Welling_Motor_Debug_Tool
         private void button_ExportParams_Click(object sender, EventArgs e)
         {
             //检查
-            if ((radioButton_MIGIC.Checked | radioButton_HUB.Checked | radioButton_HUB_FCT.Checked) == false)
+            if ((radioButton_MIGIC.Checked | radioButton_VP.Checked | radioButton_HUB.Checked | radioButton_HUB_FCT.Checked) == false)
             {
                 MessageBox.Show("请选择产品类型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
@@ -1175,6 +1183,12 @@ namespace Welling_Motor_Debug_Tool
                         myFtp.MakeDir("MIGIC_TEST/cfg" + "/" + Date);
                     ServerPath = "MIGIC_TEST/cfg" + "/" + Date;
                 }
+                else if (radioButton_VP.Checked)
+                {
+                    if (!myFtp.DirectoryExist("MC_VP_TEST/cfg", Date))
+                        myFtp.MakeDir("MC_VP_TEST/cfg" + "/" + Date);
+                    ServerPath = "MC_VP_TEST/cfg" + "/" + Date;
+                }
                 else if (radioButton_HUB_FCT.Checked)
                 {
                     if (!myFtp.DirectoryExist("HUB_Control_FCT/cfg", Date))
@@ -1258,6 +1272,8 @@ namespace Welling_Motor_Debug_Tool
                         MosCalInfo.Add(sLine);
                     }
                     objReader.Close();
+                    int index_MosCal = Array.IndexOf(MosCalInfo.ToArray(), "[MosCalK]");
+                    int index_AngleCal = Array.IndexOf(MosCalInfo.ToArray(), "[AngleCal]");
                     //导入模板文件
                     NPOI.SS.UserModel.IWorkbook workbook = WorkbookFactory.Create(importExcelName);
                     //获取第一个工作薄
@@ -1360,19 +1376,19 @@ namespace Welling_Motor_Debug_Tool
                     //第22行,第2列轮胎周长,第10列MOS内阻校准1
                     row = sheet.GetRow(21);
                     row.GetCell(1).SetCellValue(lines[DicRowNum["[整车参数]"] + 2].Split(',')[1] + " cm");
-                    row.GetCell(9).SetCellValue(MosCalInfo[40].Split(':')[1].ToString().Replace(',', '-'));
+                    row.GetCell(9).SetCellValue(MosCalInfo[index_MosCal + 2].Split(':')[1].ToString().Replace(',', '-'));
                     //第23行,第2列传动比,第10列MOS内阻校准2
                     row = sheet.GetRow(22);
                     row.GetCell(1).SetCellValue(lines[DicRowNum["[整车参数]"] + 3].Split(',')[1]);
-                    row.GetCell(9).SetCellValue(MosCalInfo[41].Split(':')[1].ToString().Replace(',', '-'));
+                    row.GetCell(9).SetCellValue(MosCalInfo[index_MosCal + 3].Split(':')[1].ToString().Replace(',', '-'));
                     //第24行,第2列转把限速,第10列MOS内阻校准3
                     row = sheet.GetRow(23);
                     row.GetCell(1).SetCellValue(lines[DicRowNum["[整车参数]"] + 4].Split(',')[1] + " km/h");
-                    row.GetCell(9).SetCellValue(MosCalInfo[42].Split(':')[1].ToString().Replace(',', '-'));
+                    row.GetCell(9).SetCellValue(MosCalInfo[index_MosCal + 4].Split(':')[1].ToString().Replace(',', '-'));
                     //第25行,第2列推行限速,第10列位置校准零点偏差
                     row = sheet.GetRow(24);
                     row.GetCell(1).SetCellValue(lines[DicRowNum["[整车参数]"] + 5].Split(',')[1] + " km/h");
-                    row.GetCell(9).SetCellValue("± " + MosCalInfo[53].Split(':')[1].ToString());
+                    row.GetCell(9).SetCellValue("± " + MosCalInfo[index_AngleCal + 2].Split(':')[1].ToString());
                     //第26行,第2列前牙盘
                     row = sheet.GetRow(25);
                     row.GetCell(1).SetCellValue(lines[DicRowNum["[整车参数]"] + 6].Split(',')[1]);

+ 2 - 2
Welling_Motor_Debug_Tool/LocalInfo.cs

@@ -12,13 +12,13 @@ namespace Welling_Motor_Debug_Tool
         public string LocalDataPath = "C:\\Temp\\MotorTestTool\\DataLog\\"; //本地数据文件路径
         public string LocalLogPath = "C:\\Temp\\MotorTestTool\\Log\\"; //本地日志文件路径
         public string PC_InfoFileName = "PC_Info.txt";//计算机信息
-        public string ConfigFileName = "Config4.ttcfg"; //配置文件
+        public string ConfigFileName = "Config5.ttcfg"; //配置文件
         public string NoteFileName = "Note.txt";
         public string SerialNumFileName1 = "serial1";//测试流水号
         public string SerialNumFileName2 = "serial2";//检验流水号
         public string ToolsPath = "C:\\Temp\\MotorTestTool\\Tools";//工具路径
         public string TorqueSensorFileName = "TorqueSensor.ttcfg"; //配置文件
-        public string UsrFileName = "UserAccount2"; //登录配置文件
+        public string UsrFileName = "UserAccount3"; //登录配置文件
         public string CfgPathName = "cfg\\"; //配置目录
         public string WalkLogPathName = "funcTest\\"; //推行测试目录
         public string CheckPathName = "qcTest\\"; //检验目录

+ 4 - 2
Welling_Motor_Debug_Tool/Login.cs

@@ -34,8 +34,10 @@ namespace Welling_Motor_Debug_Tool
                 {
                     //设定账户密码
                     string info = "";
-                    info += "USER=中置量产写入,PASSWD=1;";
-                    info += "USER=中置量产检验,PASSWD=2;";
+                    info += "USER=中置MG量产写入,PASSWD=1;";
+                    info += "USER=中置MG量产检验,PASSWD=2;";
+                    info += "USER=中置VP量产写入,PASSWD=1;";
+                    info += "USER=中置VP量产检验,PASSWD=2;";
                     info += "USER=轮毂量产写入,PASSWD=3;";
                     info += "USER=轮毂量产检验,PASSWD=4;";
                     info += "USER=中置样机测试,PASSWD=5;";

+ 8 - 0
Welling_Motor_Debug_Tool/Version.cs

@@ -18,6 +18,14 @@ namespace Welling_Motor_Debug_Tool
         //修改记录
         string ChangeLog = "修改记录:\r\n" +
             "V" + mainForm.Version + "\r\n" +
+            "1,生成参数功能增加VP电机;\r\n"+
+            "2,电机类型增加中置VP电机,并修改对应的配置文件;\r\n"+
+            "3,登录账户增加中置VP电机,测试时远程存储路径同步调整为MV_VP_TEST;\r\n"+
+            "4,增加小牙盘标签格式;\r\n"+
+            "5,针对小牙盘力矩传感器动态标定,发送加载指令后延迟2s读取标定数据;\r\n"+
+            "6,针对中置电机基础功能检验时判断踏频值。\r\n"+
+            "\r\n" +
+            "V2.5.2\r\n" +
             "1,踏频检测记录窗口内最大值;\r\n" +
             "2,速度传感器检测等待时间改为5s。\r\n" +
             "\r\n" +

+ 27 - 17
Welling_Motor_Debug_Tool/mainForm.Designer.cs

@@ -72,7 +72,7 @@ namespace Welling_Motor_Debug_Tool
             this.产品标识ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripTextBox_MACPD = new System.Windows.Forms.ToolStripTextBox();
             this.电机类型ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.中置电机ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.中置电机MIGIC_ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.轮毂电机ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
             this.判断阈值ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -701,6 +701,7 @@ namespace Welling_Motor_Debug_Tool
             this.label124 = new System.Windows.Forms.Label();
             this.label46 = new System.Windows.Forms.Label();
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
+            this.中置电机VP_ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.menuStrip_Set.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -969,7 +970,7 @@ namespace Welling_Motor_Debug_Tool
             this.存储路径ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerPath});
             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_ServerPath
@@ -984,7 +985,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.重置ToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ControlText;
             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);
             // 
@@ -1009,7 +1010,7 @@ namespace Welling_Motor_Debug_Tool
             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
@@ -1025,7 +1026,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
@@ -1041,7 +1042,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
@@ -1057,7 +1058,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
@@ -1071,25 +1072,26 @@ namespace Welling_Motor_Debug_Tool
             // 电机类型ToolStripMenuItem
             // 
             this.电机类型ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.中置电机ToolStripMenuItem,
+            this.中置电机MIGIC_ToolStripMenuItem,
+            this.中置电机VP_ToolStripMenuItem,
             this.轮毂电机ToolStripMenuItem});
             this.电机类型ToolStripMenuItem.Name = "电机类型ToolStripMenuItem";
             this.电机类型ToolStripMenuItem.Size = new System.Drawing.Size(214, 26);
             this.电机类型ToolStripMenuItem.Text = "电机类型";
             // 
-            // 中置电机ToolStripMenuItem
+            // 中置电机MIGIC_ToolStripMenuItem
             // 
-            this.中置电机ToolStripMenuItem.Checked = true;
-            this.中置电机ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.中置电机ToolStripMenuItem.Name = "中置电机ToolStripMenuItem";
-            this.中置电机ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
-            this.中置电机ToolStripMenuItem.Text = "中置电机";
-            this.中置电机ToolStripMenuItem.Click += new System.EventHandler(this.中置电机ToolStripMenuItem_Click);
+            this.中置电机MIGIC_ToolStripMenuItem.Checked = true;
+            this.中置电机MIGIC_ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.中置电机MIGIC_ToolStripMenuItem.Name = "中置电机MIGIC_ToolStripMenuItem";
+            this.中置电机MIGIC_ToolStripMenuItem.Size = new System.Drawing.Size(225, 26);
+            this.中置电机MIGIC_ToolStripMenuItem.Text = "中置电机(MIGIC)";
+            this.中置电机MIGIC_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(225, 26);
             this.轮毂电机ToolStripMenuItem.Text = "轮毂电机";
             this.轮毂电机ToolStripMenuItem.Click += new System.EventHandler(this.轮毂电机ToolStripMenuItem_Click);
             // 
@@ -7992,6 +7994,13 @@ namespace Welling_Motor_Debug_Tool
             this.pictureBox2.TabIndex = 16;
             this.pictureBox2.TabStop = false;
             // 
+            // 中置电机VP_ToolStripMenuItem
+            // 
+            this.中置电机VP_ToolStripMenuItem.Name = "中置电机VP_ToolStripMenuItem";
+            this.中置电机VP_ToolStripMenuItem.Size = new System.Drawing.Size(225, 26);
+            this.中置电机VP_ToolStripMenuItem.Text = "中置电机(VP)";
+            this.中置电机VP_ToolStripMenuItem.Click += new System.EventHandler(this.中置电机小牙盘ToolStripMenuItem_Click);
+            // 
             // mainForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@@ -8563,7 +8572,7 @@ namespace Welling_Motor_Debug_Tool
         private ComboBox comboBox_CheckModeCfgFile;
         private ComboBox comboBox_CheckModeCfgDate;
         private ToolStripMenuItem 电机类型ToolStripMenuItem;
-        private ToolStripMenuItem 中置电机ToolStripMenuItem;
+        private ToolStripMenuItem 中置电机MIGIC_ToolStripMenuItem;
         private ToolStripMenuItem 轮毂电机ToolStripMenuItem;
         private CheckBox checkBox_FacLightTest;
         private CheckBox checkBox_FacBreakTest;
@@ -8801,5 +8810,6 @@ namespace Welling_Motor_Debug_Tool
         private DataGridViewTextBoxColumn 参数7;
         private DataGridViewTextBoxColumn 参数8;
         private Label label165;
+        private ToolStripMenuItem 中置电机VP_ToolStripMenuItem;
     }
 }

+ 258 - 74
Welling_Motor_Debug_Tool/mainForm.cs

@@ -19,6 +19,7 @@ using System.Threading;
 using System.Web;
 using System.Windows.Forms;
 using System.Xml.Linq;
+using static NPOI.POIFS.Crypt.CryptoFunctions;
 
 namespace Welling_Motor_Debug_Tool
 {
@@ -26,7 +27,7 @@ namespace Welling_Motor_Debug_Tool
     {
         #region 变量定义
         //版本号
-        public static string Version = "2.5.2";
+        public static string Version = "2.5.3";
         //串口实例
         Serial_Process mySerialProcess = new Serial_Process();
         string PortNumSave = "";
@@ -480,54 +481,67 @@ namespace Welling_Motor_Debug_Tool
                 //解析配置文件
                 try
                 {
+                    int index = -1;
                     //Port Set
-                    PortNumSave = array_CfgInfo[1].ToString().Split(':')[1];
-                    PortBaudrateSave = array_CfgInfo[2].ToString().Split(':')[1];
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[PortSet]");
+                    PortNumSave = array_CfgInfo[index + 1].ToString().Split(':')[1];
+                    PortBaudrateSave = array_CfgInfo[index + 2].ToString().Split(':')[1];
                     toolStripComboBox_ComNum.SelectedIndex = toolStripComboBox_ComNum.Items.IndexOf(PortNumSave);
                     toolStripComboBox_Baudrate.SelectedIndex = toolStripComboBox_Baudrate.Items.IndexOf(PortBaudrateSave);
-                    连接开机ToolStripMenuItem.Checked = (array_CfgInfo[3].ToString().Split(':')[1] == "True");
-                    断开关机ToolStripMenuItem.Checked = (array_CfgInfo[4].ToString().Split(':')[1] == "True");
-                    识别通讯盒ToolStripMenuItem.Checked = (array_CfgInfo[5].ToString().Split(':')[1] == "True");
+                    连接开机ToolStripMenuItem.Checked = (array_CfgInfo[index + 3].ToString().Split(':')[1] == "True");
+                    断开关机ToolStripMenuItem.Checked = (array_CfgInfo[index + 4].ToString().Split(':')[1] == "True");
+                    识别通讯盒ToolStripMenuItem.Checked = (array_CfgInfo[index + 5].ToString().Split(':')[1] == "True");
                     //Option
-                    写入存储ToolStripMenuItem.Checked = (array_CfgInfo[8].ToString().Split(':')[1] == "True");
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[Option]");
+                    写入存储ToolStripMenuItem.Checked = (array_CfgInfo[index + 1].ToString().Split(':')[1] == "True");
                     //Server Set
-                    toolStripTextBox_ServerPath.Text = array_CfgInfo[11].ToString().Split(':')[1];
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[ServerSet]");
+                    toolStripTextBox_ServerPath.Text = array_CfgInfo[index + 1].ToString().Split(':')[1];
                     //MacInfo
-                    toolStripTextBox_MAC.Text = array_CfgInfo[14].ToString().Split(':')[1];
-                    toolStripTextBoxMACAddr.Text = array_CfgInfo[15].ToString().Split(':')[1];
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[MacInfo]");
+                    toolStripTextBox_MAC.Text = array_CfgInfo[index + 1].ToString().Split(':')[1];
+                    toolStripTextBoxMACAddr.Text = array_CfgInfo[index + 2].ToString().Split(':')[1];
                     toolStripTextBox_MACDate.Text = DateTime.Now.ToString("yyyyMMdd");
-                    toolStripTextBox_MACPD.Text = array_CfgInfo[17].ToString().Split(':')[1];
+                    toolStripTextBox_MACPD.Text = array_CfgInfo[index + 4].ToString().Split(':')[1];
                     //Log Address
-                    textBox_LogAddrBegin.Text = array_CfgInfo[20].ToString().Split(':')[1];
-                    textBox_LogAddrEnd.Text = array_CfgInfo[21].ToString().Split(':')[1];
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[LogAddress]");
+                    textBox_LogAddrBegin.Text = array_CfgInfo[index + 1].ToString().Split(':')[1];
+                    textBox_LogAddrEnd.Text = array_CfgInfo[index + 2].ToString().Split(':')[1];
                     //电机类型
-                    中置电机ToolStripMenuItem.Checked = (array_CfgInfo[24].ToString().Split(':')[1] == "True");
-                    轮毂电机ToolStripMenuItem.Checked = !中置电机ToolStripMenuItem.Checked;
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[MotorType]");
+                    中置电机MIGIC_ToolStripMenuItem.Checked = (array_CfgInfo[index + 1].ToString().Split(':')[1] == "True");
+                    中置电机VP_ToolStripMenuItem.Checked = (array_CfgInfo[index + 2].ToString().Split(':')[1] == "True");
+                    轮毂电机ToolStripMenuItem.Checked = (array_CfgInfo[index + 3].ToString().Split(':')[1] == "True");
                     //检测阈值
-                    toolStripTextBox_ThVol.Text = array_CfgInfo[28].ToString().Split(':')[1];
-                    toolStripTextBox_ThCur.Text = array_CfgInfo[29].ToString().Split(':')[1];
-                    toolStripTextBox_ThSpeed.Text = array_CfgInfo[30].ToString().Split(':')[1];
-                    toolStripTextBox_ThTor.Text = array_CfgInfo[31].ToString().Split(':')[1];
-                    toolStripTextBox_ThCad.Text = array_CfgInfo[32].ToString().Split(':')[1];
-                    toolStripTextBox_ThBikeSpeed.Text = array_CfgInfo[33].ToString().Split(':')[1];
-                    toolStripTextBox_ThT_PCB.Text = array_CfgInfo[34].ToString().Split(':')[1];
-                    toolStripTextBox_ThT_MCU.Text = array_CfgInfo[35].ToString().Split(':')[1];
-                    toolStripTextBox_ThT_Motor.Text = array_CfgInfo[36].ToString().Split(':')[1];
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[CheckValue]");
+                    toolStripTextBox_ThVol.Text = array_CfgInfo[index + 1].ToString().Split(':')[1];
+                    toolStripTextBox_ThCur.Text = array_CfgInfo[index + 2].ToString().Split(':')[1];
+                    toolStripTextBox_ThSpeed.Text = array_CfgInfo[index + 3].ToString().Split(':')[1];
+                    toolStripTextBox_ThTor.Text = array_CfgInfo[index + 4].ToString().Split(':')[1];
+                    toolStripTextBox_ThCad.Text = array_CfgInfo[index + 5].ToString().Split(':')[1];
+                    toolStripTextBox_ThBikeSpeed.Text = array_CfgInfo[index + 6].ToString().Split(':')[1];
+                    toolStripTextBox_ThT_PCB.Text = array_CfgInfo[index + 7].ToString().Split(':')[1];
+                    toolStripTextBox_ThT_MCU.Text = array_CfgInfo[index + 8].ToString().Split(':')[1];
+                    toolStripTextBox_ThT_Motor.Text = array_CfgInfo[index + 9].ToString().Split(':')[1];
                     //MOS内阻校准系数
-                    toolStripTextBox_MosCalK.Text = array_CfgInfo[39].ToString().Split(':')[1];
-                    toolStripTextBox_MOS1.Text= array_CfgInfo[40].ToString().Split(':')[1];
-                    toolStripTextBox_MOS2.Text = array_CfgInfo[41].ToString().Split(':')[1];
-                    toolStripTextBox_MOS3.Text = array_CfgInfo[42].ToString().Split(':')[1];
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[MosCalK]");
+                    toolStripTextBox_MosCalK.Text = array_CfgInfo[index + 1].ToString().Split(':')[1];
+                    toolStripTextBox_MOS1.Text= array_CfgInfo[index + 2].ToString().Split(':')[1];
+                    toolStripTextBox_MOS2.Text = array_CfgInfo[index + 3].ToString().Split(':')[1];
+                    toolStripTextBox_MOS3.Text = array_CfgInfo[index + 4].ToString().Split(':')[1];
                     //通信协议类型
-                    cANToolStripMenuItem.Checked = (array_CfgInfo[45].ToString().Split(':')[1] == "True");
-                    uARTToolStripMenuItem.Checked = !cANToolStripMenuItem.Checked;
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[ProtocolType]");
+                    cANToolStripMenuItem.Checked = (array_CfgInfo[index + 1].ToString().Split(':')[1] == "True");
+                    uARTToolStripMenuItem.Checked = (array_CfgInfo[index + 2].ToString().Split(':')[1] == "True");
                     //自动更新开关
-                    打开ToolStripMenuItem.Checked = (array_CfgInfo[49].ToString().Split(':')[1] == "True");
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[AutoUpdate]");
+                    打开ToolStripMenuItem.Checked = (array_CfgInfo[index + 1].ToString().Split(':')[1] == "True");
                     关闭ToolStripMenuItem.Checked = !打开ToolStripMenuItem.Checked;
                     //位置校准偏差
-                    textBox_AngleDiffTh.Text = array_CfgInfo[52].ToString().Split(':')[1];
+                    index = Array.IndexOf(array_CfgInfo.ToArray(), "[AngleCal]");
+                    textBox_AngleDiffTh.Text = array_CfgInfo[index + 1].ToString().Split(':')[1];
                     toolStripTextBox_AngleAvgMax.Text = textBox_AngleDiffTh.Text;
-                    textBox_AngleZeroTh.Text = array_CfgInfo[53].ToString().Split(':')[1];
+                    textBox_AngleZeroTh.Text = array_CfgInfo[index + 2].ToString().Split(':')[1];
                     toolStripTextBox_AngleZeroMax.Text = textBox_AngleZeroTh.Text;
                 }
                 catch (System.Exception)
@@ -621,7 +635,8 @@ namespace Welling_Motor_Debug_Tool
                             生产信息ToolStripMenuItem.Visible = true;
                             //显示电机类型,但不可编辑
                             电机类型ToolStripMenuItem.Visible = true;
-                            中置电机ToolStripMenuItem.Enabled = false;
+                            中置电机MIGIC_ToolStripMenuItem.Enabled = false;
+                            中置电机VP_ToolStripMenuItem.Enabled = false;
                             轮毂电机ToolStripMenuItem.Enabled = false;
                             if (uARTToolStripMenuItem.Checked)
                                 UART协议ToolStripMenuItem.Visible = true;
@@ -645,17 +660,28 @@ namespace Welling_Motor_Debug_Tool
                             //显示运行信息
                             tabPage_RunInfo.Parent = tabControl2;
                             //根据电机类型修改生产信息和电机类型
-                            if (EnterForm1.comboBox_User.Text.Contains("中置"))
+                            if (EnterForm1.comboBox_User.Text.Contains("中置MIGIC"))
                             {
-                                中置电机ToolStripMenuItem.Checked = true;
+                                中置电机MIGIC_ToolStripMenuItem.Checked = true;
+                                中置电机VP_ToolStripMenuItem.Checked = false;
                                 轮毂电机ToolStripMenuItem.Checked = false;
                                 toolStripTextBox_MACPD.Text = "MM_MC1";
                                 toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
                                 ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
                             }
+                            else if (EnterForm1.comboBox_User.Text.Contains("中置VP"))
+                            {
+                                中置电机MIGIC_ToolStripMenuItem.Checked = false;
+                                中置电机VP_ToolStripMenuItem.Checked = true;
+                                轮毂电机ToolStripMenuItem.Checked = false;
+                                toolStripTextBox_MACPD.Text = "MM_MV1";
+                                toolStripTextBox_ServerPath.Text = "MC_VP_TEST";
+                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            }
                             else if (EnterForm1.comboBox_User.Text.Contains("轮毂"))
                             {
-                                中置电机ToolStripMenuItem.Checked = false;
+                                中置电机MIGIC_ToolStripMenuItem.Checked = false;
+                                中置电机VP_ToolStripMenuItem.Checked = false;
                                 轮毂电机ToolStripMenuItem.Checked = true;
                                 toolStripTextBox_MACPD.Text = "GF_250_1";
                                 toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
@@ -708,23 +734,35 @@ namespace Welling_Motor_Debug_Tool
                             位置校准偏差范围ToolStripMenuItem.Visible = false;
                             //显示生产信息
                             生产信息ToolStripMenuItem.Visible = true;
-                            //显示电机类型,但不可编辑                            
+                            //显示电机类型                            
                             电机类型ToolStripMenuItem.Visible = true;
-                            中置电机ToolStripMenuItem.Enabled = true;
+                            中置电机MIGIC_ToolStripMenuItem.Enabled = true;
+                            中置电机VP_ToolStripMenuItem.Enabled=true;
                             轮毂电机ToolStripMenuItem.Enabled = true;
                             if (uARTToolStripMenuItem.Checked)
                                 UART协议ToolStripMenuItem.Visible = true;
-                            if (EnterForm1.comboBox_User.Text.Contains("中置"))
+                            if (EnterForm1.comboBox_User.Text.Contains("中置MIGIC"))
                             {
-                                中置电机ToolStripMenuItem.Checked = true;
+                                中置电机MIGIC_ToolStripMenuItem.Checked = true;
+                                中置电机VP_ToolStripMenuItem.Checked = false;
                                 轮毂电机ToolStripMenuItem.Checked = false;
                                 toolStripTextBox_MACPD.Text = "MM_MC1";
                                 toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
                                 ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
                             }
+                            else if (EnterForm1.comboBox_User.Text.Contains("中置VP"))
+                            {
+                                中置电机MIGIC_ToolStripMenuItem.Checked = false;
+                                中置电机VP_ToolStripMenuItem.Checked = true;
+                                轮毂电机ToolStripMenuItem.Checked = false;
+                                toolStripTextBox_MACPD.Text = "MM_MV1";
+                                toolStripTextBox_ServerPath.Text = "MC_VP_TEST";
+                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            }
                             else if (EnterForm1.comboBox_User.Text.Contains("轮毂"))
                             {
-                                中置电机ToolStripMenuItem.Checked = false;
+                                中置电机MIGIC_ToolStripMenuItem.Checked = false;
+                                中置电机VP_ToolStripMenuItem.Checked = false;
                                 轮毂电机ToolStripMenuItem.Checked = true;
                                 toolStripTextBox_MACPD.Text = "GF_250_1";
                                 toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
@@ -748,7 +786,8 @@ namespace Welling_Motor_Debug_Tool
                             生产信息ToolStripMenuItem.Visible = true;
                             //显示电机类型,但不可编辑                            
                             电机类型ToolStripMenuItem.Visible = false;
-                            中置电机ToolStripMenuItem.Enabled = false;
+                            中置电机MIGIC_ToolStripMenuItem.Enabled = false;
+                            中置电机VP_ToolStripMenuItem.Enabled = false;
                             轮毂电机ToolStripMenuItem.Enabled = false;
                             if (uARTToolStripMenuItem.Checked)
                                 UART协议ToolStripMenuItem.Visible = true;
@@ -772,7 +811,8 @@ namespace Welling_Motor_Debug_Tool
                             //显示运行信息
                             tabPage_RunInfo.Parent = tabControl2;
                             //目前仅轮毂使用   
-                            中置电机ToolStripMenuItem.Checked = false;
+                            中置电机MIGIC_ToolStripMenuItem.Checked = false;
+                            中置电机VP_ToolStripMenuItem.Checked = false;
                             轮毂电机ToolStripMenuItem.Checked = true;
                             toolStripTextBox_MACPD.Text = "GF_250_1";
                             toolStripTextBox_ServerPath.Text = "HUB_Control_FCT";
@@ -4398,7 +4438,7 @@ namespace Welling_Motor_Debug_Tool
                 ConfigParam[2] = (byte)(uwDataTemp & 0xFF);
                 ConfigParam[3] = (byte)(uwDataTemp >> 8);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4104, ConfigParam);
-                Delay_ms(200);
+                Delay_ms(2000);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null);
                 //标定1判断
                 label1_TorqueCal1.BackColor = Color.Red;
@@ -4455,7 +4495,7 @@ namespace Welling_Motor_Debug_Tool
                 ConfigParam[2] = (byte)(uwDataTemp & 0xFF);
                 ConfigParam[3] = (byte)(uwDataTemp >> 8);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4104, ConfigParam);
-                Delay_ms(200);
+                Delay_ms(2000);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null);
                 //标定2判断
                 label1_TorqueCal2.BackColor = Color.Red;
@@ -4513,7 +4553,7 @@ namespace Welling_Motor_Debug_Tool
                 ConfigParam[2] = (byte)(uwDataTemp & 0xFF);
                 ConfigParam[3] = (byte)(uwDataTemp >> 8);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4104, ConfigParam);
-                Delay_ms(200);
+                Delay_ms(2000);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null);
                 //标定3判断
                 label1_TorqueCal3.BackColor = Color.Red;
@@ -4571,7 +4611,7 @@ namespace Welling_Motor_Debug_Tool
                 ConfigParam[2] = (byte)(uwDataTemp & 0xFF);
                 ConfigParam[3] = (byte)(uwDataTemp >> 8);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x4104, ConfigParam);
-                Delay_ms(200);
+                Delay_ms(2000);
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null);
                 //标定4判断
                 label1_TorqueCal4.BackColor = Color.Red;
@@ -5735,7 +5775,8 @@ namespace Welling_Motor_Debug_Tool
             CfgFileInfo += "EndAddress:" + textBox_LogAddrEnd.Text + "\r\n";
             CfgFileInfo += "\r\n";
             CfgFileInfo += "[MotorType]" + "\r\n";
-            CfgFileInfo += "MidMotor:" + 中置电机ToolStripMenuItem.Checked.ToString() + "\r\n";
+            CfgFileInfo += "MidMotor1:" + 中置电机MIGIC_ToolStripMenuItem.Checked.ToString() + "\r\n";
+            CfgFileInfo += "MidMotor2:" + 中置电机VP_ToolStripMenuItem.Checked.ToString() + "\r\n";
             CfgFileInfo += "HubMotor:" + 轮毂电机ToolStripMenuItem.Checked.ToString() + "\r\n";
             CfgFileInfo += "\r\n";
             CfgFileInfo += "[CheckValue]" + "\r\n";
@@ -5814,11 +5855,37 @@ namespace Welling_Motor_Debug_Tool
                 string[] InfoList = { "" };
                 try
                 {
-                    if (中置电机ToolStripMenuItem.Checked == true)
+                    if (中置电机MIGIC_ToolStripMenuItem.Checked == true)
                     {
                         regexInfo = @"[0-9][0-9][V][0-9][0-9][0-9][W]";
                         InfoList = Regex.Split(ScanInfo, regexInfo, RegexOptions.IgnoreCase);
                     }
+                    else if (中置电机VP_ToolStripMenuItem.Checked == true)
+                    {
+                        Regex regex = new Regex(@"^M[12][0-9](0?[1-9]|1[0-2])((0?[1-9])|((1|2)[0-9])|30|31)[A-Z]\d{4}[A-Z][A-Z]?$");
+                        if (ScanInfo.Contains("  "))
+                        {
+                            InfoList = ScanInfo.Split(new string[] { "  " }, StringSplitOptions.None);
+                            string Mode = InfoList[0];
+                            string Sn = InfoList[1];
+                            if (regex.IsMatch(Sn) == false)
+                            {
+                                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "SN格式错误" + "\r\n");
+                                label_FacModeStatus.Text = "存在故障!";
+                                label_FacModeResult.BackColor = Color.Red;
+                                label_FacModeResult.Text = "标签格式错误";
+                                Delay_ms(500);
+                                //存储异常并上传
+                                FacMode_Stop(false);
+                                return;
+                            }
+                        }                        
+                        else
+                        {
+                            MessageBox.Show("SN格式错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                            return;
+                        }                        
+                    }
                     else if (轮毂电机ToolStripMenuItem.Checked == true)
                     {
                         if (!ScanInfo.Contains("/")) //老编码规则
@@ -5855,13 +5922,13 @@ namespace Welling_Motor_Debug_Tool
                             };
                             InfoList = ScanInfo.Split(new string[] { "  " }, StringSplitOptions.None);
                             string Model = InfoList[0].Replace("-", "").Replace("Q12", "QA").Replace("Q15", "QB").Replace("Q18", "QC");
-                            string Spec = InfoList[1].Replace("-", "").Replace("/","");
+                            string Spec = InfoList[1].Replace("-", "").Replace("/", "");
                             string Sn = InfoList[2];
                             InfoList[0] = Model[2] + Dic_Ver[Model.Substring(3, 2)] + Model[5] + Dic_Ver[Model.Substring(6, 2)] + Model[9];
                             InfoList[0] += Dic_Vol[Spec.Substring(0, 3)] + Spec.Substring(3, 3) + Spec.Substring(13, 4) + Spec.Substring(Spec.Length - 4, 3);
                             InfoList[1] = Sn;
                         }
-                        
+
                     }
                 }
                 catch (Exception)
@@ -5925,13 +5992,24 @@ namespace Welling_Motor_Debug_Tool
         /// <param name="e"></param>
         private void 中置电机ToolStripMenuItem_Click(object sender, EventArgs e)
         {
-            中置电机ToolStripMenuItem.Checked = true;
+            中置电机MIGIC_ToolStripMenuItem.Checked = true;
+            中置电机VP_ToolStripMenuItem.Checked = false;
             轮毂电机ToolStripMenuItem.Checked = false;
             toolStripTextBox_MACPD.Text = "MM_MC1";
             toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
             ConfigFileSave(true, localInfo.LocalPath + localInfo.ConfigFileName);
         }
 
+        private void 中置电机小牙盘ToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            中置电机MIGIC_ToolStripMenuItem.Checked = false;
+            中置电机VP_ToolStripMenuItem.Checked = true;
+            轮毂电机ToolStripMenuItem.Checked = false;
+            toolStripTextBox_MACPD.Text = "MM_MV1";
+            toolStripTextBox_ServerPath.Text = "MC_VP_TEST";
+            ConfigFileSave(true, localInfo.LocalPath + localInfo.ConfigFileName);
+        }
+
         /// <summary>
         /// 切换电机类型
         /// </summary>
@@ -5939,7 +6017,8 @@ namespace Welling_Motor_Debug_Tool
         /// <param name="e"></param>
         private void 轮毂电机ToolStripMenuItem_Click(object sender, EventArgs e)
         {
-            中置电机ToolStripMenuItem.Checked = false;
+            中置电机MIGIC_ToolStripMenuItem.Checked = false;
+            中置电机VP_ToolStripMenuItem.Checked = false;
             轮毂电机ToolStripMenuItem.Checked = true;
             toolStripTextBox_MACPD.Text = "GF_250_1";
             toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
@@ -6242,7 +6321,7 @@ namespace Welling_Motor_Debug_Tool
             }
             try
             {
-                if (中置电机ToolStripMenuItem.Checked == true)
+                if (中置电机MIGIC_ToolStripMenuItem.Checked == true)
                 {
                     if (textBox_FacModeScan.Text.Split(' ').Length != 7)
                     {
@@ -6253,7 +6332,18 @@ namespace Welling_Motor_Debug_Tool
                         return;
                     }
                 }
-                else if (轮毂电机ToolStripMenuItem.Checked == true) 
+                else if (中置电机VP_ToolStripMenuItem.Checked == true)
+                {
+                    if (textBox_FacModeScan.Text.Split(new string[] { "  " }, StringSplitOptions.None).Length != 2)
+                    {
+                        label_FacModeStatus.Text = "存在故障!";
+                        label_FacModeResult.BackColor = Color.Red;
+                        label_FacModeResult.Text = "标签格式错误";
+                        button__FacMode_Start.Enabled = true;
+                        return;
+                    }
+                }
+                else if (轮毂电机ToolStripMenuItem.Checked == true)
                 {
                     if (textBox_FacModeScan.Text.Split(new string[] { "  " }, StringSplitOptions.None).Length != 3)
                     {
@@ -6307,8 +6397,7 @@ namespace Welling_Motor_Debug_Tool
             //变量定义
             var Code = new byte[255];//发送的指令数据                      
             
-            label_FacModeStatus.Text = "开始测试"; 
-            BootInfo = "";
+            label_FacModeStatus.Text = "开始测试";             
             Delay_ms(500);
             label_FacModeStatus.Text = "系统开机";
             
@@ -6331,12 +6420,13 @@ namespace Welling_Motor_Debug_Tool
             Code[0] = 0xF0;
             mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
             Delay_ms(1500);
+            BootInfo = "";
             richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送开机指令" + "\r\n");
             Code[0] = 0xF1;
             mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
             ACK_WaitCnt = 0;
             richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "等待控制器返回Boot信息……" + "\r\n");
-            while (ACK_WaitCnt <= 20) ; //10s,等待开机成功,联动装置盒控制器接口波特率需等待5s接口自动切换为9600
+            while (ACK_WaitCnt <= 20); //10s,等待开机成功,联动装置盒控制器接口波特率需等待5s接口自动切换为9600
             
             //检查BOOT版本
             if (BootInfo != string.Empty)
@@ -6432,8 +6522,7 @@ namespace Welling_Motor_Debug_Tool
                             }
                         }
                     }
-
-                    BootInfo = "";
+                    
                     //UART控制器发送复位指令把联动装置盒控制器接口波特率改为57600
                     if (uARTToolStripMenuItem.Checked)
                     {
@@ -6452,13 +6541,14 @@ namespace Welling_Motor_Debug_Tool
                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "重新发送关机指令" + "\r\n");
                     Code[0] = 0xF0;
                     mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
-                    Delay_ms(1500);
+                    Delay_ms(3000);
+                    BootInfo = "";
                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "重新发送开机指令" + "\r\n");
                     Code[0] = 0xF1;
                     mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
                     ACK_WaitCnt = 0;
                     richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "等待控制器返回Boot信息……" + "\r\n");
-                    while (ACK_WaitCnt <= 20); //10s
+                    while (ACK_WaitCnt <= 20);
 
                     //获取Boot版本信息
                     if (BootInfo != string.Empty)
@@ -6683,8 +6773,7 @@ namespace Welling_Motor_Debug_Tool
             //位置校准
             if (checkBox_FacMode_AngleCal.Checked)
             {
-                //校准前进行一次开关机保存初始化数据
-                BootInfo = "";
+                //校准前进行一次开关机保存初始化数据                
                 label_FacModeStatus.Text = "位置校准";
                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "开始位置校准" + "\r\n");
                 //确保测试前先关机,发送关机指令再发送开机指令
@@ -6692,6 +6781,7 @@ namespace Welling_Motor_Debug_Tool
                 Code[0] = 0xF0;
                 mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
                 Delay_ms(1500);
+                BootInfo = "";
                 richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送开机指令" + "\r\n");
                 Code[0] = 0xF1;
                 mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
@@ -6867,11 +6957,43 @@ namespace Welling_Motor_Debug_Tool
                     string[] InfoList = { "" };
                     try
                     {
-                        if (中置电机ToolStripMenuItem.Checked == true)
+                        if (中置电机MIGIC_ToolStripMenuItem.Checked == true)
                         {
                             regexInfo = @"[0-9][0-9][V][0-9][0-9][0-9][W]";
                             InfoList = Regex.Split(ScanInfo.Replace(" ", ""), regexInfo, RegexOptions.IgnoreCase);
                         }
+                        else if (中置电机VP_ToolStripMenuItem.Checked == true)
+                        {
+                            Regex regex = new Regex(@"^M[12][0-9](0?[1-9]|1[0-2])((0?[1-9])|((1|2)[0-9])|30|31)[A-Z]\d{4}[A-Z][A-Z]?$");
+                            if (ScanInfo.Contains("  "))
+                            {
+                                InfoList = ScanInfo.Split(new string[] { "  " }, StringSplitOptions.None);
+                                string Mode = InfoList[0];
+                                string Sn = InfoList[1];
+                                if (regex.IsMatch(Sn) == false)
+                                {
+                                    richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "SN格式错误" + "\r\n");
+                                    label_FacModeStatus.Text = "存在故障!";
+                                    label_FacModeResult.BackColor = Color.Red;
+                                    label_FacModeResult.Text = "标签格式错误";
+                                    Delay_ms(500);
+                                    //存储异常并上传
+                                    FacMode_Stop(false);
+                                    return;
+                                }
+                            }                           
+                            else
+                            {
+                                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "标签格式错误" + "\r\n");
+                                label_FacModeStatus.Text = "存在故障!";
+                                label_FacModeResult.BackColor = Color.Red;
+                                label_FacModeResult.Text = "标签格式错误";
+                                Delay_ms(500);
+                                //存储异常并上传
+                                FacMode_Stop(false);
+                                return;
+                            }
+                        }
                         else if (轮毂电机ToolStripMenuItem.Checked == true)
                         {
                             if (!ScanInfo.Contains("/")) //老编码规则
@@ -7460,6 +7582,28 @@ namespace Welling_Motor_Debug_Tool
                     return;
                 }
 
+                //中置判断踏频
+                if ((中置电机MIGIC_ToolStripMenuItem.Checked == true) || (中置电机VP_ToolStripMenuItem.Checked == true))
+                {
+                    if ((Convert.ToDouble(textBox_RunInfo_Cadence.Text.Split(' ')[0]) <= Convert.ToDouble(toolStripTextBox_ThCad.Text.Split(',')[1])) &&
+                        (Convert.ToDouble(textBox_RunInfo_Cadence.Text.Split(' ')[0]) >= Convert.ToDouble(toolStripTextBox_ThCad.Text.Split(',')[0])))
+                    {
+                        label_FacModeCad.BackColor = Color.Green;
+                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "踏频传感器正常" + " " + textBox_RunInfo_Cadence.Text + "\r\n");
+                    }
+                    else
+                    {
+                        richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "踏频传感器异常" + " " + textBox_RunInfo_Cadence.Text + "\r\n");
+                        label_FacModeStatus.Text = "存在故障!";
+                        label_FacModeResult.BackColor = Color.Red;
+                        label_FacModeResult.Text = "测试异常";
+                        Delay_ms(500);
+                        //存储异常并上传
+                        FacMode_Stop(false);
+                        return;
+                    }
+                }
+
                 //发送指令停止电机
                 do
                 {
@@ -7946,7 +8090,7 @@ namespace Welling_Motor_Debug_Tool
                     }
                 } while (false);
                 //测试前先确定电机已停止
-                UInt16 WaitTime = 10;
+                UInt16 WaitTime = 20;
                 do
                 {
                     WaitTime--;
@@ -8617,7 +8761,7 @@ namespace Welling_Motor_Debug_Tool
             }
             try
             {
-                if (中置电机ToolStripMenuItem.Checked == true)
+                if (中置电机MIGIC_ToolStripMenuItem.Checked == true)
                 {
                     if (textBox_CheckModeScan.Text.Split(' ').Length != 7)
                     {
@@ -8628,6 +8772,17 @@ namespace Welling_Motor_Debug_Tool
                         return;
                     }
                 }
+                else if (中置电机VP_ToolStripMenuItem.Checked == true)
+                {
+                    if (textBox_CheckModeScan.Text.Split(new string[] { "  " }, StringSplitOptions.None).Length != 2)
+                    {
+                        label_CheckModeStatus.Text = "存在故障!";
+                        label_CheckModeResult.BackColor = Color.Red;
+                        label_CheckModeResult.Text = "标签格式错误";
+                        button_CheckModeStart.Enabled = true;
+                        return;
+                    }
+                }
                 else if (轮毂电机ToolStripMenuItem.Checked == true)
                 {
                     if (textBox_CheckModeScan.Text.Split(new string[] { "  " }, StringSplitOptions.None).Length != 3)
@@ -8681,12 +8836,8 @@ namespace Welling_Motor_Debug_Tool
 
             //变量定义
             var Code = new byte[255];//发送的指令数据
-            ushort DataTemp;
-            short DataTemp_Int16;
-            string ResultPathName = "";
 
             label_CheckModeStatus.Text = "开始测试";
-            BootInfo = "";
             Delay_ms(500);
             label_CheckModeStatus.Text = "系统开机";
 
@@ -8708,12 +8859,13 @@ namespace Welling_Motor_Debug_Tool
             Code[0] = 0xF0;
             mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
             Delay_ms(1500);
+            BootInfo = "";
             richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送开机指令" + "\r\n");
             Code[0] = 0xF1;
             mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
             ACK_WaitCnt = 0;
             richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "等待控制器返回Boot信息……" + "\r\n");
-            while (ACK_WaitCnt <= 20) ; //10s            
+            while (ACK_WaitCnt <= 20);
 
             //检查BOOT版本
             if (BootInfo != string.Empty)
@@ -8850,11 +9002,43 @@ namespace Welling_Motor_Debug_Tool
                 string[] InfoList = { "" };
                 try
                 {
-                    if (中置电机ToolStripMenuItem.Checked == true)
+                    if (中置电机MIGIC_ToolStripMenuItem.Checked == true)
                     {
                         regexInfo = @"[0-9][0-9][V][0-9][0-9][0-9][W]";
                         InfoList = Regex.Split(ScanInfo.Replace(" ", ""), regexInfo, RegexOptions.IgnoreCase);
                     }
+                    else if (中置电机VP_ToolStripMenuItem.Checked == true)
+                    {
+                        Regex regex = new Regex(@"^M[12][0-9](0?[1-9]|1[0-2])((0?[1-9])|((1|2)[0-9])|30|31)[A-Z]\d{4}[A-Z][A-Z]?$");
+                        if (ScanInfo.Contains("  "))
+                        {
+                            InfoList = ScanInfo.Split(new string[] { "  " }, StringSplitOptions.None);
+                            string Mode = InfoList[0];
+                            string Sn = InfoList[1];
+                            if (regex.IsMatch(Sn) == false)
+                            {
+                                richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "SN格式错误" + "\r\n");
+                                label_FacModeStatus.Text = "存在故障!";
+                                label_FacModeResult.BackColor = Color.Red;
+                                label_FacModeResult.Text = "标签格式错误";
+                                Delay_ms(500);
+                                //存储异常并上传
+                                FacMode_Stop(false);
+                                return;
+                            }
+                        }                        
+                        else
+                        {
+                            richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "标签格式错误" + "\r\n");
+                            label_FacModeStatus.Text = "存在故障!";
+                            label_FacModeResult.BackColor = Color.Red;
+                            label_FacModeResult.Text = "标签格式错误";
+                            Delay_ms(500);
+                            //存储异常并上传
+                            FacMode_Stop(false);
+                            return;
+                        }
+                    }
                     else if (轮毂电机ToolStripMenuItem.Checked == true)
                     {
                         if (!ScanInfo.Contains("/")) //老编码规则

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