Răsfoiți Sursa

1,增加拓展功能配置表;
2,增加预留的运行信息显示。

dd 5 luni în urmă
părinte
comite
2d8aab4e2c

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 7 - 0
Welling_Motor_Debug_Tool/Version.cs

@@ -18,6 +18,13 @@ namespace Welling_Motor_Debug_Tool
         //修改记录
         string ChangeLog = "修改记录:\r\n" +
             "V" + mainForm.Version + "\r\n" +
+            "1,增加力矩传感器手动标定实时检验,超范围时弹出提示;\r\n" +
+            "2,增加拓展功能配置,支持读取和写入;\r\n" +
+            "3,解决部分情况500ms定时器停止的问题;\r\n" +
+            "4,增加故障日志地址读取、硬件版本HW写入、客户定制编号写入(用于Boot校验);\r\n" +
+            "5,运行信息增加预留的显示内容和GearBox信息。\r\n" +
+            "\r\n" +
+            "V2.4.0\r\n" +
             "1,生成配置参数时增加导出EXCEL和PDF功能;\r\n" +
             "2,剎把检测前判断电机是否停止,避免误判;\r\n" +
             "3,参数检验增加位置校准判断;\r\n" +

Fișier diff suprimat deoarece este prea mare
+ 491 - 130
Welling_Motor_Debug_Tool/mainForm.Designer.cs


+ 169 - 2
Welling_Motor_Debug_Tool/mainForm.cs

@@ -1,4 +1,5 @@
 using NPOI.POIFS.Crypt.Dsig;
+using NPOI.SS.Formula.Functions;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -24,7 +25,7 @@ namespace Welling_Motor_Debug_Tool
     {
         #region 变量定义
         //版本号
-        public static string Version = "2.4.1";
+        public static string Version = "2.5.0";
         //串口实例
         Serial_Process mySerialProcess = new Serial_Process();
         string PortNumSave = "";
@@ -570,6 +571,7 @@ namespace Welling_Motor_Debug_Tool
                             tabPage_FactoryMode.Parent = null;
                             tabPage_DebugInfo.Parent = null;
                             tabPage_AngleCal.Parent = null;
+                            tabPage_FuncSet.Parent = null;
                             //显示运行信息
                             tabPage_RunInfo.Parent = tabControl2;
                             //根据电机类型修改生产信息和电机类型
@@ -696,6 +698,7 @@ namespace Welling_Motor_Debug_Tool
                             tabPage_FactoryMode.Parent = null;
                             tabPage_DebugInfo.Parent = null;
                             tabPage_AngleCal.Parent = null;
+                            tabPage_FuncSet.Parent = null;
                             //显示运行信息
                             tabPage_RunInfo.Parent = tabControl2;
                             //目前仅轮毂使用   
@@ -894,6 +897,16 @@ namespace Welling_Motor_Debug_Tool
                 dataGridView_AngleCal.Rows[index].Cells[0].Value = i + 1;
             }
             dataGridView_AngleCal.AllowUserToAddRows = false;
+
+            //拓展功能表格初始化
+            for (int i = 0; i < 8; i++)
+            {
+                int index = dataGridView_FunSet.Rows.Add();
+                dataGridView_FunSet.Rows[index].Cells[0].Value = "#" + (i + 1).ToString();
+            }
+            dataGridView_FunSet.AllowUserToAddRows = false;
+
+            //窗体显示版本
             this.Text += Version;
 
             //检查版本,自动更新
@@ -1406,6 +1419,18 @@ namespace Welling_Motor_Debug_Tool
                                     //单次时间
                                     DataTemp = (ushort)(Data[27] * 256 + Data[26]);
                                     textBox_RunInfo_Trip_Time.Text = Convert.ToString(DataTemp) + " s";
+                                    //RSV1
+                                    DataTemp = (ushort)(Data[28]);
+                                    textBox_RunInfo_RSV1.Text = Convert.ToString(DataTemp);
+                                    //RSV2
+                                    DataTemp = (ushort)(Data[29]);
+                                    textBox_RunInfo_RSV2.Text = Convert.ToString(DataTemp);
+                                    //RSV3
+                                    DataTemp = (ushort)(Data[30]);
+                                    textBox_RunInfo_RSV3.Text = Convert.ToString(DataTemp);
+                                    //GearBox
+                                    DataTemp = (ushort)(Data[31]);
+                                    textBox_RunInfo_GearBox.Text = Convert.ToString(DataTemp);
 
                                     //数据保存
                                     RunInfoAutoSave();
@@ -2280,7 +2305,20 @@ namespace Welling_Motor_Debug_Tool
                         }
                     case 0xC142: //功能配置表
                         {
-
+                            unchecked
+                            {
+                                this.Invoke((EventHandler)(delegate
+                                {
+                                    //块编号
+                                    ushort Num = (ushort)(Data[1] * 256 + Data[0]);
+                                    comboBox_FunSet_BlockNum.SelectedIndex = Num - 1;
+                                    //显示数据
+                                    for (int i = 0; i < 64; i++)
+                                    {
+                                        dataGridView_FunSet.Rows[i / 8].Cells[i % 8 + 1].Value = Data[i + 2].ToString();
+                                    }
+                                }));
+                            }
                             break;
                         }
                     case 0xC220: //定制编号
