|
@@ -32,6 +32,11 @@ namespace Welling_Motor_Debug_Tool
|
|
|
LocalInfo localInfo = new LocalInfo();
|
|
|
//FTP实例
|
|
|
ftp myFtp = new ftp();
|
|
|
+ public string ServerIP = "";
|
|
|
+ public string ServerPort = "";
|
|
|
+ public string ServerUser = "";
|
|
|
+ public string ServerPassWd = "";
|
|
|
+ public bool OfflineFlag = false;
|
|
|
//MC运行信息超时计数
|
|
|
bool MC_RunInfo_Refresh = false;
|
|
|
ushort MC_RunInfo_Refresh_Cnt = 0;
|
|
@@ -303,9 +308,32 @@ namespace Welling_Motor_Debug_Tool
|
|
|
do
|
|
|
{
|
|
|
//检查是否存在配置文件
|
|
|
- if (File.Exists(localInfo.LocalPath + localInfo.ServerCfgFileName))
|
|
|
- break;
|
|
|
- else
|
|
|
+ if (File.Exists(localInfo.LocalPath + localInfo.ServerCfgFileName)) //存在配置文件从文件选择
|
|
|
+ {
|
|
|
+ //打开文件
|
|
|
+ StreamReader objReader = new StreamReader(localInfo.LocalPath + localInfo.ServerCfgFileName);
|
|
|
+ string sLine = "";
|
|
|
+ ArrayList array_CfgInfo = new ArrayList();
|
|
|
+ array_CfgInfo.Clear();
|
|
|
+ while (sLine != null)
|
|
|
+ {
|
|
|
+ sLine = objReader.ReadLine();
|
|
|
+ array_CfgInfo.Add(sLine);
|
|
|
+ }
|
|
|
+ objReader.Close();
|
|
|
+ //解析配置文件
|
|
|
+ ServerIP = array_CfgInfo[0].ToString();
|
|
|
+ ServerPort = array_CfgInfo[1].ToString();
|
|
|
+ ServerUser = array_CfgInfo[2].ToString();
|
|
|
+ ServerPassWd = array_CfgInfo[3].ToString();
|
|
|
+ if (array_CfgInfo[4].ToString() == "True")
|
|
|
+ {
|
|
|
+ OfflineFlag = true;
|
|
|
+ checkBox_OffLineFacMode.Checked = true;
|
|
|
+ checkBox_OffLineCheckMode.Checked = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else //不存在配置文件由用户选择
|
|
|
{
|
|
|
ServerCfgForm1.ShowDialog();
|
|
|
switch (ServerCfgForm1.comboBox_Server.SelectedIndex)
|
|
@@ -313,30 +341,29 @@ namespace Welling_Motor_Debug_Tool
|
|
|
case 0: //武汉园区
|
|
|
case 1: //顺德工厂
|
|
|
{
|
|
|
- toolStripTextBox_ServerIP.Text = "10.177.130.30";
|
|
|
- toolStripTextBox_ServerPort.Text = "15021";
|
|
|
- toolStripTextBox_ServerUser.Text = "factory_test";
|
|
|
- toolStripTextBox_ServerPasswd.Text = "ttium";
|
|
|
- 不允许ToolStripMenuItem.Checked = true;
|
|
|
- 允许ToolStripMenuItem.Checked = false;
|
|
|
- 打开ToolStripMenuItem.Checked = true;
|
|
|
- 关闭ToolStripMenuItem.Checked = false;
|
|
|
+ ServerIP = "10.177.130.30";
|
|
|
+ ServerPort = "15021";
|
|
|
+ ServerUser = "factory_test";
|
|
|
+ ServerPassWd = "ttium";
|
|
|
+ OfflineFlag = false;
|
|
|
+ checkBox_OffLineFacMode.Checked = false;
|
|
|
+ checkBox_OffLineCheckMode.Checked = false;
|
|
|
break;
|
|
|
}
|
|
|
- case 2: //越南工厂
|
|
|
- case 3: //公司外部
|
|
|
+ case 2: //威灵园区
|
|
|
+ case 3: //越南工厂
|
|
|
+ case 4: //公司外部
|
|
|
{
|
|
|
- toolStripTextBox_ServerIP.Text = "8.134.109.44";
|
|
|
- toolStripTextBox_ServerPort.Text = "21";
|
|
|
- toolStripTextBox_ServerUser.Text = "ttium";
|
|
|
- toolStripTextBox_ServerPasswd.Text = "ttium123";
|
|
|
- 不允许ToolStripMenuItem.Checked = true;
|
|
|
- 允许ToolStripMenuItem.Checked = false;
|
|
|
- 打开ToolStripMenuItem.Checked = true;
|
|
|
- 关闭ToolStripMenuItem.Checked = false;
|
|
|
+ ServerIP = "8.134.109.44";
|
|
|
+ ServerPort = "21";
|
|
|
+ ServerUser = "ttium";
|
|
|
+ ServerPassWd = "ttium123";
|
|
|
+ OfflineFlag = false;
|
|
|
+ checkBox_OffLineFacMode.Checked = false;
|
|
|
+ checkBox_OffLineCheckMode.Checked = false;
|
|
|
break;
|
|
|
}
|
|
|
- case 4: //离线使用
|
|
|
+ case 5: //离线使用
|
|
|
{
|
|
|
//输入管理员密码
|
|
|
Scan scan_form = new Scan();
|
|
@@ -345,17 +372,16 @@ namespace Welling_Motor_Debug_Tool
|
|
|
scan_form.ShowDialog();
|
|
|
if (scan_form.textBox_Scan.Text == "ttium.123")
|
|
|
{
|
|
|
- 不允许ToolStripMenuItem.Checked = false;
|
|
|
- 允许ToolStripMenuItem.Checked = true;
|
|
|
- 打开ToolStripMenuItem.Checked = false;
|
|
|
- 关闭ToolStripMenuItem.Checked = true;
|
|
|
+ OfflineFlag = true;
|
|
|
+ checkBox_OffLineFacMode.Checked = true;
|
|
|
+ checkBox_OffLineCheckMode.Checked = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MessageBox.Show("密码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
System.Environment.Exit(0);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
default: //无效
|
|
@@ -367,8 +393,9 @@ namespace Welling_Motor_Debug_Tool
|
|
|
//保存配置文件
|
|
|
if (ServerCfgForm1.checkBox_NoticeSw.Checked)
|
|
|
{
|
|
|
- System.IO.File.WriteAllText(localInfo.LocalPath + localInfo.ServerCfgFileName, "");
|
|
|
- }
|
|
|
+ string str = ServerIP + "\r\n" + ServerPort + "\r\n" + ServerUser + "\r\n" + ServerPassWd + "\r\n" + (OfflineFlag == true).ToString();
|
|
|
+ System.IO.File.WriteAllText(localInfo.LocalPath + localInfo.ServerCfgFileName, str);
|
|
|
+ }
|
|
|
}
|
|
|
} while (false);
|
|
|
|
|
@@ -399,63 +426,43 @@ namespace Welling_Motor_Debug_Tool
|
|
|
识别通讯盒ToolStripMenuItem.Checked = (array_CfgInfo[5].ToString().Split(':')[1] == "True");
|
|
|
//Option
|
|
|
写入存储ToolStripMenuItem.Checked = (array_CfgInfo[8].ToString().Split(':')[1] == "True");
|
|
|
- 允许ToolStripMenuItem.Checked = (array_CfgInfo[9].ToString().Split(':')[1] == "True");
|
|
|
- 不允许ToolStripMenuItem.Checked = (array_CfgInfo[9].ToString().Split(':')[1] == "False");
|
|
|
- if (array_CfgInfo[9].ToString().Split(':')[1] == "False")
|
|
|
- {
|
|
|
- checkBox_OffLineFacMode.Checked = false;
|
|
|
- checkBox_OffLineFacMode.Enabled = false;
|
|
|
- checkBox_OffLineCheckMode.Checked = false;
|
|
|
- checkBox_OffLineCheckMode.Enabled = false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- checkBox_OffLineFacMode.Checked = true;
|
|
|
- checkBox_OffLineFacMode.Enabled = true;
|
|
|
- checkBox_OffLineCheckMode.Checked = true;
|
|
|
- checkBox_OffLineCheckMode.Enabled = true;
|
|
|
- }
|
|
|
//Server Set
|
|
|
- toolStripTextBox_ServerIP.Text = array_CfgInfo[12].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ServerPort.Text = array_CfgInfo[13].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ServerUser.Text = array_CfgInfo[14].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ServerPasswd.Text = array_CfgInfo[15].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ServerPath.Text = array_CfgInfo[16].ToString().Split(':')[1];
|
|
|
+ toolStripTextBox_ServerPath.Text = array_CfgInfo[11].ToString().Split(':')[1];
|
|
|
//MacInfo
|
|
|
- toolStripTextBox_MAC.Text = array_CfgInfo[19].ToString().Split(':')[1];
|
|
|
- toolStripTextBoxMACAddr.Text = array_CfgInfo[20].ToString().Split(':')[1];
|
|
|
+ toolStripTextBox_MAC.Text = array_CfgInfo[14].ToString().Split(':')[1];
|
|
|
+ toolStripTextBoxMACAddr.Text = array_CfgInfo[15].ToString().Split(':')[1];
|
|
|
toolStripTextBox_MACDate.Text = DateTime.Now.ToString("yyyyMMdd");
|
|
|
- toolStripTextBox_MACPD.Text = array_CfgInfo[22].ToString().Split(':')[1];
|
|
|
+ toolStripTextBox_MACPD.Text = array_CfgInfo[17].ToString().Split(':')[1];
|
|
|
//Log Address
|
|
|
- textBox_LogAddrBegin.Text = array_CfgInfo[25].ToString().Split(':')[1];
|
|
|
- textBox_LogAddrEnd.Text = array_CfgInfo[26].ToString().Split(':')[1];
|
|
|
+ textBox_LogAddrBegin.Text = array_CfgInfo[20].ToString().Split(':')[1];
|
|
|
+ textBox_LogAddrEnd.Text = array_CfgInfo[21].ToString().Split(':')[1];
|
|
|
//电机类型
|
|
|
- 中置电机ToolStripMenuItem.Checked = (array_CfgInfo[29].ToString().Split(':')[1] == "True");
|
|
|
+ 中置电机ToolStripMenuItem.Checked = (array_CfgInfo[24].ToString().Split(':')[1] == "True");
|
|
|
轮毂电机ToolStripMenuItem.Checked = !中置电机ToolStripMenuItem.Checked;
|
|
|
//检测阈值
|
|
|
- toolStripTextBox_ThVol.Text = array_CfgInfo[33].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ThCur.Text = array_CfgInfo[34].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ThSpeed.Text = array_CfgInfo[35].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ThTor.Text = array_CfgInfo[36].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ThCad.Text = array_CfgInfo[37].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ThBikeSpeed.Text = array_CfgInfo[38].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ThT_PCB.Text = array_CfgInfo[39].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ThT_MCU.Text = array_CfgInfo[40].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_ThT_Motor.Text = array_CfgInfo[41].ToString().Split(':')[1];
|
|
|
+ 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];
|
|
|
//MOS内阻校准系数
|
|
|
- toolStripTextBox_MosCalK.Text = array_CfgInfo[44].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_MOS1.Text= array_CfgInfo[45].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_MOS2.Text = array_CfgInfo[46].ToString().Split(':')[1];
|
|
|
- toolStripTextBox_MOS3.Text = array_CfgInfo[47].ToString().Split(':')[1];
|
|
|
+ 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];
|
|
|
//通信协议类型
|
|
|
- cANToolStripMenuItem.Checked = (array_CfgInfo[50].ToString().Split(':')[1] == "True");
|
|
|
+ cANToolStripMenuItem.Checked = (array_CfgInfo[45].ToString().Split(':')[1] == "True");
|
|
|
uARTToolStripMenuItem.Checked = !cANToolStripMenuItem.Checked;
|
|
|
//自动更新开关
|
|
|
- 打开ToolStripMenuItem.Checked = (array_CfgInfo[54].ToString().Split(':')[1] == "True");
|
|
|
+ 打开ToolStripMenuItem.Checked = (array_CfgInfo[49].ToString().Split(':')[1] == "True");
|
|
|
关闭ToolStripMenuItem.Checked = !打开ToolStripMenuItem.Checked;
|
|
|
//位置校准偏差
|
|
|
- textBox_AngleDiffTh.Text = array_CfgInfo[57].ToString().Split(':')[1];
|
|
|
- textBox_AngleZeroTh.Text = array_CfgInfo[58].ToString().Split(':')[1];
|
|
|
+ textBox_AngleDiffTh.Text = array_CfgInfo[52].ToString().Split(':')[1];
|
|
|
+ textBox_AngleZeroTh.Text = array_CfgInfo[53].ToString().Split(':')[1];
|
|
|
}
|
|
|
catch (System.Exception)
|
|
|
{
|
|
@@ -538,7 +545,6 @@ namespace Welling_Motor_Debug_Tool
|
|
|
//隐藏设置项
|
|
|
其它配置项ToolStripMenuItem.Visible = false;
|
|
|
写入存储ToolStripMenuItem.Visible = false;
|
|
|
- 离线使用ToolStripMenuItem.Visible = false;
|
|
|
服务器配置ToolStripMenuItem.Visible = false;
|
|
|
判断阈值ToolStripMenuItem.Visible = false;
|
|
|
mOS内阻校准系数ToolStripMenuItem.Visible = false;
|
|
@@ -626,7 +632,6 @@ namespace Welling_Motor_Debug_Tool
|
|
|
tabPage_ProductMode_Write.Parent = null;
|
|
|
//隐藏配置项
|
|
|
其它配置项ToolStripMenuItem.Visible = false;
|
|
|
- 离线使用ToolStripMenuItem.Visible = false;
|
|
|
服务器配置ToolStripMenuItem.Visible = false;
|
|
|
判断阈值ToolStripMenuItem.Visible = false;
|
|
|
力矩传感器检验ToolStripMenuItem.Visible = false;
|
|
@@ -664,7 +669,6 @@ namespace Welling_Motor_Debug_Tool
|
|
|
//隐藏设置项
|
|
|
其它配置项ToolStripMenuItem.Visible = false;
|
|
|
写入存储ToolStripMenuItem.Visible = false;
|
|
|
- 离线使用ToolStripMenuItem.Visible = false;
|
|
|
服务器配置ToolStripMenuItem.Visible = false;
|
|
|
判断阈值ToolStripMenuItem.Visible = false;
|
|
|
mOS内阻校准系数ToolStripMenuItem.Visible = false;
|
|
@@ -706,9 +710,6 @@ namespace Welling_Motor_Debug_Tool
|
|
|
tabPage_ProductMode_Write.Parent = tabControl1;
|
|
|
tabPage_ProductMode_Write.Select();
|
|
|
tabPage_ProductMode_Read.Parent = null;
|
|
|
- //允许离线使用
|
|
|
- 允许ToolStripMenuItem.Checked = false;
|
|
|
- 不允许ToolStripMenuItem.Checked = true;
|
|
|
checkBox_OffLineFacMode.Checked = false;
|
|
|
checkBox_OffLineFacMode.Enabled = true;
|
|
|
checkBox_OffLineCheckMode.Checked = false;
|
|
@@ -723,7 +724,6 @@ namespace Welling_Motor_Debug_Tool
|
|
|
//隐藏量产界面
|
|
|
tabPage_ProductMode_Read.Parent = null;
|
|
|
tabPage_ProductMode_Write.Parent = null;
|
|
|
- 离线使用ToolStripMenuItem.Visible = false;
|
|
|
服务器配置ToolStripMenuItem.Visible = false;
|
|
|
if (uARTToolStripMenuItem.Checked)
|
|
|
UART协议ToolStripMenuItem.Visible = true;
|
|
@@ -758,7 +758,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
} while (true);
|
|
|
|
|
|
//配置网络FTP服务器
|
|
|
- myFtp.FtpOption(toolStripTextBox_ServerIP.Text, toolStripTextBox_ServerPort.Text, toolStripTextBox_ServerUser.Text, toolStripTextBox_ServerPasswd.Text, "admin", "ttium_admin");
|
|
|
+ myFtp.FtpOption(ServerIP, ServerPort, ServerUser, ServerPassWd, "admin", "ttium_admin");
|
|
|
//创建线程,定时检测网络连接状态
|
|
|
Thread th = new Thread(NetworkCheck);
|
|
|
th.IsBackground = true;
|
|
@@ -774,7 +774,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
private void NetworkCheck()
|
|
|
{
|
|
|
//允许离线使用,直接退出
|
|
|
- if (允许ToolStripMenuItem.Checked == true) //允许离线使用
|
|
|
+ if (OfflineFlag == true) //允许离线使用
|
|
|
{
|
|
|
timer_500ms.Enabled = false;
|
|
|
MessageBoxTimeOut.Show("离线使用,不检测网络状态!", "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
@@ -818,7 +818,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //创建定时器,定时10s检查网络
|
|
|
+ //创建定时器,定时30s检查网络
|
|
|
System.Timers.Timer timer_CheckNet = new System.Timers.Timer();
|
|
|
timer_CheckNet.Enabled = true;
|
|
|
timer_CheckNet.Interval = 30000;
|
|
@@ -905,7 +905,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
//检查版本,自动更新
|
|
|
do
|
|
|
{
|
|
|
- if (打开ToolStripMenuItem.Checked == false)//关闭自动更新
|
|
|
+ if ((打开ToolStripMenuItem.Checked == false) || OfflineFlag == true)//关闭自动更新或离线时
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
@@ -4841,10 +4841,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
FileInfo += "\r\n";
|
|
|
FileInfo += "[整车参数]\r\n";
|
|
|
FileInfo += richTextBox_BikeParam.Text + "\r\n";
|
|
|
- FileInfo += "\r\n";
|
|
|
- FileInfo += "[整车参数2]\r\n";
|
|
|
- FileInfo += richTextBox_BikeParam2.Text + "\r\n";
|
|
|
- FileInfo += "\r\n";
|
|
|
+ FileInfo += "\r\n";
|
|
|
FileInfo += "[控制参数]\r\n";
|
|
|
FileInfo += richTextBox_ControlParam.Text + "\r\n";
|
|
|
FileInfo += "\r\n";
|
|
@@ -4855,10 +4852,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
for(int i=0;i<15;i++)
|
|
|
{
|
|
|
FileInfo += AssistParams[i] + "\r\n";
|
|
|
- }
|
|
|
- FileInfo += "[用户骑行参数]\r\n";
|
|
|
- FileInfo += richTextBox_UsrRidesParam.Text + "\r\n";
|
|
|
- FileInfo += "\r\n";
|
|
|
+ }
|
|
|
FileInfo += "[调试参数]\r\n";
|
|
|
FileInfo += richTextBox_DebugParam.Text + "\r\n";
|
|
|
FileInfo += "\r\n";
|
|
@@ -4875,6 +4869,12 @@ namespace Welling_Motor_Debug_Tool
|
|
|
FileInfo += textBox_MOS_R2.Text + ", ";
|
|
|
FileInfo += textBox_MOS_R3.Text + "\r\n";
|
|
|
FileInfo += "\r\n";
|
|
|
+ FileInfo += "[整车参数2]\r\n";
|
|
|
+ FileInfo += richTextBox_BikeParam2.Text + "\r\n";
|
|
|
+ FileInfo += "\r\n";
|
|
|
+ FileInfo += "[用户骑行参数]\r\n";
|
|
|
+ FileInfo += richTextBox_UsrRidesParam.Text + "\r\n";
|
|
|
+ FileInfo += "\r\n";
|
|
|
FileInfo += "[生产信息]\r\n";
|
|
|
FileInfo += "生产商: " + textBox_MAC.Text + "\r\n";
|
|
|
FileInfo += "生产地: " + textBox_MACAdd.Text + "\r\n";
|
|
@@ -4894,6 +4894,8 @@ namespace Welling_Motor_Debug_Tool
|
|
|
FileInfo += "SIP: " + ((radioButton_SIP_SaveYes.Checked == true) ? "已存储" : "未存储") + "\r\n";
|
|
|
FileInfo += "\r\n";
|
|
|
FileInfo += Local_HdInformation;
|
|
|
+ FileInfo += "\r\n";
|
|
|
+ FileInfo += "文件格式: V2.0\r\n";
|
|
|
System.IO.File.WriteAllText(DataFileName, FileInfo);
|
|
|
Delay_ms(1000);
|
|
|
|
|
@@ -5432,13 +5434,8 @@ namespace Welling_Motor_Debug_Tool
|
|
|
CfgFileInfo += "\r\n";
|
|
|
CfgFileInfo += "[Option]" + "\r\n";
|
|
|
CfgFileInfo += "SaveWhenWrite:" + 写入存储ToolStripMenuItem.Checked.ToString() + "\r\n";
|
|
|
- CfgFileInfo += "OfflineEnable:" + 允许ToolStripMenuItem.Checked + "\r\n";
|
|
|
CfgFileInfo += "\r\n";
|
|
|
CfgFileInfo += "[ServerSet]" + "\r\n";
|
|
|
- CfgFileInfo += "IPAddress:" + toolStripTextBox_ServerIP.Text + "\r\n";
|
|
|
- CfgFileInfo += "Port:" + toolStripTextBox_ServerPort.Text + "\r\n";
|
|
|
- CfgFileInfo += "User:" + toolStripTextBox_ServerUser.Text + "\r\n";
|
|
|
- CfgFileInfo += "Password:" + toolStripTextBox_ServerPasswd.Text + "\r\n";
|
|
|
CfgFileInfo += "PathName:" + toolStripTextBox_ServerPath.Text + "\r\n";
|
|
|
CfgFileInfo += "\r\n";
|
|
|
CfgFileInfo += "[MacInfo]" + "\r\n";
|
|
@@ -5508,59 +5505,6 @@ namespace Welling_Motor_Debug_Tool
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 允许离线使用
|
|
|
- /// </summary>
|
|
|
- /// <param name="sender"></param>
|
|
|
- /// <param name="e"></param>
|
|
|
- private void 允许ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
- {
|
|
|
- //输入用户名
|
|
|
- EnterForm1.ShowDialog();
|
|
|
- try
|
|
|
- {
|
|
|
- if (EnterForm1.textBox_Passwd.Text == EnterForm1.UserAccount[EnterForm1.comboBox_User.Text])//检验模式所有用户支持
|
|
|
- {
|
|
|
- if (EnterForm1.comboBox_User.Text == "管理员")
|
|
|
- {
|
|
|
- 允许ToolStripMenuItem.Checked = true;
|
|
|
- 不允许ToolStripMenuItem.Checked = false;
|
|
|
- ConfigFileSave(true, localInfo.LocalPath + localInfo.ConfigFileName);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("权限不支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
- 允许ToolStripMenuItem.Checked = false;
|
|
|
- 不允许ToolStripMenuItem.Checked = true;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
- 允许ToolStripMenuItem.Checked = false;
|
|
|
- 不允许ToolStripMenuItem.Checked = true;
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- MessageBox.Show("用户不存在或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
- 允许ToolStripMenuItem.Checked = false;
|
|
|
- 不允许ToolStripMenuItem.Checked = true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 不允许离线使用
|
|
|
- /// </summary>
|
|
|
- /// <param name="sender"></param>
|
|
|
- /// <param name="e"></param>
|
|
|
- private void 不允许ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
- {
|
|
|
- 允许ToolStripMenuItem.Checked = false;
|
|
|
- 不允许ToolStripMenuItem.Checked = true;
|
|
|
- ConfigFileSave(true, localInfo.LocalPath + localInfo.ConfigFileName);
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 弹出扫码按钮
|
|
|
/// </summary>
|
|
@@ -5653,97 +5597,6 @@ namespace Welling_Motor_Debug_Tool
|
|
|
scan_form.Dispose();
|
|
|
}
|
|
|
|
|
|
- private void 服务器配置ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
- {
|
|
|
- //输入用户名
|
|
|
- EnterForm1.ShowDialog();
|
|
|
- try
|
|
|
- {
|
|
|
- if (EnterForm1.textBox_Passwd.Text == EnterForm1.UserAccount[EnterForm1.comboBox_User.Text])//检验模式所有用户支持
|
|
|
- {
|
|
|
- if (EnterForm1.comboBox_User.Text == "管理员")
|
|
|
- {
|
|
|
- IP地址ToolStripMenuItem.Visible = true;
|
|
|
- 端口ToolStripMenuItem.Visible = true;
|
|
|
- 用户名ToolStripMenuItem.Visible = true;
|
|
|
- 密码ToolStripMenuItem.Visible = true;
|
|
|
- 存储路径ToolStripMenuItem.Visible = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("权限不支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
- IP地址ToolStripMenuItem.Visible = false;
|
|
|
- 端口ToolStripMenuItem.Visible = false;
|
|
|
- 用户名ToolStripMenuItem.Visible = false;
|
|
|
- 密码ToolStripMenuItem.Visible = false;
|
|
|
- 存储路径ToolStripMenuItem.Visible = false;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
- IP地址ToolStripMenuItem.Visible = false;
|
|
|
- 端口ToolStripMenuItem.Visible = false;
|
|
|
- 用户名ToolStripMenuItem.Visible = false;
|
|
|
- 密码ToolStripMenuItem.Visible = false;
|
|
|
- 存储路径ToolStripMenuItem.Visible = false;
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- MessageBox.Show("用户不存在或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
- IP地址ToolStripMenuItem.Visible = false;
|
|
|
- 端口ToolStripMenuItem.Visible = false;
|
|
|
- 用户名ToolStripMenuItem.Visible = false;
|
|
|
- 密码ToolStripMenuItem.Visible = false;
|
|
|
- 存储路径ToolStripMenuItem.Visible = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void 生产信息ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
- {
|
|
|
- //输入用户名
|
|
|
- EnterForm1.ShowDialog();
|
|
|
- try
|
|
|
- {
|
|
|
- if (EnterForm1.textBox_Passwd.Text == EnterForm1.UserAccount[EnterForm1.comboBox_User.Text])//检验模式所有用户支持
|
|
|
- {
|
|
|
- if (EnterForm1.comboBox_User.Text == "管理员")
|
|
|
- {
|
|
|
- 生产商ToolStripMenuItem.Visible = true;
|
|
|
- 生产地ToolStripMenuItem.Visible = true;
|
|
|
- 生产日期ToolStripMenuItem.Visible = true;
|
|
|
- 产品标识ToolStripMenuItem.Visible = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("权限不支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
- 生产商ToolStripMenuItem.Visible = false;
|
|
|
- 生产地ToolStripMenuItem.Visible = false;
|
|
|
- 生产日期ToolStripMenuItem.Visible = false;
|
|
|
- 产品标识ToolStripMenuItem.Visible = false;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
- 生产商ToolStripMenuItem.Visible = false;
|
|
|
- 生产地ToolStripMenuItem.Visible = false;
|
|
|
- 生产日期ToolStripMenuItem.Visible = false;
|
|
|
- 产品标识ToolStripMenuItem.Visible = false;
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- MessageBox.Show("用户不存在或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
- 生产商ToolStripMenuItem.Visible = false;
|
|
|
- 生产地ToolStripMenuItem.Visible = false;
|
|
|
- 生产日期ToolStripMenuItem.Visible = false;
|
|
|
- 产品标识ToolStripMenuItem.Visible = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 切换电机类型
|
|
|
/// </summary>
|
|
@@ -8087,37 +7940,38 @@ namespace Welling_Motor_Debug_Tool
|
|
|
do
|
|
|
{
|
|
|
if (!OK_Flag)
|
|
|
+ {
|
|
|
+ richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "测试异常,停止导出" + "\r\n");
|
|
|
break;
|
|
|
- richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "导出电机存储参数" + "\r\n");
|
|
|
+ }
|
|
|
+ richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "导出电机存储参数" + "\r\n");
|
|
|
//读取一次马达参数
|
|
|
richTextBox_MotorParam.Clear();
|
|
|
if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x3A00, null)) break; ;
|
|
|
Delay_ms(100);
|
|
|
Params += "[马达参数]" + "\r\n" + richTextBox_MotorParam.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
//读取一次整车参数
|
|
|
richTextBox_BikeParam.Clear();
|
|
|
if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x3C00, null)) break;
|
|
|
Delay_ms(100);
|
|
|
Params += "[整车参数]" + "\r\n" + richTextBox_BikeParam.Text + "\r\n";
|
|
|
-
|
|
|
- //读取一次整车参数2
|
|
|
- richTextBox_BikeParam2.Clear();
|
|
|
- if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4C00, null)) break;
|
|
|
- Delay_ms(100);
|
|
|
- Params += "[整车参数2]" + "\r\n" + richTextBox_BikeParam2.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
//读取一次控制参数
|
|
|
richTextBox_ControlParam.Clear();
|
|
|
if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x3E00, null)) break;
|
|
|
Delay_ms(100);
|
|
|
Params += "[控制参数]" + "\r\n" + richTextBox_ControlParam.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
//查询传感器
|
|
|
richTextBox_SensorParam.Clear();
|
|
|
if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4000, null)) break;
|
|
|
Delay_ms(100);
|
|
|
Params += "[传感器参数]" + "\r\n" + richTextBox_SensorParam.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
//读取15次助力参数
|
|
|
Params += "[助力参数]" + "\r\n";
|
|
@@ -8131,26 +7985,50 @@ namespace Welling_Motor_Debug_Tool
|
|
|
ConfigParam[3] = (byte)(((i >= 5) ? 5 : i) >> 8);
|
|
|
if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4304, ConfigParam)) break;
|
|
|
Delay_ms(200);
|
|
|
- Params += richTextBox_AssistParam.Text + "\r\n";
|
|
|
+ Params += richTextBox_AssistParam.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
}
|
|
|
-
|
|
|
- //读取一次用户骑行参数
|
|
|
- richTextBox_UsrRidesParam.Clear();
|
|
|
- mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4A00, null);
|
|
|
- Delay_ms(100);
|
|
|
- Params += "[用户骑行参数]" + "\r\n" + richTextBox_UsrRidesParam.Text + "\r\n";
|
|
|
-
|
|
|
+
|
|
|
//读取一次调试信息
|
|
|
richTextBox_DebugParam.Clear();
|
|
|
if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4500, null)) break;
|
|
|
Delay_ms(100);
|
|
|
Params += "[调试参数]" + "\r\n" + richTextBox_DebugParam.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
//读取一次历史信息
|
|
|
richTextBox_Record.Clear();
|
|
|
if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x1E00, null)) break;
|
|
|
Delay_ms(100);
|
|
|
- Params += "[历史信息]" + "\r\n" + richTextBox_Record.Text + "\r\n";
|
|
|
+ Params += "[历史信息]" + "\r\n" + richTextBox_Record.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
+
|
|
|
+ //读取一次MOS内阻校准参数
|
|
|
+ foreach (Control c in groupBox21.Controls)
|
|
|
+ {
|
|
|
+ if (c is TextBox)
|
|
|
+ c.Text = "";
|
|
|
+ }
|
|
|
+ mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4B00, null);
|
|
|
+ Delay_ms(100);
|
|
|
+ Params += "[MOS内阻校准参数]" + "\r\n";
|
|
|
+ Params += textBox_MOS_K1.Text + ", " + textBox_MOS_K2.Text + ", " + textBox_MOS_K3.Text + ", " + textBox_MOS_K4.Text + ", "
|
|
|
+ + textBox_MOS_K5.Text + ", " + textBox_MOS_R1.Text + ", " + textBox_MOS_R2.Text + ", " + textBox_MOS_R3.Text + ", " + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
+
|
|
|
+ //读取一次整车参数2
|
|
|
+ richTextBox_BikeParam2.Clear();
|
|
|
+ if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4C00, null)) break;
|
|
|
+ Delay_ms(100);
|
|
|
+ Params += "[整车参数2]" + "\r\n" + richTextBox_BikeParam2.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
+
|
|
|
+ //读取一次用户骑行参数
|
|
|
+ richTextBox_UsrRidesParam.Clear();
|
|
|
+ mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4A00, null);
|
|
|
+ Delay_ms(100);
|
|
|
+ Params += "[用户骑行参数]" + "\r\n" + richTextBox_UsrRidesParam.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
//读取一次生产信息
|
|
|
textBox_MAC.Text = "";
|
|
@@ -8164,6 +8042,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
Params += "生产地: " + textBox_MACAdd.Text + "\r\n";
|
|
|
Params += "生产日期: " + textBox_MACDate.Text + "\r\n";
|
|
|
Params += "产品标识: " + textBox_PP.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
//读取一次自定义信息
|
|
|
textBox_User1.Text = "---";
|
|
@@ -8179,12 +8058,14 @@ namespace Welling_Motor_Debug_Tool
|
|
|
Params += "自定义1: " + textBox_User1.Text + "\r\n";
|
|
|
Params += "自定义2: " + textBox_User2.Text + "\r\n";
|
|
|
Params += "自定义3: " + textBox_User3.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
//读取一次密钥
|
|
|
textBox_Key.Text = "---";
|
|
|
if (!mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x1000, null)) break;
|
|
|
Delay_ms(100);
|
|
|
Params += "[校验密钥]" + "\r\n" + textBox_Key.Text + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
//读取一次存储标志
|
|
|
radioButton_EE_SaveYes.Checked = false;
|
|
@@ -8196,18 +8077,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
Params += "[存储标志]" + "\r\n";
|
|
|
Params += "EEPROM: " + ((radioButton_EE_SaveYes.Checked == true) ? "已存储" : "未存储") + "\r\n";
|
|
|
Params += "SIP: " + ((radioButton_SIP_SaveYes.Checked == true) ? "已存储" : "未存储") + "\r\n";
|
|
|
-
|
|
|
- //读取一次MOS内阻校准参数
|
|
|
- foreach (Control c in groupBox21.Controls)
|
|
|
- {
|
|
|
- if (c is TextBox)
|
|
|
- c.Text = "";
|
|
|
- }
|
|
|
- mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x4B00, null);
|
|
|
- Delay_ms(100);
|
|
|
- Params += "[MOS内阻校准参数]" + "\r\n";
|
|
|
- Params += textBox_MOS_K1.Text + ", " + textBox_MOS_K2.Text + ", " + textBox_MOS_K3.Text + ", " + textBox_MOS_K4.Text + ", "
|
|
|
- + textBox_MOS_K5.Text + ", " + textBox_MOS_R1.Text + ", " + textBox_MOS_R2.Text + ", " + textBox_MOS_R3.Text + ", " + "\r\n";
|
|
|
+ Params += "\r\n";
|
|
|
|
|
|
} while (false);
|
|
|
|
|
@@ -8278,7 +8148,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
file_str += "检验记录:\r\n" + richTextBox_CheckModeLog.Text.Replace("\n", "\r\n") + "\r\n\r\n";
|
|
|
file_str += "检验结果:\r\n" + label_CheckModeResult.Text + "\r\n\r\n";
|
|
|
file_str += Local_HdInformation;
|
|
|
- file_str += "电机存储参数:\r\n" + Params + "\r\n";
|
|
|
+ file_str += "\r\n电机存储参数:\r\n" + Params + "\r\n";
|
|
|
System.IO.File.WriteAllText(LogSaveFileName, file_str);
|
|
|
//上传测试记录到服务器
|
|
|
if (myFtp.IsNetConnected == true)
|
|
@@ -8441,15 +8311,15 @@ namespace Welling_Motor_Debug_Tool
|
|
|
|
|
|
//系统开机,确保测试前先关机,发送关机指令再发送开机指令
|
|
|
//确保测试前先关机,发送关机指令再发送开机指令
|
|
|
- richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送关机指令" + "\r\n");
|
|
|
+ richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送关机指令" + "\r\n");
|
|
|
Code[0] = 0xF0;
|
|
|
mySerialProcess.SendCmd(0x7FF, 0x16, 0x2201, Code);
|
|
|
Delay_ms(1500);
|
|
|
- richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送开机指令" + "\r\n");
|
|
|
+ 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_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "等待控制器返回Boot信息……" + "\r\n");
|
|
|
+ richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "等待控制器返回Boot信息……" + "\r\n");
|
|
|
while (ACK_WaitCnt <= 20) ; //10s
|
|
|
|
|
|
//检查BOOT版本
|
|
@@ -8480,7 +8350,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
Delay_ms(500);
|
|
|
mySerialProcess.SendCmd((ushort)0x7FF, (byte)0x16, (ushort)0x7702, Code);
|
|
|
Delay_ms(500);
|
|
|
- richTextBox_FacModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送指令进入5S协议" + "\r\n");
|
|
|
+ richTextBox_CheckModeLog.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "发送指令进入5S协议" + "\r\n");
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -9420,7 +9290,7 @@ namespace Welling_Motor_Debug_Tool
|
|
|
|
|
|
if (myFtp.IsNetConnected)
|
|
|
{
|
|
|
- toolTip1.SetToolTip(this.label_ServerStatus, "IP: " + toolStripTextBox_ServerIP.Text);//设置故障内容显示
|
|
|
+ toolTip1.SetToolTip(this.label_ServerStatus, "IP: " + ServerIP);//设置故障内容显示
|
|
|
}
|
|
|
else
|
|
|
{
|