Selaa lähdekoodia

1,参数检验时增加指令比对。

dd 5 kuukautta sitten
vanhempi
sitoutus
33f799dfdb

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 6 - 1
Welling_Motor_Debug_Tool/Params.cs

@@ -48,6 +48,11 @@ namespace Welling_Motor_Debug_Tool
         public Dictionary<string, ushort> ConfigCheckReadCmd = new Dictionary<string, ushort>() {{ "[自定义1]", 0x1300 }, {"[自定义2]", 0x1500 }, {"[自定义3]", 0x1700 },
                                                                                                  { "[生产信息]", 0x1F00}, {"[马达信息]", 0x3A00}, {"[整车参数]", 0x3C00 },
                                                                                                  {"[控制参数]", 0x3E00}, {"[力矩传感器参数]", 0x4000}, {"[其它传感器参数]", 0x4000},
-                                                                                                 {"[助力参数]", 0x4304},{ "[调试参数]",0x4500} };
+                                                                                                 {"[助力参数]", 0x4304},{ "[调试参数]",0x4500} ,{ "[整车参数2]",0x4C00},{ "[用户骑行参数]",0x4A00}};
+        public Dictionary<string, ushort> ConfigCheckRevCmd = new Dictionary<string, ushort>() {{ "[自定义1]", 0xA610 }, {"[自定义2]", 0xA710 }, {"[自定义3]", 0xA810 },
+                                                                                                 { "[生产信息]", 0xA520}, {"[马达信息]", 0xB226}, {"[整车参数]", 0xB31A },
+                                                                                                 {"[控制参数]", 0xB420}, {"[力矩传感器参数]", 0xB528}, {"[其它传感器参数]", 0xB528},
+                                                                                                 {"[助力参数]", 0xB64C},{ "[调试参数]",0xB83A},{ "[整车参数2]",0xBD20},{ "[用户骑行参数]",0xBE20} };
+
     }
 }

+ 17 - 2
Welling_Motor_Debug_Tool/mainForm.cs

@@ -8866,10 +8866,25 @@ namespace Welling_Motor_Debug_Tool
                         //比较当前指令,读取的配置文件和返回数据比较
                         string ParamWrite = ConfigCmd[key].Substring(24, ConfigCmd[key].Length - 40).Trim();
                         string ParamRead = "";
+                        ushort CmdGet = Convert.ToUInt16(CmdRevStrTemp.Substring(0, 6).Trim().Replace(" ", ""), 16);//接收到指令的命令字
+                        ushort CmdRev = myParams.ConfigCheckRevCmd[key];//接收指令设计值
+                        if (CmdGet != CmdRev)
+                        {
+                            richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + key + "接收指令不正确" + "\r\n");
+                            richTextBox_CheckModeLog.AppendText("接收指令:" + "0x" + CmdGet.ToString("X2") + "\r\n");
+                            richTextBox_CheckModeLog.AppendText("正确指令应为:" + "0x" + CmdRev.ToString("X2") + "\r\n");
+                            label_CheckModeStatus.Text = "存在故障!";
+                            label_CheckModeResult.BackColor = Color.Red;
+                            label_CheckModeResult.Text = "测试异常";
+                            Delay_ms(500);
+                            //存储异常并上传
+                            CheckMode_Stop(false);
+                            return;
+                        }
                         if (string.Compare(key, "[其它传感器参数]") == 0)
-                            ParamRead = CmdRevStrTemp.Substring(90, CmdRevStrTemp.Length - 90).Trim(); //去掉去掉命令字、力矩传感器参数
+                            ParamRead = CmdRevStrTemp.Substring(90, CmdRevStrTemp.Length - 90).Trim(); //去掉命令字、力矩传感器标定参数
                         else if (string.Compare(key, "[控制参数]") == 0)
-                            ParamRead = CmdRevStrTemp.Substring(18, CmdRevStrTemp.Length - 18).Trim(); //去掉去掉命令字、位置零点
+                            ParamRead = CmdRevStrTemp.Substring(18, CmdRevStrTemp.Length - 18).Trim(); //去掉命令字、位置零点
                         else
                             ParamRead = CmdRevStrTemp.Substring(6, CmdRevStrTemp.Length - 6).Trim(); //去掉命令字
                         if (ParamWrite.Contains(ParamRead))

BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.Properties.Resources.resources


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.AssemblyReference.cache


+ 1 - 1
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-764a16b72b9a762637c098319b83307eb05991ef
+441adacf67438a11f7c49778bb4c20fa25df26fd58c5cada2f9c92d0e618d81a

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