Browse Source

2021-12-20 / Simon Xue

Action:
1. Modify DD360UCar Project.
2. Add Get Power Cabinet Version communication protocol.
3. Modify RFIC Libary.
4. Add DCInputOVP and DCInputUVP message.

Files
1. As follow commit history

Image version : V2.00.XX.XXXX.XX
Simon Xue 3 years ago
parent
commit
c41c24e5c8

+ 94 - 70
EVSE/Modularization/Module_RFID.c

@@ -198,6 +198,25 @@ char ClaCheckSum(unsigned char *buffer, int len)
 	return chksum;
 }
 
+int chksumValid(unsigned char * buffer)
+{
+	int result = FAIL;
+	int chksum = 0;
+
+	if(buffer[0] > 2)
+	{
+		for(int idx=0;idx<(buffer[0]);idx++)
+		{
+			chksum ^= buffer[idx];
+		}
+
+		if(chksum == buffer[buffer[0]])
+			result = PASS;
+	}
+
+	return result;
+}
+
 bool getRequestCardSN(int Fd, int moduleType, RFID* rfid)
 {
 	bool isSuccess = false;
@@ -250,15 +269,14 @@ bool ISO14443A_REQUEST_SN(int Fd, int moduleType, unsigned char *data)
 {
 	bool isSuccess = false;
 	int tx_len = 4;
-	unsigned char txByte[tx_len];
-	unsigned char rxByte[254];
-	unsigned char tmp[254];
+	unsigned char txByte[4] 		= {0};
+	unsigned char rxByte[254] 		= {0};
 	
-	unsigned char TX_MESSAGE[254];
-	unsigned char RX_MESSAGE[254];
-	unsigned char TMP_MESSAGE[254];
-	unsigned char TX_LENGTH;
-	unsigned char RX_LENGTH;
+	unsigned char TX_MESSAGE[254] 	= {0};
+	unsigned char RX_MESSAGE[254] 	= {0};
+	unsigned char TMP_MESSAGE[254] 	= {0};
+	unsigned char TX_LENGTH 		= 0;
+	unsigned char RX_LENGTH			= 0;
 
 	switch(moduleType)
 	{
@@ -274,41 +292,42 @@ bool ISO14443A_REQUEST_SN(int Fd, int moduleType, unsigned char *data)
 
 			if(Fd > 0)
 			{
-				memset(rxByte, 0, sizeof (rxByte));
 				if(system_command(Fd, txByte, tx_len, rxByte) > 0)
 				{
-					memset(tmp, 0, sizeof tmp);
-					memcpy(tmp, rxByte, sizeof(rxByte));
-					if(tmp[1] == RFID_CMD_ISO1443A_REQUEST)
+					if(chksumValid(rxByte) == PASS)
 					{
-						if(tmp[0] == 0x09)
+						if((rxByte[1] == RFID_CMD_ISO1443A_REQUEST))
 						{
-							DEBUG_INFO_1("MIFARE CLASSIC.\n");
-
-							cardLength = LENGTH_4;
-							memcpy(data, rxByte+2, cardLength);
-
-							isSuccess = true;
+							if(rxByte[0] == 0x09)
+							{
+								cardLength = LENGTH_4;
+								memcpy(data, rxByte+2, cardLength);
+								DEBUG_INFO_1("MIFARE CLASSIC SN: %02X-%02X-%02X-%02X\n", data[0], data[1], data[2], data[3]);
+								isSuccess = true;
+							}
+							else if(rxByte[0] == 0x0C)
+							{
+								cardLength = LENGTH_7;
+								memcpy(data, rxByte+2, cardLength);
+								DEBUG_INFO_1("MIFARE PLUS SN: %02X-%02X-%02X-%02X-%02X-%02X-%02X\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
+
+								isSuccess = true;
+							}
+							else
+							{}
 						}
-						else if(tmp[0] == 0x0C)
+						else if (rxByte[1] == 0xDF)
 						{
-							DEBUG_INFO_1("MIFARE PLUS.\n");
-
-							cardLength = LENGTH_7;
-							memcpy(data, rxByte+2, cardLength);
-
-							isSuccess = true;
+							cardLength = LENGTH_0;
+							isSuccess = false;
 						}
 						else
 						{}
 					}
-					else if (tmp[1] == 0xDF)
+					else
 					{
-						cardLength = LENGTH_0;
-						isSuccess = false;
+						//DEBUG_ERROR_1("Response check sum mismatch.\n");
 					}
-					else
-					{}
 				}
 				else
 				{}
@@ -394,9 +413,8 @@ bool ISO14443B_REQUEST_SN(int Fd, int moduleType, unsigned char *data)
 	bool isSuccess = false;
 	int cardLength;
 	int tx_len = 5;
-	unsigned char txByte[tx_len];
-	unsigned char rxByte[254];
-	unsigned char tmp[254];
+	unsigned char txByte[5] 	= {0};
+	unsigned char rxByte[254] 	= {0};
 	
 	/*
 	unsigned char TX_MESSAGE[254];
@@ -421,27 +439,30 @@ bool ISO14443B_REQUEST_SN(int Fd, int moduleType, unsigned char *data)
 
 			if(Fd > 0)
 			{
-				memset(rxByte, 0, sizeof (rxByte));
 				if(system_command(Fd, txByte, tx_len, rxByte) > 0)
 				{
-					memset(tmp, 0, sizeof tmp);
-					memcpy(tmp, rxByte, sizeof(rxByte));
-					if(tmp[1] == RFID_CMD_ISO1443B_REQUEST)
+					if(chksumValid(rxByte) == PASS)
 					{
-						DEBUG_INFO_1("ISO14443 TYPE B.\n");
-
-						cardLength = LENGTH_4;
-						memcpy(data, rxByte+3, cardLength);
+						if((rxByte[1] == RFID_CMD_ISO1443B_REQUEST) && (rxByte[0] >= 12))
+						{
+							cardLength = LENGTH_4;
+							memcpy(data, rxByte+3, cardLength);
+							DEBUG_INFO_1("ISO14443-B SN: %02X-%02X-%02X-%02X\n", data[0], data[1], data[2], data[3]);
 
-						isSuccess = true;
+							isSuccess = true;
+						}
+						else if(rxByte[1] == 0x9F)
+						{
+							cardLength = LENGTH_0;
+							isSuccess = false;
+						}
+						else
+						{}
 					}
-					else if(tmp[1] == 0x9F)
+					else
 					{
-						cardLength = LENGTH_0;
-						isSuccess = false;
+						//DEBUG_ERROR_1("Response check sum mismatch.\n");
 					}
-					else
-					{}
 				}
 				else
 				{}
@@ -515,15 +536,14 @@ bool FELICA_REQUEST_SN(int Fd, int moduleType, unsigned char *data)
 	bool isSuccess = false;
 	int cardLength;
 	int tx_len = 9;
-	unsigned char txByte[tx_len];
-	unsigned char rxByte[254];
-	unsigned char tmp[254];
+	unsigned char txByte[9] 		= {0};
+	unsigned char rxByte[254]		= {0};
 	
-	unsigned char TX_MESSAGE[254];
-	unsigned char RX_MESSAGE[254];
-	unsigned char TMP_MESSAGE[254];
-	unsigned char TX_LENGTH;
-	unsigned char RX_LENGTH;
+	unsigned char TX_MESSAGE[254]	= {0};
+	unsigned char RX_MESSAGE[254]	= {0};
+	unsigned char TMP_MESSAGE[254]	= {0};
+	unsigned char TX_LENGTH			= 0;
+	unsigned char RX_LENGTH			= 0;
 
 	switch(moduleType)
 	{
@@ -547,24 +567,28 @@ bool FELICA_REQUEST_SN(int Fd, int moduleType, unsigned char *data)
 				memset(rxByte, 0, sizeof (rxByte));
 				if(system_command(Fd, txByte, tx_len, rxByte) > 0)
 				{
-					memset(tmp, 0, sizeof tmp);
-					memcpy(tmp, rxByte, sizeof(rxByte));
-					if(tmp[1] == RFID_CMD_FELICA_POLLING_REQUEST)
+					if(chksumValid(rxByte) == PASS)
 					{
-						DEBUG_INFO_1("FELICA.\n");
-
-						cardLength = LENGTH_6;
-						memcpy(data, rxByte+6, cardLength);
+						if((rxByte[1] == RFID_CMD_FELICA_POLLING_REQUEST) && (rxByte[0] >= 22))
+						{
+							cardLength = LENGTH_6;
+							memcpy(data, rxByte+6, cardLength);
+							DEBUG_INFO_1("FELICA SN: %02X-%02X-%02X-%02X-%02X-%02X\n", data[0], data[1], data[2], data[3], data[4], data[5]);
 
-						isSuccess = true;
+							isSuccess = true;
+						}
+						else if(rxByte[1] == 0xD0)
+						{
+							cardLength = LENGTH_0;
+							isSuccess = false;
+						}
+						else
+						{}
 					}
-					else if(tmp[1] == 0xD0)
+					else
 					{
-						cardLength = LENGTH_0;
-						isSuccess = false;
+						//DEBUG_ERROR_1("Response check sum mismatch.\n");
 					}
-					else
-					{}
 				}
 				else
 				{}
@@ -1023,4 +1047,4 @@ bool setDefaultOfAutomaticDetectingCard(int Fd, int moduleType, int Value)
 	}
 	
 	return isSuccess;
-}
+}

+ 11 - 1
EVSE/Projects/DD360UCar/Apps/CSU/Primary.c

@@ -201,7 +201,11 @@ void CheckPrimaryWarm(void)
                 ShmDcCommonData->PowerAlarmState.StatusBit.DcInputOVP = YES;
                 EmcOccureByString("042200");
                 Rtn = 1;
-            } else if (memcmp(&pSysWarning->WarningCode[i][0], "042200", 6) == 0) {
+            } else if (memcmp(&pSysWarning->WarningCode[i][0], "042328", 6) == 0) {
+			   ShmDcCommonData->PowerAlarmState.StatusBit.DcInputUVP = YES;
+			   EmcOccureByString("042200");
+			   Rtn = 1;
+		    } else if (memcmp(&pSysWarning->WarningCode[i][0], "042200", 6) == 0) {
                 ShmDcCommonData->PowerAlarmState.StatusBit.SystemL1InputOVP = YES;
                 EmcOccureByString("042200");
                 Rtn = 1;
@@ -227,6 +231,7 @@ void CheckPrimaryWarm(void)
             ShmDcCommonData->PowerAlarmState.StatusBit.EmergencyStop = NO;
             ShmDcCommonData->PowerAlarmState.StatusBit.DoorOpen = NO;
             ShmDcCommonData->PowerAlarmState.StatusBit.DcInputOVP = NO;
+            ShmDcCommonData->PowerAlarmState.StatusBit.DcInputUVP = NO;
             ShmDcCommonData->PowerAlarmState.StatusBit.SystemL1InputOVP = NO;
             ShmDcCommonData->PowerAlarmState.StatusBit.SystemL2InputOVP = NO;
             ShmDcCommonData->PowerAlarmState.StatusBit.SystemL3InputOVP = NO;
@@ -234,6 +239,8 @@ void CheckPrimaryWarm(void)
             ReleaseEmsOccureByString(0, "042251");
             ReleaseEmsOccureByString(0, "042252");
             ReleaseEmsOccureByString(0, "042200");
+            ReleaseEmsOccureByString(0, "042327");
+            ReleaseEmsOccureByString(0, "042328");
             ReleaseEmsOccureByString(0, "042201");
             ReleaseEmsOccureByString(0, "042202");
             ReleaseEmsOccureByString(0, "042267");
@@ -243,6 +250,7 @@ void CheckPrimaryWarm(void)
         ShmDcCommonData->PowerAlarmState.StatusBit.EmergencyStop = NO;
         ShmDcCommonData->PowerAlarmState.StatusBit.DoorOpen = NO;
         ShmDcCommonData->PowerAlarmState.StatusBit.DcInputOVP = NO;
+        ShmDcCommonData->PowerAlarmState.StatusBit.DcInputUVP = NO;
         ShmDcCommonData->PowerAlarmState.StatusBit.SystemL1InputOVP = NO;
         ShmDcCommonData->PowerAlarmState.StatusBit.SystemL2InputOVP = NO;
         ShmDcCommonData->PowerAlarmState.StatusBit.SystemL3InputOVP = NO;
@@ -250,6 +258,8 @@ void CheckPrimaryWarm(void)
         ReleaseEmsOccureByString(0, "042251");
         ReleaseEmsOccureByString(0, "042252");
         ReleaseEmsOccureByString(0, "042200");
+        ReleaseEmsOccureByString(0, "042327");
+        ReleaseEmsOccureByString(0, "042328");
         ReleaseEmsOccureByString(0, "042201");
         ReleaseEmsOccureByString(0, "042202");
         ReleaseEmsOccureByString(0, "042267");

+ 1 - 0
EVSE/Projects/DD360UCar/Apps/CSU/main.c

@@ -3396,6 +3396,7 @@ static void ReviewCriticalAlarm(void)
             ShmDcCommonData->PowerAlarmState.StatusBit.EmergencyStop == YES ||
             ShmDcCommonData->PowerAlarmState.StatusBit.DoorOpen == YES ||
             ShmDcCommonData->PowerAlarmState.StatusBit.DcInputOVP == YES ||
+			ShmDcCommonData->PowerAlarmState.StatusBit.DcInputUVP == YES ||
             ShmDcCommonData->PowerAlarmState.StatusBit.SystemL1InputOVP == YES ||
             ShmDcCommonData->PowerAlarmState.StatusBit.SystemL2InputOVP == YES ||
             ShmDcCommonData->PowerAlarmState.StatusBit.SystemL3InputOVP == YES ||

+ 20 - 1
EVSE/Projects/DD360UCar/Apps/Config.h

@@ -363,11 +363,11 @@ typedef union {
         uint8_t EmergencyStop: 1;    //Power cabinet emergency stop
         uint8_t DoorOpen: 1;         //Power cabinet emergency door open
         uint8_t DcInputOVP: 1;
+        uint8_t DcInputUVP: 1;
         uint8_t SystemL1InputOVP: 1; //Power cabinet system L1 input OVP
         uint8_t SystemL2InputOVP: 1; //Power cabinet System L2 input OVP
         uint8_t SystemL3InputOVP: 1; //Power cabinet System L3 input OVP
         uint8_t PsuFailure: 1;       //Power cabinet PSU Failure Alarm
-        uint8_t Reserved: 1;
     } StatusBit;
 } PowerAlarmState;
 
@@ -392,6 +392,12 @@ typedef struct StPcPsuOutput { //from power cabinet PSU output
     uint16_t Current;
 } PcPsuOutput;
 
+typedef struct Psu_VersionInfo{
+	uint8_t n_PSU;
+	uint8_t DCVersion[32];
+	uint8_t FPCVersion[32];
+}PsuVerInfo;
+
 typedef struct StDcCommonInfo {
     uint8_t RebootCount;
     uint8_t CcsVersion;
@@ -409,6 +415,19 @@ typedef struct StDcCommonInfo {
     uint8_t CcsTypeSaved[2];
     PcPsuOutput PcPsuOutput[2];
     uint8_t Reserved[3];
+    // Power Cabinet Version
+    uint8_t CabinetModelName[32];
+    uint8_t CabinetBoolLoaderVersion[32];
+    uint8_t CabinetKernelVersion[32];
+    uint8_t CabinetRFSystemVersion[32];
+    uint8_t CabinetPrimaryVersion[32];
+    uint8_t CabinetIPAddr[32];
+    uint8_t CabinetRelay0Version[32];
+    uint8_t CabinetRelay1Version[32];
+    uint8_t CabinetFanVersion[32];
+    // PSU Version
+    uint8_t PSU_Number;
+    PsuVerInfo PsuVer[12];
 } DcCommonInfo;
 
 #endif /* CONFIG_H_ */

+ 6 - 6
EVSE/Projects/DD360UCar/Apps/Define/define.c

@@ -103,7 +103,7 @@ char FaultStatusCode[40][6]=
 "011036", //Rotary switch fault
 "011037", //CCS liquid chiller water level fault
 "011038", //Chiller temperature sensor broken
-"011039", //Parallel relay welding 
+"011039", //Parallel relay welding
 "011040"  //Parallel output relay driving fault
 };
 
@@ -233,11 +233,11 @@ char AlarmStatusCode[160][6]=
 "012321", // System CCS output UCP
 "012322", // System GBT output UCP
 "012323", // System Chiller output OTP
-"012324", // reserved
-"012325", // reserved
-"012326", // reserved
-"012327", // reserved
-"012328",   // reserved
+"012324", // Connector 1 detects abnormal voltage on the output line
+"012325", // Connector 2 detects abnormal voltage on the output line
+"012326", // System task is lost
+"012327", // DC input ovp
+"012328", // DC input uvp
 "012329",   // reserved
 "012330",   // reserved
 "012331",   // reserved

+ 41 - 24
EVSE/Projects/DD360UCar/Apps/Define/define.h

@@ -63,6 +63,15 @@ Storage							0x0A200000-0x7FFFFFFF		1886 MB
     #define GENERAL_GUN_QUANTITY    0
     #define PSU_QUANTITY            0
     #define ONE_CONNECTOR_USE       0
+#elif defined NoodoeAX
+    #define MAX_PSU_QUANTITY        62
+    #define CHAdeMO_QUANTITY        1
+    #define CCS_QUANTITY            1
+    #define GB_QUANTITY             0
+    #define AC_QUANTITY             1
+    #define GENERAL_GUN_QUANTITY    0
+    #define PSU_QUANTITY            0
+    #define ONE_CONNECTOR_USE       0
 #elif defined AX80
     #define MAX_PSU_QUANTITY        62
     #define CHAdeMO_QUANTITY        1
@@ -117,7 +126,7 @@ Storage							0x0A200000-0x7FFFFFFF		1886 MB
     #define GENERAL_GUN_QUANTITY	0
     #define PSU_QUANTITY            2
     #define ONE_CONNECTOR_USE       0
-#elif defined DD360 || defined DD360Audi || defined DD360ComBox || defined DD360UCar
+#elif defined DD360 || defined DD360Audi || defined DD360ComBox || defined DD360UCar || defined DD360Tcci
     #define MAX_PSU_QUANTITY        62
     #define CHAdeMO_QUANTITY        2
     #define CCS_QUANTITY            2
@@ -312,6 +321,8 @@ enum CoreProfile {
      TimeOffsetNextTransition,
      SystemUptimeSec,
      FreeVend,
+     OcppServer,
+     MaintainServer,
      ConfigurationVersion,
 	 _CoreProfile_CNT
 };
@@ -450,7 +461,9 @@ typedef union
         unsigned int AlarmStop:1;                   // 0: no effect,    1: alarm stop
         unsigned int BackendStop:1;                 // 0: no effect,    1: backend stop
         unsigned int ManualStop:1;                  // 0: no effect,    1: manual stop
-        unsigned int res:28;
+        unsigned int HardResetStop:1;               // 0: no effect,    1: hard reset stop
+        unsigned int SoftResetStop:1;               // 0: no effect,    1: soft reset stop
+        unsigned int res:26;
     }bits;
 }ChargingStop;
 
@@ -660,6 +673,18 @@ struct ChargingInfoData
     unsigned char       CCSGunType;
 };
 
+typedef struct
+{
+    unsigned char       AuthId[32];
+                                                        // 0: Authorize idle, 1: Authorize wait,   2: Authorizing
+    unsigned char       AuthStatus;                     // 3: Authorize done, 4: Authorize end
+    unsigned char       AuthTarget;                     // Authorize Target Connector ID: 1 ~ 4, AutoSelection: 0xFF
+    unsigned char       AuthType;                       // 0: _AuthType_None,   1: _AuthType_RFID, 2: _AuthType_RemoteStart
+    unsigned char       AuthResult;                     // 0: _AuthResult_None, 1: _AuthResult_Valid,   2: _AuthResult_Invalid
+    unsigned char       AuthRequest;                    // 0: no request, 1: authorize request
+    unsigned char       res;
+}AuthorizingInfoData;
+
 typedef union
 {
     unsigned int SettingValue;
@@ -670,7 +695,6 @@ typedef union
         unsigned int DispenserConfigSync:1;             // 0: not synced,   1: synced
         unsigned int MiscNeedAnnouncement:1;            // 0: no need,      1: need send misc command
         unsigned int NeedDispenserVerInfo:1;            // 0: no need,      1: need dispenser to report it's version info
-        unsigned int EnableAutoGunSelection:1;          // 0: disable,      1: enable auto gun selection
         unsigned int AuthorizeRequest:1;                // 0: idle,         1: requesting                           ( dispenser -> cabinet)
         unsigned int ConnectorTimeoutConfigRequest:1;   // 0: no request,   1: connector timeout setting            (    ocpp   -> cabinet -> dispenser)
         unsigned int DefaultPriceConfigRequest:1;       // 0: no request,   1: default price setting                (    ocpp   -> cabinet -> dispenser)
@@ -690,7 +714,7 @@ typedef union
         unsigned int StopButtonStatusRequest:1;         // 0: no request,   1: stop charging button status has changed          ( cabinet -> dispenser)
         unsigned int AuthModeConfigRequest:1;           // 0: no request,   1: AuthMode Config has changed                      ( cabinet -> dispenser)
         unsigned int EVCCIDConfigRequest:1;             // 0: no request,   1: EVCCID Config has changed                        ( cabinet -> dispenser)
-        unsigned int res:7;
+        unsigned int res:8;
     }bits;
 }DispenserSettingFlag;
 
