|
@@ -31,6 +31,8 @@
|
|
|
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
|
|
|
#define PASS 1
|
|
|
#define FAIL -1
|
|
|
+#define YES 1
|
|
|
+#define NO 0
|
|
|
|
|
|
struct SysConfigAndInfo *ShmSysConfigAndInfo;
|
|
|
struct StatusCodeData *ShmStatusCodeData;
|
|
@@ -84,7 +86,7 @@ void PRINTF_FUNC(char *string, ...)
|
|
|
vsnprintf(buffer, sizeof(buffer), string, args);
|
|
|
va_end(args);
|
|
|
|
|
|
- if (DEBUG)
|
|
|
+ if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES)
|
|
|
printf("%s \n", buffer);
|
|
|
else
|
|
|
DEBUG_INFO("%s \n", buffer);
|
|
@@ -167,38 +169,40 @@ void AddFaultCodeToBuf(unsigned char *Code)
|
|
|
|
|
|
void RemoveFaultCodeToBuf(unsigned char *Code)
|
|
|
{
|
|
|
- unsigned char find = 0x00;
|
|
|
+ unsigned char find = 0x01;
|
|
|
char _code[7];
|
|
|
sprintf(_code,"%s", Code);
|
|
|
|
|
|
- // 把相關的錯誤碼一次移除,避免重複顯示
|
|
|
- while(!find)
|
|
|
- {
|
|
|
- for(unsigned char i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++)
|
|
|
- {
|
|
|
- if (find == 0x00)
|
|
|
- {
|
|
|
- if(memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], _code, 7) != 0)
|
|
|
- {
|
|
|
- find = 0x01;
|
|
|
- }
|
|
|
- }
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // 把相關的錯誤碼一次移除,避免重複顯示
|
|
|
+ while(find)
|
|
|
+ {
|
|
|
+ find = 0x00;
|
|
|
+ for(unsigned char i = 0; i < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++)
|
|
|
+ {
|
|
|
+ if (find == 0x00)
|
|
|
+ {
|
|
|
+ if(memcmp(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[i][0], _code, 7) == 0)
|
|
|
+ {
|
|
|
+ find = 0x01;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- ShmSysConfigAndInfo->SysWarningInfo.WarningCount--;
|
|
|
- }
|
|
|
+ if (find)
|
|
|
+ ShmSysConfigAndInfo->SysWarningInfo.WarningCount--;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
int main(void)
|
|
@@ -282,7 +286,7 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
//check Info Status
|
|
|
- for(ByteCount=0;ByteCount<30;ByteCount++)
|
|
|
+ for(ByteCount=0;ByteCount<40;ByteCount++)
|
|
|
{
|
|
|
if(ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[ByteCount] != ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount])
|
|
|
{
|