Browse Source

2021-10-13 / Wendell

Actions
1. [fix] ocpp ErrorCode issue
2. [fix] pointer(ShmGroupCollection) operation issue
3. [fix] system do not restart psu when psu alarm (only two psu group in use)
4. [fix] system status will go into AUTHORIZING state after alarm recovered if level 2 alarm occur at AUTHORIZING state
5. [fix] total psu quantity in use
6. [mod] extend dispenser connection quantity to 4
7. [mod] SPD、DoorOpen、Emergency_Btn occur 3 times continuously will trigger alarm

Files
1. As follow commit history

Image version : V1.04.XX.XXXX.XX
Wendell 3 years ago
parent
commit
9c91f7f280

+ 13 - 0
EVSE/Projects/DO360/Apps/Common.h

@@ -10,6 +10,19 @@
 
 #include <time.h>
 
+#define ARRAY_SIZE(A)               (sizeof(A) / sizeof(A[0]))
+#define PASS                        1
+#define FAIL                        -1
+#define YES                         1
+#define NO                          0
+#define ON                          1
+#define OFF                         0
+#define true                        1
+#define false                       0
+#define NORMAL                      0
+#define ABNORMAL                    1
+#define EQUAL                       0
+
 #define LOG_INFO(format, args...) StoreSysLogMsg("[%s:%4d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
 #define LOG_WARN(format, args...) StoreSysLogMsg("[%s:%4d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
 #define LOG_ERROR(format, args...) StoreSysLogMsg("[%s:%4d][%s][Erro] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)

+ 11 - 24
EVSE/Projects/DO360/Apps/Module_EvComm.c

@@ -42,20 +42,9 @@
 #include	"Config.h"
 #include    "Common.h"
 
-#define ARRAY_SIZE(A)				(sizeof(A) / sizeof(A[0]))
-#define PASS						1
-#define FAIL			   			-1
-#define YES							1
-#define NO							0
-#define ON							1
-#define OFF							0
-#define true			    		1
-#define false						0
-
 struct SysConfigAndInfo				*ShmSysConfigAndInfo;
 ChargerInfoData                     *ShmChargerInfo;
 struct ChargingInfoData             *chargingInfo[CONNECTOR_QUANTITY];
-PsuGroupCollectionData              *ShmGroupCollection;
 struct PsuData                      *ShmPsuData;
 
 void ShowSocketData(struct PACKET_STRUCTURE *packet)
@@ -132,11 +121,6 @@ int InitShareMemory()
         result = FAIL;
     }
 
-    if(result == PASS)
-    {
-        ShmGroupCollection = &ShmChargerInfo->PsuGrouping.GroupCollection[0];
-    }
-
 	return result;
 }
 
@@ -990,7 +974,7 @@ void GetConfigLimitPowerAndCurrent(byte index, unsigned short *power, unsigned s
     {
         if(ShmChargerInfo->PsuGrouping.GroupCollection[i].Role == _GROLE_MASTER)
         {
-            inUsingCnt += ShmChargerInfo->PsuGrouping.GroupCollection[index].GunPsuQuantity;
+            inUsingCnt += ShmChargerInfo->PsuGrouping.GroupCollection[i].GunPsuQuantity;
         }
     }
 
@@ -998,7 +982,7 @@ void GetConfigLimitPowerAndCurrent(byte index, unsigned short *power, unsigned s
         ShmSysConfigAndInfo->SysConfig.MaxChargingPower != 0)
     {
         limitPower = ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10;
-        limitPower = (limitPower * ShmGroupCollection[index].GunPsuQuantity) / inUsingCnt;
+        limitPower = (limitPower * ShmChargerInfo->PsuGrouping.GroupCollection[index].GunPsuQuantity) / inUsingCnt;
     }
     ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].MaxTotalChargingPower = limitPower;
 
@@ -1006,7 +990,7 @@ void GetConfigLimitPowerAndCurrent(byte index, unsigned short *power, unsigned s
         ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent != 0)
     {
         limitCurrent = ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent * 10;
-        limitCurrent = (limitCurrent * ShmGroupCollection[index].GunPsuQuantity) / inUsingCnt;
+        limitCurrent = (limitCurrent * ShmChargerInfo->PsuGrouping.GroupCollection[index].GunPsuQuantity) / inUsingCnt;
     }
     ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].MaxTotalChargingCurrent = limitCurrent;
 
@@ -1046,7 +1030,7 @@ void GetMaxChargingProfileLimit(byte index, unsigned short *power, unsigned shor
     {
         if(ShmChargerInfo->PsuGrouping.GroupCollection[i].Role == _GROLE_MASTER)
         {
-            inUsingCnt += ShmChargerInfo->PsuGrouping.GroupCollection[index].GunPsuQuantity;
+            inUsingCnt += ShmChargerInfo->PsuGrouping.GroupCollection[i].GunPsuQuantity;
         }
     }
 
@@ -1055,7 +1039,7 @@ void GetMaxChargingProfileLimit(byte index, unsigned short *power, unsigned shor
         ShmSysConfigAndInfo->SysInfo.MaxChargingProfilePower >= 0)
     {
         limitPower = (int)ShmSysConfigAndInfo->SysInfo.MaxChargingProfilePower / 100;
-        limitPower = (limitPower * ShmGroupCollection[index].GunPsuQuantity) / inUsingCnt;
+        limitPower = (limitPower * ShmChargerInfo->PsuGrouping.GroupCollection[index].GunPsuQuantity) / inUsingCnt;
 
         if(*power > limitPower)
         {
@@ -2591,7 +2575,7 @@ void DispenserSocketProcess(int socketFd, struct sockaddr_in clientInfo, unsigne
 	unsigned char ackResult = _R_NG;
 	DispenserAck_Status ack = _DAS_Wait;
 
-	LOG_INFO("IP %s connection(%d) is established, start dispenser process", (inet_ntoa(clientInfo.sin_addr)), index);
+	LOG_INFO("IP %s connection(%d) is established, start dispenser process, PID = %d", (inet_ntoa(clientInfo.sin_addr)), index, getpid());
 
 	while(1)
 	{
@@ -2932,7 +2916,10 @@ BOOL IsConflictIp(uint32_t ipAddress)
 		if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].IpAddress == ipAddress)
 		{
             int dispenser = ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].DispenserIndex;
-            ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenser].Setting.bits.DuplicateIp = true;
+            if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenser].Setting.bits.DuplicateIp == false)
+            {
+                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenser].Setting.bits.DuplicateIp = true;
+            }
 			return true;
 		}
 	}
@@ -3095,7 +3082,7 @@ int tcpSocketServerStart(void)
     }
 	listen(sockFd, CONNECTION_LIMIT);
 
-	LOG_INFO("TCP Server Start");
+	LOG_INFO("Dispenser TCP Server Start");
 
 	signal(SIGCHLD, SIG_IGN);
 

+ 2 - 2
EVSE/Projects/DO360/Apps/Module_EvComm.h

@@ -1,7 +1,7 @@
 /*
  * Module_EvComm.h
  *
- *  Created on: 2020�~9��14��
+ *  Created on: 2020年9月14日
  *      Author: Wendell
  */
 
@@ -25,7 +25,7 @@
 
 // socket setting
 #define	CONNECTION_LIMIT				5
-#define MAXIMUM_CONNECT_QUANTITY		2
+#define MAXIMUM_CONNECT_QUANTITY		4
 
 #define CCS_MAX_PHYSICAL_VOLTAGE        9500
 #define CCS_NATURAL_MAX_CURRENT         2000

+ 0 - 6
EVSE/Projects/DO360/Apps/Module_EventLogging.c

@@ -29,12 +29,6 @@
 #include	"../../define.h"
 #include    "Common.h"
 
-#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
-#define PASS				1
-#define FAIL				-1
-#define YES					1
-#define NO					0
-
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData 			*ShmStatusCodeData;
 struct StatusCodeData           StatusCodeDisableMask;

+ 6 - 15
EVSE/Projects/DO360/Apps/Module_InternalComm.c

@@ -33,16 +33,10 @@
 #include    "Config.h"
 #include    "Common.h"
 
-#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
-#define PASS				1
-#define FAIL				-1
-#define YES					1
-#define NO					0
 #define TEN_MINUTES			600
 #define ENV_TEMP_MIN		45
 #define ENV_TEMP_MAX		50
 #define DEFAULT_AC_INDEX	2
-#define EQUAL				0
 #define COLOR_MAX_LV		100
 #define COLOR_MIN_LV		0
 
@@ -69,7 +63,6 @@ PsuGroupParallelRelay           *ShmParallelRelayConfirmed;
 RBRelayControl                  *LocationRelayCtrl[MAX_GROUP_QUANTITY];
 RBRelayControl                  *LocationRelayResponse[MAX_GROUP_QUANTITY];
 Connector_GFD                   *LocaltionGfd[MAX_GROUP_QUANTITY];
-PsuGroupCollectionData          *ShmGroupCollection;
 
 #define VIN_MAX_VOLTAGE_IEC         285	// 大於該值 : OVP
 #define VIN_MAX_REV_VOLTAGE_IEC     275 // 小於賦歸 OVP
@@ -1131,8 +1124,8 @@ void SetK1K2RelayStatus(byte index)
 
                 if(_chargingData[index]->SystemStatus == S_PREPARING_FOR_EVSE)
                 {
-                    if(ShmGroupCollection[index].GroupCtrl.bits.CableCheckDone == false &&
-                        ShmGroupCollection[index].GroupCtrl.bits.InPrechargeMode == false)
+                    if(ShmPsuGrouping->GroupCollection[index].GroupCtrl.bits.CableCheckDone == false &&
+                        ShmPsuGrouping->GroupCollection[index].GroupCtrl.bits.InPrechargeMode == false)
                     {
                         if(!ShmOutputRelayConfig[index]->bits.Output_N || !ShmOutputRelayConfig[index]->bits.Output_P)
                         {
@@ -1141,8 +1134,8 @@ void SetK1K2RelayStatus(byte index)
                         ShmOutputRelayConfig[index]->bits.Output_N = true;
                         ShmOutputRelayConfig[index]->bits.Output_P = true;
                     }
-                    else if(ShmGroupCollection[index].GroupCtrl.bits.CableCheckDone == true &&
-                        ShmGroupCollection[index].GroupCtrl.bits.InPrechargeMode == false)
+                    else if(ShmPsuGrouping->GroupCollection[index].GroupCtrl.bits.CableCheckDone == true &&
+                        ShmPsuGrouping->GroupCollection[index].GroupCtrl.bits.InPrechargeMode == false)
                     {
                         if(_chargingData[index]->FireChargingVoltage <= SELF_TO_CHANGE_RELAY_STATUS)
                         {
@@ -1154,8 +1147,8 @@ void SetK1K2RelayStatus(byte index)
                             ShmOutputRelayConfig[index]->bits.Output_P = false;
                         }
                     }
-                    else if(ShmGroupCollection[index].GroupCtrl.bits.CableCheckDone == true &&
-                        ShmGroupCollection[index].GroupCtrl.bits.InPrechargeMode == true)
+                    else if(ShmPsuGrouping->GroupCollection[index].GroupCtrl.bits.CableCheckDone == true &&
+                        ShmPsuGrouping->GroupCollection[index].GroupCtrl.bits.InPrechargeMode == true)
                     {
                         unsigned short voltage = 0, diffVol = 0;
                         voltage = (int)(_chargingData[index]->PresentChargingVoltage * 10);
@@ -1644,8 +1637,6 @@ int InitShareMemory()
                 LocaltionGfd[3] = (Connector_GFD *)&gfd_adc[1].Resister_conn2;
             }
         }
-
-        ShmGroupCollection = &ShmPsuGrouping->GroupCollection[0];
     }
 
 	return result;

+ 28 - 30
EVSE/Projects/DO360/Apps/Module_PrimaryComm.c

@@ -33,12 +33,6 @@
 #include    "Config.h"
 #include    "Common.h"
 
-#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
-#define PASS				1
-#define FAIL				-1
-#define YES					1
-#define NO					0
-
 #define COMM_FAIL_COUNT         10
 #define STATE_CHANGE_COUNT      3
 
@@ -65,11 +59,11 @@ byte _OutputDrv = 0;
 byte _acStatus = 0;
 byte _acChkCount = 0;
 int _CommFailCount = 0;
-char _CabinetSwitch = -1;
-char _TempSwitch = -1;
-char _TempSPD = -1;
-char _TempDoor = -1;
-char _TempEmg = -1;
+int _CabinetSwitch = -1;
+int _TempSwitch = -1;
+int _TempSPD = -1;
+int _TempDoor = -1;
+int _TempEmg = -1;
 byte _SwitchCnt = 0;
 byte _SPDCnt = 0;
 byte _DoorCnt = 0;
@@ -279,24 +273,26 @@ void GetInputGpioStatus()
 			_acChkCount = 0;
 
 		ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec = gpio_in.AC_MainBreaker;
-		/*
+
 		if(_TempSPD != gpio_in.SPD)
 		{
 		    _SPDCnt++;
-		    if(_SPDCnt >= STATE_CHANGE_COUNT || _TempSPD == -1)
+		    if(_SPDCnt >= STATE_CHANGE_COUNT || _TempSPD < 0)
 		    {
 		        _TempSPD = gpio_in.SPD;
 		        _SPDCnt = 0;
 		    }
 		}
-		if(_TempSPD != -1)
+		if(_TempSPD >= 0)
 		{
 		    ShmPrimaryMcuData->InputDet.bits.SpdDetec = _TempSPD;
 		}
-		*/
+#if 0
 		ShmPrimaryMcuData->InputDet.bits.SpdDetec = gpio_in.SPD;
+#endif
 
 		// DO360 Door Status is the inverse of DS's
+#if 0
         if(ShmChargerInfo->Control.PrimaryCtrl.bits.DoorSensorReverse)
         {
             ShmPrimaryMcuData->InputDet.bits.DoorOpen = gpio_in.Door_Open ? 0 : 1;
@@ -305,51 +301,49 @@ void GetInputGpioStatus()
         {
             ShmPrimaryMcuData->InputDet.bits.DoorOpen = gpio_in.Door_Open ? 1 : 0;
         }
-
-		/*
+#endif
         if(_TempDoor != gpio_in.Door_Open)
         {
             _DoorCnt++;
-            if(_DoorCnt >= STATE_CHANGE_COUNT || _TempDoor == -1)
+            if(_DoorCnt >= STATE_CHANGE_COUNT || _TempDoor < 0)
             {
                 _TempDoor = gpio_in.Door_Open;
                 _DoorCnt = 0;
             }
         }
-        if(_TempDoor != -1)
+        if(_TempDoor >= 0)
         {
             if(ShmChargerInfo->Control.PrimaryCtrl.bits.DoorSensorReverse)
             {
-                ShmPrimaryMcuData->InputDet.bits.DoorOpen = _DoorCnt ? 0 : 1;
+                ShmPrimaryMcuData->InputDet.bits.DoorOpen = _TempDoor > 0 ? 0 : 1;
             }
             else
             {
-                ShmPrimaryMcuData->InputDet.bits.DoorOpen = _DoorCnt ? 1 : 0;
+                ShmPrimaryMcuData->InputDet.bits.DoorOpen = _TempDoor > 0 ? 1 : 0;
             }
         }
-        */
 		// Bypass door open
 		//ShmPrimaryMcuData->InputDet.bits.DoorOpen = 0;
 
 		ShmPrimaryMcuData->InputDet.bits.Button1 = gpio_in.Button[0];
 		ShmPrimaryMcuData->InputDet.bits.Button2 = gpio_in.Button[1];
-		/*
+
 		if(_TempEmg != gpio_in.Emergency_Btn)
 		{
 		    _EmgBtnCnt++;
-		    if(_EmgBtnCnt >= STATE_CHANGE_COUNT || _TempEmg == -1)
+		    if(_EmgBtnCnt >= STATE_CHANGE_COUNT || _TempEmg < 0)
 		    {
 		        _TempEmg = gpio_in.Emergency_Btn;
 		        _EmgBtnCnt = 0;
 		    }
 		}
-		if(_TempEmg != -1)
+		if(_TempEmg >= 0)
 		{
-		    ShmPrimaryMcuData->InputDet.bits.EmergencyButton = _TempEmg ? 1 : 0;
+		    ShmPrimaryMcuData->InputDet.bits.EmergencyButton = _TempEmg > 0 ? 1 : 0;
 		}
-		*/
+#if 0
 		ShmPrimaryMcuData->InputDet.bits.EmergencyButton = gpio_in.Emergency_Btn;
-
+#endif
 		//LOG_INFO("left = %d", ShmPrimaryMcuData->InputDet.bits.Button1);
 		//LOG_INFO("right = %d", ShmPrimaryMcuData->InputDet.bits.Button2);
 		//LOG_INFO("ShmSysConfigAndInfo->SysInfo.AcContactorStatus = %d", ShmSysConfigAndInfo->SysInfo.AcContactorStatus);
@@ -377,7 +371,7 @@ void GetInputGpioStatus()
 
 		if(_CabinetSwitch != _TempSwitch)
 		{
-		    LOG_INFO("Cabinet Switch: %d, Key3: %d, Key2: %d, Key1: %d, Key0: %d",
+            LOG_INFO("Switch: %d, Key3: %d, Key2: %d, Key1: %d, Key0: %d",
                 _TempSwitch,
                 ShmPrimaryMcuData->InputDet.bits.Key3,
                 ShmPrimaryMcuData->InputDet.bits.Key2,
@@ -385,8 +379,12 @@ void GetInputGpioStatus()
                 ShmPrimaryMcuData->InputDet.bits.Key0);
 		}
         _CabinetSwitch = _TempSwitch;
-        if(_CabinetSwitch != -1)
+        if(_CabinetSwitch >= 0)
         {
+            if(ShmChargerInfo->Control.CabinetSwitch != _CabinetSwitch)
+            {
+                LOG_INFO("Set Cabinet Switch: %d", _CabinetSwitch);
+            }
             ShmChargerInfo->Control.CabinetSwitch = _CabinetSwitch;
         }
 	}

File diff suppressed because it is too large
+ 181 - 189
EVSE/Projects/DO360/Apps/Module_PsuComm.c


+ 115 - 110
EVSE/Projects/DO360/Apps/ReadCmdline.c

@@ -42,9 +42,6 @@
 #include    "Common.h"
 
 typedef unsigned char			byte;
-#define PASS				1
-#define FAIL				-1
-#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
 #define	NO_DEFINE			255
 #define DEFAULT_AC_INDEX	2
 
@@ -65,7 +62,6 @@ struct PsuData 					*ShmPsuData;
 ChargerInfoData                 *ShmChargerInfo;
 PsuPositionInfoData             *ShmPsuPosition;
 PsuGroupingInfoData             *ShmPsuGrouping;
-PsuGroupCollectionData          *ShmGroupCollection;
 
 struct ChargingInfoData 		*_chargingData[CONNECTOR_QUANTITY];
 struct ChargingInfoData 		*ac_chargingInfo[AC_QUANTITY];
@@ -247,7 +243,6 @@ int InitShareMemory()
     {
         ShmPsuPosition = &ShmChargerInfo->PsuPosition;
         ShmPsuGrouping = &ShmChargerInfo->PsuGrouping;
-        ShmGroupCollection = &ShmChargerInfo->PsuGrouping.GroupCollection[0];
     }
 
     return result;
@@ -1487,11 +1482,11 @@ void SetGroupRole(byte group, byte role)
 {
     if(group < GENERAL_GUN_QUANTITY)
     {
-        if(ShmGroupCollection[group].Role != role)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role != role)
         {
             //printf("\r\nSet Group %d Role = %d", group, role);
         }
-        ShmGroupCollection[group].Role = role;
+        ShmChargerInfo->PsuGrouping.GroupCollection[group].Role = role;
     }
 }
 
