소스 검색

[Bug fixed][DM30][DW30][Event log]: When remove fault code from buffer, the next fault code of the removed code will be disappear.

2020.06.15 / TC Hsu

Actions: Correct the RemoveFaultCodeToBuf() function, after remove the fault code out of buffer, rotation all following stored fault code forward from next fault code. i.e. Fault code find at buffer(n),from buffer(n), move buffer(n+1) to buffer(n) and buffer(n+2) to buffer(n+1), etc... Not from buffer(n+1), move buffer(n+2) to buffer(n+1), it will lose the fault code of buffer(n+1).

Image version    : N/A
Image checksum   : N/A

Hardware PWB P/N : N/A
Hardware Version : N/A

Files:

	modified:   EVSE/Projects/DM30/Apps/Module_EventLogging.c
	modified:   EVSE/Projects/DW30/Apps/Module_EventLogging.c
TC_Hsu 4 년 전
부모
커밋
0f3cac177b
2개의 변경된 파일10개의 추가작업 그리고 18개의 파일을 삭제
  1. 5 9
      EVSE/Projects/DM30/Apps/Module_EventLogging.c
  2. 5 9
      EVSE/Projects/DW30/Apps/Module_EventLogging.c

+ 5 - 9
EVSE/Projects/DM30/Apps/Module_EventLogging.c

@@ -180,6 +180,7 @@ void RemoveFaultCodeToBuf(unsigned char *Code)
     char _code[7];
     sprintf(_code,"%s", Code);
 
+    printf("********************* %s \n", _code);
     // 把相關的錯誤碼一次移除,避免重複顯示
     while(find)
     {
@@ -195,20 +196,15 @@ void RemoveFaultCodeToBuf(unsigned char *Code)
             }
             else
             {
-                if(i == ShmSysConfigAndInfo->SysWarningInfo.WarningCount - 1)
-                {
-                    memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "", 7);
-                }
-                else
-                {
-                    memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0],
-                            &ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + 1][0], 7);
-                }
+                memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i - 1][0],
+                       &ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], 7);
             }
         }
 
         if (find)
+        {
             ShmSysConfigAndInfo->SysWarningInfo.WarningCount--;
+        }
     }
 }
 

+ 5 - 9
EVSE/Projects/DW30/Apps/Module_EventLogging.c

@@ -180,6 +180,7 @@ void RemoveFaultCodeToBuf(unsigned char *Code)
     char _code[7];
     sprintf(_code,"%s", Code);
 
+    printf("********************* %s \n", _code);
     // 把相關的錯誤碼一次移除,避免重複顯示
     while(find)
     {
@@ -195,20 +196,15 @@ void RemoveFaultCodeToBuf(unsigned char *Code)
             }
             else
             {
-                if(i == ShmSysConfigAndInfo->SysWarningInfo.WarningCount - 1)
-                {
-                    memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], "", 7);
-                }
-                else
-                {
-                    memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0],
-                            &ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i + 1][0], 7);
-                }
+                memcpy(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i - 1][0],
+                       &ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], 7);
             }
         }
 
         if (find)
+        {
             ShmSysConfigAndInfo->SysWarningInfo.WarningCount--;
+        }
     }
 }