Release v1.1.1.1: Anti-Theft buttons update, BMS history chg_wait column, and wait for charging status display

This commit is contained in:
2026-09-22 15:17:18 +09:00
parent df038ae86b
commit 33fee50a10
26 changed files with 1570 additions and 2643 deletions

View File

@@ -103,6 +103,7 @@ namespace LFP_Manager.Forms
hDT.Columns.Add("no", typeof(int));
hDT.Columns.Add("datetime", typeof(string));
hDT.Columns.Add("status", typeof(int));
hDT.Columns.Add("chg_wait", typeof(int));
hDT.Columns.Add("warning", typeof(short));
hDT.Columns.Add("protect", typeof(short));
hDT.Columns.Add("error", typeof(short));
@@ -116,7 +117,7 @@ namespace LFP_Manager.Forms
{
hDT.Columns.Add(string.Format("temp_{0:00}", i + 1), typeof(float));
}
for (int i = 0; i < 16; i++)
for (int i = 0; i < csConstData.SystemInfo.MAX_MODULE_CELL_SIZE; i++)
{
hDT.Columns.Add(string.Format("cell_v_{0:00}", i + 1), typeof(float));
}
@@ -146,8 +147,8 @@ namespace LFP_Manager.Forms
{
if (bms_history_req == false || data == null) return;
// BMS History response packet: Addr(1) + Func(1) + ByteCount(1 = 58) + Data(58) + CRC(2) = 63 bytes
if (data.Length >= 63 && data[1] == 0x03 && data[2] == 58)
// BMS History response packet: Addr(1) + Func(1) + ByteCount(1 = 56) + Data(56) + CRC(2) = 61 bytes
if (data.Length >= 61 && data[1] == 0x03 && data[2] == 56)
{
try
{
@@ -184,7 +185,9 @@ namespace LFP_Manager.Forms
hRow["datetime"] = stDateTime;
pos = 2;
hRow["status"] = shorts[pos++];
short rawStatus = shorts[pos++];
hRow["status"] = (int)(rawStatus & 0x7FFF);
hRow["chg_wait"] = ((rawStatus & 0x8000) != 0) ? 1 : 0;
hRow["warning"] = shorts[pos++];
hRow["protect"] = shorts[pos++];
hRow["error"] = shorts[pos++];
@@ -192,14 +195,14 @@ namespace LFP_Manager.Forms
hRow["current"] = string.Format("{0:0.00}", Convert.ToDouble(shorts[pos++]) / 100);
hRow["SOC"] = string.Format("{0:0.0}", Convert.ToDouble(shorts[pos++]) / 1);
// Temperature
// Temperature (3 registers = 6 temps)
for (int i = 0; i < 3; i++)
{
hRow[string.Format("temp_{0:00}", (i * 2) + 1)] = Convert.ToDouble((byte)(shorts[pos] >> 8));
hRow[string.Format("temp_{0:00}", (i * 2) + 2)] = Convert.ToDouble((byte)(shorts[pos++] >> 0));
}
// Cell Voltage
for (int i = 0; i < 16; i++)
// Cell Voltage (15 cells)
for (int i = 0; i < csConstData.SystemInfo.MAX_MODULE_CELL_SIZE; i++)
{
hRow[string.Format("cell_v_{0:00}", i + 1)] = Convert.ToDouble(shorts[pos++]) / 1000;
}
@@ -278,14 +281,14 @@ namespace LFP_Manager.Forms
sdata[2] = (byte)(addr >> 8); // Address H
sdata[3] = (byte)(addr >> 0); // Address L
sdata[4] = 0x00; // Number of Register H
sdata[5] = 0x1D; // Number of Register L
sdata[5] = 0x1C; // Number of Register L (28 registers = 56 bytes)
crc = csSerialCommFunction.GetCRC(sdata, 6);
sdata[6] = crc[1]; // CRCH
sdata[7] = crc[0]; // CRCL
OnSendUartData?.Invoke(addr, sdata, false);
OnSendUartData?.Invoke(addr, sdata, true);
}
private void gvBmsHistory_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
@@ -294,7 +297,7 @@ namespace LFP_Manager.Forms
if (e.Column.FieldName == "status")
{
int status = Convert.ToInt32(e.Value);
int status = Convert.ToInt32(e.Value) & 0x7FFF;
switch ((ushort)status)
{
case 0x0000: e.DisplayText = "STANDBY (0x0000)"; break;
@@ -304,11 +307,6 @@ namespace LFP_Manager.Forms
case 0x0004: e.DisplayText = "TRIP (0x0004)"; break;
case 0x0008: e.DisplayText = "CHG-LIMIT (0x0008)"; break;
case 0x0032: e.DisplayText = "POWER-ON (0x0032)"; break;
case 0x8000: e.DisplayText = "STANDBY-HEAT (0x8000)"; break;
case 0x8001: e.DisplayText = "CHARGING-HEAT (0x8001)"; break;
case 0x8002: e.DisplayText = "DISCHARGING-HEAT (0x8002)"; break;
case 0x8004: e.DisplayText = "TRIP-HEAT (0x8004)"; break;
case 0x8008: e.DisplayText = "CHG-LIMIT-HEAT (0x8008)"; break;
default: e.DisplayText = string.Format("UNKNOWN (0x{0:X4})", status); break;
}
}