@@ -1500,9 +1495,9 @@ void SetGroupToIdle(byte group)
     if(group < GENERAL_GUN_QUANTITY)
     {
         SetGroupRole(group, _GROLE_IDLE);
-        ShmGroupCollection[group].Partner.Quantity = 0;
-        memset(ShmGroupCollection[group].Partner.Member, 0x00, ARRAY_SIZE(ShmGroupCollection[group].Partner.Member));
-        ShmGroupCollection[group].TargetGroup = 0;
+        ShmChargerInfo->PsuGrouping.GroupCollection[group].Partner.Quantity = 0;
+        memset(ShmChargerInfo->PsuGrouping.GroupCollection[group].Partner.Member, 0x00, ARRAY_SIZE(ShmChargerInfo->PsuGrouping.GroupCollection[group].Partner.Member));
+        ShmChargerInfo->PsuGrouping.GroupCollection[group].TargetGroup = 0;
         //printf("\r\n Reset Group %02X To Idle", group);
     }
 }
@@ -1512,7 +1507,7 @@ void SetGroupToMaster(byte group)
     if(group < GENERAL_GUN_QUANTITY)
     {
         SetGroupRole(group, _GROLE_MASTER);
-        ShmGroupCollection[group].TargetGroup = group + 1;
+        ShmChargerInfo->PsuGrouping.GroupCollection[group].TargetGroup = group + 1;
         //printf("\r\n Set Group %02X As Master", group);
     }
 }
@@ -1522,7 +1517,7 @@ void SetGroupToSlave(byte group, byte target)
     if(group < GENERAL_GUN_QUANTITY && target < GENERAL_GUN_QUANTITY)
     {
         SetGroupRole(group, _GROLE_SLAVE);
-        ShmGroupCollection[group].TargetGroup = target + 1;
+        ShmChargerInfo->PsuGrouping.GroupCollection[group].TargetGroup = target + 1;
         //printf("\r\n Set Group %02X As Slave", group);
     }
 }
@@ -1535,25 +1530,25 @@ void AddGroupCollection(byte group, byte target)
 
     if(group < GENERAL_GUN_QUANTITY && target < GENERAL_GUN_QUANTITY)
     {
-        if(ShmGroupCollection[target].Role != _GROLE_MASTER)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[target].Role != _GROLE_MASTER)
         {
             return;
         }
-        if(ShmGroupCollection[group].Role != _GROLE_IDLE &&
-            ShmGroupCollection[group].Role != _GROLE_WAIT_IDLE &&
-            ShmGroupCollection[group].Role != _GROLE_PRECHARGE_READY)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role != _GROLE_IDLE &&
+            ShmChargerInfo->PsuGrouping.GroupCollection[group].Role != _GROLE_WAIT_IDLE &&
+            ShmChargerInfo->PsuGrouping.GroupCollection[group].Role != _GROLE_PRECHARGE_READY)
         {
             return;
         }
 
         SetGroupToSlave(group, target);
-        ShmGroupCollection[target].Partner.Member[ShmGroupCollection[target].Partner.Quantity++] = group;
-        ParallelConfig = ShmGroupCollection[target].ParallelConfig[group];
+        ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Member[ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity++] = group;
+        ParallelConfig = ShmChargerInfo->PsuGrouping.GroupCollection[target].ParallelConfig[group];
         if(ParallelConfig != 0)
         {
             ShmPsuGrouping->ParallelRelayConfig.CtrlValue |= (1 << (ParallelConfig - 1));
         }
-        //printf("\r\n Add Group %02X To Gun %d (Quantity %d), Set Parallel Relay %d On", group, target + 1, ShmGroupCollection[target].Partner.Quantity, ParallelConfig);
+        //printf("\r\n Add Group %02X To Gun %d (Quantity %d), Set Parallel Relay %d On", group, target + 1, ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity, ParallelConfig);
     }
 }
 
@@ -1567,11 +1562,11 @@ void RemoveGroupCollection(byte group, byte target)
 
     if(group < GENERAL_GUN_QUANTITY && target < GENERAL_GUN_QUANTITY)
     {
-        for(int i = 0; i < ShmGroupCollection[target].Partner.Quantity; i++)
+        for(int i = 0; i < ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity; i++)
         {
-            if(group == ShmGroupCollection[target].Partner.Member[i])
+            if(group == ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Member[i])
             {
-                ShmGroupCollection[target].Partner.Member[i] = 0;
+                ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Member[i] = 0;
                 location = i;
                 find = true;
                 break;
@@ -1579,20 +1574,20 @@ void RemoveGroupCollection(byte group, byte target)
         }
         if(find)
         {
-            for(int i = location + 1; i < ShmGroupCollection[target].Partner.Quantity; i++)
+            for(int i = location + 1; i < ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity; i++)
             {
-                slave = ShmGroupCollection[target].Partner.Member[i];
-                ShmGroupCollection[target].Partner.Member[i] = 0;
-                ShmGroupCollection[target].Partner.Member[i - 1] = slave;
+                slave = ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Member[i];
+                ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Member[i] = 0;
+                ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Member[i - 1] = slave;
             }
-            ShmGroupCollection[target].Partner.Quantity--;
+            ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity--;
             SetGroupToIdle(group);
-            ParallelConfig = ShmGroupCollection[target].ParallelConfig[group];
+            ParallelConfig = ShmChargerInfo->PsuGrouping.GroupCollection[target].ParallelConfig[group];
             if(ParallelConfig != 0)
             {
                 ShmPsuGrouping->ParallelRelayConfig.CtrlValue &= ~(1 << (ParallelConfig - 1));
             }
-            //printf("\r\n Remove Group %02X From Gun %d (Quantity %d), Clean Parallel Relay %d Off", group, target + 1, ShmGroupCollection[target].Partner.Quantity, ParallelConfig);
+            //printf("\r\n Remove Group %02X From Gun %d (Quantity %d), Clean Parallel Relay %d Off", group, target + 1, ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity, ParallelConfig);
         }
     }
 }
@@ -1609,14 +1604,14 @@ void ShowGroupingInfo(void)
     {
         target = ShmPsuGrouping->Layout[i];
         printf("\r\n  %d   (%2d)   %2d  %d     %02X    ",
-            target + 1, _chargingData[target]->SystemStatus, ShmGroupCollection[target].Role,
-            ShmGroupCollection[target].Partner.Quantity, ShmGroupCollection[target].TargetGroup);
+            target + 1, _chargingData[target]->SystemStatus, ShmChargerInfo->PsuGrouping.GroupCollection[target].Role,
+            ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity, ShmChargerInfo->PsuGrouping.GroupCollection[target].TargetGroup);
 
         for(int j = 0; j < 3; j++)
         {
-            if(ShmGroupCollection[target].Role == 1 && j < ShmGroupCollection[target].Partner.Quantity)
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[target].Role == 1 && j < ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity)
             {
-                printf("[%02X] ", ShmGroupCollection[target].Partner.Member[j]);
+                printf("[%02X] ", ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Member[j]);
             }
             else
             {
@@ -1640,19 +1635,19 @@ void PsuGroupSwitchToIdle(byte group)
 {
     int master = 0, quantity = 0, location = 0, total = 0;
 
-    if(ShmGroupCollection[group].Role != _GROLE_SLAVE)
+    if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role != _GROLE_SLAVE)
     {
         return;
     }
 
-    master = ShmGroupCollection[group].TargetGroup - 1;
-    quantity = ShmGroupCollection[master].Partner.Quantity;
+    master = ShmChargerInfo->PsuGrouping.GroupCollection[group].TargetGroup - 1;
+    quantity = ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Quantity;
     //printf("\r\n Search Group %02X From Gun %d", group, master + 1);
     for(int i = 0; i < quantity; i++)
     {
         if(total == 0)
         {
-            if(group == ShmGroupCollection[master].Partner.Member[i])
+            if(group == ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Member[i])
             {
                 location = i;
                 total++;
@@ -1662,20 +1657,20 @@ void PsuGroupSwitchToIdle(byte group)
         else
         {
             // find other group in the same direction
-            if(ShmPsuGrouping->Location[ShmGroupCollection[master].Partner.Member[location]] < ShmPsuGrouping->Location[master])
+            if(ShmPsuGrouping->Location[ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Member[location]] < ShmPsuGrouping->Location[master])
             {
-                if(ShmPsuGrouping->Location[ShmGroupCollection[master].Partner.Member[i]] < ShmPsuGrouping->Location[master])
+                if(ShmPsuGrouping->Location[ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Member[i]] < ShmPsuGrouping->Location[master])
                 {
                     total++;
-                    //printf("\r\n Find Other Group %02X In The Same Direction", ShmGroupCollection[master].Partner.Member[i]);
+                    //printf("\r\n Find Other Group %02X In The Same Direction", ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Member[i]);
                 }
             }
-            if(ShmPsuGrouping->Location[ShmGroupCollection[master].Partner.Member[location]] > ShmPsuGrouping->Location[master])
+            if(ShmPsuGrouping->Location[ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Member[location]] > ShmPsuGrouping->Location[master])
             {
-                if(ShmPsuGrouping->Location[ShmGroupCollection[master].Partner.Member[i]] > ShmPsuGrouping->Location[master])
+                if(ShmPsuGrouping->Location[ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Member[i]] > ShmPsuGrouping->Location[master])
                 {
                     total++;
-                    //printf("\r\n Find Other Group %02X In The Same Direction", ShmGroupCollection[master].Partner.Member[i]);
+                    //printf("\r\n Find Other Group %02X In The Same Direction", ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Member[i]);
                 }
             }
         }
@@ -1685,7 +1680,7 @@ void PsuGroupSwitchToIdle(byte group)
     {
         unsigned char collection[GENERAL_GUN_QUANTITY];
         //printf("\r\n There are %d Group Need To Switch Idle:", total);
-        memcpy(collection, ShmGroupCollection[master].Partner.Member, ARRAY_SIZE(ShmGroupCollection[master].Partner.Member));
+        memcpy(collection, ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Member, ARRAY_SIZE(ShmChargerInfo->PsuGrouping.GroupCollection[master].Partner.Member));
 
         for(int i = 0; i < total; i++)
         {
@@ -1706,7 +1701,7 @@ void FindPsuGroupPartner(byte master, byte quantity, PsuGroupPartner *tPartner)
     memset(&partner, 0x00, sizeof(PsuGroupPartner));
 
     // search from left
-    location = ShmGroupCollection[master].Location - 1;
+    location = ShmChargerInfo->PsuGrouping.GroupCollection[master].Location - 1;
     for(int i = location; i >= 0; i--)
     {
         if(partner.Quantity >= quantity)
@@ -1715,14 +1710,14 @@ void FindPsuGroupPartner(byte master, byte quantity, PsuGroupPartner *tPartner)
         }
 
         slave = ShmPsuGrouping->Layout[i];
-        if(ShmGroupCollection[slave].Role == _GROLE_IDLE)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_IDLE)
         {
             //printf("\r\n Find Group %02X From Left", slave);
             partner.Member[partner.Quantity++] = slave;
         }
         else
         {
-            if(ShmGroupCollection[slave].Role == _GROLE_SLAVE && master == (ShmGroupCollection[slave].TargetGroup - 1))
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_SLAVE && master == (ShmChargerInfo->PsuGrouping.GroupCollection[slave].TargetGroup - 1))
             {
                 continue;
             }
@@ -1731,7 +1726,7 @@ void FindPsuGroupPartner(byte master, byte quantity, PsuGroupPartner *tPartner)
     }
 
     // search from right
-    location = ShmGroupCollection[master].Location + 1;
+    location = ShmChargerInfo->PsuGrouping.GroupCollection[master].Location + 1;
     for(int i = location; i < 4; i++)
     {
         if(partner.Quantity >= quantity)
@@ -1740,14 +1735,14 @@ void FindPsuGroupPartner(byte master, byte quantity, PsuGroupPartner *tPartner)
         }
 
         slave = ShmPsuGrouping->Layout[i];
-        if(ShmGroupCollection[slave].Role == _GROLE_IDLE)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_IDLE)
         {
             //printf("\r\n Find Group %02X From Right", slave);
             partner.Member[partner.Quantity++] = slave;
         }
         else
         {
-            if(ShmGroupCollection[slave].Role == _GROLE_SLAVE && master == (ShmGroupCollection[slave].TargetGroup - 1))
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_SLAVE && master == (ShmChargerInfo->PsuGrouping.GroupCollection[slave].TargetGroup - 1))
             {
                 continue;
             }
@@ -1769,17 +1764,17 @@ int GetPsuGroupAvailable(byte group)
     return partner.Quantity;
 #if 0
     // search from left
-    location = ShmGroupCollection[group].Location - 1;
+    location = ShmChargerInfo->PsuGrouping.GroupCollection[group].Location - 1;
     for(int i = location; i >= 0; i--)
     {
         slave = ShmPsuGrouping->Layout[i];
-        if(ShmGroupCollection[slave].Role == _GROLE_IDLE)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_IDLE)
         {
             available++;
         }
         else
         {
-            if(ShmGroupCollection[slave].Role == _GROLE_SLAVE && group == (ShmGroupCollection[slave].TargetGroup - 1))
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_SLAVE && group == (ShmChargerInfo->PsuGrouping.GroupCollection[slave].TargetGroup - 1))
             {
                 continue;
             }
@@ -1787,17 +1782,17 @@ int GetPsuGroupAvailable(byte group)
         }
     }
     // search from right
-    location = ShmGroupCollection[group].Location + 1;
+    location = ShmChargerInfo->PsuGrouping.GroupCollection[group].Location + 1;
     for(int i = location; i < 4; i++)
     {
         slave = ShmPsuGrouping->Layout[i];
-        if(ShmGroupCollection[slave].Role == _GROLE_IDLE)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_IDLE)
         {
             available++;
         }
         else
         {
-            if(ShmGroupCollection[slave].Role == _GROLE_SLAVE && group == (ShmGroupCollection[slave].TargetGroup - 1))
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_SLAVE && group == (ShmChargerInfo->PsuGrouping.GroupCollection[slave].TargetGroup - 1))
             {
                 continue;
             }
@@ -1816,18 +1811,18 @@ void PsuGroupShareCheck(byte group)
     //printf("\r\n Gun %d Total Group = %d", group + 1, total);
 
     // search from left
-    location = ShmGroupCollection[group].Location - 1;
+    location = ShmChargerInfo->PsuGrouping.GroupCollection[group].Location - 1;
     for(int i = location; i >= 0; i--)
     {
         slave = ShmPsuGrouping->Layout[i];
-        if(ShmGroupCollection[slave].Role == _GROLE_SLAVE)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_SLAVE)
         {
-            target = ShmGroupCollection[slave].TargetGroup - 1;
-            if((ShmGroupCollection[target].Partner.Quantity + 1) > total)
+            target = ShmChargerInfo->PsuGrouping.GroupCollection[slave].TargetGroup - 1;
+            if((ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity + 1) > total)
             {
-                share = (ShmGroupCollection[target].Partner.Quantity + 1 - total) / 2;
+                share = (ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity + 1 - total) / 2;
             }
-            //printf("\r\n Find Group %02X Have %d Resource Can Shared %d From Left", target, ShmGroupCollection[target].Partner.Quantity, share);
+            //printf("\r\n Find Group %02X Have %d Resource Can Shared %d From Left", target, ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity, share);
             break;
         }
         else
@@ -1839,18 +1834,18 @@ void PsuGroupShareCheck(byte group)
     if(share == 0)
     {
         // search from right
-        location = ShmGroupCollection[group].Location + 1;
+        location = ShmChargerInfo->PsuGrouping.GroupCollection[group].Location + 1;
         for(int i = location; i < 4; i++)
         {
             slave = ShmPsuGrouping->Layout[i];
-            if(ShmGroupCollection[slave].Role == _GROLE_SLAVE)
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_SLAVE)
             {
-                target = ShmGroupCollection[slave].TargetGroup - 1;
-                if((ShmGroupCollection[target].Partner.Quantity + 1) > total)
+                target = ShmChargerInfo->PsuGrouping.GroupCollection[slave].TargetGroup - 1;
+                if((ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity + 1) > total)
                 {
-                    share = (ShmGroupCollection[target].Partner.Quantity + 1 - total) / 2;
+                    share = (ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity + 1 - total) / 2;
                 }
-                //printf("\r\n Find Group %02X Have %d Resource Can Shared %d From Left", target, ShmGroupCollection[target].Partner.Quantity, share);
+                //printf("\r\n Find Group %02X Have %d Resource Can Shared %d From Left", target, ShmChargerInfo->PsuGrouping.GroupCollection[target].Partner.Quantity, share);
                 break;
             }
             else
@@ -1877,17 +1872,17 @@ void SimplePsuGroupStartCharging(byte group)
     int available = 0;
     PsuGroupPartner partner;
 
-    if(ShmGroupCollection[group].Role == _GROLE_SLAVE)
+    if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role == _GROLE_SLAVE)
     {
         return;
     }
 
-    if(ShmGroupCollection[group].Role != _GROLE_IDLE && ShmGroupCollection[group].Role != _GROLE_MASTER)
+    if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role != _GROLE_IDLE && ShmChargerInfo->PsuGrouping.GroupCollection[group].Role != _GROLE_MASTER)
     {
         return;
     }
 
-    if(ShmGroupCollection[group].Role == _GROLE_IDLE)
+    if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role == _GROLE_IDLE)
     {
         SetGroupToMaster(group);
 
@@ -1916,18 +1911,18 @@ void SimplePsuGroupStartCharging(byte group)
 
 #if 0
     // search from left
-    location = ShmGroupCollection[group].Location - 1;
+    location = ShmChargerInfo->PsuGrouping.GroupCollection[group].Location - 1;
     for(int i = location; i >= 0; i--)
     {
         slave = ShmPsuGrouping->Layout[i];
-        if(ShmGroupCollection[slave].Role == _GROLE_IDLE)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_IDLE)
         {
             //printf("\r\n Find %02X From Left", slave);
             AddGroupCollection(slave, group);
         }
         else
         {
-            if(ShmGroupCollection[slave].Role == _GROLE_SLAVE && group == (ShmGroupCollection[slave].TargetGroup - 1))
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_SLAVE && group == (ShmChargerInfo->PsuGrouping.GroupCollection[slave].TargetGroup - 1))
             {
                 continue;
             }
@@ -1936,18 +1931,18 @@ void SimplePsuGroupStartCharging(byte group)
     }
 
     // search from right
-    location = ShmGroupCollection[group].Location + 1;
+    location = ShmChargerInfo->PsuGrouping.GroupCollection[group].Location + 1;
     for(int i = location; i < 4; i++)
     {
         slave = ShmPsuGrouping->Layout[i];
-        if(ShmGroupCollection[slave].Role == _GROLE_IDLE)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_IDLE)
         {
             //printf("\r\n Find %02X From Right", slave);
             AddGroupCollection(slave, group);
         }
         else
         {
-            if(ShmGroupCollection[slave].Role == _GROLE_SLAVE && group == (ShmGroupCollection[slave].TargetGroup - 1))
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[slave].Role == _GROLE_SLAVE && group == (ShmChargerInfo->PsuGrouping.GroupCollection[slave].TargetGroup - 1))
             {
                 continue;
             }
@@ -1961,17 +1956,17 @@ void PsuGroupStopCharging(byte group)
 {
     int total = 0;
 
-    if(ShmGroupCollection[group].Role != _GROLE_MASTER)
+    if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role != _GROLE_MASTER)
     {
         return;
     }
 
-    total = ShmGroupCollection[group].Partner.Quantity;
+    total = ShmChargerInfo->PsuGrouping.GroupCollection[group].Partner.Quantity;
     if(total > 0)
     {
         unsigned char collection[GENERAL_GUN_QUANTITY];
-        //printf("\r\n There are %d Group Need To Stop:", ShmGroupCollection[group].Partner.Quantity);
-        memcpy(collection, ShmGroupCollection[group].Partner.Member, ARRAY_SIZE(ShmGroupCollection[group].Partner.Member));
+        //printf("\r\n There are %d Group Need To Stop:", ShmChargerInfo->PsuGrouping.GroupCollection[group].Partner.Quantity);
+        memcpy(collection, ShmChargerInfo->PsuGrouping.GroupCollection[group].Partner.Member, ARRAY_SIZE(ShmChargerInfo->PsuGrouping.GroupCollection[group].Partner.Member));
 
         for(int i = 0; i < total; i++)
         {
@@ -2001,7 +1996,7 @@ void RunSimplePsuGrouping(char *v1, char *v2)
     {
         if(charging > 0)
         {
-            if(ShmGroupCollection[group].Role == _GROLE_SLAVE)
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role == _GROLE_SLAVE)
             {
                 //printf("\r\nGroup %02X Is In Use, Need To Stop Charging", group);
                 PsuGroupSwitchToIdle(group);
@@ -2011,11 +2006,11 @@ void RunSimplePsuGrouping(char *v1, char *v2)
         }
         if(charging == 0)
         {
-            if(ShmGroupCollection[group].Role == _GROLE_MASTER)
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role == _GROLE_MASTER)
             {
                 PsuGroupStopCharging(group);
             }
-            if(ShmGroupCollection[group].Role == _GROLE_SLAVE)
+            if(ShmChargerInfo->PsuGrouping.GroupCollection[group].Role == _GROLE_SLAVE)
             {
                 PsuGroupSwitchToIdle(group);
             }
@@ -2037,7 +2032,17 @@ void ShowCabinetInfo(void)
         ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity,
         ShmSysConfigAndInfo->SysInfo.DispenserInfo.PresentConnectorQuantity,
         ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity);
+    printf("\r\n");
+    for(int i = 0; i < GENERAL_GUN_QUANTITY; i++)
+    {
+        ipAddress = ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].IpAddress;
 
+        printf("\r\n Dispenser Connection[%d] Status: %d, DispenserIndex: %d, IP: %d.%d.%d.%d", i,
+                ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].Status,
+                ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].DispenserIndex,
+                ((ipAddress >> 0) & 0xFF), ((ipAddress >> 8) & 0xFF), ((ipAddress >> 16) & 0xFF), ((ipAddress >> 24) & 0xFF));
+    }
+    printf("\r\n");
     for(int i = 0; i < GENERAL_GUN_QUANTITY; i++)
     {
         printf("\r\n Connector[%d] Index: %2X, Status = %2d , %s", i, _chargingData[i]->Index, _chargingData[i]->SystemStatus,
@@ -2136,9 +2141,9 @@ void ShowGroupingDemand(void)
     for(int i = 0; i < 4; i++)
     {
         target = ShmPsuGrouping->Layout[i];
-        if(ShmGroupCollection[target].TargetGroup != 0)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[target].TargetGroup != 0)
         {
-            k1k2 = _chargingData[ShmGroupCollection[target].TargetGroup - 1]->RelayK1K2Status;
+            k1k2 = _chargingData[ShmChargerInfo->PsuGrouping.GroupCollection[target].TargetGroup - 1]->RelayK1K2Status;
         }
         else
         {
@@ -2146,16 +2151,16 @@ void ShowGroupingDemand(void)
         }
 
         printf("\r\n  %d    %2d     %02X      %d     %4d V    %3d.%d A       %4d A         %3d.%02d",
-            target + 1, ShmGroupCollection[target].Role, ShmGroupCollection[target].TargetGroup, k1k2,
+            target + 1, ShmChargerInfo->PsuGrouping.GroupCollection[target].Role, ShmChargerInfo->PsuGrouping.GroupCollection[target].TargetGroup, k1k2,
             (ShmPsuGrouping->GroupOutput[target].GTargetVoltage / 10),
             (ShmPsuGrouping->GroupOutput[target].GTargetCurrent / 10),
             (ShmPsuGrouping->GroupOutput[target].GTargetCurrent % 10),
             (int)(_chargingData[target]->AvailableChargingCurrent / 10),
             (ShmPsuGrouping->GroupOutput[target].OutputLoading / 100),
             (ShmPsuGrouping->GroupOutput[target].OutputLoading % 100));
-        if(ShmGroupCollection[target].TargetGroup == target + 1)
+        if(ShmChargerInfo->PsuGrouping.GroupCollection[target].TargetGroup == target + 1)
         {
-            printf("       %3d.%02d", (ShmGroupCollection[target].GunLoading / 100), (ShmGroupCollection[target].GunLoading % 100));
+            printf("       %3d.%02d", (ShmChargerInfo->PsuGrouping.GroupCollection[target].GunLoading / 100), (ShmChargerInfo->PsuGrouping.GroupCollection[target].GunLoading % 100));
         }
     }
 
@@ -2190,7 +2195,7 @@ void SetGunStartCharging(char *v1, char *v2, char *v3)
         ShmChargerInfo->Control.FCharging[gun - 1].FTargetVoltage = _voltage * 10;
         ShmChargerInfo->Control.FCharging[gun - 1].FTargetCurrent = _current * 10;
     }
-    else if(ShmGroupCollection[gun - 1].Role == _GROLE_MASTER)
+    else if(ShmChargerInfo->PsuGrouping.GroupCollection[gun - 1].Role == _GROLE_MASTER)
     {
         if(ShmChargerInfo->Control.FCharging[gun - 1].FCtrl.bits.EnableForceCharging)
         {
@@ -2418,10 +2423,10 @@ void SetGunStopCharging(char *v1)
         printf("\r\nSet Gun %d Stop Charging(ManualStop)", gun);
         _chargingData[gun - 1]->ChargingStopFlag.bits.ManualStop = true;
     }
-    else if(ShmGroupCollection[gun - 1].Role == _GROLE_SLAVE)
+    else if(ShmChargerInfo->PsuGrouping.GroupCollection[gun - 1].Role == _GROLE_SLAVE)
     {
         printf("\r\nSet Group [%02X] Stop", gun - 1);
-        ShmGroupCollection[gun - 1].GroupCtrl.bits.SlavePowerOffRequest = true;
+        ShmChargerInfo->PsuGrouping.GroupCollection[gun - 1].GroupCtrl.bits.SlavePowerOffRequest = true;
     }
     else
     {
@@ -2447,10 +2452,10 @@ void SetGunStopCharging(char *v1)
 
                     if(PreviousSystemStatus == 0xFF)
                     {
-                        if(ShmGroupCollection[gun - 1].Role == _GROLE_SLAVE)
+                        if(ShmChargerInfo->PsuGrouping.GroupCollection[gun - 1].Role == _GROLE_SLAVE)
                         {
                             printf("\r\nSet Group [%02X] Stop", gun - 1);
-                            ShmGroupCollection[gun - 1].GroupCtrl.bits.SlavePowerOffRequest = true;
+                            ShmChargerInfo->PsuGrouping.GroupCollection[gun - 1].GroupCtrl.bits.SlavePowerOffRequest = true;
                         }
                     }
                     PreviousSystemStatus = _chargingData[gun - 1]->SystemStatus;
@@ -2633,10 +2638,10 @@ void SetGunExtend(char *v1)
 
     gun = atoi(v1);
 
-    if(_chargingData[gun - 1]->SystemStatus == S_CHARGING && ShmGroupCollection[gun - 1].Role == _GROLE_MASTER)
+    if(_chargingData[gun - 1]->SystemStatus == S_CHARGING && ShmChargerInfo->PsuGrouping.GroupCollection[gun - 1].Role == _GROLE_MASTER)
     {
         printf("\r\nSet Group [%02X] Extend Capability", gun - 1);
-        ShmGroupCollection[gun - 1].GroupCtrl.bits.MorePowerRequest = true;
+        ShmChargerInfo->PsuGrouping.GroupCollection[gun - 1].GroupCtrl.bits.MorePowerRequest = true;
     }
     else
     {
@@ -2849,7 +2854,7 @@ void ShowChargerLimit(void)
         {
             printf(" %7s   %2d",
                 _chargingData[i]->Type <= _Type_GB ? str_gun_type[_chargingData[i]->Type] : "???",
-                ShmGroupCollection[i].GunPsuQuantity);
+                ShmChargerInfo->PsuGrouping.GroupCollection[i].GunPsuQuantity);
             printf("   %4d V   %4d A",
                 (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].RemoteMaxPhysicalVoltage / 10),
                 (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].RemoteMaxPhysicalCurrent / 10));
@@ -2859,7 +2864,7 @@ void ShowChargerLimit(void)
                 limitPower = (int)ShmSysConfigAndInfo->SysInfo.MaxChargingProfilePower;
                 if(inUsingCnt > 0)
                 {
-                    limitPower = (limitPower * ShmGroupCollection[i].GunPsuQuantity) / inUsingCnt;
+                    limitPower = (limitPower * ShmChargerInfo->PsuGrouping.GroupCollection[i].GunPsuQuantity) / inUsingCnt;
                 }
             }
             else
@@ -2902,18 +2907,18 @@ int main(void)
     }
 
     /*
-    memset(&ShmGroupCollection[0], 0x00, sizeof(PsuGroupCollectionData));
-    memset(&ShmGroupCollection[1], 0x00, sizeof(PsuGroupCollectionData));
-    memset(&ShmGroupCollection[2], 0x00, sizeof(PsuGroupCollectionData));
-    memset(&ShmGroupCollection[3], 0x00, sizeof(PsuGroupCollectionData));
-    ShmGroupCollection[0].Index = 0;
-    ShmGroupCollection[1].Index = 1;
-    ShmGroupCollection[2].Index = 2;
-    ShmGroupCollection[3].Index = 3;
-    ShmGroupCollection[0].Location = 0;
-    ShmGroupCollection[1].Location = 3;
-    ShmGroupCollection[2].Location = 1;
-    ShmGroupCollection[3].Location = 2;
+    memset(&ShmChargerInfo->PsuGrouping.GroupCollection[0], 0x00, sizeof(PsuGroupCollectionData));
+    memset(&ShmChargerInfo->PsuGrouping.GroupCollection[1], 0x00, sizeof(PsuGroupCollectionData));
+    memset(&ShmChargerInfo->PsuGrouping.GroupCollection[2], 0x00, sizeof(PsuGroupCollectionData));
+    memset(&ShmChargerInfo->PsuGrouping.GroupCollection[3], 0x00, sizeof(PsuGroupCollectionData));
+    ShmChargerInfo->PsuGrouping.GroupCollection[0].Index = 0;
+    ShmChargerInfo->PsuGrouping.GroupCollection[1].Index = 1;
+    ShmChargerInfo->PsuGrouping.GroupCollection[2].Index = 2;
+    ShmChargerInfo->PsuGrouping.GroupCollection[3].Index = 3;
+    ShmChargerInfo->PsuGrouping.GroupCollection[0].Location = 0;
+    ShmChargerInfo->PsuGrouping.GroupCollection[1].Location = 3;
+    ShmChargerInfo->PsuGrouping.GroupCollection[2].Location = 1;
+    ShmChargerInfo->PsuGrouping.GroupCollection[3].Location = 2;
     */
 
 	for(;;)

+ 106 - 82
EVSE/Projects/DO360/Apps/main.c

@@ -42,17 +42,6 @@
 #include    "Module_EvComm.h"
 #include    "Common.h"
 
-#define 	ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
-#define 	PASS				1
-#define 	FAIL				-1
-#define 	BUFFER_SIZE			128
-#define 	YES					1
-#define 	NO					0
-#define     ON                  1
-#define     OFF                 0
-#define 	NORMAL				0
-#define		ABNORMAL			1
-#define 	EQUAL				0
 #define 	BTN_RELEASE			0
 #define 	BTN_PRESS			1
 #define 	MAX_BUF 			64
@@ -179,6 +168,8 @@ void gpio_set_value(unsigned int gpio, unsigned int value);
 void ChangeGunSelectByIndex(byte sel);
 void ChargingAlarmProcess(byte gunIndex);
 void InformOcppErrOccur(byte codeType);
+void SetOcppErrorCode(unsigned char _index, char *errCode);
+void SetOcppVendorErrorCode(unsigned char _index, char *vendorCode);
 
 void ReleaseAlarmCode(byte gunIndex);
 
@@ -215,7 +206,6 @@ struct MeterInformation         *ShmCsuMeterData;
 ChargerInfoData                 *ShmChargerInfo;
 PsuPositionInfoData             *ShmPsuPosition;
 PsuGroupingInfoData             *ShmPsuGrouping;
-PsuGroupCollectionData          *ShmGroupCollection;
 
 struct ChargingInfoData			*chargingInfo[CONNECTOR_QUANTITY];
 struct ChargingInfoData			*ac_chargingInfo[AC_QUANTITY];
@@ -237,6 +227,8 @@ float                           _lastProfilePower[CONNECTOR_QUANTITY];
 float                           _lastProfileCurrent[CONNECTOR_QUANTITY];
 float                           _lastMaxProfilePower;
 
+struct StructStatusNotification _BackupStatusNotification[CONNECTOR_QUANTITY];
+
 bool _NeedReset4gWifi;
 struct timespec _4gWifiReset_time;
 
