From 7f8220834560c57eea5f9061670d29b44d0aaa8b Mon Sep 17 00:00:00 2001 From: jkwoo Date: Tue, 13 Oct 2026 10:52:18 +0900 Subject: [PATCH] Release v1.1.1.2: Fix FW update reply and update Anti-Theft error 0x4000 alarm display - Fix FW update freezing at first 128B by setting ReplyFlag=true in RequestFlashWrite and handling FW Update timeouts in csUartThread - Update Operating Status: remove Anti-Theft from Status (0x0004 -> TRIP) and display TRIP (Anti-Theft) in Alarm when errorCode is 0x4000 - Sync Status/Alarm string mapping in csLog for CSV data logging - Bump assembly version to v1.1.1.2 --- LFP_Manager/Controls/ucShelfStatus.cs | 26 ++++++++++++++------------ LFP_Manager/Forms/fmxFwUpdate.cs | 4 ++-- LFP_Manager/Properties/AssemblyInfo.cs | 6 +++--- LFP_Manager/Threads/csUartThread.cs | 24 +++++++++++++++++++++++- LFP_Manager/Utils/csLog.cs | 12 +++++------- 5 files changed, 47 insertions(+), 25 deletions(-) diff --git a/LFP_Manager/Controls/ucShelfStatus.cs b/LFP_Manager/Controls/ucShelfStatus.cs index 6506651..08d50f1 100644 --- a/LFP_Manager/Controls/ucShelfStatus.cs +++ b/LFP_Manager/Controls/ucShelfStatus.cs @@ -704,16 +704,8 @@ namespace LFP_Manager.Controls lbStatus.ForeColor = System.Drawing.Color.Magenta; break; case 0x0004: // TRIP - if (SystemData.StatusData.protection == 0) - { - lbStatus.Text = "TRIP (Anti-Theft)"; - lbStatus.ForeColor = Color.Red; - } - else - { - lbStatus.Text = "TRIP"; - lbStatus.ForeColor = Color.Red; - } + lbStatus.Text = "TRIP"; + lbStatus.ForeColor = Color.Red; break; case 0x0008: // Chg-Lmt lbStatus.Text = "CHG-LIMIT"; @@ -745,7 +737,12 @@ namespace LFP_Manager.Controls if (SystemData.ShelfCommFail == false) { // Alarm Display - if (SystemData.StatusData.protection != 0) + if (((ushort)SystemData.StatusData.errorCode & 0x4000) == 0x4000) + { + lbAlarm.Text = "TRIP (Anti-Theft)"; + lbAlarm.ForeColor = Color.Red; + } + else if (SystemData.StatusData.protection != 0) { lbAlarm.Text = "FAULT"; lbAlarm.ForeColor = Color.Red; @@ -781,7 +778,12 @@ namespace LFP_Manager.Controls if (SystemData.ShelfCommFail == false) { // Alarm Display - if (SystemData.StatusData.batteryStatus == 0) + if (((ushort)SystemData.StatusData.errorCode & 0x4000) == 0x4000) + { + lbAlarm.Text = "TRIP (Anti-Theft)"; + lbAlarm.ForeColor = System.Drawing.Color.Red; + } + else if (SystemData.StatusData.batteryStatus == 0) { lbAlarm.Text = "NORMAL"; lbAlarm.ForeColor = System.Drawing.Color.Green; diff --git a/LFP_Manager/Forms/fmxFwUpdate.cs b/LFP_Manager/Forms/fmxFwUpdate.cs index a23c3eb..756e20f 100644 --- a/LFP_Manager/Forms/fmxFwUpdate.cs +++ b/LFP_Manager/Forms/fmxFwUpdate.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -457,7 +457,7 @@ namespace LFP_Manager sdata[sdata.Length - 1] = crc[0]; // CRCL FwSentLength = data.Length; - OnSendUartData?.Invoke((ushort)SystemId, sdata, false); + OnSendUartData?.Invoke((ushort)SystemId, sdata, true); } #endregion diff --git a/LFP_Manager/Properties/AssemblyInfo.cs b/LFP_Manager/Properties/AssemblyInfo.cs index 37d5ecd..f8ed5ed 100644 --- a/LFP_Manager/Properties/AssemblyInfo.cs +++ b/LFP_Manager/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.1.1")] -[assembly: AssemblyFileVersion("1.1.1.1")] +[assembly: AssemblyVersion("1.1.1.2")] +[assembly: AssemblyFileVersion("1.1.1.2")] diff --git a/LFP_Manager/Threads/csUartThread.cs b/LFP_Manager/Threads/csUartThread.cs index 3053009..7652980 100644 --- a/LFP_Manager/Threads/csUartThread.cs +++ b/LFP_Manager/Threads/csUartThread.cs @@ -213,7 +213,29 @@ namespace LFP_Manager.Threads public void SetWriteReg(ushort WriteAddr, byte[] WriteData, bool ReplyFlag) { if (WriteData == null) return; - TUartTxItem item = new TUartTxItem(UartTxType.WriteReg, SystemId, WriteAddr, (ushort)WriteData.Length, WriteData, ReplyFlag, Config.RecvWaitTime); + + UartTxType txType = UartTxType.WriteReg; + int timeoutMs = Config.RecvWaitTime; + bool expectReply = ReplyFlag; + + // FW 업데이트 패킷 감지 (Target ID: 0x7F 또는 FW 명령어) + if (WriteData.Length >= 2 && WriteData[0] == 0x7F) + { + txType = UartTxType.FwUpdate; + byte cmd = WriteData[1]; + if (cmd == csSerialCommFunction.FW_FLASH_ERASE_CMD) // 0x43 Erase + { + expectReply = true; + timeoutMs = Math.Max(Config.RecvWaitTime, 5000); // Flash Erase 대기시간 (섹터 지우기 최대 수 초 소요) + } + else if (cmd == csSerialCommFunction.FW_FLASH_WRITE_CMD) // 0x31 Write + { + expectReply = true; + timeoutMs = Math.Max(Config.RecvWaitTime, 2000); // Flash Write 128B 응답 대기 + } + } + + TUartTxItem item = new TUartTxItem(txType, SystemId, WriteAddr, (ushort)WriteData.Length, WriteData, expectReply, timeoutMs); EnqueueTx(item); } diff --git a/LFP_Manager/Utils/csLog.cs b/LFP_Manager/Utils/csLog.cs index 576fc52..1768a02 100644 --- a/LFP_Manager/Utils/csLog.cs +++ b/LFP_Manager/Utils/csLog.cs @@ -311,10 +311,7 @@ namespace LFP_Manager.Utils result = "FLOATING"; break; case 0x0004: - if (aProtection == 0) - result = "TRIP (Anti-Theft)"; - else - result = "TRIP"; + result = "TRIP"; break; case 0x0008: result = "CHG-LIMIT"; @@ -329,12 +326,13 @@ namespace LFP_Manager.Utils return result; } - private static string GetAlarmString(short aAlarm) + private static string GetAlarmString(short aAlarm, short aErrorCode = 0) { string result = ""; bool[] rackStatus = csUtils.Int16ToBitArray(aAlarm); - if (aAlarm == 0) result = "NORMAL"; + if (((ushort)aErrorCode & 0x4000) == 0x4000) result = "TRIP (Anti-Theft)"; + else if (aAlarm == 0) result = "NORMAL"; else if (aAlarm == 1) result = "WARNING"; else if (aAlarm == 2) result = "FAULT"; else if (aAlarm == 3) result = "WARMING UP"; @@ -460,7 +458,7 @@ namespace LFP_Manager.Utils , sData.Information.BMS_SN_Str // 4 MODEL , GetCommStatus(sConfig, sData) // 5 COMM STATUS , GetStatusString(sData.StatusData.status, sData.StatusData.protection) // 6 STATUS - , GetAlarmString(sData.StatusData.batteryStatus) // 7 ALARM + , GetAlarmString(sData.StatusData.batteryStatus, sData.StatusData.errorCode) // 7 ALARM ); sdata += String.Format(