@@ -727,11 +751,7 @@ struct DispenserModule
     unsigned char   Connector2FwRev[32];        //Connector2 module firmware version
     struct   LED    LedInfo;                    // LED configuration info
 
-                                                // 0: Authorize idle, 1: Authorize wait,   2: Authorizing
-    unsigned char           AuthStatus;         // 3: Authorize done, 4: Authorize end
-    unsigned char           AuthTarget;         // Authorize Target Connector ID: 1 ~ 4, AutoSelection: 0xFF
-    unsigned char           AuthType;           // 0: _AuthType_None, 1: _AuthType_RFID, 2: _AuthType_RemoteStart
-    unsigned char           AuthResult;         // 0: _AuthResult_None, 1: _AuthResult_Valid,   2: _AuthResult_Invalid
+    AuthorizingInfoData     AuthInfo;
     DispenserSettingFlag    Setting;
     char                    FwFileName[128];
     unsigned char           ConnectionChannel;
@@ -824,8 +844,7 @@ struct ConnectorInfoData
     unsigned char ParentDispensetIndex;                 // Parent Dispenser Index: 0 ~ 3
     ConnectorParameter       Parameter;
 
-    unsigned char            AuthorizingType;
-    unsigned char            AuthorizingResult;         // 0: _AuthResult_None, 1: _AuthResult_Valid,   2: _AuthResult_Invalid
+    AuthorizingInfoData      AuthInfo;
     struct ChargingInfoData  GeneralChargingData;
     struct WARNING_CODE_INFO WarningInfo;
 
@@ -857,14 +876,11 @@ typedef union
     unsigned int SettingValue;
     struct
     {
-        unsigned int StartAuthorize:1;          // 0: idle,    1: authorizing
-        unsigned int AuthorizingCompleted:1;    // 0: not yet, 1: authorizing completed
         unsigned int DispenserDisconnection:1;  // 0: no connection,  1: dispenser connected
-        unsigned int BackendAuthorized:1;       // 0: local authorized, 1: backend authorized
         unsigned int FlashConfigChanged:1;      // 0: no effect, 1: flash config has changed
         unsigned int EnableWriteFlash:1;        // 0: no effect, 1: enable to write flash after timeout
         unsigned int CleanWiringInfo:1;         // 0: no effect, 1: clean wiring info
-        unsigned int res:25;
+        unsigned int res:28;
     }bits;
 }CabinetSettingFlag;
 
@@ -990,7 +1006,7 @@ struct SysInfoData
     CabinetMiscCommand      CabinetMicsStatus;
     struct LocalSharingInfo localSharingInfo;           // Local power sharing info structure
     DC_Meter_Info DcMeterInfo[4];
-    unsigned char           OTPTemp;                    // OTP Temperature 
+    unsigned char           OTPTemp;                    // OTP Temperature
     unsigned char           OTPTempR;                   // OTP Recovery Temperature
 };
 
@@ -1309,7 +1325,7 @@ char AlarmStatusCode[160][6]=
     "012325",   // Connector 2 detects abnormal voltage on the output line
     "012326",   // System task is lost
     "012327",   // DC input ovp
-    "012328",   // reserved
+    "012328",   // DC input uvp
     "012329",   // reserved
     "012330",   // reserved
     "012331",   // reserved
@@ -1496,7 +1512,8 @@ struct AlarmCodeData
             unsigned char SystemTaskLost:1;                         //bit 6
             unsigned char DcInputOVP:1;                             //bit 7
             //AlarmVal[16]
-            unsigned char :8;                                       //reserved bit 0 ~ bit 7
+            unsigned char DcInputUVP:1;                             //bit 0
+            unsigned char :7;                                       //reserved bit 0 ~ bit 7
             //AlarmVal[17]
             unsigned char :8;                                       //reserved bit 0 ~ bit 7
             //AlarmVal[18]
@@ -4388,7 +4405,7 @@ struct OCPP16ConfigurationItem
 {
 	unsigned char 		ItemName[64];
 	unsigned char 		ItemAccessibility;//0:RO, 1:RW
-	unsigned char 		ItemData[500];
+	unsigned char 		ItemData[501];//value should be limited in 500 bytes
 };
 
 struct OCPP16ConfigurationTable
@@ -4568,9 +4585,9 @@ struct StructSignedFirmwareStatusNotification
 
 struct StructSessionTarget
 {
-	unsigned char		targetSoc;			// Unit: %,   		0 is unlimit
-	unsigned short		targetEnergy;		// Unit: KWH		0 is unlimit
-	unsigned short		targetDuration;		// Unit: Minutes	0 is unlimit
+    unsigned char       targetSoc;          // Unit: %,         0 is unlimit
+    unsigned short      targetEnergy;       // Unit: KWH        0 is unlimit
+    unsigned short      targetDuration;     // Unit: Minutes    0 is unlimit
 };
 
 struct OCPP16Data
@@ -4761,7 +4778,7 @@ struct OCPP16Data
     struct StructSecurityEventNotification          SecurityEventNotification;
     struct StructSignCertificate                    SignCertificate;
     struct StructSignedFirmwareStatusNotification   SignedFirmwareStatusNotification;
-    struct StructSessionTarget	                    SessionTarget[CONNECTOR_QUANTITY];
+    struct StructSessionTarget                      SessionTarget[CONNECTOR_QUANTITY];
 };
 
 
@@ -6140,7 +6157,7 @@ struct OCPP20Data
 	struct UpdateFirmware_20					UpdateFirmware;
 	struct ChargingProfileType                  SmartChargingProfile[CONNECTOR_QUANTITY];
 	struct ChargingProfileType                  MaxChargingProfile;
-	struct StructSessionTarget	                SessionTarget[CONNECTOR_QUANTITY];
+	struct StructSessionTarget                  SessionTarget[CONNECTOR_QUANTITY];
 };
 
 

+ 135 - 4
EVSE/Projects/DD360UCar/Apps/ModuleDoComm/DoComm.c

@@ -49,7 +49,7 @@ static struct WARNING_CODE_INFO gPreSysWarningInfo = {0};
 
 // Hexdump
 char old_Hexdump[10240];
-
+uint8_t psu_num= 0;
 //------------------------------------------------------------------------------
 static void removeFaultCodeToBuf(uint8_t *Code);
 static void addFaultCodeToBuf(uint8_t *Code);
@@ -1023,7 +1023,29 @@ static int powerCabinetStatusProcess(uint8_t dataLen, uint8_t *data)
 
     return PASS;
 }
-
+void GetCabientDcmRevHandle(uint8_t *data)
+{
+	PCDCMVer *pVersion = (PCDCMVer *)&data[0];
+	strcpy(ShmDcCommonData->CabinetModelName , pVersion->CabinetModelName);
+	strcpy(ShmDcCommonData->CabinetBoolLoaderVersion, pVersion->CabinetBoolLoaderVersion);
+	strcpy(ShmDcCommonData->CabinetKernelVersion , pVersion->CabinetKernelVersion);
+	strcpy(ShmDcCommonData->CabinetRFSystemVersion , pVersion->CabinetRFSystemVersion);
+	strcpy(ShmDcCommonData->CabinetPrimaryVersion , pVersion->CabinetPrimaryVersion);
+	strcpy(ShmDcCommonData->CabinetIPAddr , pVersion->CabinetIPAddr);
+}
+void GetCabientOtherRevHandle(uint8_t *data)
+{
+	PCOthVer *pVersion = (PCOthVer *)&data[0];
+	strcpy(ShmDcCommonData->CabinetRelay0Version , pVersion->CabinetRelay0Version);
+	strcpy(ShmDcCommonData->CabinetRelay1Version , pVersion->CabinetRelay1Version);
+	strcpy(ShmDcCommonData->CabinetFanVersion , pVersion->CabinetFanVersion);
+}
+void GetCabientEachPsuRevHandle(uint8_t *data)
+{
+	PCnPsuVer *pVersion = (PCnPsuVer *)&data[0];
+	strcpy(ShmDcCommonData->PsuVer[pVersion->n_PSU].DCVersion, pVersion->DCVersion);
+	strcpy(ShmDcCommonData->PsuVer[pVersion->n_PSU].FPCVersion, pVersion->FPCVersion);
+}
 static int responsePackeHandle(int fd, uint8_t *pResult, uint8_t plugNum, uint8_t reg)
 {
     int ret = PASS;
@@ -1165,7 +1187,19 @@ static int responsePackeHandle(int fd, uint8_t *pResult, uint8_t plugNum, uint8_
             pDcChargingInfo->GroundFaultStatus = gfd->Status;
         }
         break;
-
+    case REG_GET_CABINET_DCM_VERSION:
+    	GetCabientDcmRevHandle(pCsuResult->Data.Data);
+        break;
+    case REG_GET_CABINET_OTHER_VERSION:
+    	GetCabientOtherRevHandle(pCsuResult->Data.Data);
+        break;
+    case REG_GET_CABINET_PSU_NUMBER:
+    	ShmDcCommonData->PSU_Number = pCsuResult->Data.Data[0];
+    	log_info("PSU Numbers:%d",ShmDcCommonData->PSU_Number);
+        break;
+    case REG_GET_CABINET_PSU_VERSION:
+    	GetCabientEachPsuRevHandle(pCsuResult->Data.Data);
+        break;
     default:
         break;
     }