@@ -257,7 +249,7 @@ bool isModelNameMatch = true;
 
 //int rfidFd = -1;
 //char* rfidPortName = "/dev/ttyS2";
-char* fwVersion = "V1.03.00.0000.00";
+char* fwVersion = "V1.04.00.0000.00";
 
 sqlite3 *localDb;
 bool isDb_ready;
@@ -737,7 +729,6 @@ int CreateShareMemory()
     memset(ShmChargerInfo, 0, sizeof(ChargerInfoData));
     ShmPsuPosition = &ShmChargerInfo->PsuPosition;
     ShmPsuGrouping = &ShmChargerInfo->PsuGrouping;
-    ShmGroupCollection = &ShmChargerInfo->PsuGrouping.GroupCollection[0];
 
 	return 1;
 }
@@ -1421,6 +1412,51 @@ void Check4gWifiReset(void)
     }
 }
 
+void MasterCabinetDhcpClientConfig(void)
+{
+    char tmpbuf[256];
+
+    //Run DHCP client if enabled
+    system("killall udhcpc");
+    system("rm -rf /etc/resolv.conf");
+    system("echo nameserver 8.8.8.8 > /etc/resolv.conf");       //Google DNS server
+    system("echo nameserver 180.76.76.76 > /etc/resolv.conf");  //Baidu DNS server
+    //system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
+
+    if(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient == 0)
+    {
+        sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
+        system(tmpbuf);
+    }
+
+    //Upgrade system id to /etc/hostname
+    sprintf(tmpbuf, "echo %s > /etc/hostname", ShmSysConfigAndInfo->SysConfig.SystemId);
+    system(tmpbuf);
+}
+
+void InitMasterCabinetEthernet(void)
+{
+    char tmpbuf[256];
+
+    //Init Eth0 for internet
+    memset(tmpbuf,0,256);
+    sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up",
+        ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+        ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
+    system(tmpbuf);
+
+    memset(tmpbuf,0,256);
+    sprintf(tmpbuf,"route add default gw %s eth0 ",
+        ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
+    system(tmpbuf);
+    //system("ifconfig lo up");
+    //  /sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
+    //Init Eth1 for administrator tool
+    memset(tmpbuf,0,256);
+    sprintf(tmpbuf,"/sbin/ifconfig eth1 %s netmask %s up", "192.168.100.1", "255.255.255.0");
+    system(tmpbuf);
+}
+
 void InitEthernet()
 {
     system("ifconfig eth0 down");
@@ -1430,40 +1466,9 @@ void InitEthernet()
 	// /sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 down
 	system("echo 1 > /sys/class/gpio/gpio110/value");//reset PHY
 	sleep(2);
-	//Init Eth0 for internet
-	memset(tmpbuf,0,256);
-	sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up",
-        ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
-        ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
-	system(tmpbuf);
 
-	memset(tmpbuf,0,256);
-	sprintf(tmpbuf,"route add default gw %s eth0 ",
-        ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
-	system(tmpbuf);
-	//system("ifconfig lo up");
-	//  /sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
-    //Init Eth1 for administrator tool
-	memset(tmpbuf,0,256);
-	sprintf(tmpbuf,"/sbin/ifconfig eth1 %s netmask %s up", "192.168.100.1", "255.255.255.0");
-	system(tmpbuf);
-
-    //Run DHCP client if enabled
-	system("killall udhcpc");
-	system("rm -rf /etc/resolv.conf");
-	system("echo nameserver 8.8.8.8 > /etc/resolv.conf");		//Google DNS server
-	system("echo nameserver 180.76.76.76 > /etc/resolv.conf");	//Baidu DNS server
-	system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
-
-	if(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient == 0)
-	{
-		sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
-		system(tmpbuf);
-	}
-
-	//Upgrade system id to /etc/hostname
-	sprintf(tmpbuf, "echo %s > /etc/hostname", ShmSysConfigAndInfo->SysConfig.SystemId);
-	system(tmpbuf);
+	InitMasterCabinetEthernet();
+	MasterCabinetDhcpClientConfig();
 
 	// DO360 DHCP Server
 	InitialDispenserDhcpServerConfig();
@@ -1896,6 +1901,11 @@ void InitialShareMemoryInfo()
     {
         LOG_INFO("Dispenser[%d] <=> %d", i, ShmSysConfigAndInfo->SysConfig.WiringInfo.WiringSetting[i]);
     }
+
+    for(int i = 0; i < CONNECTOR_QUANTITY; i++)
+    {
+        memset((char *)&_BackupStatusNotification[i], 0, sizeof(struct StructStatusNotification));
+    }
 }
 
 int Initialization(void)
@@ -1915,7 +1925,7 @@ int Initialization(void)
 		ShmSysConfigAndInfo->SysInfo.ConnectorInfo[count].Parameter.bits.RemoteStopRequest = false;
 		ShmSysConfigAndInfo->SysInfo.ConnectorInfo[count].Parameter.bits.RemoteStopConfirm = false;
 
-		strcpy((char *)ShmOCPP16Data->StatusNotification[count].ErrorCode, "NoError");
+		SetOcppErrorCode(count, "NoError");
 	}
 
 	LOG_INFO("Initialization OK");
@@ -1936,15 +1946,15 @@ void InitialPsuGroupingAndLocation(void)
     }
     for(int i = 0; i < CONNECTOR_QUANTITY; i++)
     {
-        ShmGroupCollection[i].Index = i;
-        ShmGroupCollection[i].Location = ShmPsuGrouping->Location[i];
+        ShmPsuGrouping->GroupCollection[i].Index = i;
+        ShmPsuGrouping->GroupCollection[i].Location = ShmPsuGrouping->Location[i];
         if(ShmChargerInfo->Control.SysCtrl.bits.SecondRelayBoardEnable)
         {
-            memcpy(&ShmGroupCollection[i].ParallelConfig[0], &GroupParallelRelay_4_Gun[i][0], GENERAL_GUN_QUANTITY);
+            memcpy(&ShmPsuGrouping->GroupCollection[i].ParallelConfig[0], &GroupParallelRelay_4_Gun[i][0], GENERAL_GUN_QUANTITY);
         }
         else
         {
-            memcpy(&ShmGroupCollection[i].ParallelConfig[0], &GroupParallelRelay_2_Gun[i][0], GENERAL_GUN_QUANTITY);
+            memcpy(&ShmPsuGrouping->GroupCollection[i].ParallelConfig[0], &GroupParallelRelay_2_Gun[i][0], GENERAL_GUN_QUANTITY);
         }
         _PsuGroupAvailable[i] = NO;
     }
@@ -2127,7 +2137,7 @@ bool DisplaySelfTestFailReason()
 }
 */
 