@@ -10566,6 +10604,135 @@ namespace Welling_Motor_Debug_Tool
             mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x5720, UserArray);
         }
 
+        /// <summary>
+        /// 读取指定块拓展功能
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void button_FunSet_Read_Click(object sender, EventArgs e)
+        {
+            if (comboBox_FunSet_BlockNum.SelectedIndex < 0)
+            {
+                MessageBox.Show("请选择块编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+            }
+            else
+            {
+                //清空当前内容
+                for (int i = 0; i < 8; i++)
+                    for (int j = 0; j < 8; j++)
+                    {
+                        dataGridView_FunSet.Rows[i].Cells[j + 1].Value = "";
+                    }
+                //发送读取指令
+                ushort Num = (ushort)(comboBox_FunSet_BlockNum.SelectedIndex + 1);
+                var Code = new byte[2];
+                Code[0] = (byte)(Num & 0xFF);
+                Code[1] = (byte)(Num >> 8);
+                mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x5402, Code);
+            }
+        }
+
+        /// <summary>
+        /// 写入指定块或指定单元参数
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void button_FunSet_Write_Click(object sender, EventArgs e)
+        {
+            if (radioButton_WriteByBlock.Checked == true)
+            {
+                if (comboBox_FunSet_BlockNum.SelectedIndex < 0)
+                    MessageBox.Show("请选择块编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                else
+                {
+                    //开始按块写入
+                    ushort Num = (ushort)(comboBox_FunSet_BlockNum.SelectedIndex + 1);
+                    var Code = new byte[66];
+                    Code[0] = (byte)(Num & 0xFF);
+                    Code[1] = (byte)(Num >> 8);
+                    for (int i = 0; i < 8; i++)
+                        for (int j = 0; j < 8; j++)
+                        {
+                            try
+                            {
+                                byte Data = Convert.ToByte(dataGridView_FunSet.Rows[i].Cells[j + 1].Value);                                
+                                Code[i * 8 + j + 2] = (byte)(Data & 0xFF);
+                            }
+                            catch (Exception)
+                            {
+                                MessageBox.Show("数据格式错误或超范围!\r\n" + "单元编号:" + (i + 1).ToString() + "\r\n" + "参数:" + (j + 1).ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                                return;
+                            }
+                        }
+                    if (MessageBox.Show("请核对块编号!\r\n" + "块编号:" + (Num).ToString(), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
+                        mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x5542, Code);
+                    else
+                        MessageBoxTimeOut.Show("取消写入", "提示", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
+                }                
+            }
+            else if (radioButton_WriteByUnit.Checked == true)
+            {
+                if (comboBox_FunSet_BlockNum.SelectedIndex < 0)
+                    MessageBox.Show("请选择块编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                else
+                {
+                    if (comboBox_FunSet_UnitNum.SelectedIndex < 0)
+                        MessageBox.Show("请选择单元编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                    else
+                    {
+                        //开始按单元写入
+                        ushort Num1 = (ushort)(comboBox_FunSet_BlockNum.SelectedIndex + 1);
+                        ushort Num2 = (ushort)(comboBox_FunSet_UnitNum.SelectedIndex + 1);
+                        var Code = new byte[12];
+                        Code[0] = (byte)(Num1 & 0xFF);
+                        Code[1] = (byte)(Num1 >> 8);
+                        Code[2] = (byte)(Num2 & 0xFF);
+                        Code[3] = (byte)(Num2 >> 8);
+                        for (int i = 0; i < 8; i++)
+                        {
+                            try
+                            {
+                                byte Data = Convert.ToByte(dataGridView_FunSet.Rows[Num2 - 1].Cells[i + 1].Value);
+                                Code[i + 4] = (byte)(Data & 0xFF);
+                            }
+                            catch (Exception)
+                            {
+                                MessageBox.Show("数据格式错误或超范围!\r\n" + "单元编号:" + Num2.ToString() + "\r\n" + "参数:" + (i + 1).ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                                return;
+                            }
+                        }
+                        if (MessageBox.Show("请核对块编号和单元编号!\r\n" + "块编号:" + Num1.ToString() + "\r\n" + "单元编号:" + Num2.ToString(), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
+                            mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x550C, Code);
+                        else
+                            MessageBoxTimeOut.Show("取消写入", "提示", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    }
+                }
+            }
+            else
+            {
+                MessageBox.Show("请选择写入方式!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+            }
+        }
+
+        /// <summary>
+        /// 按块写入时隐藏单元编号
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void radioButton_WriteByUnit_CheckedChanged(object sender, EventArgs e)
+        {
+            if (radioButton_WriteByUnit.Checked == true)
+            {
+                label159.Visible = true;
+                comboBox_FunSet_UnitNum.Visible = true;
+            }
+            else
+            {
+                label159.Visible = false;
+                comboBox_FunSet_UnitNum.Visible = false;
+            }
+        }
+
         /// <summary>
         /// 打开或关闭指令窗口
         /// </summary>

+ 27 - 0
Welling_Motor_Debug_Tool/mainForm.resx

@@ -144,6 +144,33 @@
   <metadata name="Angle_360.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="单元号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="参数1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="参数2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="参数3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="参数4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="参数5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="参数6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="参数7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="参数8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="timer_500ms.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>275, 17</value>
   </metadata>

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


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff