Эх сурвалжийг харах

解决离线使用500ms定时器不运行。

dd 5 сар өмнө
parent
commit
c429271158

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 6 - 20
Welling_Motor_Debug_Tool/mainForm.cs

@@ -774,9 +774,7 @@ namespace Welling_Motor_Debug_Tool
             //允许离线使用,直接退出
             if (OfflineFlag == true) //允许离线使用
             {
-                timer_500ms.Enabled = false;
                 MessageBoxTimeOut.Show("离线使用,不检测网络状态!", "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Information);
-                timer_500ms.Enabled = true;
                 return;
             }
             //不允许离线使用,实时监测网络状态
@@ -809,9 +807,7 @@ namespace Welling_Motor_Debug_Tool
                     myFtp.IsNetConnected = false;
                     if (EnterForm1.comboBox_User.Text != "管理员")
                     {
-                        timer_500ms.Enabled = false;
                         MessageBoxTimeOut.Show("网络断开,将自动关闭!", "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Warning);
-                        timer_500ms.Enabled = true;
                         this.Close();
                     }                    
                 }
@@ -861,9 +857,7 @@ namespace Welling_Motor_Debug_Tool
                 myFtp.IsNetConnected = false;
                 if (EnterForm1.comboBox_User.Text != "管理员")
                 {
-                    timer_500ms.Enabled = false;
                     MessageBoxTimeOut.Show("网络断开, 请检查网络!", "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Warning); //提示框自动3s关闭
-                    timer_500ms.Enabled = true;
                     //禁止使用
                     groupBox1.Enabled = false;
                     groupBox3.Enabled = false;
@@ -1444,9 +1438,7 @@ namespace Welling_Motor_Debug_Tool
                                 {
                                     if (ACK_DisFlag == true)
                                     {
-                                        timer_500ms.Enabled = false;
                                         MessageBoxTimeOut.Show("OK", "反馈指令", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
-                                        timer_500ms.Enabled = true;
                                         //关机反馈
                                         PowerOffAckStatus = true;
                                     }
@@ -2386,9 +2378,7 @@ namespace Welling_Motor_Debug_Tool
                             {
                                 this.Invoke((EventHandler)(delegate
                                 {
-                                    timer_500ms.Enabled = false;
                                     MessageBoxTimeOut.Show("OK", "反馈指令", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
-                                    timer_500ms.Enabled = true;
                                 }));
                             }
                             break;
@@ -3565,9 +3555,7 @@ namespace Welling_Motor_Debug_Tool
 
                 if (PowerOffAckStatus)
                 {
-                    timer_500ms.Enabled = false;
                     MessageBoxTimeOut.Show("已关机!", "提示", 3000, MessageBoxButtons.OK, MessageBoxIcon.None);
-                    timer_500ms.Enabled = true;
                 }
                 else
                 {
@@ -3720,9 +3708,8 @@ namespace Welling_Motor_Debug_Tool
                     System.IO.File.AppendAllText(RunInfoSaveFilename, "时间 --> 车速 , 转速 , 踏频 , 力矩Reg , 力矩 , 踩踏方向 , 电压 , 电流 , 功率 , 电量 , " +
                         "PCB温度 , 绕组温度 , MOS温度 , 挡位 , 灯开关 , 续航 , 平均功耗 , 单次里程 , 单次时间 , 故障码 , " +
                         "系统状态机 , 二层状态机 , 电机状态机 , 助力状态机 , D轴电流给定 , Q轴电流给定 , D轴电压给定 , Q轴电压给定 , 瞬时力矩 , 时间滤波力矩 , 踏频滤波力矩 , D轴电流反馈 , Q轴电流反馈 , 助力函数输出" + "\r\n");
-                    timer_500ms.Enabled = false;
+
                     MessageBoxTimeOut.Show("开始记录", "提示", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    timer_500ms.Enabled = true;
                     运行信息记录ToolStripMenuItem.Checked = true;
                 }
                 else
@@ -3735,9 +3722,7 @@ namespace Welling_Motor_Debug_Tool
             else
             {
                 运行信息记录ToolStripMenuItem.Checked = false;
-                timer_500ms.Enabled = false;
                 MessageBoxTimeOut.Show("停止记录", "提示", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
-                timer_500ms.Enabled = true;
             }
 
         }
@@ -5088,9 +5073,7 @@ namespace Welling_Motor_Debug_Tool
                     bool result2 = myFtp.UploadFile(DataFileName, toolStripTextBox_ServerPath.Text + "\\Samples" + "\\" + DataNow + "\\" + PD_PathName);
                     if ((result1 & result2) == true)
                     {
-                        timer_500ms.Enabled = false;
-                        MessageBoxTimeOut.Show("数据已上传!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
-                        timer_500ms.Enabled = true;
+                        MessageBoxTimeOut.Show("数据已上传!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);                        
                     }
                     else
                     {
@@ -10353,10 +10336,13 @@ namespace Welling_Motor_Debug_Tool
                 SaveFlag[3] = (byte)(data2 >> 8);
 
                 mySerialProcess.SendCmd((ushort)0x751, (byte)0x16, (ushort)0x5104, SaveFlag);
+                timer_500ms.Enabled = true;
             }
             else
+            {
+                timer_500ms.Enabled = true;
                 MessageBoxTimeOut.Show("写入取消", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
-            timer_500ms.Enabled = true;
+            }
         }
 
         /// <summary>

BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.exe


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.pdb