-void SelfTestRun()
+void SelfTestRun(void)
 {
     struct timespec _selfTest_time;
 
@@ -2684,12 +2694,12 @@ void ReleaseAlarmCode(byte gunIndex)
 {
     if (strcmp((char *)ShmOCPP16Data->StatusNotification[gunIndex].ErrorCode, "NoError") != EQUAL)
     {
-        strcpy((char *)ShmOCPP16Data->StatusNotification[gunIndex].ErrorCode, "NoError");
+        SetOcppErrorCode(gunIndex, "NoError");
     }
 
     if (strcmp((char *)ShmOCPP16Data->StatusNotification[gunIndex].VendorErrorCode, "") != EQUAL)
     {
-        strcpy((char *)ShmOCPP16Data->StatusNotification[gunIndex].VendorErrorCode, "");
+        SetOcppVendorErrorCode(gunIndex, "");
     }
 
     if (strcmp((char *)chargingInfo[gunIndex]->ConnectorAlarmCode, "") != EQUAL)
@@ -2837,7 +2847,6 @@ void ReleaseEmsOccureByString(byte index, char *code)
 	if (isTrigger)
 	{
 		ReleaseChargingProcessByString(level);
-		//InformOcppErrOccur(6);
 	}
 }
 
@@ -2927,7 +2936,7 @@ void ChkPsuStatus(void)
 
             for(int gunIndex = 0; gunIndex < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gunIndex++)
             {
-                if(chargingInfo[gunIndex]->SystemStatus != S_FAULT)
+                if(chargingInfo[gunIndex]->SystemStatus != S_FAULT && chargingInfo[gunIndex]->SystemStatus != S_MAINTAIN)
                 {
                     allFaultStatus = false;
                 }
@@ -5316,14 +5325,22 @@ void OcppRemoteStartChk()
 
 void ChkOcppStatus(byte gunIndex)
 {
+    if(strcmp((char *)ShmOCPP16Data->StatusNotification[gunIndex].ErrorCode, "") == EQUAL)
+    {
+        if(strcmp((char *)_BackupStatusNotification[gunIndex].ErrorCode, "") != EQUAL)
+        {
+            strcpy((char *)ShmOCPP16Data->StatusNotification[gunIndex].ErrorCode, (char *)_BackupStatusNotification[gunIndex].ErrorCode);
+            //LOG_INFO("Gun %d Ocpp StatusNotification Recovery", gunIndex + 1);
+        }
+    }
+
 	if (chargingInfo[gunIndex]->SystemStatus == S_IDLE &&
 			ShmOCPP16Data->CsMsg.bits[gunIndex].ReserveNowReq == YES)
 	{
 		ShmOCPP16Data->CsMsg.bits[gunIndex].ReserveNowReq = NO;
 		if (isReservationExpired(gunIndex))
 		{
-		    LOG_INFO("***************ChkOcppStatus : OcppReservedStatus********************");
-			LOG_INFO("***************ChkOcppStatus : OcppReservedStatus********************");
+		    LOG_INFO("***************ChkOcppStatus: Gun %d OcppReservedStatus********************", gunIndex + 1);
 			chargingInfo[gunIndex]->ReservationId = ShmOCPP16Data->ReserveNow[gunIndex].ReservationId;
 			chargingInfo[gunIndex]->SystemStatus = S_RESERVATION;
 		}
@@ -5336,8 +5353,7 @@ void ChkOcppStatus(byte gunIndex)
 		ShmOCPP16Data->CsMsg.bits[gunIndex].CancelReservationReq = NO;
 		if (isReservationExpired(gunIndex))
 		{
-		    LOG_INFO("***************ChkOcppStatus : Cancel OcppReservedStatus********************");
-		    LOG_INFO("***************ChkOcppStatus : Cancel OcppReservedStatus********************");
+		    LOG_INFO("***************ChkOcppStatus: Gun %d Cancel OcppReservedStatus********************", gunIndex + 1);
 			chargingInfo[gunIndex]->ReservationId = 0;
 			chargingInfo[gunIndex]->SystemStatus = S_IDLE;
 		}
@@ -5346,8 +5362,7 @@ void ChkOcppStatus(byte gunIndex)
 
 	if (ShmOCPP16Data->CsMsg.bits[gunIndex].ChangeAvailabilityReq == YES)
 	{
-	    LOG_INFO("***************ChkOcppStatus : OcppChangeAvailability********************");
-	    LOG_INFO("***************ChkOcppStatus : OcppChangeAvailability********************");
+	    LOG_INFO("***************ChkOcppStatus: Gun %d OcppChangeAvailability********************", gunIndex + 1);
 		ShmOCPP16Data->CsMsg.bits[gunIndex].ChangeAvailabilityReq = NO;
 		if(strcmp((char *)ShmOCPP16Data->ChangeAvailability[gunIndex].Type, "Operative") == EQUAL)
 		{
@@ -5393,7 +5408,7 @@ void ChkOcppStatus(byte gunIndex)
 			// 充電中,需停止充電
 			strcpy((char *)ShmOCPP16Data->StopTransaction[gunIndex].StopReason, "UnlockCommand");
 			ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gunIndex].Parameter.bits.UnlockStopRequest = true;
-			LOG_INFO("********** OcppUnlockStop Gun %d **********", gunIndex);
+			LOG_INFO("********** OcppUnlockStop Gun %d **********", gunIndex + 1);
 		}
 
 		strcpy((char *)ShmOCPP16Data->UnlockConnector[gunIndex].ResponseStatus, "Unlocked");
@@ -5411,7 +5426,7 @@ void ChkOcppStatus(byte gunIndex)
         {
             strcpy((char *)ShmOCPP16Data->StopTransaction[gunIndex].StopReason, "Remote");
             ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gunIndex].Parameter.bits.RemoteStopRequest = true;
-            LOG_INFO("********** OcppRemoteStop Gun %d **********", gunIndex);
+            LOG_INFO("********** OcppRemoteStop Gun %d **********", gunIndex + 1);
         }
     }
 }
@@ -5481,10 +5496,22 @@ void InformOcppErrOccur(byte codeType)
 
 	for (byte gun_index = 0; gun_index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gun_index++)
 	{
-		strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode, _error);
+		SetOcppErrorCode(gun_index, _error);
 	}
 }
 
+void SetOcppErrorCode(unsigned char _index, char *errCode)
+{
+    strcpy((char *)ShmOCPP16Data->StatusNotification[_index].ErrorCode, errCode);
+    strcpy((char *)_BackupStatusNotification[_index].ErrorCode, errCode);
+}
+
+void SetOcppVendorErrorCode(unsigned char _index, char *vendorCode)
+{
+    strcpy((char *)ShmOCPP16Data->StatusNotification[_index].VendorErrorCode, vendorCode);
+    strcpy((char *)_BackupStatusNotification[_index].VendorErrorCode, vendorCode);
+}
+
 //===============================================
 // SQLite3 related routine
 //===============================================
@@ -6204,13 +6231,13 @@ void UpdateErrorCodeToOcpp(byte index)
     //printf("ConnectorAlarmCode = %s \n", chargingInfo[index]->ConnectorAlarmCode);
     if (strcmp((char *)chargingInfo[index]->ConnectorAlarmCode, "") != EQUAL)
     {
-        strcpy((char *)ShmOCPP16Data->StatusNotification[index].ErrorCode, "InternalError");
-        strcpy((char *)ShmOCPP16Data->StatusNotification[index].VendorErrorCode, (char *)chargingInfo[index]->ConnectorAlarmCode);
+        SetOcppErrorCode(index, "InternalError");
+        SetOcppVendorErrorCode(index, (char *)chargingInfo[index]->ConnectorAlarmCode);
     }
     else if (strcmp((char *)chargingInfo[index]->EvConnAlarmCode, "") != EQUAL)
     {
-        strcpy((char *)ShmOCPP16Data->StatusNotification[index].ErrorCode, "OtherError");
-        strcpy((char *)ShmOCPP16Data->StatusNotification[index].VendorErrorCode, (char *)chargingInfo[index]->EvConnAlarmCode);
+        SetOcppErrorCode(index, "OtherError");
+        SetOcppVendorErrorCode(index, (char *)chargingInfo[index]->EvConnAlarmCode);
     }
 }
 
@@ -6277,11 +6304,6 @@ void CheckDispenserVersionUpdateRequirement(void)
 
 }
 
-void ChargerBootingProcess(void)
-{
-
-}
-
 // connector: connector infex, 0 ~ 3
 void SetLedIndicationStatus(unsigned char connector, unsigned char indication)
 {
@@ -6507,16 +6529,16 @@ bool ConnectorRequestToCharging(unsigned char connector)
     unsigned char role = 0;
     bool done = false;
 
-    role = ShmGroupCollection[connector].Role;
+    role = ShmPsuGrouping->GroupCollection[connector].Role;
 
     switch(role)
     {
         case _GROLE_IDLE:
-            if(!ShmGroupCollection[connector].GroupCtrl.bits.ChargingRequest)
+            if(!ShmPsuGrouping->GroupCollection[connector].GroupCtrl.bits.ChargingRequest)
             {
                 LOG_INFO("Request Gun %d To Start Charging", connector + 1);
             }
-            ShmGroupCollection[connector].GroupCtrl.bits.ChargingRequest = true;
+            ShmPsuGrouping->GroupCollection[connector].GroupCtrl.bits.ChargingRequest = true;
             break;
 
         case _GROLE_MASTER:
@@ -6524,11 +6546,11 @@ bool ConnectorRequestToCharging(unsigned char connector)
             break;
 
         case _GROLE_SLAVE:
-            if(!ShmGroupCollection[connector].GroupCtrl.bits.SlaveChargingRequest)
+            if(!ShmPsuGrouping->GroupCollection[connector].GroupCtrl.bits.SlaveChargingRequest)
             {
                 LOG_INFO("Gun %d Wait For Re-Grouping", connector + 1);
             }
-            ShmGroupCollection[connector].GroupCtrl.bits.SlaveChargingRequest = true;
+            ShmPsuGrouping->GroupCollection[connector].GroupCtrl.bits.SlaveChargingRequest = true;
             break;
 
         case _GROLE_REQUEST_TO_CHARGING:
@@ -6547,7 +6569,7 @@ bool IsConnectorGroupingCompleted(unsigned char connector)
     unsigned char role = 0;
     bool completed = false;
 
-    role = ShmGroupCollection[connector].Role;
+    role = ShmPsuGrouping->GroupCollection[connector].Role;
 
     switch(role)
     {
@@ -6825,7 +6847,9 @@ int main(void)
                             strcpy((char *)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "");
                             ReleaseAlarmCode(gun_index);
 
-                            // clean connector infomation
+                            // clean connector information
+                            ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].AuthorizingType = _AuthType_None;
+                            ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].AuthorizingResult = _AuthResult_None;
                             ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].RemoteChargingVoltage = 0;
                             ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].RemoteChargingCurrent = 0;
                             ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].RemoteRemainChargingDuration = 0;

BIN
EVSE/Projects/DO360/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/DO360/Images/ramdisk.gz


Some files were not shown because too many files changed in this diff