@@ -1202,6 +1236,12 @@ static int composeSocketData(int fd,
 
     //Hexdump((uint8_t *)&csuCmdPkt, sendPktLen);
 
+    // Not Let ask cabinet version trasmit into FAIL Network
+    if (reg == REG_GET_CABINET_DCM_VERSION || reg == REG_GET_CABINET_OTHER_VERSION ||
+    		reg == REG_GET_CABINET_PSU_NUMBER || reg == REG_GET_CABINET_PSU_VERSION) {
+    	gDoCommGblData.DisConnCount = 0;
+    }
+
     //send command packet
     if ((size = sendTcpSocket(fd, (uint8_t *)&csuCmdPkt, sendPktLen)) < 0) {
         log_error("TCP socket send packet fail = %d", size);
@@ -1540,6 +1580,59 @@ static int readChargingCapability(int fd, uint8_t id)
     return ret;
 }
 
+static int readCabinetDCMVersion(int fd, uint8_t id)
+{
+    int ret = PASS;
+
+    ret = composeSocketData(fd,
+                            id,
+                            OP_READ_DATA,
+                            REG_GET_CABINET_DCM_VERSION,
+                            0,
+                            NULL);
+
+    return ret;
+}
+static int readCabinetOtherVersion(int fd, uint8_t id)
+{
+    int ret = PASS;
+
+    ret = composeSocketData(fd,
+                            id,
+                            OP_READ_DATA,
+							REG_GET_CABINET_OTHER_VERSION,
+                            0,
+                            NULL);
+
+    return ret;
+}
+static int readCabinetPSUNumber(int fd, uint8_t id)
+{
+    int ret = PASS;
+
+    ret = composeSocketData(fd,
+                            id,
+                            OP_READ_DATA,
+							REG_GET_CABINET_PSU_NUMBER,
+                            0,
+                            NULL);
+
+    return ret;
+}
+static int readCabinetEachPSUVersion(int fd, uint8_t id,uint8_t n_psu)
+{
+    int ret = PASS;
+    uint8_t data_buf[0] = {0};
+    data_buf[0] = n_psu;
+    ret = composeSocketData(fd,
+                            id,
+                            OP_READ_DATA,
+							REG_GET_CABINET_PSU_VERSION,
+							sizeof(data_buf),
+							&data_buf[0]);
+
+    return ret;
+}
 static int writeDispenserStatus(int fd, uint8_t gunID)
 {
     uint8_t warningCount = 0;
@@ -1936,8 +2029,46 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
 {
     uint8_t i = 0;
     struct timeb AuthNowTime = {0};
-    pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(plugNum);
 
+    pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(plugNum);
+    // Get Power Cabinet Version information
+    if (pSysConfig->ShowInformation == YES && pSysInfo->SystemPage == _LCM_VIEW) {
+    	// Get Power Cabinet DCM Version
+        ftime(&AuthNowTime);
+        if (DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_DCM_VERSION], AuthNowTime) > LOOP_RETRY_TIME ||
+                DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_DCM_VERSION], AuthNowTime) < 0
+           ) {
+            readCabinetDCMVersion(fd, gunID);
+            ftime(&gRegTimeUp[plugNum][REG_GET_CABINET_DCM_VERSION]);
+        }
+        // Get Power Cabinet Relay and Fan Version
+		ftime(&AuthNowTime);
+		if (DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_OTHER_VERSION], AuthNowTime) > LOOP_RETRY_TIME ||
+				DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_OTHER_VERSION], AuthNowTime) < 0
+		   ) {
+			readCabinetOtherVersion(fd, gunID);
+			ftime(&gRegTimeUp[plugNum][REG_GET_CABINET_OTHER_VERSION]);
+		}
+		// Get Power Cabinet PSU Numbers
+		ftime(&AuthNowTime);
+		if (DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_PSU_NUMBER], AuthNowTime) > LOOP_RETRY_TIME ||
+				DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_PSU_NUMBER], AuthNowTime) < 0
+		   ) {
+			readCabinetPSUNumber(fd, gunID);
+			ftime(&gRegTimeUp[plugNum][REG_GET_CABINET_PSU_NUMBER]);
+		}
+		// Get Power Cabinet each PSU Version
+		if (ShmDcCommonData->PSU_Number > 0) {
+			for(i = 0 ; i < ShmDcCommonData->PSU_Number ; i++) {
+				if (DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_PSU_VERSION], AuthNowTime) > LOOP_RETRY_TIME ||
+						DiffTimeb(gRegTimeUp[plugNum][REG_GET_CABINET_PSU_VERSION], AuthNowTime) < 0
+				   ) {
+					readCabinetEachPSUVersion(fd, gunID,i);
+					ftime(&gRegTimeUp[plugNum][REG_GET_CABINET_PSU_VERSION]);
+				}
+			}
+		}
+    }
     switch (pDcChargingInfo->SystemStatus) {
     case S_IDLE:
     case S_RESERVATION:

+ 25 - 1
EVSE/Projects/DD360UCar/Apps/ModuleDoComm/DoComm.h

@@ -80,7 +80,10 @@
 #define REG_QRCODE_URL_INFO                     0X10
 #define REG_WAIT_PLUG_IT_STATE                  0x11
 #define REG_Ground_Fault_Detection              0x12
-
+#define REG_GET_CABINET_DCM_VERSION             0x13
+#define REG_GET_CABINET_OTHER_VERSION           0x14
+#define REG_GET_CABINET_PSU_NUMBER              0x15
+#define REG_GET_CABINET_PSU_VERSION             0x16
 //------------------------------------------------------------------------------
 //--- dispenser result ---
 //------------------------------------------------------------------------------
@@ -234,6 +237,27 @@ typedef struct StAccountInfo {
     uint8_t Reserved[3];
 } AccountInfo;
 
+typedef struct stCabinetDCMVersion {
+    uint8_t CabinetModelName[32];
+    uint8_t CabinetBoolLoaderVersion[32];
+    uint8_t CabinetKernelVersion[32];
+    uint8_t CabinetRFSystemVersion[32];
+    uint8_t CabinetPrimaryVersion[32];
+    uint8_t CabinetIPAddr[32];
+}PCDCMVer;
+
+typedef struct stCabinetOtherVersion {
+    uint8_t CabinetRelay0Version[32];
+    uint8_t CabinetRelay1Version[32];
+    uint8_t CabinetFanVersion[32];
+}PCOthVer;
+
+typedef struct stCabinetEachPsuVersion {
+	uint8_t n_PSU;
+	uint8_t DCVersion[32];
+	uint8_t FPCVersion[32];
+}PCnPsuVer;
+
 #pragma pack(pop)
 
 #endif /* _DO_COMM_H_ */

+ 0 - 2351
EVSE/Projects/DD360UCar/Apps/ModuleLcmCtrl/Module_LcmContro_oldl.c

@@ -1,2351 +0,0 @@
-#include <stdio.h>      /*標準輸入輸出定義*/
-#include <stdlib.h>     /*標準函數庫定義*/
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-#include <termios.h>
-#include <fcntl.h>
-#include <time.h>
-
-#include <sys/ioctl.h>
-#include <sys/timeb.h>
-
-#include "Module_LcmControl.h"
-#include "../Log/log.h"
-#include "../ShareMemory/shmMem.h"
-#include "../Define/define.h"
-#include "../Config.h"
-#include "../SelectGun/SelectGun.h"
-
-//------------------------------------------------------------------------------
-//struct SysConfigAndInfo         *ShmSysConfigAndInfo;
-//struct StatusCodeData           *ShmStatusCodeData;
-static struct SysConfigData *pSysConfig = NULL;
-static struct SysInfoData *pSysInfo = NULL;
-static struct WARNING_CODE_INFO *pSysWarning = NULL;
-
-static struct FanModuleData *ShmFanModuleData;
-static struct PrimaryMcuData *ShmPrimaryMcuData;
-static SelectGunInfo *ShmSelectGunInfo = NULL;
-static struct ChargingInfoData *pDcChargingInfo = NULL;
-static struct ChargingInfoData *pAcChargingInfo = NULL;
-
-bool needReloadQr = true;
-
-bool _isShow = false; //DS60-120 add
-uint8_t _showInformIndex = 0; //DS60-120 add
-
-int _port;
-//char* pPortName         = "/dev/ttyO2";
-char *pPortName           = "/dev/ttyS3";
-char *moduleName          = "DMT80480T070_09WT";
-uint8_t _totalCount;
-uint8_t acgunCount;
-//struct ChargingInfoData *_chargingInfoData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
-//struct ChargingInfoData *ac_chargingInfo[AC_QUANTITY];
-
-uint8_t ac_ani_battery_level    = _BATTERY_LEVEL_FOR_MAP_LV5;
-uint8_t isDiffStatus            = false;
-uint8_t isChangeBattMap         = false;
-// 當前選擇的槍號
-short _currentPage              = _LCM_VIEW;
-short _oldPage                  = _LCM_VIEW;
-
-uint8_t _gunIndex               = 0;
-bool _wifi_conn_status          = false;
-bool _battery_display_ani       = false;
-uint8_t _curPage_index          = 0;
-bool _page_reload               = false;
-
-// LCM - HW
-uint8_t _everyPageRollChange    = 0;
-short __conn_status             = 0x0030;
-short __ethernet_status         = 0x0032;
-short __3G4G_status             = 0x0036;
-short __3G4G_status1            = 0x0037;
-short __3G4G_move_status        = 0x0038;
-short __wifi_status             = 0x003C;
-
-short __sel_gun_btn             = 0x0040;
-short __ret_home_btn            = 0x0042;
-short __stop_method_btn         = 0x0044;
-
-short __qr_code                 = 0x0250;
-short __main_rfid               = 0x0052;
-short __main_qr                 = 0x0054;
-short __main_app                = 0x0056;
-
-short __plug_in_arrow           = 0x0060;
-
-short __conn_line               = 0x0066;
-
-short __gun_type_index          = 0x0070;
-short __cmp_gun_type_index      = 0x0080; ////For Audi
-short __batt_map_empty          = 0x0090; ////For Audi
-short __qr_code_pre             = 0x0280;
-
-short __side_top                = 0x0090;
-short __side_down               = 0x0092;
-short __side_mid                = 0x0094;
-
-short __conn_line_chag          = 0x0096;
-short __batt_map                = 0x0100;
-short __soc_value_charging      = 0x0102;
-short __remain_time_map         = 0x0106;
-short __power_map               = 0x0108;
-short __energy_map              = 0x010A;
-short __remain_time_tx          = 0x0110;
-
-short __trp_remain_time_map     = 0x0116;
-short __trp_power_map           = 0x0118;
-short __trp_energy_map          = 0x011A;
-
-short __output_eng_tx           = 0x0120;
-short __total_out_eng_tx        = 0x0130;
-short __conn_line_comp          = 0x0140;
-short __charging_fee_map        = 0x0146;
-short __charging_fee_tx         = 0x0150;
-
-short __money_by_rate           = 0x0200;
-short __money_rate              = 0x0220;
-short __money_rate_map          = 0x0230;
-
-//DS60-120 add
-short __csu_ver_string          = 0x0300;
-short __csu_ver_value           = 0x0310;
-short __fan_speed_string        = 0x0390;
-short __fan_speed_value         = 0x0400;
-
-short __dc1_ver_string          = 0x0320;
-short __dc1_ver_value           = 0x0330;
-short __dc2_ver_string          = 0x0340;
-short __dc2_ver_value           = 0x0350;
-short __eth0_ip_string          = 0x0360;
-short __eth0_ip_value           = 0x0370;
-short __sn_string               = 0x0410;
-short __sn_value                = 0x0420;
-
-//For Audi, for select gun
-short __left_gun_map            = 0x0260;
-short __right_gun_map           = 0x0262;
-short __add_chk_btn             = 0x0264;
-//short __station_id            = 0x0270;
-short __balance                 = 0x0270;
-short __remain_balance          = 0x0280;
-short __custStationIdL1         = 0x0450;
-//short __custStationIdL2       = 0x0470;
-short _emergency_map            = 0x011C;
-
-// ICON ID
-uint8_t _disappear              = 0;
-uint8_t _disconnect             = 1;
-uint8_t _connect                = 2;
-uint8_t _warning                = 3;
-uint8_t _arrow_dark             = 4;
-uint8_t _arrow_light            = 5;
-uint8_t _3G4G_disconnect        = 6;
-uint8_t __3G4G_connect          = 7;
-uint8_t _wifi_disconnect        = 8;
-uint8_t _wifi_connect           = 9;
-uint8_t _logo                   = 10;
-uint8_t _conn_map1              = 11;
-uint8_t _conn_map2              = 12;
-uint8_t _sel_gun_btn            = 13;
-uint8_t _back_home_btn          = 14;
-uint8_t _stop_charging_btn      = 15;
-uint8_t _stop_charging_btn_scan = 16;
-uint8_t _chademo_dark           = 17;
-uint8_t _ccs_dark               = 18;
-uint8_t _gbt_dark               = 19;
-uint8_t _actype_dark            = 20;
-uint8_t _chademo_light          = 21;
-uint8_t _ccs_light              = 22;
-uint8_t _gbt_light              = 23;
-uint8_t _actype_light           = 24;
-uint8_t _main_none_rfid         = 25;
-uint8_t _main_rfid              = 26;
-uint8_t _main_none_app          = 27;
-uint8_t _main_app               = 28;
-uint8_t _main_none_qr           = 29;
-uint8_t _main_qr                = 30;
-uint8_t _charging_map1          = 31;
-uint8_t _charging_map2          = 32;
-uint8_t _battery_empty          = 33;
-uint8_t _battery_cap_20         = 34;
-uint8_t _battery_cap_40         = 35;
-uint8_t _battery_cap_60         = 36;
-uint8_t _battery_cap_80         = 37;
-uint8_t _battery_cap_100        = 38;
-uint8_t _battery_map            = 39;
-uint8_t _power_map              = 40;
-uint8_t _time_map               = 41;
-uint8_t _complete_map           = 42;
-uint8_t _battery_soc_20         = 43;
-uint8_t _battery_soc_40         = 44;
-uint8_t _battery_soc_60         = 45;
-uint8_t _battery_soc_80         = 46;
-uint8_t _battery_soc_100        = 47;
-uint8_t _battery_eng_map        = 48;
-uint8_t _money_map              = 49;
-uint8_t _elapse_time_map        = 50;
-uint8_t _charging_money         = 51;
-//uint8_t _side_none_rfid       = 52;
-//uint8_t _side_rfid            = 53;
-//uint8_t _side_none_app        = 54;
-//uint8_t _side_app             = 55;
-//uint8_t _side_none_qr         = 56;
-//uint8_t _side_qr              = 57;
-uint8_t _eth_disconnect         = 52; //58;
-uint8_t _eth_connect            = 53; //59;
-
-uint8_t _chademo_dark_cmp       = 54;
-uint8_t _ccs_dark_cmp           = 55;
-uint8_t _gbt_dark_cmp           = 56;
-uint8_t _actype_dark_cmp        = 57;
-uint8_t _chademo_light_cmp      = 58;
-uint8_t _ccs_light_cmp          = 59;
-uint8_t _gbt_light_cmp          = 60;
-uint8_t _actype_light_cmp       = 61;
-
-uint8_t _logo_cmp               = 62;
-uint8_t _battery_eng_trp_map    = 63;
-uint8_t _money_trp_map          = 64;
-uint8_t _elapse_time_trp_map    = 65;
-
-////For Audi
-uint8_t _left_gun_disable_map   = 66;
-uint8_t _left_gun_enable_map    = 67;
-uint8_t _right_gun_disable_map  = 68;
-uint8_t _right_gun_enable_map   = 69;
-uint8_t _select_gun_btn         = 70;
-uint8_t _emergency_disable_map  = 72;
-// For replug
-struct timespec showReplugStrTimer;
-short __show_replugString_value = 0x0460;
-uint8_t _showReplugStr_1 = 74;
-uint8_t _showReplugStr_2 = 75;
-
-//#define log_info(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-//#define log_warn(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-//#define log_error(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-
-//=================================
-// Common routine
-//=================================
-/*int StoreLogMsg(const char *fmt, ...)
-{
-    char Buf[4096 + 256];
-    char buffer[4096];
-    va_list args;
-    struct timeb  SeqEndTime;
-    struct tm *tm;
-
-    va_start(args, fmt);
-    int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
-    va_end(args);
-
-    memset(Buf, 0, sizeof(Buf));
-    ftime(&SeqEndTime);
-    SeqEndTime.time = time(NULL);
-    tm = localtime(&SeqEndTime.time);
-
-    if (pSysConfig->SwitchDebugFlag == YES) {
-        sprintf(Buf, "%02d:%02d:%02d:%03d - %s",
-                tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm, buffer);
-        printf("%s ", Buf);
-    } else {
-        sprintf(Buf, "echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-                tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm,
-                buffer,
-                tm->tm_year + 1900, tm->tm_mon + 1);
-        system(Buf);
-    }
-
-    return rc;
-}
-
-char *getTimeString(void)
-{
-    char *result = malloc(21);
-    time_t timep;
-    struct tm *p;
-    time(&timep);
-    p = gmtime(&timep);
-
-    sprintf(result, "[%04d-%02d-%02d %02d:%02d:%02d]", (1900 + p->tm_year), (1 + p->tm_mon), p->tm_mday, p->tm_hour, p->tm_hour, p->tm_sec);
-
-    return result;
-}
-*/
-
-#if 0
-//==========================================
-// Init all share memory
-//==========================================
-int InitShareMemory()
-{
-    int result = PASS;
-    int MeterSMId;
-
-    //creat ShmSysConfigAndInfo
-    if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0) {
-#ifdef SystemLogMessage
-        log_error("shmget ShmSysConfigAndInfo NG");
-#endif
-        result = FAIL;
-    } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
-#ifdef SystemLogMessage
-        log_error("shmat ShmSysConfigAndInfo NG");
-#endif
-        result = FAIL;
-    } else
-    {}
-
-    //creat ShmStatusCodeData
-    if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0) {
-#ifdef SystemLogMessage
-        log_error("shmget ShmStatusCodeData NG");
-#endif
-        result = FAIL;
-    } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
-#ifdef SystemLogMessage
-        log_error("shmat ShmStatusCodeData NG");
-#endif
-        result = FAIL;
-    } else
-    {}
-
-    //creat Audi customization info
-    if ((MeterSMId = shmget(ShmSelectGunInfoKey, sizeof(SelectGunInfo), IPC_CREAT | 0777)) < 0) {
-        log_error("[main]CreatShareMemory:shmget select gun info NG ");
-        return 0;
-    } else if ((ShmSelectGunInfo = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
-        log_error("[main]CreatShareMemory:shmat shmget select gun info ");
-        return 0;
-    }
-
-    //creat ShmStatusCodeData
-    if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), 0777)) < 0) {
-#ifdef SystemLogMessage
-        log_error("shmget ShmPrimaryMcuData NG");
-#endif
-        result = FAIL;
-    } else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) - 1) {
-#ifdef ShmPrimaryMcuData
-        log_error("shmat ShmPrimaryMcuData NG");
-#endif
-        result = FAIL;
-    }
-
-    return result;
-}
-#endif //0
-
-//==========================================
-// Open and Close RS232 and R/W
-//==========================================
-int CreateCommunicationLcmPort()
-{
-    int fd;
-    struct termios tios;
-
-    fd = open(pPortName, O_RDWR);
-    if (fd <= 0) {
-#ifdef SystemLogMessage
-        log_error("open /dev/ttyS3 NG ");
-#endif
-        return -1;
-    }
-    ioctl(fd, TCGETS, &tios);
-    tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
-    tios.c_lflag = 0;
-    tios.c_iflag = 0;
-    tios.c_oflag = 0;
-    tios.c_cc[VMIN] = 0;
-    tios.c_cc[VTIME] = (uint8_t) 5;
-    tios.c_lflag = 0;
-    tcflush(fd, TCIFLUSH);
-    ioctl(fd, TCSETS, &tios);
-
-    return fd;
-}
-
-void CloseCommunicationLcmPort()
-{
-    close(_port);
-}
-
-void WriteCmdToLcm(uint8_t *cmd, uint8_t cmdLen)
-{
-    int len = write(_port, cmd, cmdLen);
-    if (len >= sizeof(cmd)) {
-        //log_info("Write cmd to LCM successfully. ");
-    }
-}
-
-void ReadMsgFromLcm(uint8_t *msg, uint8_t readLen)
-{
-    read(_port, msg, readLen);
-
-    if (*msg == CMD_TITLE_1 && *(msg + 1) == CMD_TITLE_2) {
-        if (*(msg + 3) == CMD_WRITE) {
-            switch (*(msg + 4)) {
-            case CMD_REGISTER: {
-                // 頁面
-                strcpy((char *)pSysInfo->LcmHwRev, moduleName);
-            }
-            break;
-            }
-        } else if (*(msg + 3) == CMD_MULTI_READ) {
-//          switch ((unsigned short) (*(msg + 4) << 8) + (unsigned short) *(msg + 5))
-//          {
-//              case BUTTON_GUN_INDEX:
-//              {
-//                  // 當前選的槍號
-//                  _curGunIndex = (*(msg + 8));
-//              }
-//              break;
-//          }
-        }
-    }
-}
-
-//================================================
-// Function
-//================================================
-void ChangeToOtherPage(short newPage)
-{
-    uint8_t cmd[7];
-    memset(cmd, 0x00, sizeof(cmd));
-
-    cmd[0] = CMD_TITLE_1;
-    cmd[1] = CMD_TITLE_2;
-    cmd[2] = 0x02 + sizeof(newPage);
-    cmd[3] = CMD_READ;
-    cmd[4] = CMD_REGISTER;
-    cmd[5] = newPage >> 8;
-    cmd[6] = newPage & 0x00FF;
-
-    WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
-    usleep(100000);
-}
-
-void ChangeBackLight(bool islight)
-{
-    uint8_t value = 0x01;
-
-    if (islight) {
-        value = 0x20;
-    }
-    uint8_t cmd[7];
-    memset(cmd, 0x00, sizeof(cmd));
-
-    cmd[0] = CMD_TITLE_1;
-    cmd[1] = CMD_TITLE_2;
-    cmd[2] = 0x03;
-    cmd[3] = CMD_READ;
-    cmd[4] = CMD_BACKLIGHT;
-    cmd[5] = value;
-
-    WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
-    usleep(5000);
-}
-
-void GetCurrentPage()
-{
-    uint8_t cmd[6];
-    memset(cmd, 0x00, sizeof(cmd));
-    uint8_t msg[8];
-    memset(msg, 0x00, sizeof(msg));
-
-    cmd[0] = CMD_TITLE_1;
-    cmd[1] = CMD_TITLE_2;
-    cmd[2] = 0x03;              // 底下總長度
-    cmd[3] = CMD_WRITE;
-    cmd[4] = CMD_REGISTER;
-    cmd[5] = 0x02;
-
-    WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
-    usleep(5000);
-    ReadMsgFromLcm(msg, ARRAY_SIZE(msg));
-}
-
-void DisplayValueToLcm(short address, uint8_t *data, uint8_t len)
-{
-    uint8_t cmd[256];
-    memset(cmd, 0x00, sizeof(cmd));
-
-    cmd[0] = CMD_TITLE_1;
-    cmd[1] = CMD_TITLE_2;
-    cmd[2] = 0x03 + len;
-    cmd[3] = CMD_MULTI_WRITE;
-    cmd[4] = address >> 8;
-    cmd[5] = address & 0x00FF;
-
-    for (uint8_t count = 0; count < len; count++) {
-        cmd[6 + count] = *(data + count);
-    }
-
-    WriteCmdToLcm(cmd, cmd[2] + 3);
-}
-
-void ChangeDisplay2Value(short address, short value)
-{
-    uint8_t data[2];
-    data[0] = value >> 8;
-    data[1] = value & 0x00FF;
-
-    DisplayValueToLcm(address, data, sizeof(data));
-}
-
-void GetBtnStatus(short address, uint8_t len)
-{
-    uint8_t cmd[8];
-    memset(cmd, 0x00, sizeof(cmd));
-    uint8_t msg[8];
-    memset(msg, 0x00, sizeof(msg));
-
-    cmd[0] = CMD_TITLE_1;
-    cmd[1] = CMD_TITLE_2;
-    cmd[2] = 0x03 + len;
-    cmd[3] = CMD_MULTI_READ;
-    cmd[4] = address >> 8;
-    cmd[5] = address & 0x00FF;
-    cmd[6] = 0x00 + len;
-
-    WriteCmdToLcm(cmd, cmd[2] + 3);
-    usleep(100000);
-    ReadMsgFromLcm(msg, (len * 2) + sizeof(msg));
-}
-
-//================================================
-// Warning process
-//================================================
-void string2ByteArray(uint8_t *input, uint8_t *output)
-{
-    int loop;
-    int i;
-
-    loop = 0;
-    i = 0;
-
-    while (input[loop] != '\0') {
-        output[i++] = input[loop++];
-    }
-    output[loop] = '\0';
-}
-
-void ChangeWarningFunc()
-{
-    uint8_t cmd[7] = {0};
-    uint8_t i = 0;
-    //uint8_t j = 0;
-    //log_info("ChangeWarningFunc ");
-    // 最多一次五筆
-    //log_info("LCM PageIndex = %d ", pSysWarning->PageIndex);
-    //log_info("WarningCount = %d ", pSysWarning->WarningCount);
-//#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
-    for (i = 0; (i + pSysWarning->PageIndex * 5) < pSysWarning->WarningCount; i++) {
-        memset(cmd, 0x00, sizeof(cmd));
-        if ((i) >= 5) {
-            break;
-        }
-
-        //error code
-        string2ByteArray(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], cmd);
-        DisplayValueToLcm(0x0010 + ((i) * 6), cmd, sizeof(cmd));
-        //警告標示
-        memset(cmd, 0x00, sizeof(cmd));
-
-        cmd[0] = 0x00;
-        cmd[1] = 0x01;
-        DisplayValueToLcm(0x0002 + ((i) * 2), cmd, 2);
-    }
-
-    memset(cmd, 0x00, sizeof(cmd));
-    for (; i < 5; i++) {
-        DisplayValueToLcm(0x0010 + ((i) * 6), cmd, sizeof(cmd));
-        DisplayValueToLcm(0x0002 + ((i) * 2), cmd, 2);
-    }
-
-    /*#else
-        for (i = 0; (i + pSysWarning->PageIndex * 5) < pSysWarning->WarningCount; i++) {
-            memset(cmd, 0x00, sizeof(cmd));
-            if ((i - j) >= 5) {
-                break;
-            }
-            if (
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "033900", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "033901", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "033902", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "043627", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "043628", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "043622", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "043623", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "043624", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "043625", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "043626", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "042241", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], "042242", 6) == 0)
-            ) {
-                j++;
-                continue;
-            }
-            //error code
-            string2ByteArray(&pSysWarning->WarningCode[i + pSysWarning->PageIndex * 5][0], cmd);
-            DisplayValueToLcm(0x0010 + ((i - j) * 6), cmd, sizeof(cmd));
-            //警告標示
-            memset(cmd, 0x00, sizeof(cmd));
-
-            cmd[0] = 0x00;
-            cmd[1] = 0x01;
-            DisplayValueToLcm(0x0002 + ((i - j) * 2), cmd, 2);
-        }
-
-        memset(cmd, 0x00, sizeof(cmd));
-        i = i - j;
-        for (; (i) < 5; i++) {
-            DisplayValueToLcm(0x0010 + ((i) * 6), cmd, sizeof(cmd));
-            DisplayValueToLcm(0x0002 + ((i) * 2), cmd, 2);
-        }
-
-    #endif //!defined DD360 && !defined DD360Audi
-    */
-}
-
-//================================================
-// QR Code process
-//================================================
-void ChangeQrCode_Idle(char *input)
-{
-#if defined DD360Audi
-    int len = strlen(input) + 3;
-    int loop = 0;
-    int i = 0, j = 0, k = 0, l = 0;
-    uint8_t qrUrl[128] = {0};
-    uint16_t urlLen = 0;
-    uint8_t cmd[len];
-    uint8_t tmpBuf[15] = {0};
-    //uint8_t tmpLen = sizeof(tmpBuf) - 1;
-
-    strncpy((char *)cmd, " ", len);
-
-    while (input[loop] != '\0') {
-        cmd[i++] = input[loop++];
-        l = loop - 1;
-        if (len >= 25) {
-            if (i >= 16 && i <= 19) {
-                tmpBuf[k++] = input[l];
-                //printf("tmpBuf = %s", tmpBuf);
-            } else if (i >= 21 && i <= 23) {
-                tmpBuf[k++] = input[l];
-            }
-        }
-    }
-    tmpBuf[k] = '\0';
-    //printf("tmpBuf = %s", tmpBuf);
-    j += sprintf((char *)&cmd[i], ":%d", pSysInfo->CurGunSelected); ////For Audi
-    cmd[len - 1] = '\0';
-    urlLen = sprintf((char *)qrUrl, "%s%s", NOODOE_QR_CODE_URL, cmd);
-    qrUrl[urlLen] = '\0';
-    //printf("qr url = %s", qrUrl);
-    DisplayValueToLcm(__qr_code, qrUrl, urlLen);
-
-    j = 0;
-    j += sprintf((char *)&tmpBuf[k], "0%d", pSysInfo->CurGunSelected); ////For Audi
-    tmpBuf[k + j] = '\0';
-
-    //if (len < 25) {
-    //    strncpy((char *)tmpBuf, (char *)cmd, sizeof(tmpBuf));
-    //}
-    //tmpBuf[tmpLen] = '\0';
-    DisplayValueToLcm(__custStationIdL1, tmpBuf, sizeof(tmpBuf));
-
-    /*if (len > sizeof(tmpBuf)) {
-        strncpy((char *)tmpBuf, (char *)cmd, sizeof(tmpBuf));
-        tmpBuf[tmpLen] = '\0';
-        DisplayValueToLcm(__custStationIdL1, tmpBuf, sizeof(tmpBuf));
-
-        memset(tmpBuf, 0, sizeof(tmpBuf));
-        strncpy((char *)tmpBuf, (char *)&cmd[tmpLen], sizeof(tmpBuf));
-        tmpBuf[tmpLen] = '\0';
-        DisplayValueToLcm(__custStationIdL2, tmpBuf, sizeof(tmpBuf));
-    } else {
-        DisplayValueToLcm(__custStationIdL1, cmd, len);
-
-        strncpy((char *)tmpBuf, " ", sizeof(tmpBuf));
-        tmpBuf[tmpLen] = '\0';
-        DisplayValueToLcm(__custStationIdL2, tmpBuf, sizeof(tmpBuf));
-    }*/
-
-#else
-    int len = strlen(input);
-    uint8_t cmd[len];
-
-    int loop = 0;
-    int i = 0;
-
-    while (input[loop] != '\0') {
-        cmd[i++] = input[loop++];
-    }
-
-    DisplayValueToLcm(__qr_code, cmd, len + 1);
-#endif //defined DD360Audi
-}
-
-void ChangeQrCode_Charge(char *input)
-{
-#if defined DD360Audi
-    int len = strlen(input) + 3;
-    int loop = 0;
-    int i = 0, j = 0, k = 0, l = 0;
-    uint8_t qrUrl[128] = {0};
-    uint16_t urlLen = 0;
-    uint8_t cmd[len];
-    uint8_t tmpBuf[15] = {0};
-    //uint8_t tmpLen = sizeof(tmpBuf) - 1;
-
-    strncpy((char *)cmd, " ", len);
-
-    while (input[loop] != '\0') {
-        cmd[i++] = input[loop++];
-        l = loop - 1;
-        if (len >= 25) {
-            if (i >= 16 && i <= 19) {
-                tmpBuf[k++] = input[l];
-                //printf("tmpBuf = %s", tmpBuf);
-            } else if (i >= 21 && i <= 23) {
-                tmpBuf[k++] = input[l];
-            }
-        }
-    }
-    tmpBuf[k] = '\0';
-    //printf("tmpBuf = %s", tmpBuf);
-    j += sprintf((char *)&cmd[i], ":%d", pSysInfo->CurGunSelected); ////For Audi
-    cmd[len - 1] = '\0';
-    urlLen = sprintf((char *)qrUrl, "%s%s", NOODOE_QR_CODE_URL, cmd);
-    qrUrl[urlLen] = '\0';
-    DisplayValueToLcm(__qr_code, qrUrl, urlLen);
-
-    j = 0;
-    j += sprintf((char *)&tmpBuf[k], "0%d", pSysInfo->CurGunSelected); ////For Audi
-    tmpBuf[k + j] = '\0';
-
-    if (len < 25) {
-        strncpy((char *)tmpBuf, (char *)cmd, sizeof(tmpBuf));
-    }
-    //tmpBuf[tmpLen] = '\0';
-    DisplayValueToLcm(__custStationIdL1, tmpBuf, sizeof(tmpBuf));
-    /*if (len > sizeof(tmpBuf)) {
-        strncpy((char *)tmpBuf, (char *)cmd, sizeof(tmpBuf));
-        tmpBuf[tmpLen] = '\0';
-        DisplayValueToLcm(__custStationIdL1, tmpBuf, sizeof(tmpBuf));
-
-        memset(tmpBuf, 0, sizeof(tmpBuf));
-        strncpy((char *)tmpBuf, (char *)&cmd[tmpLen], sizeof(tmpBuf));
-        tmpBuf[tmpLen] = '\0';
-        DisplayValueToLcm(__custStationIdL2, tmpBuf, sizeof(tmpBuf));
-    } else {
-        DisplayValueToLcm(__custStationIdL1, cmd, len);
-
-        strncpy((char *)tmpBuf, " ", sizeof(tmpBuf));
-        tmpBuf[tmpLen] = '\0';
-        DisplayValueToLcm(__custStationIdL2, tmpBuf, sizeof(tmpBuf));
-    }*/
-
-#else
-    int len = strlen(input);
-    uint8_t cmd[len];
-
-    int loop = 0;
-    int i = 0;
-
-    while (input[loop] != '\0') {
-        cmd[i++] = input[loop++];
-    }
-
-    DisplayValueToLcm(__qr_code_pre, cmd, len + 1);
-#endif //defined DD360Audi
-}
-
-//================================================
-// Change current page
-//================================================
-void ChangeCurPage()
-{
-    //log_info("cur = %d, new = %d ", _currentPage, pSysInfo->PageIndex);
-    if (_currentPage != pSysInfo->PageIndex) {
-        _currentPage = pSysInfo->PageIndex;
-        ChangeToOtherPage(_currentPage);
-        _everyPageRollChange = 0;
-    }
-}
-
-//================================================
-// Main process
-//================================================
-uint8_t demoCount = 0;
-void DemoFunction()
-{
-    if (demoCount == 0) {
-        pSysWarning->WarningCount = 6;
-        memcpy(&pSysWarning->WarningCode[0][0], "000001", 7);
-        memcpy(&pSysWarning->WarningCode[1][0], "000002", 7);
-        memcpy(&pSysWarning->WarningCode[2][0], "000003", 7);
-        memcpy(&pSysWarning->WarningCode[3][0], "000004", 7);
-        memcpy(&pSysWarning->WarningCode[4][0], "000005", 7);
-        memcpy(&pSysWarning->WarningCode[5][0], "000006", 7);
-    } else {
-        if (demoCount == 20) {
-            pSysInfo->PageIndex = _LCM_VIEW;
-        } else if (demoCount == 80) {
-            pSysInfo->PageIndex = _LCM_START_AUTHORIZING;
-        } else if (demoCount == 100) {
-            //pSysInfo->PageIndex = _LCM_AUTHORIZ_COMP;
-        } else if (demoCount == 120) {
-            pSysInfo->PageIndex = _LCM_WAIT_PLUGIN;
-        } else if (demoCount == 140) {
-            pSysInfo->PageIndex =  _LCM_LINK_ERROR;
-        } else if (demoCount == 180) {
-            pSysInfo->PageIndex = _LCM_DETAIL_VIEW;
-        }
-    }
-
-    if (demoCount < 180) {
-        demoCount++;
-    }
-}
-
-//================================================
-// Main process
-//================================================
-bool FindChargingInfoData(uint8_t target, struct ChargingInfoData **_chargingData)
-{
-    for (uint8_t index = 0; index < CHAdeMO_QUANTITY; index++) {
-        if (pSysInfo->ChademoChargingData[index].Index == target) {
-            _chargingData[target] = &pSysInfo->ChademoChargingData[index];
-            return true;
-        }
-    }
-
-    for (uint8_t index = 0; index < CCS_QUANTITY; index++) {
-        if (pSysInfo->CcsChargingData[index].Index == target) {
-            _chargingData[target] = &pSysInfo->CcsChargingData[index];
-            return true;
-        }
-    }
-
-    for (uint8_t index = 0; index < GB_QUANTITY; index++) {
-        if (pSysInfo->GbChargingData[index].Index == target) {
-            _chargingData[target] = &pSysInfo->GbChargingData[index];
-            return true;
-        }
-    }
-
-    return false;
-}
-
-bool FindAcChargingInfoData(uint8_t target, struct ChargingInfoData **acChargingData)
-{
-    if (target < AC_QUANTITY) {
-        acChargingData[target] = &pSysInfo->AcChargingData[target];
-        return true;
-    }
-
-    return false;
-}
-int GetTimeoutValue(struct timespec *startTime)
-{
-    struct timespec endTime;
-    clock_gettime(CLOCK_MONOTONIC_COARSE, &endTime);
-    return endTime.tv_sec - startTime->tv_sec;
-}
-void GetTimespecFunc(struct timespec *time)
-{
-    clock_gettime(CLOCK_MONOTONIC_COARSE, time);
-}
-
-void RunReplugStringFunction(bool isRun)
-{
-    if (isRun) {
-        int time = GetTimeoutValue(&showReplugStrTimer);
-        if (time >=1 && time <2) {
-            ChangeDisplay2Value(__show_replugString_value, _showReplugStr_1);
-        } else if (time < 1) {
-            ChangeDisplay2Value(__show_replugString_value, _showReplugStr_2);
-        } else
-            GetTimespecFunc(&showReplugStrTimer);
-
-    } else
-        ChangeDisplay2Value(__show_replugString_value, _disappear);
-}
-
-/**
- * [ChangeBalanceValue :print balance information]
- * @Author
- * @DateTime 2020-11-26
- */
-static void ChangeBalanceValue(uint16_t addr, uint8_t index) ////For Audi
-{
-    uint8_t cmd[10] = {0};
-    uint8_t value[10] = {0};
-    uint8_t len = 0;
-    float balance = ShmSelectGunInfo->PricesInfo[index].Balance;
-
-    if ((balance) == (FAIL_BALANCE_PRICES)) {
-        balance = 0.00;
-    }
-
-    len += sprintf((char *) value, "%.2f", balance);
-    if (len < 6) {
-        sprintf((char *)&value[len], "%s",
-                (uint8_t *)GetCurrency(pSysConfig->BillingData.Currency));
-    }
-
-    value[sizeof(value) - 1] = '\0';
-
-    string2ByteArray(value, cmd);
-    DisplayValueToLcm(addr, cmd, sizeof(cmd));
-}
-
-void ChangeAcBattMapAndValue(short page)
-{
-    pAcChargingInfo = (struct ChargingInfoData *)GetAcChargingInfoData(0);
-
-    if (page == _LCM_VIEW) {
-        if (isDiffStatus != _battery_display_ani) {
-            isChangeBattMap = false;
-            isDiffStatus = _battery_display_ani;
-        }
-
-        if (pAcChargingInfo->IsCharging && !isChangeBattMap) {
-            isChangeBattMap = true;
-            if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV5) {
-                ChangeDisplay2Value(__batt_map, _battery_empty);
-                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_EMP;
-            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_EMP) {
-                ChangeDisplay2Value(__batt_map, _battery_cap_20);
-                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV1;
-            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV1) {
-                ChangeDisplay2Value(__batt_map, _battery_cap_40);
-                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV2;
-            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV2) {
-                ChangeDisplay2Value(__batt_map, _battery_cap_60);
-                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV3;
-            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV3) {
-                ChangeDisplay2Value(__batt_map, _battery_cap_80);
-                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV4;
-            } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV4) {
-                ChangeDisplay2Value(__batt_map, _battery_cap_100);
-                ac_ani_battery_level = _BATTERY_LEVEL_FOR_MAP_LV5;
-            }
-        }
-    } else if (page == _LCM_SUMMARY) {
-        if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV5) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_20);
-        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_EMP) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_20);
-        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV1) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_40);
-        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV2) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_60);
-        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV3) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_80);
-        } else if (ac_ani_battery_level == _BATTERY_LEVEL_FOR_MAP_LV4) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_100);
-        }
-    }
-
-    ChangeDisplay2Value(__soc_value_charging, _disappear);
-}
-
-void ChangeBattMapAndValue(short page, int soc)
-{
-//  srand(time(NULL));
-//  int min = 10;
-//  int max = 90;
-//  soc = rand() % (max - min + 1) + min;
-
-    if (page == _LCM_PRECHARGE) {
-        ChangeDisplay2Value(__batt_map_empty, _battery_empty);
-    } else if (page == _LCM_VIEW) {
-        if (soc < 20) {
-            if (_battery_display_ani) {
-                ChangeDisplay2Value(__batt_map, _battery_empty);
-            } else {
-                ChangeDisplay2Value(__batt_map, _battery_cap_20);
-            }
-        } else if (soc >= 20 && soc < 40) {
-            if (_battery_display_ani) {
-                ChangeDisplay2Value(__batt_map, _battery_cap_20);
-            } else {
-                ChangeDisplay2Value(__batt_map, _battery_cap_40);
-            }
-        } else if (soc >= 40 && soc < 60) {
-            if (_battery_display_ani) {
-                ChangeDisplay2Value(__batt_map, _battery_cap_40);
-            } else {
-                ChangeDisplay2Value(__batt_map, _battery_cap_60);
-            }
-        } else if (soc >= 60 && soc < 80) {
-            if (_battery_display_ani) {
-                ChangeDisplay2Value(__batt_map, _battery_cap_60);
-            } else {
-                ChangeDisplay2Value(__batt_map, _battery_cap_80);
-            }
-        } else if (soc >= 80 && soc <= 100) {
-            if (_battery_display_ani) {
-                ChangeDisplay2Value(__batt_map, _battery_cap_80); //DS60-120 add
-            } else {
-                ChangeDisplay2Value(__batt_map, _battery_cap_100);
-            }
-        }
-    } else if (page == _LCM_SUMMARY) {
-        if (soc < 20) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_20);
-        } else if (soc >= 20 && soc < 40) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_40);
-        } else if (soc >= 40 && soc < 60) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_60);
-        } else if (soc >= 60 && soc < 80) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_80);
-        } else if (soc >= 80 && soc <= 100) {
-            ChangeDisplay2Value(__batt_map, _battery_soc_100);
-        }
-    }
-
-    uint8_t cmd[5];
-    uint8_t value[5];
-
-    memset(cmd, 0x00, sizeof(cmd));
-    memset(value, 0x00, sizeof(value));
-    sprintf((char *)value, "%d%%", soc);
-    string2ByteArray(value, cmd);
-    DisplayValueToLcm(__soc_value_charging, cmd, sizeof(cmd));
-}
-
-void ChangeRemainTime(int sec)
-{
-    int h, m, s;
-    uint8_t cmd[10];
-    uint8_t value[10];
-
-    memset(cmd, 0x00, sizeof(cmd));
-
-//  srand(time(NULL));
-//  int min = 0;
-//  int max = 65536;
-//  sec = rand() % (max - min + 1) + min;
-
-    h = (sec / 3600);
-    m = (sec - (3600 * h)) / 60;
-    s = (sec - (3600 * h) - (m * 60));
-    sprintf((char *)value, "%02d:%02d:%02d", h, m, s);
-    string2ByteArray(value, cmd);
-    DisplayValueToLcm(__remain_time_tx, cmd, sizeof(cmd));
-}
-
-void ChangeChargingEnergyValue(float energy)
-{
-    uint8_t cmd[10];
-    uint8_t value[10];
-
-    memset(cmd, 0x00, sizeof(cmd));
-    if (energy >= 0.05) {
-        energy -= 0.05;
-    }
-    sprintf((char *) value, "%.1f kWh", energy);
-    string2ByteArray(value, cmd);
-    DisplayValueToLcm(__total_out_eng_tx, cmd, sizeof(cmd));
-}
-
-void ChangeChargingPowerValue(float pow)
-{
-    uint8_t cmd[10];
-    uint8_t value[10];
-
-    memset(cmd, 0x00, sizeof(cmd));
-
-//  float min = 0.0;
-//  float max = 50;
-//  pow = (max - min) * rand() / (RAND_MAX + 1.0) + min;
-    sprintf((char *) value, "%.1f kW", pow);
-    string2ByteArray(value, cmd);
-    DisplayValueToLcm(__output_eng_tx, cmd, sizeof(cmd));
-}
-
-void ChangeChargingFeeValue(float fee)
-{
-    uint8_t cmd[10];
-    uint8_t value[10];
-
-    memset(cmd, 0x00, sizeof(cmd));
-
-    sprintf((char *) value, "%.2f", fee);
-    string2ByteArray(value, cmd);
-    DisplayValueToLcm(__charging_fee_tx, cmd, sizeof(cmd));
-}
-
-void DisplayMoneyRate(float money)
-{
-    uint8_t cmd[8];
-    uint8_t value[8];
-
-    memset(cmd, 0x00, sizeof(cmd));
-
-    sprintf((char *) value, "%.2f", money);
-    string2ByteArray(value, cmd);
-    DisplayValueToLcm(__money_by_rate, cmd, sizeof(cmd));
-}
-
-void DisplayMoneyCur(uint8_t *cur)
-{
-    uint8_t cmd[10] = {0};
-    uint8_t buf[10] = {0};
-    uint8_t len = 0;
-
-    *(cur + 3) = '\0';
-    memset(cmd, 0x00, sizeof(cmd));
-    len = sprintf((char *) buf, "%s/kWh", cur);
-    buf[len] = '\0';
-    string2ByteArray(buf, cmd);
-    DisplayValueToLcm(__money_rate, cmd, sizeof(cmd));
-}
-
-void RefreshPageAnimation(uint8_t value)
-{
-    switch (_currentPage) {
-    case _LCM_VIEW: {
-
-    }
-    break;
-    case _LCM_WAIT_PLUGIN: {
-        if (_everyPageRollChange == 0) {
-            ChangeDisplay2Value(__plug_in_arrow, _arrow_dark);
-        } else if (_everyPageRollChange == 15) {
-            ChangeDisplay2Value(__plug_in_arrow, _arrow_light);
-        }
-
-        _everyPageRollChange > 30 ? _everyPageRollChange = 0 : _everyPageRollChange++;
-    }
-    break;
-    case _LCM_PRECHARGE:
-    case _LCM_SUMMARY: {
-        if (_currentPage == _LCM_PRECHARGE) {
-            if (_everyPageRollChange == 0 || _everyPageRollChange == 22) {
-                ChangeDisplay2Value(__conn_line, _conn_map1);
-            } else if (_everyPageRollChange == 11 || _everyPageRollChange == 33) {
-                ChangeDisplay2Value(__conn_line, _conn_map2);
-            }
-        } else if (_currentPage == _LCM_VIEW) {
-            if (_everyPageRollChange == 0 || _everyPageRollChange == 22) {
-                ChangeDisplay2Value(__conn_line_chag, _charging_map1);
-            } else if (_everyPageRollChange == 11 || _everyPageRollChange == 33) {
-                ChangeDisplay2Value(__conn_line_chag, _charging_map2);
-            }
-        } else if (_currentPage == _LCM_SUMMARY) {
-            if (_everyPageRollChange == 0) {
-                ChangeDisplay2Value(__conn_line_comp, _complete_map);
-            }
-        }
-
-        _everyPageRollChange >= 45 ? _everyPageRollChange = 0 : _everyPageRollChange++;
-    }
-    break;
-    }
-}
-
-void RefreshConnStatus()
-{
-    // Wifi priority is higher than Ethernet
-#if defined DD360 ||defined DD360Audi || defined DD360ComBox || defined DD360UCar
-    uint8_t i = 0;
-    uint8_t ehtStatus = 0;
-
-    for (i = 0; i < pSysWarning->WarningCount; i++) {
-        if (memcmp(&pSysWarning->WarningCode[i][0], "012304", 6) == 0) {
-            ehtStatus = 1;
-            //if (ShmSelectGunInfo->EthDevStatus.Ethernet != DEV_ST_DISABLE) {
-            //    ShmSelectGunInfo->EthDevStatus.Ethernet = DEV_ST_ENABLE_NO_USE;
-            //}
-            break;
-        }
-    }
-
-    if (ShmSelectGunInfo->EthDevStatus.Backend == DEV_ST_DISABLE) {
-        ChangeDisplay2Value(__conn_status, _disappear);
-    } else if (ShmSelectGunInfo->EthDevStatus.Backend == DEV_ST_ENABLE_USE) {
-        ChangeDisplay2Value(__conn_status, _connect);
-    } else if (ShmSelectGunInfo->EthDevStatus.Backend == DEV_ST_ENABLE_NO_USE) {
-        ChangeDisplay2Value(__conn_status, _disconnect);
-    }
-
-    if (ehtStatus == 1) {
-        if (ShmSelectGunInfo->EthDevStatus.Ethernet != DEV_ST_DISABLE) {
-            ChangeDisplay2Value(__ethernet_status, _eth_disconnect);
-        }
-    } else {
-        if (ShmSelectGunInfo->EthDevStatus.Ethernet != DEV_ST_DISABLE) {
-            ChangeDisplay2Value(__ethernet_status, _eth_connect);
-        }
-        //if (ShmSelectGunInfo->EthDevStatus.Ethernet == DEV_ST_DISABLE) {
-        //} else if (ShmSelectGunInfo->EthDevStatus.Ethernet == DEV_ST_ENABLE_USE) {
-        //    ChangeDisplay2Value(__ethernet_status, _eth_connect);
-        //} else if (ShmSelectGunInfo->EthDevStatus.Ethernet == DEV_ST_ENABLE_NO_USE) {
-        //    ChangeDisplay2Value(__ethernet_status, _eth_disconnect);
-        //}
-    }
-
-    if (ShmSelectGunInfo->EthDevStatus.Wifi == DEV_ST_DISABLE) {
-        ChangeDisplay2Value(__wifi_status, _disappear);
-
-        ChangeDisplay2Value(__3G4G_status, _disappear);
-        if (ShmSelectGunInfo->EthDevStatus.FourG == DEV_ST_DISABLE) {
-            ChangeDisplay2Value(__3G4G_move_status, _disappear);
-        } else if (ShmSelectGunInfo->EthDevStatus.FourG == DEV_ST_ENABLE_USE) {
-            ChangeDisplay2Value(__3G4G_move_status, __3G4G_connect);
-        } else if (ShmSelectGunInfo->EthDevStatus.FourG == DEV_ST_ENABLE_NO_USE) {
-            ChangeDisplay2Value(__3G4G_move_status, _3G4G_disconnect);
-        }
-    } else if (ShmSelectGunInfo->EthDevStatus.Wifi == DEV_ST_ENABLE_USE) {
-        ChangeDisplay2Value(__3G4G_move_status, _disappear);
-        ChangeDisplay2Value(__wifi_status, _wifi_connect);
-    } else if (ShmSelectGunInfo->EthDevStatus.Wifi == DEV_ST_ENABLE_NO_USE) {
-        ChangeDisplay2Value(__3G4G_move_status, _disappear);
-        ChangeDisplay2Value(__wifi_status, _wifi_disconnect);
-    }
-
-    if (ShmSelectGunInfo->EthDevStatus.Wifi != DEV_ST_DISABLE) {
-        if (ShmSelectGunInfo->EthDevStatus.FourG == DEV_ST_DISABLE) {
-            ChangeDisplay2Value(__3G4G_status, _disappear);
-        } else if (ShmSelectGunInfo->EthDevStatus.FourG == DEV_ST_ENABLE_USE) {
-            ChangeDisplay2Value(__3G4G_status, __3G4G_connect);
-        } else if (ShmSelectGunInfo->EthDevStatus.FourG == DEV_ST_ENABLE_NO_USE) {
-            ChangeDisplay2Value(__3G4G_status, _3G4G_disconnect);
-        }
-    }
-
-    //uint8_t flag[4] = {0};
-
-    /*for (i = 0; i < pSysWarning->WarningCount; i++) {
-        //printf("status code = %s", &pSysWarning->WarningCode[i][0]);
-        if (memcmp(&pSysWarning->WarningCode[i][0], "012304", 6) == 0) {
-            flag[0] = 1;
-            continue;
-        }
-
-        if (memcmp(&pSysWarning->WarningCode[i][0], "043625", 6) == 0) {
-            //disconnected from AP through WiFi
-            flag[1] = 1;
-            continue;
-        }
-
-        if (memcmp(&pSysWarning->WarningCode[i][0], "043627", 6) == 0) { //wifi disabled
-            flag[1] = 2;
-            continue;
-        }
-
-        if ((memcmp(&pSysWarning->WarningCode[i][0], "033900", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i][0], "033901", 6) == 0) ||
-                (memcmp(&pSysWarning->WarningCode[i][0], "033902", 6) == 0)) {
-            flag[2] = 1;
-            continue;
-        }
-
-        if (memcmp(&pSysWarning->WarningCode[i][0], "043626", 6) == 0) {
-            //disconnected from APN through 3G/4G
-            flag[3] = 1;
-            continue;
-        }
-
-        if (memcmp(&pSysWarning->WarningCode[i][0], "043628", 6) == 0) { //4g disabled
-            flag[3] = 2;
-            continue;
-        }
-    }
-
-
-    if (flag[0] == 1) {
-        ChangeDisplay2Value(__ethernet_status, _eth_disconnect);
-    } else {
-        ChangeDisplay2Value(__ethernet_status, _eth_connect);
-    }
-
-    //ChangeDisplay2Value(__wifi_status, _disappear);
-    //ChangeDisplay2Value(__conn_status, _disappear);
-    //ChangeDisplay2Value(__3G4G_status, _disappear);
-
-    if (flag[1] == 1) {
-        ChangeDisplay2Value(__3G4G_move_status, _disappear);
-        ChangeDisplay2Value(__wifi_status, _wifi_disconnect);
-    } else if (flag[1] == 2) {
-        ChangeDisplay2Value(__wifi_status, _disappear);
-    } else {
-        ChangeDisplay2Value(__3G4G_move_status, _disappear);
-        ChangeDisplay2Value(__wifi_status, _wifi_connect);
-    }
-
-    if (flag[2] == 1) {
-        ChangeDisplay2Value(__conn_status, _disconnect);
-    } else {
-        ChangeDisplay2Value(__conn_status, _connect);
-    }
-
-    if (flag[1] == 2) {
-        ChangeDisplay2Value(__3G4G_status, _disappear);
-        if (flag[3] == 1) {
-            ChangeDisplay2Value(__3G4G_move_status, _3G4G_disconnect);
-        } else if (flag[3] == 2) {
-            ChangeDisplay2Value(__3G4G_move_status, _disappear);
-        } else {
-            ChangeDisplay2Value(__3G4G_move_status, __3G4G_connect);
-        }
-    } else {
-        if (flag[3] == 1) {
-            ChangeDisplay2Value(__3G4G_status, _3G4G_disconnect);
-        } else if (flag[3] == 2) {
-            ChangeDisplay2Value(__3G4G_status, _disappear);
-        } else {
-            ChangeDisplay2Value(__3G4G_status, __3G4G_connect);
-        }
-    }
-    */
-#else
-// eth
-    /*
-    if (pSysInfo->ethInternetConn == YES) {
-        ChangeDisplay2Value(__ethernet_status, _ethernet_connect);
-    } else {
-        ChangeDisplay2Value(__ethernet_status, _ethernet_disconnect);
-    }
-    */
-    uint8_t ehtStatus = 0;
-    int i;
-    for (i = 0; i < pSysWarning->WarningCount; i++) {
-        if (memcmp(&pSysWarning->WarningCode[i][0], "012304", 6) == 0) {
-            ehtStatus = 1;
-            //if (ShmSelectGunInfo->EthDevStatus.Ethernet != DEV_ST_DISABLE) {
-            //    ShmSelectGunInfo->EthDevStatus.Ethernet = DEV_ST_ENABLE_NO_USE;
-            //}
-            break;
-        }
-    }
-
-    if (ehtStatus == 1) {
-        if (ShmSelectGunInfo->EthDevStatus.Ethernet != DEV_ST_DISABLE) {
-            ChangeDisplay2Value(__ethernet_status, _eth_disconnect);
-        }
-    } else {
-        if (ShmSelectGunInfo->EthDevStatus.Ethernet != DEV_ST_DISABLE) {
-            ChangeDisplay2Value(__ethernet_status, _eth_connect);
-        }
-        //if (ShmSelectGunInfo->EthDevStatus.Ethernet == DEV_ST_DISABLE) {
-        //} else if (ShmSelectGunInfo->EthDevStatus.Ethernet == DEV_ST_ENABLE_USE) {
-        //    ChangeDisplay2Value(__ethernet_status, _eth_connect);
-        //} else if (ShmSelectGunInfo->EthDevStatus.Ethernet == DEV_ST_ENABLE_NO_USE) {
-        //    ChangeDisplay2Value(__ethernet_status, _eth_disconnect);
-        //}
-    }
-    // Wifi
-    if ((pSysConfig->ModelName[10] == 'W' ||
-            pSysConfig->ModelName[10] == 'D') &&
-            pSysConfig->AthInterface.WifiMode != _SYS_WIFI_MODE_DISABLE) {
-        if (pSysConfig->AthInterface.WifiNetworkConn == YES ||
-                pSysConfig->AthInterface.WifiMode == _SYS_WIFI_MODE_AP) {
-            ChangeDisplay2Value(__wifi_status, _wifi_connect);
-        } else {
-            ChangeDisplay2Value(__wifi_status, _wifi_disconnect);
-        }
-    } else {
-        ChangeDisplay2Value(__wifi_status, _disappear);
-    }
-
-    if ((pSysConfig->ModelName[10] == 'T' ||
-            pSysConfig->ModelName[10] == 'D') &&
-            pSysConfig->TelecomInterface.TelcomEnabled != NO) {
-        if (pSysConfig->AthInterface.WifiMode == _SYS_WIFI_MODE_DISABLE) {
-            ChangeDisplay2Value(__3G4G_status, _disappear);
-            // 3G/4G
-            if (pSysConfig->TelecomInterface.TelcomNetworkConn == YES)
-            { ChangeDisplay2Value(__3G4G_move_status, _3G4G_disconnect); }
-            else
-            { ChangeDisplay2Value(__3G4G_move_status, _3G4G_disconnect); }
-        } else {
-            ChangeDisplay2Value(__3G4G_move_status, _disappear);
-            // 3G/4G
-            if (pSysConfig->TelecomInterface.TelcomNetworkConn == YES)
-            { ChangeDisplay2Value(__3G4G_status, _3G4G_disconnect); }
-
-            else
-            { ChangeDisplay2Value(__3G4G_status, _3G4G_disconnect); }
-        }
-    } else {
-        ChangeDisplay2Value(__3G4G_status, _disappear);
-
-        ChangeDisplay2Value(__3G4G_move_status, _disappear);
-    }
-
-    // 連線到後台
-    if (pSysInfo->OcppConnStatus == YES) {
-        ChangeDisplay2Value(__conn_status, _connect);
-    } else {
-        ChangeDisplay2Value(__conn_status, _disconnect);
-    }
-
-    /*if (pSysConfig->AthInterface.WifiNetworkConn == YES ||
-            pSysConfig->AthInterface.WifiMode == _SYS_WIFI_MODE_AP) {
-        _wifi_conn_status = true;
-        ChangeDisplay2Value(__wifi_status, _wifi_connect);
-        ChangeDisplay2Value(__ethernet_status, _disappear);
-    } else {
-        _wifi_conn_status = false;
-        ChangeDisplay2Value(__wifi_status, _disappear);
-    }
-
-    if (!_wifi_conn_status) {
-        if (pSysConfig->TelecomInterface.TelcomNetworkConn == YES ||
-                pSysInfo->InternetConn == YES) {
-            ChangeDisplay2Value(__ethernet_status, _ethernet_connect);
-        } else {
-            ChangeDisplay2Value(__ethernet_status, _ethernet_disconnect);
-        }
-    }
-
-    // 連線到後台
-    if (pSysInfo->OcppConnStatus == YES) {
-        ChangeDisplay2Value(__conn_status, _connect);
-    } else {
-        ChangeDisplay2Value(__conn_status, _disconnect);
-    }
-    */
-#endif //defined DD360 || defined DD360Audi
-}
-
-uint8_t FirstPageChanged()
-{
-    uint8_t result = NO;
-
-    if (_currentPage != _oldPage) {
-        result = YES;
-        _oldPage = _currentPage;
-    }
-
-    return result;
-}
-
-bool IsPageReloadChk()
-{
-    bool result = false;
-
-    if (pSysInfo->CurGunSelectedByAc == NO_DEFINE) {
-        if (_curPage_index != pSysInfo->CurGunSelected) {
-            _curPage_index = pSysInfo->CurGunSelected;
-            result = true;
-        }
-    } else {
-        if (_curPage_index != pSysInfo->CurGunSelectedByAc) {
-            _curPage_index = pSysInfo->CurGunSelectedByAc;
-            result = true;
-        }
-    }
-
-    return result;
-}
-
-void ClearDisplayInfo()
-{
-    ChangeDisplay2Value(__csu_ver_string, _disappear);
-    ChangeDisplay2Value(__csu_ver_value, _disappear);
-
-    ChangeDisplay2Value(__eth0_ip_string, _disappear);
-    ChangeDisplay2Value(__eth0_ip_value, _disappear);
-
-    ChangeDisplay2Value(__sn_string, _disappear);
-    ChangeDisplay2Value(__sn_value, _disappear);
-
-    ChangeDisplay2Value(__dc1_ver_string, _disappear);
-    ChangeDisplay2Value(__dc1_ver_value, _disappear);
-
-    ChangeDisplay2Value(__dc2_ver_string, _disappear);
-    ChangeDisplay2Value(__dc2_ver_value, _disappear);
-
-    ChangeDisplay2Value(__fan_speed_string, _disappear);
-    ChangeDisplay2Value(__fan_speed_value, _disappear);
-}
-
-void DisplayInfoCsuVer(bool isShow, uint8_t *modelName)
-{
-    if (isShow) {
-        uint8_t value[10];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *)value, "CSU Ver >");
-        DisplayValueToLcm(__csu_ver_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        strncpy((char *)value, (char *)modelName, 5);
-        DisplayValueToLcm(__csu_ver_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__csu_ver_string, _disappear);
-        ChangeDisplay2Value(__csu_ver_value, _disappear);
-    }
-}
-
-void ShowWifiMode(bool isShow, uint8_t mode)
-{
-    if (isShow) {
-        uint8_t value[20];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "Wifi Mo. >");
-        DisplayValueToLcm(__csu_ver_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        if (mode == 0) {
-            sprintf((char *)value, "disable");
-        } else if (mode == 1) {
-            sprintf((char *)value, "station");
-        } else if (mode == 2) {
-            sprintf((char *)value, "AP");
-        }
-
-        DisplayValueToLcm(__csu_ver_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__csu_ver_string, _disappear);
-        ChangeDisplay2Value(__csu_ver_value, _disappear);
-    }
-}
-
-void DisplayInfoEthIp(bool isShow, uint8_t *ip)
-{
-    if (isShow) {
-        uint8_t value[20];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "Eth IP >");
-        DisplayValueToLcm(__eth0_ip_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, (char *) ip);
-        DisplayValueToLcm(__eth0_ip_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__eth0_ip_string, _disappear);
-        ChangeDisplay2Value(__eth0_ip_value, _disappear);
-    }
-}
-
-void Show4GRssi(bool isShow, int dbValue)
-{
-    if (isShow) {
-        uint8_t value[20];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "RSSI >");
-        DisplayValueToLcm(__eth0_ip_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        sprintf((char *)value, "%d dBm", dbValue);
-        DisplayValueToLcm(__eth0_ip_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__eth0_ip_string, _disappear);
-        ChangeDisplay2Value(__eth0_ip_value, _disappear);
-    }
-}
-
-void DisplayInfoSN(bool isShow, uint8_t *sn)
-{
-    if (isShow) {
-        uint8_t value[30];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "SN >");
-        DisplayValueToLcm(__sn_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, (char *) sn);
-        DisplayValueToLcm(__sn_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__sn_string, _disappear);
-        ChangeDisplay2Value(__sn_value, _disappear);
-    }
-}
-
-void ShowWifiRssi(bool isShow, int dbValue)
-{
-    if (isShow) {
-        uint8_t value[20];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "RSSI >");
-        DisplayValueToLcm(__sn_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        sprintf((char *)value, "%d dBm", dbValue);
-        DisplayValueToLcm(__sn_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__sn_string, _disappear);
-        ChangeDisplay2Value(__sn_value, _disappear);
-    }
-}
-
-void DisplayInfoGun1Ver(bool isShow, uint8_t *version)
-{
-    if (isShow) {
-        uint8_t value[10];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "Ct1 Ver >");
-        DisplayValueToLcm(__dc1_ver_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, (char *) version);
-        DisplayValueToLcm(__dc1_ver_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__dc1_ver_string, _disappear);
-        ChangeDisplay2Value(__dc1_ver_value, _disappear);
-    }
-}
-
-void Show4GMode(bool isShow, uint8_t mode)
-{
-    if (isShow) {
-        uint8_t value[20];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "3/4G Mo. >");
-        DisplayValueToLcm(__dc1_ver_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        if (mode == 0) {
-            sprintf((char *)value, "disable");
-        } else if (mode == 1) {
-            sprintf((char *)value, "enable");
-        }
-
-        DisplayValueToLcm(__dc1_ver_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__dc1_ver_string, _disappear);
-        ChangeDisplay2Value(__dc1_ver_value, _disappear);
-    }
-}
-
-void DisplayInfoGun2Ver(bool isShow, uint8_t *version)
-{
-    if (isShow) {
-        uint8_t value[10];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "Ct2 Ver >");
-        DisplayValueToLcm(__dc2_ver_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, (char *) version);
-        DisplayValueToLcm(__dc2_ver_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__dc2_ver_string, _disappear);
-        ChangeDisplay2Value(__dc2_ver_value, _disappear);
-    }
-}
-
-void Show4GIP(bool isShow, uint8_t *ip)
-{
-    if (isShow) {
-        uint8_t value[20];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "3/4G IP >");
-        DisplayValueToLcm(__dc2_ver_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, (char *) ip);
-        DisplayValueToLcm(__dc2_ver_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__dc2_ver_string, _disappear);
-        ChangeDisplay2Value(__dc2_ver_value, _disappear);
-    }
-}
-
-void DisplayInfoSpeed(bool isShow, unsigned int fan)
-{
-    if (isShow) {
-        uint8_t value[10];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "Fan Spd >");
-        DisplayValueToLcm(__fan_speed_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        sprintf((char *)value, "%d", fan);
-        DisplayValueToLcm(__fan_speed_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__fan_speed_string, _disappear);
-        ChangeDisplay2Value(__fan_speed_value, _disappear);
-    }
-}
-
-void ShowWifiIP(bool isShow, uint8_t *ip)
-{
-    if (isShow) {
-        uint8_t value[20];
-
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, "Wifi IP >");
-        DisplayValueToLcm(__fan_speed_string, value, sizeof(value));
-        memset(value, 0x00, sizeof(value));
-        strcpy((char *) value, (char *) ip);
-        DisplayValueToLcm(__fan_speed_value, value, sizeof(value));
-    } else {
-        ChangeDisplay2Value(__fan_speed_string, _disappear);
-        ChangeDisplay2Value(__fan_speed_value, _disappear);
-    }
-}
-
-void InformationShow()
-{
-    if (pSysConfig->ShowInformation == YES) {
-        bool show = _isShow = true;
-        if (_showInformIndex == 0) {
-            DisplayInfoCsuVer(show, pSysInfo->CsuRootFsFwRev);
-            DisplayInfoSpeed(show, pSysInfo->SystemFanRotaSpeed);
-            DisplayInfoSN(show, pSysConfig->SerialNumber);
-
-            DisplayInfoEthIp(show, pSysConfig->Eth0Interface.EthIpAddress);
-            DisplayInfoGun1Ver(show, pSysInfo->Connector1FwRev);
-            if (_totalCount > 1) {
-                DisplayInfoGun2Ver(show, pSysInfo->Connector2FwRev);
-            } else {
-                DisplayInfoGun2Ver(false, pSysInfo->Connector2FwRev);
-            }
-        } else if (_showInformIndex == 1) {
-            ShowWifiMode(show, pSysConfig->AthInterface.WifiMode);
-            ShowWifiIP(show, pSysConfig->AthInterface.WifiIpAddress);
-            ShowWifiRssi(show, pSysConfig->AthInterface.WifiRssi);
-
-            Show4GMode(show, pSysConfig->TelecomInterface.TelcomEnabled);
-            Show4GIP(show, pSysConfig->TelecomInterface.TelcomIpAddress);
-            Show4GRssi(show, pSysConfig->TelecomInterface.TelcomRssi);
-        }
-    } else {
-        ClearDisplayInfo();
-
-        if (_isShow) {
-            _isShow = false;
-            _showInformIndex++;
-            if (_showInformIndex >= 2) {
-                _showInformIndex = 0;
-            }
-        }
-    }
-}
-
-void ProcessPageInfo()
-{
-    _page_reload = IsPageReloadChk();
-    pAcChargingInfo = (struct ChargingInfoData *)GetAcChargingInfoData(0);
-
-    // 隨插即充 - 可省略該按鈕 //DS60-120 add
-    if (pSysConfig->AuthorisationMode == AUTH_MODE_ENABLE) {
-        ChangeDisplay2Value(__ret_home_btn, _back_home_btn);
-        if (_totalCount >= 2 && pSysInfo->IsAlternatvieConf == NO) {
-            ChangeDisplay2Value(__sel_gun_btn, _sel_gun_btn);
-        } else {
-            ChangeDisplay2Value(__sel_gun_btn, _disappear);
-        }
-    }
-
-    switch (_currentPage) {
-    case _LCM_VIEW: ////For Audi
-    case _LCM_DETAIL_VIEW:
-        if (pSysInfo->CurGunSelected == 0) {
-            ChangeDisplay2Value(__left_gun_map, _left_gun_enable_map);
-            ChangeDisplay2Value(__right_gun_map, _right_gun_disable_map);
-        } else if (pSysInfo->CurGunSelected == 1) {
-            ChangeDisplay2Value(__left_gun_map, _left_gun_disable_map);
-            ChangeDisplay2Value(__right_gun_map, _right_gun_enable_map);
-        }
-        ChangeDisplay2Value(__add_chk_btn, _select_gun_btn);
-        break;
-
-    case _LCM_START_SCAN:
-    case _LCM_STOP_RFID:
-    case _LCM_STOP_APP:
-        if (pSysConfig->isRFID) {
-            ChangeDisplay2Value(__main_rfid, _main_rfid);
-        } else {
-            ChangeDisplay2Value(__main_rfid, _main_none_rfid);
-        }
-
-        if (pSysConfig->isQRCode) {
-            ChangeDisplay2Value(__main_qr, _main_qr);
-        } else {
-            ChangeDisplay2Value(__qr_code, _disappear);
-            ChangeDisplay2Value(__main_qr, _main_none_qr);
-            needReloadQr = true;
-        }
-
-        if (pSysConfig->isAPP) {
-            ChangeDisplay2Value(__main_app, _main_app);
-        } else {
-            ChangeDisplay2Value(__main_app, _main_none_app);
-        }
-
-        //if (FirstPageChanged() == YES || needReloadQr || _page_reload) {
-        if (pSysConfig->isQRCode) {
-            needReloadQr = false;
-            if (pSysConfig->QRCodeMadeMode == NO) {
-                //uint8_t len = strlen((char *)pSysConfig->SystemId);
-                ChangeQrCode_Idle((char *)pSysConfig->SystemId);
-            } else {
-                //uint8_t len = strlen((char *)pSysConfig->QRCodeContent);
-                ChangeQrCode_Idle((char *)pSysConfig->QRCodeContent);
-            }
-            //ChangeQrCode_Idle((char *)pSysConfig->SystemId);
-        }
-        //}
-
-        //DS60-120 add
-        bool isCharging = false;
-        for (uint8_t i = 0; i < _totalCount; i++) {
-            pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(i);
-
-            if (pDcChargingInfo->SystemStatus == S_IDLE) {
-                continue;
-            }
-
-            isCharging = true;
-            break;
-        }
-        if (isCharging && pSysInfo->IsAlternatvieConf == NO) {
-            ChangeDisplay2Value(__sel_gun_btn, _sel_gun_btn);
-        } else {
-            ChangeDisplay2Value(__sel_gun_btn, _disappear);
-        }
-        break;
-    case _LCM_START_AUTHORIZING:
-    case _LCM_START_AUTHORIZE_FAIL:
-    case _LCM_STOP_RFID_FAIL:
-    case _LCM_LINK_ERROR:
-        //case _LCM_WAIT_FOR_PLUG: {
-        FirstPageChanged();
-        break;
-    case _LCM_WAIT_PLUGIN:
-    case _LCM_WAIT_PLUGOUT:
-        FirstPageChanged();
-        if (pSysConfig->AuthorisationMode == AUTH_MODE_DISABLE) {
-            // 新增隨插即充功能預設在等待插槍頁面在開啟
-            ChangeDisplay2Value(__ret_home_btn, _disappear);
-            bool isCharging = false;
-            for (uint8_t i = 0; i < _totalCount; i++) {
-                pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(i);
-
-                if (pDcChargingInfo->SystemStatus == S_IDLE) {
-                    continue;
-                }
-
-                isCharging = true;
-                break;
-            }
-
-            if (isCharging && pSysInfo->IsAlternatvieConf == NO) {
-                ChangeDisplay2Value(__sel_gun_btn, _sel_gun_btn);
-            } else {
-                ChangeDisplay2Value(__sel_gun_btn, _disappear);
-            }
-        } else {
-            ChangeDisplay2Value(__sel_gun_btn, _disappear);
-        }
-        break;
-    case _LCM_PRECHARGE:
-    case _LCM_STOPPING:
-    case _LCM_SUMMARY: {
-        bool isShowAc = false;
-        uint8_t gunTargetIndex = 0;
-
-        if (acgunCount > 0) {
-            gunTargetIndex = 2;
-            if (pSysInfo->CurGunSelectedByAc != NO_DEFINE) {
-                isShowAc = true;
-                //ChangeDisplay2Value(__gun_type_index + (2 * 2), _actype_light); //DS60-120 remove
-                if (_currentPage == _LCM_SUMMARY) {
-                    ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _actype_light_cmp);
-                } else {
-                    ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _actype_light);
-                }
-
-                if (_currentPage == _LCM_VIEW) {
-                    ChangeAcBattMapAndValue(_LCM_VIEW);
-                    if (pAcChargingInfo->PresentChargedDuration >= 0 &&
-                            pAcChargingInfo->PresentChargedDuration <= TIME_MAX_SEC) {
-                        ChangeRemainTime(pAcChargingInfo->PresentChargedDuration);
-                    } else {
-                        ChangeRemainTime(0);
-                    }
-
-                    if (pAcChargingInfo->PresentChargingPower >= 0.1 &&
-                            pAcChargingInfo->PresentChargingPower <= POWER_MAX_KW) {
-                        ChangeChargingPowerValue(pAcChargingInfo->PresentChargingPower);
-                    } else {
-                        ChangeChargingPowerValue(0);
-                    }
-
-                    if (pAcChargingInfo->PresentChargedEnergy >= 0.1 &&
-                            pAcChargingInfo->PresentChargedEnergy <= ENERGY_MAX_KWH) {
-                        ChangeChargingEnergyValue(pAcChargingInfo->PresentChargedEnergy);
-                    } else {
-                        ChangeChargingEnergyValue(0);
-                    }
-
-                    if (strcmp((char *)pAcChargingInfo->StartUserId, "") == 0 ||
-                            pSysConfig->StopChargingByButton == YES) {
-                        ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn);
-                    } else {
-                        ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn_scan);
-                    }
-                } else if (_currentPage == _LCM_SUMMARY) {
-                    ChangeAcBattMapAndValue(_LCM_SUMMARY);
-                    if (pAcChargingInfo->PresentChargedDuration >= 0 &&
-                            pAcChargingInfo->PresentChargedDuration <= TIME_MAX_SEC) {
-                        ChangeRemainTime(pAcChargingInfo->PresentChargedDuration);
-                    } else {
-                        ChangeRemainTime(0);
-                    }
-
-                    if (pAcChargingInfo->PresentChargingPower >= 0.1 &&
-                            pAcChargingInfo->PresentChargingPower <= POWER_MAX_KW) {
-                        ChangeChargingPowerValue(pAcChargingInfo->PresentChargingPower);
-                    } else {
-                        ChangeChargingPowerValue(0);
-                    }
-
-                    if (pAcChargingInfo->PresentChargedEnergy >= 0.1 &&
-                            pAcChargingInfo->PresentChargedEnergy <= ENERGY_MAX_KWH) {
-                        ChangeChargingEnergyValue(pAcChargingInfo->PresentChargedEnergy);
-
-                        if (pSysConfig->BillingData.isBilling &&
-                                pAcChargingInfo->ChargingFee >= 0) {
-                            ChangeChargingFeeValue(pAcChargingInfo->ChargingFee);
-                        }
-                    } else {
-                        ChangeChargingEnergyValue(0);
-                        if (pSysConfig->BillingData.isBilling) {
-                            ChangeChargingFeeValue(0);
-                        }
-                    }
-
-                    if (!pSysConfig->BillingData.isBilling) {
-                        ChangeDisplay2Value(__charging_fee_map, _disappear);
-                        ChangeDisplay2Value(__charging_fee_tx, _disappear);
-                    } else {
-                        ChangeDisplay2Value(__charging_fee_map, _money_map);
-                    }
-                }
-            } else {
-                //ChangeDisplay2Value(__gun_type_index + (2 * 2), _actype_dark); //DS60-120 remove
-                if (_currentPage == _LCM_SUMMARY) {
-                    ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _actype_dark_cmp);
-                } else {
-                    ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _actype_dark);
-                }
-            }
-        } else {
-            //ChangeDisplay2Value(__gun_type_index + (2 * 2), _disappear); //DS60-120 remove
-            if (_totalCount > 1) {
-                gunTargetIndex = 2;
-                ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _disappear);
-                ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _disappear);
-            }
-        }
-
-        gunTargetIndex = 0; //DS60-120 add
-        for (uint8_t i = 0; i < _totalCount; i++) {
-            if (_totalCount == 1 && acgunCount <= 0) { //DS60-120 add
-                gunTargetIndex = 2;
-            } else {
-                gunTargetIndex = i;
-            }
-
-            pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(i);
-
-            switch (pDcChargingInfo->Type) {
-            case _Type_Chademo: {
-                if (pSysInfo->CurGunSelected == i && !isShowAc) {
-                    if (_currentPage == _LCM_SUMMARY) {
-                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _chademo_light_cmp);
-                    } else {
-                        ChangeDisplay2Value(__gun_type_index + (i * 2), _chademo_light);
-                    }
-                } else {
-                    if (_currentPage == _LCM_SUMMARY) {
-                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _chademo_dark_cmp);
-                    } else {
-                        ChangeDisplay2Value(__gun_type_index + (i * 2), _chademo_dark);
-                    }
-                }
-            }
-            break;
-            case _Type_GB: {
-                if (pSysInfo->CurGunSelected == i && !isShowAc) {
-                    if (_currentPage == _LCM_SUMMARY) {
-                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _gbt_light_cmp);
-                    } else {
-                        ChangeDisplay2Value(__gun_type_index + (i * 2), _gbt_light);
-                    }
-                } else {
-                    if (_currentPage == _LCM_SUMMARY) {
-                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _gbt_dark_cmp);
-                    } else {
-                        ChangeDisplay2Value(__gun_type_index + (i * 2), _gbt_dark);
-                    }
-                }
-            }
-            break;
-            case _Type_CCS_2: {
-                if (pSysInfo->CurGunSelected == i && !isShowAc) {
-                    if (_currentPage == _LCM_SUMMARY) {
-                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _ccs_light_cmp);
-                    } else {
-                        ChangeDisplay2Value(__gun_type_index + (i * 2), _ccs_light);
-                    }
-                } else {
-                    if (_currentPage == _LCM_SUMMARY) {
-                        ChangeDisplay2Value(__cmp_gun_type_index + (i * 2), _ccs_dark_cmp);
-                    } else {
-                        ChangeDisplay2Value(__gun_type_index + (i * 2), _ccs_dark);
-                    }
-                }
-            }
-            break;
-            }
-
-            if (_currentPage == _LCM_PRECHARGE && !isShowAc) {
-                if (pSysInfo->CurGunSelected == i) {
-                    ChangeBattMapAndValue(_currentPage, pDcChargingInfo->EvBatterySoc);
-                }
-            } else if (_currentPage == _LCM_VIEW && !isShowAc) {
-                if (pSysInfo->CurGunSelected == i) {
-                    ChangeBattMapAndValue(_LCM_VIEW, pDcChargingInfo->EvBatterySoc);
-                    if (pDcChargingInfo->PresentChargedDuration >= 0 &&
-                            pDcChargingInfo->PresentChargedDuration <= TIME_MAX_SEC) {
-                        ChangeRemainTime(pDcChargingInfo->PresentChargedDuration);
-                    } else {
-                        ChangeRemainTime(0);
-                    }
-
-                    if (pDcChargingInfo->PresentChargingPower >= 0 &&
-                            pDcChargingInfo->PresentChargingPower <= POWER_MAX_KW) {
-                        ChangeChargingPowerValue(pDcChargingInfo->PresentChargingPower);
-                    } else {
-                        ChangeChargingPowerValue(0);
-                    }
-
-                    if (pDcChargingInfo->PresentChargedEnergy >= 0.1 &&
-                            pDcChargingInfo->PresentChargedEnergy <= ENERGY_MAX_KWH) {
-                        ChangeChargingEnergyValue(pDcChargingInfo->PresentChargedEnergy);
-                    } else {
-                        ChangeChargingEnergyValue(0);
-                    }
-
-                    if (strcmp((char *)pDcChargingInfo->StartUserId, "") == 0 ||
-                            pSysConfig->StopChargingByButton == YES) {
-                        ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn);
-                    } else {
-                        ChangeDisplay2Value(__stop_method_btn, _stop_charging_btn_scan);
-                    }
-                }
-            } else if (_currentPage == _LCM_SUMMARY && !isShowAc) {
-                if (pSysInfo->CurGunSelected == i) {
-                    ChangeBattMapAndValue(_LCM_SUMMARY, pDcChargingInfo->EvBatterySoc);
-                    if (pDcChargingInfo->PresentChargedDuration >= 0 &&
-                            pDcChargingInfo->PresentChargedDuration <= TIME_MAX_SEC) {
-                        ChangeRemainTime(pDcChargingInfo->PresentChargedDuration);
-                    } else {
-                        ChangeRemainTime(0);
-                    }
-
-                    if (pDcChargingInfo->PresentChargingPower >= 0 &&
-                            pDcChargingInfo->PresentChargingPower <= POWER_MAX_KW) {
-                        ChangeChargingPowerValue(pDcChargingInfo->PresentChargingPower);
-                    } else {
-                        ChangeChargingPowerValue(0);
-                    }
-#if 1
-                    if (pDcChargingInfo->PresentChargedEnergy >= 0.1 &&
-                            pDcChargingInfo->PresentChargedEnergy <= ENERGY_MAX_KWH) {
-                        ChangeChargingEnergyValue(pDcChargingInfo->PresentChargedEnergy);
-
-                        if (pSysConfig->BillingData.isBilling &&
-                                pDcChargingInfo->ChargingFee >= 0) {
-                            ChangeChargingFeeValue(pDcChargingInfo->ChargingFee);
-                            ChangeBalanceValue(__remain_balance, i);
-                        }
-                    } else {
-                        ChangeChargingEnergyValue(0);
-                        if (pSysConfig->BillingData.isBilling) {
-                            ChangeChargingFeeValue(0);
-                            ChangeBalanceValue(__remain_balance, i);
-                        }
-                    }
-#else
-                    ChangeChargingEnergyValue(pDcChargingInfo->PresentChargedEnergy);
-
-                    if (pSysConfig->BillingData.isBilling &&
-                            pDcChargingInfo->ChargingFee >= 0) {
-                        ChangeChargingFeeValue(pDcChargingInfo->ChargingFee);
-                        ChangeBalanceValue(__remain_balance, i);
-                    }
-#endif // 0
-                    if (!pSysConfig->BillingData.isBilling) {
-                        ChangeDisplay2Value(__charging_fee_map, _disappear);
-                        ChangeDisplay2Value(__charging_fee_tx, _disappear);
-                    } else {
-                        ChangeDisplay2Value(__charging_fee_map, _money_map);
-                    }
-#ifdef DD360Audi
-                    // Warming Occur in prepare or precharing state, turn into complete mode
-                    if (pDcChargingInfo->Replug_flag) {
-                        RunReplugStringFunction(true);
-                    } else {
-                        RunReplugStringFunction(false);
-                    }
-#else
-#endif					
-                }
-            }
-        }
-
-        // gun btn and QR code
-        if (_totalCount + acgunCount >= 2 && _currentPage) {
-            uint8_t index = 0;
-            for (index = 0; index < _totalCount; index++) {
-                if (pSysInfo->CurGunSelected != index) {
-                    break;
-                }
-            }
-
-            pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(index);
-
-            if (pDcChargingInfo->SystemStatus == S_IDLE ||
-                    pDcChargingInfo->SystemStatus == S_RESERVATION ||
-                    pDcChargingInfo->SystemStatus == S_BOOTING) {
-                if (FirstPageChanged() == YES || needReloadQr || _page_reload) {
-                    if (pSysConfig->isQRCode) {
-                        needReloadQr = false;
-                        //ChangeQrCode_Charge((char *)pSysConfig->SystemId); //DS60-120 remove
-                        if (pSysConfig->QRCodeMadeMode == NO) {
-                            //uint8_t len = strlen((char *)pSysConfig->SystemId);
-                            ChangeQrCode_Charge((char *)pSysConfig->SystemId);
-                        } else {
-                            //uint8_t len = strlen((char *)pSysConfig->QRCodeContent);
-                            ChangeQrCode_Charge((char *)pSysConfig->QRCodeContent);
-                        }
-                    }
-                }
-            }
-        }
-    }
-    break;
-
-    case _LCM_ERROR:
-    case _LCM_MAINTAIN:
-        // AUDI_LCM_CHANGE
-        if (ShmPrimaryMcuData->InputDet.bits.EmergencyButton == 1) {
-            ChangeDisplay2Value(_emergency_map, _emergency_disable_map);
-        } else {
-            ChangeDisplay2Value(_emergency_map, _disappear);
-        }
-        break;
-    }
-}
-
-void ChangeDisplayMoneyInfo()
-{
-    uint8_t curGun = pSysInfo->CurGunSelected;
-
-    if (pSysConfig->BillingData.isBilling) {
-        struct timeb csuTime;
-        struct tm *tmCSU;
-
-        ftime(&csuTime);
-        tmCSU = localtime(&csuTime.time);
-
-        ChangeDisplay2Value(__money_rate_map, _charging_money);
-#if defined DD360Audi
-        if (ShmSelectGunInfo->PricesInfo[curGun].UserPrices != 0.00) { //Jerry add
-            DisplayMoneyRate(ShmSelectGunInfo->PricesInfo[curGun].UserPrices);
-        } else {
-#endif //defined DD360Audi
-            if (tmCSU->tm_hour <= 23) {
-                pSysConfig->BillingData.Cur_fee = pSysConfig->BillingData.Fee[tmCSU->tm_hour];
-                DisplayMoneyRate(pSysConfig->BillingData.Cur_fee);
-            }
-
-            if (pSysConfig->BillingData.Currency <= 53) {
-                DisplayMoneyCur((uint8_t *)GetCurrency(pSysConfig->BillingData.Currency));
-            }
-#if defined DD360Audi
-        }
-#endif //defined DD360Audi
-    } else {
-        ChangeDisplay2Value(__money_rate_map, _disappear);
-        ChangeDisplay2Value(__money_by_rate, _disappear);
-        ChangeDisplay2Value(__money_rate, _disappear);
-    }
-}
-
-/*void Initialization()
-{
-    bool isPass = false;
-    uint8_t count = 5;
-    while (!isPass && count > 0) {
-        isPass = true;
-        for (uint8_t _index = 0; _index < _totalCount; _index++) {
-            if (!FindChargingInfoData(_index, &_chargingInfoData[0])) {
-                log_error("LcmComm (main) : FindChargingInfoData false ");
-                isPass = false;
-                count--;
-                break;
-            }
-        }
-
-        sleep(1);
-    }
-
-    isPass = false;
-
-    if (acgunCount > 0) {
-        while (!isPass) {
-            isPass = true;
-            for (uint8_t _index = 0; _index < acgunCount; _index++) {
-                if (!FindAcChargingInfoData(_index, &ac_chargingInfo[0])) {
-                    log_error("LcmComm : FindAcChargingInfoData false ");
-                    isPass = false;
-                    break;
-                }
-            }
-
-            sleep(1);
-        }
-    }
-
-    if (count == 0) {
-        log_info("LCM Initialization Gun Fail.............");
-    }
-}
-*/
-
-//DS60-120 add
-void DefaultIconStatus()
-{
-    for (uint8_t i = 0; i < 3; i++) {
-        ChangeDisplay2Value(__gun_type_index + (i * 2), _disappear);
-    }
-
-    if (pSysInfo->IsAlternatvieConf == YES || _totalCount == 1) {
-        ChangeDisplay2Value(__sel_gun_btn, _disappear);
-    } else {
-        ChangeDisplay2Value(__sel_gun_btn, _sel_gun_btn);
-    }
-}
-
-int main(void)
-{
-
-    //if (InitShareMemory() == FAIL) {
-    //    log_error("InitShareMemory NG");
-    //
-    //    if (ShmStatusCodeData != NULL) {
-    //        ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
-    //    }
-    //    sleep(5);
-    //    return 0;
-    //}
-
-    if (CreateAllCsuShareMemory() == FAIL) {
-        log_error("create share memory error");
-        return FAIL;
-    }
-
-    MappingGunChargingInfo("LCM Control Task");
-
-    pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
-    pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
-    pSysWarning = (struct WARNING_CODE_INFO *)GetShmSysWarningInfo();
-    ShmFanModuleData = (struct FanModuleData *)GetShmFanModuleData();;
-    ShmPrimaryMcuData = (struct PrimaryMcuData *)GetShmPrimaryMcuData();
-    ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
-    struct StatusCodeData *ShmStatusCodeData = (struct StatusCodeData *)GetShmStatusCodeData();;
- 
-
-    _port = CreateCommunicationLcmPort();
-    uint8_t changeWarningPriority = 0;
-    uint8_t curWarningCount = 255;
-    ChangeBackLight(true);
-    _totalCount = pSysConfig->TotalConnectorCount;
-    acgunCount = pSysConfig->AcConnectorCount;
-    //Initialization();
-
-    //printf("_LCM_COMPLETE ");
-    //ChangeToOtherPage(_LCM_COMPLETE);
-    //return 0;
-
-    for (uint8_t i = 0; i < 3; i++) {
-        ChangeDisplay2Value(__gun_type_index + (i * 2), _disappear);
-    }
-
-    DefaultIconStatus(); //DS60-120 add
-
-    while (_port != -1) {
-        if (strcmp((char *)pSysInfo->LcmHwRev, moduleName) != 0x00) {
-            GetCurrentPage();
-            sleep(1);
-#ifndef DD360ComBox
-            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.LcmModuleCommFail = true;
-#endif
-
-        } else {
-            //DemoFunction();
-#ifndef DD360ComBox
-            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.LcmModuleCommFail = false;
-#endif
-
-            // Warning 處理
-            if (curWarningCount != pSysWarning->WarningCount) {
-                changeWarningPriority = 0;
-                pSysWarning->PageIndex = 0;
-                curWarningCount = pSysWarning->WarningCount;
-                ChangeWarningFunc();
-            } else if (pSysWarning->WarningCount > 5 && changeWarningPriority == 0) {
-                // 當有兩頁 Warning 則每隔三秒改變一次
-                if (pSysWarning->PageIndex == 0) {
-                    pSysWarning->PageIndex = 1;
-                } else {
-                    pSysWarning->PageIndex = 0;
-                }
-
-                ChangeWarningFunc();
-            }
-
-            // 頁面資訊處理
-            ProcessPageInfo();
-
-            // 網路 - wifi - 連線訊號處理
-            RefreshConnStatus();
-
-            // 換頁處理
-            GetCurrentPage(); //DS60-120 add
-            ChangeCurPage();
-
-            RefreshPageAnimation(_everyPageRollChange);
-
-#if defined DD360Audi
-            ChangeDisplayMoneyInfo();
-#else
-            if (changeWarningPriority == 0) { ////For Audi
-                ChangeDisplayMoneyInfo();
-                InformationShow();
-            }
-#endif //defined DD360Audi
-
-            changeWarningPriority >= 15 ? (_battery_display_ani = true) : (_battery_display_ani = false);
-            changeWarningPriority >= 30 ? changeWarningPriority = 0 : changeWarningPriority++;
-            usleep(100000);
-        }
-    }
-
-#ifndef DD360ComBox
-            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.LcmModuleCommFail = true;
-#endif
-    log_info("Close LCM Uart Port");
-    CloseCommunicationLcmPort();
-
-    return FAIL;
-}

+ 38 - 23
EVSE/Projects/DD360UCar/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -39,6 +39,7 @@ int _port;
 char *pPortName           = "/dev/ttyS3";
 char *moduleName          = "DMT80480T070_09WT";
 bool is_show = false;
+uint8_t _everyPageRollChange;
 //==========================================
 // Open and Close RS232 and R/W
 //==========================================
@@ -242,6 +243,14 @@ void string2ByteArray(uint8_t *input, uint8_t *output)
     output[loop] = '\0';
 }
 
+void RefreshProgressAnimation(uint8_t progress_index)
+{
+    if(_everyPageRollChange % 2) {
+        progress_index+=1;
+    }
+    ChangeDisplay2Value(_ProgressBar_LEVEL,progress_index);
+    _everyPageRollChange++;
+}
 //================================================
 // Change current page
 //================================================
@@ -603,9 +612,9 @@ void ShowGunCountDownTimer()
 }
 void ShowProgressBar()
 {
-    for(int i = 0 ; i <= 9 ; i++) {
+    for(int i = 0 ; i <= 19 ; i++) {
         ChangeDisplay2Value(_ProgressBar_LEVEL,_ICON_ProgressBar_10+i);
-        usleep(200000);
+        usleep(100000);
     }
 }
 void ShowSummaryPage()
@@ -746,7 +755,7 @@ void DemoFunction()
                 ShowViewChargingTime(LEFT_GUN_NUM,i*60);
                 ShowViewCharingMoney(LEFT_GUN_NUM,i);
                 ShowViewChargingPower(LEFT_GUN_NUM,i);
-                usleep(200000);
+                usleep(100000);
             }
             break;
         case __VIEW_RIGHT_CHARGE_:
@@ -755,7 +764,7 @@ void DemoFunction()
                 ShowViewChargingTime(RIGHT_GUN_NUM,i*60);
                 ShowViewCharingMoney(RIGHT_GUN_NUM,i);
                 ShowViewChargingPower(RIGHT_GUN_NUM,i);
-                usleep(200000);
+                usleep(100000);
             }
             break;
         case __VIEW_ALL_CHARGE_:
@@ -769,7 +778,7 @@ void DemoFunction()
                 ShowViewChargingTime(RIGHT_GUN_NUM,i*60);
                 ShowViewCharingMoney(RIGHT_GUN_NUM,i);
                 ShowViewChargingPower(RIGHT_GUN_NUM,i);
-                usleep(200000);
+                usleep(100000);
             }
             break;
         case __START_SCAN_:
@@ -778,7 +787,7 @@ void DemoFunction()
             break;
         case 11:
             for(i = 0 ; i <= 100 ; i++) {
-                ChangeDisplay2Value(_ProgressBar_LEVEL,_ICON_ProgressBar_10+(i/10)-1);
+                RefreshProgressAnimation(_ICON_ProgressBar_10+((i/10)*2));
                 uint8_t digits = i % 10;
                 uint8_t tens = (i / 10) %10;
                 uint8_t hundreds = i / 100;
@@ -823,21 +832,19 @@ void DemoFunction()
             sprintf((char *)value,"%02d:%02d",tm->tm_hour,tm->tm_min);
 
             DisplayValueToLcm(_Count_Down_Time, (uint8_t *)value, sizeof(value));
-            if (pSysInfo->PageIndex == 11 ) {
-                for( i = 12 ; i <= 21 ; i++) {
-                    ChangeDisplay2Value(_ProgressBar_LEVEL,i);
-                    usleep(200000);
-                }
-            }
             if (pSysInfo->PageIndex == 17 ) {
 
             }
             break;
         case __START_AUTHORIZE_:
-        case 10:
-        case 14:
-            for( i = 12 ; i <= 21 ; i++) {
-                ChangeDisplay2Value(_ProgressBar_LEVEL,i);
+        case __PRE_CHARGE_:
+        case __STOP_AUTHORIZE_:
+            for( i = 0 ; i <= 20 ; i++) {
+                RefreshProgressAnimation(_ICON_ProgressBar_10);
+                usleep(200000);
+            }
+            for( i = 0 ; i <= 20 ; i++) {
+                RefreshProgressAnimation(_ICON_ProgressBar_20);
                 usleep(200000);
             }
             break;
@@ -973,6 +980,7 @@ void InformationShow()
         ShowDispenserVersion();
     }
 }
+
 int main(void)
 {
     bool defaulttext = false;
@@ -997,12 +1005,13 @@ int main(void)
     uint8_t curWarningCount = 255;
     ChangeBackLight(true);
     _totalCount = pSysConfig->TotalConnectorCount;
+    _everyPageRollChange = 0;
     //Initialization();
 
     //printf("_LCM_COMPLETE ");
     //ChangeToOtherPage(_LCM_COMPLETE);
     //return 0;
-    uint8_t index = 21;
+    //uint8_t index = 5;
 
     while (_port != -1) {
         if (strcmp((char *)pSysInfo->LcmHwRev, moduleName) != 0x00) {
@@ -1042,6 +1051,7 @@ int main(void)
             }
 
             // 頁面資訊處理
+
             ProcessPageInfo();
 
             // 換頁處理
@@ -1057,14 +1067,19 @@ int main(void)
                     _showInformIndex >= 1 ? _showInformIndex = 0 : _showInformIndex++;
                 is_show = false;
             }
-            GetCurrentPage(); //DS60-120 add
-            ChangeCurPage();
-            //ChangeToOtherPage(index);
-            //DemoFunction();
+            //GetCurrentPage(); //DS60-120 add
+            //ChangeCurPage();
 
+            /*
+            GetCurrentPage();
+            ChangeToOtherPage(index);
+            GetCurrentPage();
+            DemoFunction();
+            index >= 22 ? index = 1 : index++;
+            */
+            //usleep(100000);
             usleep(100000);
-            //usleep(10000000);
-            //index >= 22 ? index = 21 : index++;
+
         }
     } //while
 

