فهرست منبع

[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--;
+        }
     }
 }