fix
This commit is contained in:
@@ -117,10 +117,6 @@ namespace Project
|
||||
Console.WriteLine($"bms connect to {PUB.setting.Port_BAT}");
|
||||
PUB.BMS.PortName = PUB.setting.Port_BAT;
|
||||
PUB.BMS.Open();
|
||||
|
||||
PUB.BMS.BMSDataReceive += Bms_BMSDataReceive;
|
||||
PUB.BMS.Message += Bms_Message;
|
||||
PUB.BMS.ChargeDetect += BMS_ChargeDetect;
|
||||
|
||||
VAR.TIME.Update(eVarTime.LastConn_BAT);
|
||||
VAR.TIME.Update(eVarTime.LastConnTry_BAT);
|
||||
@@ -132,9 +128,6 @@ namespace Project
|
||||
if (ts.TotalSeconds > 10)
|
||||
{
|
||||
Console.WriteLine("bms auto disconnect");
|
||||
PUB.BMS.BMSDataReceive -= Bms_BMSDataReceive;
|
||||
PUB.BMS.Message -= Bms_Message;
|
||||
PUB.BMS.ChargeDetect -= BMS_ChargeDetect;
|
||||
PUB.BMS.Close();
|
||||
VAR.TIME.Set(eVarTime.LastConn_BAT,DateTime.Now.AddSeconds(5));
|
||||
}
|
||||
@@ -159,7 +152,7 @@ namespace Project
|
||||
{
|
||||
if (PUB.BMS.lastSendTime.Year == 1982) PUB.BMS.lastSendTime = DateTime.Now.AddSeconds(1);
|
||||
var ts = DateTime.Now - PUB.BMS.lastSendTime;
|
||||
if (ts.TotalMilliseconds >= PUB.setting.interval_bms)
|
||||
if (ts.TotalSeconds >= PUB.setting.interval_bms)
|
||||
{
|
||||
PUB.BMS.SendQuery();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user