* Added RS232/RS485 Packet Analyzer (Tools -> Packet Analyzer)
* Updated BMS History register request/response length by model
* Fixed decimal truncation issue in Brazil locale for DB/CSV Log and Excel Export
This commit is contained in:
2026-11-06 15:35:44 +09:00
parent 56e341a48a
commit e041527b56
42 changed files with 5888 additions and 160 deletions

View File

@@ -1,4 +1,4 @@
using DevExpress.XtraGauges.Core.Model;
using DevExpress.XtraGauges.Core.Model;
using LFP_Manager.DataStructure;
using LFP_Manager.Function;
using LFP_Manager.Utils;
@@ -39,6 +39,7 @@ namespace LFP_Manager.Threads
public event UartDataUpdateRS485 OnUpdate = null;
public event UartDataRecvRS485 OnDataRecv = null;
public event UartDataPrintRS485 OnPrint = null;
public event UartDataPacketRS485 OnPacketLog = null;
#endregion
@@ -467,6 +468,7 @@ namespace LFP_Manager.Threads
{
sPort.Write(txData, 0, txData.Length);
SafeRaiseOnPrint(csLog.trx_data_print(txData, txData.Length, 0));
OnPacketLog?.Invoke(DateTime.Now, true, txData, null);
}
catch (Exception ex)
{
@@ -514,6 +516,12 @@ namespace LFP_Manager.Threads
break;
case 1: // Packet OK, no error
SafeRaiseOnPrint(csLog.trx_data_print(ReadBuf, rPosition, 1));
if (OnPacketLog != null)
{
byte[] pData = new byte[rPosition];
Array.Copy(ReadBuf, 0, pData, 0, rPosition);
OnPacketLog(DateTime.Now, false, pData, null);
}
TimeOutCount[ModuleID - 1] = 0;
@@ -530,6 +538,12 @@ namespace LFP_Manager.Threads
goto StartSend;
case 2: // Fw Update Packet OK
SafeRaiseOnPrint(csLog.trx_data_print(ReadBuf, rPosition, 1));
if (OnPacketLog != null)
{
byte[] pData = new byte[rPosition];
Array.Copy(ReadBuf, 0, pData, 0, rPosition);
OnPacketLog(DateTime.Now, false, pData, "FW Update Response");
}
TimeOutCount[ModuleID - 1] = 0;
rFlag = false;
@@ -541,6 +555,12 @@ namespace LFP_Manager.Threads
}
goto StartSend;
case -1: // Packet error
if (OnPacketLog != null && rPosition > 0)
{
byte[] pData = new byte[rPosition];
Array.Copy(ReadBuf, 0, pData, 0, rPosition);
OnPacketLog(DateTime.Now, false, pData, "Packet Error / CRC Mismatch");
}
RecvPacketInit();
Thread.Sleep(100);
goto StartSend;