Pārlūkot izejas kodu

添加轮毂和中置电机类型选择,同步修改产品标识,和远程存储路径。

hero 1 gadu atpakaļ
vecāks
revīzija
33ddf01234

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 51 - 18
Welling_Motor_Debug_Tool/Form1.Designer.cs

@@ -454,6 +454,9 @@ namespace Welling_Motor_Debug_Tool
             this.label105 = new System.Windows.Forms.Label();
             this.label106 = new System.Windows.Forms.Label();
             this.label107 = new System.Windows.Forms.Label();
+            this.电机类型ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.中置电机ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.轮毂电机ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.menuStrip_Set.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -634,7 +637,8 @@ namespace Welling_Motor_Debug_Tool
             this.写入存储ToolStripMenuItem,
             this.离线使用ToolStripMenuItem,
             this.服务器配置ToolStripMenuItem,
-            this.生产信息ToolStripMenuItem});
+            this.生产信息ToolStripMenuItem,
+            this.电机类型ToolStripMenuItem});
             this.配置ToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
             this.配置ToolStripMenuItem.Name = "配置ToolStripMenuItem";
             this.配置ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
@@ -663,14 +667,14 @@ namespace Welling_Motor_Debug_Tool
             this.允许ToolStripMenuItem.Checked = true;
             this.允许ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
             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);
             // 
             // 不允许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);
             // 
@@ -691,7 +695,7 @@ namespace Welling_Motor_Debug_Tool
             this.IP地址ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerIP});
             this.IP地址ToolStripMenuItem.Name = "IP地址ToolStripMenuItem";
-            this.IP地址ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.IP地址ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.IP地址ToolStripMenuItem.Text = "IP地址";
             // 
             // toolStripTextBox_ServerIP
@@ -707,7 +711,7 @@ namespace Welling_Motor_Debug_Tool
             this.端口ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerPort});
             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_ServerPort
@@ -723,7 +727,7 @@ namespace Welling_Motor_Debug_Tool
             this.用户名ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerUser});
             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_ServerUser
@@ -739,7 +743,7 @@ namespace Welling_Motor_Debug_Tool
             this.密码ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerPasswd});
             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_ServerPasswd
@@ -755,12 +759,13 @@ 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
             // 
             this.toolStripTextBox_ServerPath.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
+            this.toolStripTextBox_ServerPath.ForeColor = System.Drawing.SystemColors.WindowText;
             this.toolStripTextBox_ServerPath.Name = "toolStripTextBox_ServerPath";
             this.toolStripTextBox_ServerPath.Size = new System.Drawing.Size(200, 28);
             this.toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
@@ -782,7 +787,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
@@ -798,7 +803,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
@@ -814,7 +819,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
@@ -830,7 +835,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
@@ -856,21 +861,21 @@ namespace Welling_Motor_Debug_Tool
             // 运行信息记录ToolStripMenuItem
             // 
             this.运行信息记录ToolStripMenuItem.Name = "运行信息记录ToolStripMenuItem";
-            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.运行信息记录ToolStripMenuItem.Text = "运行信息记录";
             this.运行信息记录ToolStripMenuItem.Click += new System.EventHandler(this.记录数据ToolStripMenuItem_Click);
             // 
             // 计算器ToolStripMenuItem
             // 
             this.计算器ToolStripMenuItem.Name = "计算器ToolStripMenuItem";
-            this.计算器ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.计算器ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.计算器ToolStripMenuItem.Text = "计算器";
             this.计算器ToolStripMenuItem.Click += new System.EventHandler(this.计算器ToolStripMenuItem_Click);
             // 
             // 页面保存ToolStripMenuItem
             // 
             this.页面保存ToolStripMenuItem.Name = "页面保存ToolStripMenuItem";
-            this.页面保存ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.页面保存ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.页面保存ToolStripMenuItem.Text = "页面保存";
             this.页面保存ToolStripMenuItem.Click += new System.EventHandler(this.页面保存ToolStripMenuItem_Click);
             // 
@@ -880,20 +885,20 @@ namespace Welling_Motor_Debug_Tool
             this.开机ToolStripMenuItem,
             this.关机ToolStripMenuItem});
             this.系统开关ToolStripMenuItem.Name = "系统开关ToolStripMenuItem";
-            this.系统开关ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.系统开关ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.系统开关ToolStripMenuItem.Text = "电源控制";
             // 
             // 开机ToolStripMenuItem
             // 
             this.开机ToolStripMenuItem.Name = "开机ToolStripMenuItem";
-            this.开机ToolStripMenuItem.Size = new System.Drawing.Size(112, 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(112, 26);
+            this.关机ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.关机ToolStripMenuItem.Text = "关机";
             this.关机ToolStripMenuItem.Click += new System.EventHandler(this.关机ToolStripMenuItem_Click);
             // 
@@ -4979,6 +4984,31 @@ namespace Welling_Motor_Debug_Tool
             this.label107.TabIndex = 44;
             this.label107.Text = "系统状态机";
             // 
+            // 电机类型ToolStripMenuItem
+            // 
+            this.电机类型ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.中置电机ToolStripMenuItem,
+            this.轮毂电机ToolStripMenuItem});
+            this.电机类型ToolStripMenuItem.Name = "电机类型ToolStripMenuItem";
+            this.电机类型ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
+            this.电机类型ToolStripMenuItem.Text = "电机类型";
+            // 
+            // 中置电机ToolStripMenuItem
+            // 
+            this.中置电机ToolStripMenuItem.Checked = true;
+            this.中置电机ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.中置电机ToolStripMenuItem.Name = "中置电机ToolStripMenuItem";
+            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(180, 26);
+            this.轮毂电机ToolStripMenuItem.Text = "轮毂电机";
+            this.轮毂电机ToolStripMenuItem.Click += new System.EventHandler(this.轮毂电机ToolStripMenuItem_Click);
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@@ -5520,5 +5550,8 @@ namespace Welling_Motor_Debug_Tool
         private Label label110;
         private Label label108;
         private Label label111;