+ 22 - 11
EVSE/Projects/DD360UCar/Apps/ModuleLcmCtrl/Module_LcmControl.h

@@ -115,17 +115,8 @@ enum _ICON_LIST_ {
     _ICON_CCS1_Symbol,
     _ICON_CCS2_Symbol,
     _ICON_Power_Symbol,
-    _ICON_ProgressBar_10,
-    _ICON_ProgressBar_20,
-    _ICON_ProgressBar_30,
-    _ICON_ProgressBar_40,
-    _ICON_ProgressBar_50,
-    _ICON_ProgressBar_60,
-    _ICON_ProgressBar_70,
-    _ICON_ProgressBar_80,
-    _ICON_ProgressBar_90,
-    _ICON_ProgressBar_100,
-    _ICON_Red_Num_0,
+
+    _ICON_Red_Num_0 = 31,
     _ICON_Red_Num_1,
     _ICON_Red_Num_2,
     _ICON_Red_Num_3,
@@ -151,6 +142,26 @@ enum _ICON_LIST_ {
     _ICON_Card_Time,
     _ICON_Card_Cap,
     _ICON_Card_Money,
+
+    _ICON_ProgressBar_10 = 60,
+    _ICON_ProgressBar_10_cantrary,
+    _ICON_ProgressBar_20,
+    _ICON_ProgressBar_20_cantrary,
+    _ICON_ProgressBar_30,
+    _ICON_ProgressBar_30_cantrary,
+    _ICON_ProgressBar_40,
+    _ICON_ProgressBar_40_cantrary,
+    _ICON_ProgressBar_50,
+    _ICON_ProgressBar_50_cantrary,
+    _ICON_ProgressBar_60,
+    _ICON_ProgressBar_60_cantrary,
+    _ICON_ProgressBar_70,
+    _ICON_ProgressBar_70_cantrary,
+    _ICON_ProgressBar_80,
+    _ICON_ProgressBar_80_cantrary,
+    _ICON_ProgressBar_90,
+    _ICON_ProgressBar_90_cantrary,
+    _ICON_ProgressBar_100,
 };
 
 

+ 1 - 1
EVSE/Projects/DD360UCar/Apps/Script/copy_to_D.sh

@@ -1,2 +1,2 @@
 #!/bin/bash
-sudo cp -r /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects/DD360UCar/Apps/* /mnt/d/Phihong/Project/DD360UCar/Apps/
+sudo cp -R /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects/DD360UCar/Apps/* /mnt/d/Phihong/Project/DD360UCar/Apps/

+ 41 - 24
EVSE/Projects/define.h

@@ -63,6 +63,15 @@ Storage							0x0A200000-0x7FFFFFFF		1886 MB
     #define GENERAL_GUN_QUANTITY    0
     #define PSU_QUANTITY            0
     #define ONE_CONNECTOR_USE       0
+#elif defined NoodoeAX
+    #define MAX_PSU_QUANTITY        62
+    #define CHAdeMO_QUANTITY        1
+    #define CCS_QUANTITY            1
+    #define GB_QUANTITY             0
+    #define AC_QUANTITY             1
+    #define GENERAL_GUN_QUANTITY    0
+    #define PSU_QUANTITY            0
+    #define ONE_CONNECTOR_USE       0
 #elif defined AX80
     #define MAX_PSU_QUANTITY        62
     #define CHAdeMO_QUANTITY        1
@@ -117,7 +126,7 @@ Storage							0x0A200000-0x7FFFFFFF		1886 MB
     #define GENERAL_GUN_QUANTITY	0
     #define PSU_QUANTITY            2
     #define ONE_CONNECTOR_USE       0
-#elif defined DD360 || defined DD360Audi || defined DD360ComBox || defined DD360UCar
+#elif defined DD360 || defined DD360Audi || defined DD360ComBox || defined DD360UCar || defined DD360Tcci
     #define MAX_PSU_QUANTITY        62
     #define CHAdeMO_QUANTITY        2
     #define CCS_QUANTITY            2
@@ -312,6 +321,8 @@ enum CoreProfile {
      TimeOffsetNextTransition,
      SystemUptimeSec,
      FreeVend,
+     OcppServer,
+     MaintainServer,
      ConfigurationVersion,
 	 _CoreProfile_CNT
 };
@@ -450,7 +461,9 @@ typedef union
         unsigned int AlarmStop:1;                   // 0: no effect,    1: alarm stop
         unsigned int BackendStop:1;                 // 0: no effect,    1: backend stop
         unsigned int ManualStop:1;                  // 0: no effect,    1: manual stop
-        unsigned int res:28;
+        unsigned int HardResetStop:1;               // 0: no effect,    1: hard reset stop
+        unsigned int SoftResetStop:1;               // 0: no effect,    1: soft reset stop
+        unsigned int res:26;
     }bits;
 }ChargingStop;
 
@@ -660,6 +673,18 @@ struct ChargingInfoData
     unsigned char       CCSGunType;
 };
 
+typedef struct
+{
+    unsigned char       AuthId[32];
+                                                        // 0: Authorize idle, 1: Authorize wait,   2: Authorizing
+    unsigned char       AuthStatus;                     // 3: Authorize done, 4: Authorize end
+    unsigned char       AuthTarget;                     // Authorize Target Connector ID: 1 ~ 4, AutoSelection: 0xFF
+    unsigned char       AuthType;                       // 0: _AuthType_None,   1: _AuthType_RFID, 2: _AuthType_RemoteStart
+    unsigned char       AuthResult;                     // 0: _AuthResult_None, 1: _AuthResult_Valid,   2: _AuthResult_Invalid
+    unsigned char       AuthRequest;                    // 0: no request, 1: authorize request
+    unsigned char       res;
+}AuthorizingInfoData;
+
 typedef union
 {
     unsigned int SettingValue;
@@ -670,7 +695,6 @@ typedef union
         unsigned int DispenserConfigSync:1;             // 0: not synced,   1: synced
         unsigned int MiscNeedAnnouncement:1;            // 0: no need,      1: need send misc command
         unsigned int NeedDispenserVerInfo:1;            // 0: no need,      1: need dispenser to report it's version info
-        unsigned int EnableAutoGunSelection:1;          // 0: disable,      1: enable auto gun selection
         unsigned int AuthorizeRequest:1;                // 0: idle,         1: requesting                           ( dispenser -> cabinet)
         unsigned int ConnectorTimeoutConfigRequest:1;   // 0: no request,   1: connector timeout setting            (    ocpp   -> cabinet -> dispenser)
         unsigned int DefaultPriceConfigRequest:1;       // 0: no request,   1: default price setting                (    ocpp   -> cabinet -> dispenser)
@@ -690,7 +714,7 @@ typedef union
         unsigned int StopButtonStatusRequest:1;         // 0: no request,   1: stop charging button status has changed          ( cabinet -> dispenser)
         unsigned int AuthModeConfigRequest:1;           // 0: no request,   1: AuthMode Config has changed                      ( cabinet -> dispenser)
         unsigned int EVCCIDConfigRequest:1;             // 0: no request,   1: EVCCID Config has changed                        ( cabinet -> dispenser)
-        unsigned int res:7;
+        unsigned int res:8;
     }bits;
 }DispenserSettingFlag;
 
@@ -727,11 +751,7 @@ struct DispenserModule
     unsigned char   Connector2FwRev[32];        //Connector2 module firmware version
     struct   LED    LedInfo;                    // LED configuration info
 
-                                                // 0: Authorize idle, 1: Authorize wait,   2: Authorizing
-    unsigned char           AuthStatus;         // 3: Authorize done, 4: Authorize end
-    unsigned char           AuthTarget;         // Authorize Target Connector ID: 1 ~ 4, AutoSelection: 0xFF
-    unsigned char           AuthType;           // 0: _AuthType_None, 1: _AuthType_RFID, 2: _AuthType_RemoteStart
-    unsigned char           AuthResult;         // 0: _AuthResult_None, 1: _AuthResult_Valid,   2: _AuthResult_Invalid
+    AuthorizingInfoData     AuthInfo;
     DispenserSettingFlag    Setting;
     char                    FwFileName[128];
     unsigned char           ConnectionChannel;
@@ -824,8 +844,7 @@ struct ConnectorInfoData
     unsigned char ParentDispensetIndex;                 // Parent Dispenser Index: 0 ~ 3
     ConnectorParameter       Parameter;
 
-    unsigned char            AuthorizingType;
-    unsigned char            AuthorizingResult;         // 0: _AuthResult_None, 1: _AuthResult_Valid,   2: _AuthResult_Invalid
+    AuthorizingInfoData      AuthInfo;
     struct ChargingInfoData  GeneralChargingData;
     struct WARNING_CODE_INFO WarningInfo;
 
@@ -857,14 +876,11 @@ typedef union
     unsigned int SettingValue;
     struct
     {
-        unsigned int StartAuthorize:1;          // 0: idle,    1: authorizing
-        unsigned int AuthorizingCompleted:1;    // 0: not yet, 1: authorizing completed
         unsigned int DispenserDisconnection:1;  // 0: no connection,  1: dispenser connected
-        unsigned int BackendAuthorized:1;       // 0: local authorized, 1: backend authorized
         unsigned int FlashConfigChanged:1;      // 0: no effect, 1: flash config has changed
         unsigned int EnableWriteFlash:1;        // 0: no effect, 1: enable to write flash after timeout
         unsigned int CleanWiringInfo:1;         // 0: no effect, 1: clean wiring info
-        unsigned int res:25;
+        unsigned int res:28;
     }bits;
 }CabinetSettingFlag;
 
@@ -990,7 +1006,7 @@ struct SysInfoData
     CabinetMiscCommand      CabinetMicsStatus;
     struct LocalSharingInfo localSharingInfo;           // Local power sharing info structure
     DC_Meter_Info DcMeterInfo[4];
-    unsigned char           OTPTemp;                    // OTP Temperature 
+    unsigned char           OTPTemp;                    // OTP Temperature
     unsigned char           OTPTempR;                   // OTP Recovery Temperature
 };
 
@@ -1304,7 +1320,7 @@ char AlarmStatusCode[160][6]=
     "012325",   // Connector 2 detects abnormal voltage on the output line
     "012326",   // System task is lost
     "012327",   // DC input ovp
-    "012328",   // reserved
+    "012328",   // DC input uvp
     "012329",   // reserved
     "012330",   // reserved
     "012331",   // reserved
@@ -1490,7 +1506,8 @@ struct AlarmCodeData
             unsigned char SystemTaskLost:1;                         //bit 6
             unsigned char DcInputOVP:1;                             //bit 7
             //AlarmVal[16]
-            unsigned char :8;                                       //reserved bit 0 ~ bit 7
+            unsigned char DcInputUVP:1;                             //bit 0
+            unsigned char :7;                                       //reserved bit 0 ~ bit 7
             //AlarmVal[17]
             unsigned char :8;                                       //reserved bit 0 ~ bit 7
             //AlarmVal[18]
@@ -4380,7 +4397,7 @@ struct OCPP16ConfigurationItem
 {
 	unsigned char 		ItemName[64];
 	unsigned char 		ItemAccessibility;//0:RO, 1:RW
-	unsigned char 		ItemData[500];
+	unsigned char 		ItemData[501];//value should be limited in 500 bytes
 };
 
 struct OCPP16ConfigurationTable
@@ -4560,9 +4577,9 @@ struct StructSignedFirmwareStatusNotification
 
 struct StructSessionTarget
 {
-	unsigned char		targetSoc;			// Unit: %,   		0 is unlimit
-	unsigned short		targetEnergy;		// Unit: KWH		0 is unlimit
-	unsigned short		targetDuration;		// Unit: Minutes	0 is unlimit
+    unsigned char       targetSoc;          // Unit: %,         0 is unlimit
+    unsigned short      targetEnergy;       // Unit: KWH        0 is unlimit
+    unsigned short      targetDuration;     // Unit: Minutes    0 is unlimit
 };
 
 struct OCPP16Data
@@ -4753,7 +4770,7 @@ struct OCPP16Data
     struct StructSecurityEventNotification          SecurityEventNotification;
     struct StructSignCertificate                    SignCertificate;
     struct StructSignedFirmwareStatusNotification   SignedFirmwareStatusNotification;
-    struct StructSessionTarget	                    SessionTarget[CONNECTOR_QUANTITY];
+    struct StructSessionTarget                      SessionTarget[CONNECTOR_QUANTITY];
 };
 
 
@@ -6132,7 +6149,7 @@ struct OCPP20Data
 	struct UpdateFirmware_20					UpdateFirmware;
 	struct ChargingProfileType                  SmartChargingProfile[CONNECTOR_QUANTITY];
 	struct ChargingProfileType                  MaxChargingProfile;
-	struct StructSessionTarget	                SessionTarget[CONNECTOR_QUANTITY];
+	struct StructSessionTarget                  SessionTarget[CONNECTOR_QUANTITY];
 };
 
 #endif // DEFINE_H_