+        private ToolStripMenuItem 电机类型ToolStripMenuItem;
+        private ToolStripMenuItem 中置电机ToolStripMenuItem;
+        private ToolStripMenuItem 轮毂电机ToolStripMenuItem;
     }
 }

+ 51 - 7
Welling_Motor_Debug_Tool/Form1.cs

@@ -105,6 +105,10 @@ namespace Welling_Motor_Debug_Tool
         {
             InitializeComponent();
             //检查配置文件
+            if (!Directory.Exists("C:\\Temp"))
+            {
+                Directory.CreateDirectory("C:\\Temp");
+            }
             if (File.Exists(ConfigFileName)) //存在配置文件,导入配置信息
             {
                 //打开文件
@@ -145,6 +149,9 @@ namespace Welling_Motor_Debug_Tool
                     //Log Address
                     textBox_LogAddrBegin.Text = array_CfgInfo[25].ToString().Split(':')[1];
                     textBox_LogAddrEnd.Text = array_CfgInfo[26].ToString().Split(':')[1];
+                    //电机类型
+                    中置电机ToolStripMenuItem.Checked = (array_CfgInfo[29].ToString().Split(':')[1] == "True");
+                    轮毂电机ToolStripMenuItem.Checked = !中置电机ToolStripMenuItem.Checked;
                 }
                 catch (System.Exception)
                 {
@@ -4260,11 +4267,6 @@ namespace Welling_Motor_Debug_Tool
                     MessageBox.Show("SN无效,上传失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     break;
                 }
-                if (!textBox_FacModeName.Text.Contains("MIGIC"))
-                {
-                    MessageBox.Show("型号名无效,上传失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                    break;
-                }
 
                 //设置文件存储路径
                 string Save_Path = LocalPath + "\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\"; ;
@@ -4846,6 +4848,10 @@ namespace Welling_Motor_Debug_Tool
             CfgFileInfo += "[LogAddress]" + "\r\n";
             CfgFileInfo += "BeginAddress:" + textBox_LogAddrBegin.Text + "\r\n";
             CfgFileInfo += "EndAddress:" + textBox_LogAddrEnd.Text + "\r\n";
+            CfgFileInfo += "\r\n";
+            CfgFileInfo += "[MotorType]" + "\r\n";
+            CfgFileInfo += "MidMotor:" + 中置电机ToolStripMenuItem.Checked.ToString() + "\r\n";
+            CfgFileInfo += "HubMotor:" + 轮毂电机ToolStripMenuItem.Checked.ToString() + "\r\n";
             System.IO.File.WriteAllText(FileName, CfgFileInfo);
         }
 
@@ -4913,8 +4919,18 @@ namespace Welling_Motor_Debug_Tool
                     break;
                 }
                 string ScanInfo = scan_form.textBox_Code.Text;
-                string regexInfo = @"[0-9][0-9][V][0-9][0-9][0-9][W]";
-                string[] InfoList = Regex.Split(ScanInfo, regexInfo, RegexOptions.IgnoreCase);
+                string regexInfo = "";
+                string[] InfoList = { "" };
+                if (中置电机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 (轮毂电机ToolStripMenuItem.Checked == true)
+                {
+                    regexInfo = @"\s{2}";
+                    InfoList = Regex.Split(ScanInfo, regexInfo, RegexOptions.IgnoreCase);
+                }
                 if (InfoList.Length >= 2)
                 {
                     //写入型号
@@ -4963,6 +4979,34 @@ namespace Welling_Motor_Debug_Tool
             } while (false);
             scan_form.Dispose();
         }
+
+        /// <summary>
+        /// 切换电机类型
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void 中置电机ToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            中置电机ToolStripMenuItem.Checked = true;
+            轮毂电机ToolStripMenuItem.Checked = false;
+            toolStripTextBox_MACPD.Text = "MM_MC1";
+            toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
+            ConfigFileSave(true, ConfigFileName);
+        }
+
+        /// <summary>
+        /// 切换电机类型
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void 轮毂电机ToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            中置电机ToolStripMenuItem.Checked = false;
+            轮毂电机ToolStripMenuItem.Checked = true;
+            toolStripTextBox_MACPD.Text = "GF_250_1";
+            toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
+            ConfigFileSave(true, ConfigFileName);
+        }
     }
 
 

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/obj/Debug/DesignTimeResolveAssemblyReferences.cache


BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


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

@@ -54,3 +54,14 @@ D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.pdb
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Scan.resources
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe.config
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.pdb
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.AssemblyReference.cache
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Form1.resources
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Properties.Resources.resources
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Scan.resources
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.GenerateResource.cache
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache
+D:\Documents\Work\SoftDesign\Welling-MidMotor\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.exe
+D:\Documents\Work\SoftDesign\Welling-MidMotor\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