Explorar o código

Merge branch 'DS60-120'

FolusWen %!s(int64=4) %!d(string=hai) anos
pai
achega
6fa2f96a1d

+ 12 - 3
EVSE/Projects/DS60-120/Apps/FactoryConfig.c

@@ -37,6 +37,7 @@
 #define FAIL				-1
 #define OUTPUT_FLASH		0x01
 #define OUTPUT_FILE			0x02
+#define EQUAL				0
 
 struct SysConfigData 			SysConfig;
 
@@ -105,8 +106,16 @@ int main(int argc,char *argv[])
 	*/
 	//********** System **********// udhcpc -i eth1 -s ./dhcp_script/eth1.script
 	//
-	strcpy((char *)SysConfig.ModelName, "DSYE601J0EE2PH");
-	strcpy((char *)SysConfig.SerialNumber, "NeedSetupSN");
+	if (argc == 4)
+	{
+		strcpy((char *)SysConfig.ModelName, argv[2]);
+		strcpy((char *)SysConfig.SerialNumber, argv[3]);
+	}
+	else
+	{
+		strcpy((char *)SysConfig.ModelName, "DSYE601J0EE2PH");
+		strcpy((char *)SysConfig.SerialNumber, "NeedSetupSN");
+	}
 
 	memset(SysConfig.SystemId, 0x00, sizeof(SysConfig.SystemId));
 
@@ -146,7 +155,7 @@ int main(int argc,char *argv[])
 	strcpy((char *) SysConfig.Eth1Interface.EthIpAddress, "192.168.0.10");
 	strcpy((char *) SysConfig.Eth1Interface.EthSubmaskAddress, "255.255.255.0");
 	strcpy((char *) SysConfig.Eth1Interface.EthGatewayAddress, "192.168.0.254");
-	if(SysConfig.ModelName[10] == 'W')
+	if(SysConfig.ModelName[10] == 'W' || SysConfig.ModelName[10] == 'D')
 		SysConfig.AthInterface.WifiMode = 2;
 	else
 		SysConfig.AthInterface.WifiMode = 0;

+ 126 - 4
EVSE/Projects/DS60-120/Apps/Module_EvComm.c

@@ -66,9 +66,12 @@ float _outCur_2 = 0;
 // Chademo : 500V, 125A,
 // GB : 750, 120A
 // CCS : 950V, 120A
-float maxChargingVol[2] = { 5000, 9500 };			// 限制最大充電電壓,如依照模塊則填上 0
+double chademoVol = 5000;
+double ccsVol = 9500;
+double gbVol = 7500;
+float maxChargingVol[2] = { 0, 0 };			// 限制最大充電電壓,如依照模塊則填上 0
 // 限制最大充電電流與能量透過 Web
-float maxChargingCur[2] = { 1200, 1200 };			// 限制最大充電電流,如依照模塊則填上 0
+float maxChargingCur[2] = { 0, 0 };			// 限制最大充電電流,如依照模塊則填上 0
 float maxChargingPow = 0;							// 限制最大充電能量,如依照模塊則填上 0
 
 // 槍資訊
@@ -76,6 +79,7 @@ struct ChargingInfoData *_chargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUAN
 struct timeval _chk_ratingPower_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 struct timeval _chk_chademo_permission_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 bool chkChademoPermission[2] = { false, false };
+byte SendErrorCount[2] = { 0, 0};
 
 struct Ev_Board_Cmd Ev_Cmd={
 		0,
@@ -3257,6 +3261,93 @@ void SendStopOnly(byte index)
 		_chargingData[index]->Evboard_id);
 }
 
+void FormatVoltageAndCurrent()
+{
+	char isLowCur = 0x00;
+	char EvsePower[2];
+
+	EvsePower[2] = '\0';
+	if (strlen((char *) ShmSysConfigAndInfo->SysConfig.ModelName) >= 6)
+	{
+		strncpy(EvsePower, (char *)(ShmSysConfigAndInfo->SysConfig.ModelName + 4), 2);
+
+		if (strcmp(EvsePower, "30") == EQUAL)
+		{
+			isLowCur = 0x00;
+		}
+		else if (strcmp(EvsePower, "60") == EQUAL)
+		{
+			isLowCur = 0x01;
+		}
+		else
+		{
+			isLowCur = 0x02;
+		}
+	}
+
+	for (byte _index = 0; _index < gun_count; _index++)
+	{
+		if (_chargingData[_index]->Type == _Type_Chademo)
+		{
+			maxChargingVol[_index] = chademoVol;
+		}
+		else if (_chargingData[_index]->Type == _Type_CCS_2)
+		{
+			maxChargingVol[_index] = ccsVol;
+		}
+		else if (_chargingData[_index]->Type == _Type_GB)
+		{
+			maxChargingVol[_index] = gbVol;
+		}
+
+		if (isLowCur == 0x00)
+		{
+			if (_chargingData[_index]->Type == _Type_Chademo)
+			{
+				maxChargingCur[_index] = 600;
+			}
+			else if (_chargingData[_index]->Type == _Type_CCS_2)
+			{
+				maxChargingCur[_index] = 600;
+			}
+			else if (_chargingData[_index]->Type == _Type_GB)
+			{
+				maxChargingCur[_index] = 800;
+			}
+		}
+		else if (isLowCur == 0x01)
+		{
+			if (_chargingData[_index]->Type == _Type_Chademo)
+			{
+				maxChargingCur[_index] = 1200;
+			}
+			else if (_chargingData[_index]->Type == _Type_CCS_2)
+			{
+				maxChargingCur[_index] = 1200;
+			}
+			else if (_chargingData[_index]->Type == _Type_GB)
+			{
+				maxChargingCur[_index] = 1200;
+			}
+		}
+		else
+		{
+			if (_chargingData[_index]->Type == _Type_Chademo)
+			{
+				maxChargingCur[_index] = 1200;
+			}
+			else if (_chargingData[_index]->Type == _Type_CCS_2)
+			{
+				maxChargingCur[_index] = 2000;
+			}
+			else if (_chargingData[_index]->Type == _Type_GB)
+			{
+				maxChargingCur[_index] = 2500;
+			}
+		}
+	}
+}
+
 int main(int argc, char *argv[])
 {
 	if(InitShareMemory() == FAIL)
@@ -3274,11 +3365,19 @@ int main(int argc, char *argv[])
 
 	gun_count = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
 	Initialization();
+	// 根據輸出能量與槍別給予當前最大耐壓耐流
+	FormatVoltageAndCurrent();
 	CanFd = InitCanBus();
 	CANReceiver();
 
 	byte priorityLow = 1;
 	time_t rtc = GetRtcInfoForEpoch();
+
+	for (byte _index = 0; _index < gun_count; _index++)
+	{
+		PRINTF_FUNC("Vol = %f, Cur = %f \n", maxChargingVol[_index], maxChargingCur[_index]);
+	}
+
 	while(CanFd)
 	{
 		for(byte _index = 0; _index < gun_count; _index++)
@@ -3373,6 +3472,7 @@ int main(int argc, char *argv[])
 						_chargingData[_index]->ChargingProfileCurrent = -1;
 
 						chargingTime[_index] = 0;
+						SendErrorCount[_index] = 0;
 
 						//maxChargingCur[_index] = ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent * 10;
 						maxChargingPow = (ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10);
@@ -3568,6 +3668,7 @@ int main(int argc, char *argv[])
 					}
 				}
 					break;
+				case S_ALARM:
 				case S_TERMINATING:
 				{
 					// 設定當前輸出
@@ -3577,8 +3678,9 @@ int main(int argc, char *argv[])
 						SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
 
 					// 槍鎖還在,則代表是樁端要求的停止
-					if (_chargingData[_index]->GunLocked == START ||
-							_chargingData[_index]->Type == _Type_CCS_2)
+					if (SendErrorCount[_index] < 3 &&
+							(_chargingData[_index]->GunLocked == START ||
+							_chargingData[_index]->Type == _Type_CCS_2))
 					{
 						byte normalStop = 0x01;
 						byte stopReason[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
@@ -3589,6 +3691,7 @@ int main(int argc, char *argv[])
 						}
 
 						EvseStopChargingEvent(normalStop, stopReason, _chargingData[_index]->Evboard_id);
+						SendErrorCount[_index] += 1;
 					}
 
 					if(_chargingData[_index]->Type == _Type_CCS_2)
@@ -3597,6 +3700,25 @@ int main(int argc, char *argv[])
 					}
 
 					GetOutputReq(_index, _chargingData[_index]->Evboard_id);
+
+					if (_chargingData[_index]->SystemStatus == S_ALARM)
+					{
+						if (priorityLow == 1)
+						{
+							float maxVol, maxCur;
+
+							// 樁端輸出能力
+							maxVol = _chargingData[_index]->MaximumChargingVoltage;
+							maxCur = _chargingData[_index]->AvailableChargingCurrent;
+
+							GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
+							SetChargingPermission(_index, STOP,
+									_chargingData[_index]->AvailableChargingPower,
+									maxCur,
+									maxVol,
+									_chargingData[_index]->Evboard_id);
+						}
+					}
 				}
 					break;
 				case S_COMPLETE:

+ 371 - 344
EVSE/Projects/DS60-120/Apps/Module_InternalComm.c

@@ -49,6 +49,8 @@
 #define	NO_DEFINE			255
 #define	NDEFAULT_AC_INDEX	2
 
+#define OVP_UVP_CHK_COUNT 	3
+
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData 			*ShmStatusCodeData;
 struct FanModuleData			*ShmFanModuleData;
@@ -57,10 +59,15 @@ struct LedModuleData			*ShmLedModuleData;
 struct PsuData 					*ShmPsuData;
 struct OCPP16Data				*ShmOCPP16Data;
 
-#define VIN_MAX_VOLTAGE_IEC		285	// 大於該值 : OVP
-#define VIN_MIN_VOLTAGE_IEC		160	// 小於該值 : UVP
-#define VIN_MAX_VOLTAGE_UL		315	// 大於該值 : OVP // 美規 (W)
-#define VIN_MIN_VOLTAGE_UL		210	// 小於該值 : UVP
+#define VIN_MAX_VOLTAGE_IEC			285	// 大於該值 : OVP
+#define VIN_MAX_REV_VOLTAGE_IEC		275	// 小於賦歸 OVP
+#define VIN_MIN_VOLTAGE_IEC			160	// 小於該值 : UVP
+#define VIN_MIN_REV_VOLTAGE_IEC		170	// 大於賦歸 UVP
+
+#define VIN_MAX_VOLTAGE_UL			315	// 大於該值 : OVP // 美規 (W)
+#define VIN_MAX_REV_VOLTAGE_UL		305	// 小於賦歸 OVP
+#define VIN_MIN_VOLTAGE_UL			210	// 小於該值 : UVP
+#define VIN_MIN_REV_VOLTAGE_UL 		220	// 大於賦歸 UVP
 
 #define VIN_DROP_VOLTAGE	150	// 小於該值 : ac drop
 
@@ -447,180 +454,252 @@ void GetPresentInputVol()
 		// Vin (UVP)
 		if (ShmSysConfigAndInfo->SysInfo.ChargerType == _CHARGER_TYPE_IEC)
 		{
-			if (inputVoltage.L1N_L12 < VIN_MIN_VOLTAGE_IEC)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == NO)
 			{
-				PRINTF_FUNC("In Uvp L1N_L12 = %f \n", inputVoltage.L1N_L12);
-				if (_threePhaseUvp[0] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = YES;
-				else
-					_threePhaseUvp[0] += 1;
+				if (inputVoltage.L1N_L12 < VIN_MIN_VOLTAGE_IEC)
+				{
+					PRINTF_FUNC("In Uvp L1N_L12 = %f \n", inputVoltage.L1N_L12);
+					if (_threePhaseUvp[0] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = YES;
+					else
+						_threePhaseUvp[0] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = NO;
-				_threePhaseUvp[0] = 0;
+				if (inputVoltage.L1N_L12 > VIN_MIN_REV_VOLTAGE_IEC)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = NO;
+					_threePhaseUvp[0] = 0;
+				}
 			}
 
-			if (inputVoltage.L2N_L23 < VIN_MIN_VOLTAGE_IEC)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == NO)
 			{
-				PRINTF_FUNC("In Uvp L2N_L23 = %f \n", inputVoltage.L2N_L23);
-				if (_threePhaseUvp[1] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = YES;
-				else
+				if (inputVoltage.L2N_L23 < VIN_MIN_VOLTAGE_IEC)
+				{
+					PRINTF_FUNC("In Uvp L2N_L23 = %f \n", inputVoltage.L2N_L23);
+					if (_threePhaseUvp[1] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = YES;
+					else
 					_threePhaseUvp[1] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = NO;
-				_threePhaseUvp[1] = 0;
+				if (inputVoltage.L2N_L23 > VIN_MIN_REV_VOLTAGE_IEC)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = NO;
+					_threePhaseUvp[1] = 0;
+				}
 			}
 
-			if (inputVoltage.L3N_L31 < VIN_MIN_VOLTAGE_IEC)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == NO)
 			{
-				PRINTF_FUNC("In Uvp L3N_L31 = %f \n", inputVoltage.L3N_L31);
-				if (_threePhaseUvp[2] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = YES;
-				else
-					_threePhaseUvp[2] += 1;
+				if (inputVoltage.L3N_L31 < VIN_MIN_VOLTAGE_IEC)
+				{
+					PRINTF_FUNC("In Uvp L3N_L31 = %f \n", inputVoltage.L3N_L31);
+					if (_threePhaseUvp[2] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = YES;
+					else
+						_threePhaseUvp[2] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = NO;
-				_threePhaseUvp[2] = 0;
+				if (inputVoltage.L3N_L31 > VIN_MIN_REV_VOLTAGE_IEC)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = NO;
+					_threePhaseUvp[2] = 0;
+				}
 			}
 		}
 		else if (ShmSysConfigAndInfo->SysInfo.ChargerType == _CHARGER_TYPE_UL)
 		{
-			if (inputVoltage.L1N_L12 < VIN_MIN_VOLTAGE_UL)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == NO)
 			{
-				PRINTF_FUNC("In Uvp L1N_L12 = %f \n", inputVoltage.L1N_L12);
-				if (_threePhaseUvp[0] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = YES;
-				else
-					_threePhaseUvp[0] += 1;
+				if (inputVoltage.L1N_L12 < VIN_MIN_VOLTAGE_UL)
+				{
+					PRINTF_FUNC("In Uvp L1N_L12 = %f \n", inputVoltage.L1N_L12);
+					if (_threePhaseUvp[0] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = YES;
+					else
+						_threePhaseUvp[0] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = NO;
-				_threePhaseUvp[0] = 0;
+				if (inputVoltage.L1N_L12 > VIN_MIN_REV_VOLTAGE_UL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = NO;
+					_threePhaseUvp[0] = 0;
+				}
 			}
 
-			if (inputVoltage.L2N_L23 < VIN_MIN_VOLTAGE_UL)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == NO)
 			{
-				PRINTF_FUNC("In Uvp L2N_L23 = %f \n", inputVoltage.L2N_L23);
-				if (_threePhaseUvp[1] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = YES;
-				else
-					_threePhaseUvp[1] += 1;
+				if (inputVoltage.L2N_L23 < VIN_MIN_VOLTAGE_UL)
+				{
+					PRINTF_FUNC("In Uvp L2N_L23 = %f \n", inputVoltage.L2N_L23);
+					if (_threePhaseUvp[1] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = YES;
+					else
+						_threePhaseUvp[1] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = NO;
-				_threePhaseUvp[1] = 0;
+				if (inputVoltage.L2N_L23 > VIN_MIN_REV_VOLTAGE_UL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = NO;
+					_threePhaseUvp[1] = 0;
+				}
 			}
 
-			if (inputVoltage.L3N_L31 < VIN_MIN_VOLTAGE_UL)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == NO)
 			{
-				PRINTF_FUNC("In Uvp L3N_L31 = %f \n", inputVoltage.L3N_L31);
-				if (_threePhaseUvp[2] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = YES;
-				else
-					_threePhaseUvp[2] += 1;
+				if (inputVoltage.L3N_L31 < VIN_MIN_VOLTAGE_UL)
+				{
+					PRINTF_FUNC("In Uvp L3N_L31 = %f \n", inputVoltage.L3N_L31);
+					if (_threePhaseUvp[2] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = YES;
+					else
+						_threePhaseUvp[2] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = NO;
-				_threePhaseUvp[2] = 0;
+				if (inputVoltage.L3N_L31 > VIN_MIN_REV_VOLTAGE_UL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = NO;
+					_threePhaseUvp[2] = 0;
+				}
 			}
 		}
 		//********************************************************************************************************//
 		// Vin (OVP)
 		if (ShmSysConfigAndInfo->SysInfo.ChargerType == _CHARGER_TYPE_IEC)
 		{
-			if (inputVoltage.L1N_L12 > VIN_MAX_VOLTAGE_IEC)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == NO)
 			{
-				PRINTF_FUNC("In Ovp L1N_L12 = %f \n", inputVoltage.L1N_L12);
-				if (_threePhaseOvp[0] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = YES;
-				else
-					_threePhaseOvp[0] += 1;
+				if (inputVoltage.L1N_L12 > VIN_MAX_VOLTAGE_IEC)
+				{
+					PRINTF_FUNC("In Ovp L1N_L12 = %f \n", inputVoltage.L1N_L12);
+					if (_threePhaseOvp[0] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = YES;
+					else
+						_threePhaseOvp[0] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = NO;
-				_threePhaseOvp[0] = 0;
+				if (inputVoltage.L1N_L12 < VIN_MAX_REV_VOLTAGE_IEC)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = NO;
+					_threePhaseOvp[0] = 0;
+				}
 			}
 
-			if (inputVoltage.L2N_L23 > VIN_MAX_VOLTAGE_IEC)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == NO)
 			{
-				PRINTF_FUNC("In Ovp L2N_L23 = %f \n", inputVoltage.L2N_L23);
-				if (_threePhaseOvp[1] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = YES;
-				else
-					_threePhaseOvp[1] += 1;
+				if (inputVoltage.L2N_L23 > VIN_MAX_VOLTAGE_IEC)
+				{
+					PRINTF_FUNC("In Ovp L2N_L23 = %f \n", inputVoltage.L2N_L23);
+					if (_threePhaseOvp[1] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = YES;
+					else
+						_threePhaseOvp[1] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = NO;
-				_threePhaseOvp[1] = 0;
+				if (inputVoltage.L2N_L23 < VIN_MAX_REV_VOLTAGE_IEC)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = NO;
+					_threePhaseOvp[1] = 0;
+				}
 			}
 
-			if (inputVoltage.L3N_L31 > VIN_MAX_VOLTAGE_IEC)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == NO)
 			{
-				PRINTF_FUNC("In Ovp L3N_L31 = %f \n", inputVoltage.L3N_L31);
-				if (_threePhaseOvp[2] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = YES;
-				else
-					_threePhaseOvp[2] += 1;
+				if (inputVoltage.L3N_L31 > VIN_MAX_VOLTAGE_IEC)
+				{
+					PRINTF_FUNC("In Ovp L3N_L31 = %f \n", inputVoltage.L3N_L31);
+					if (_threePhaseOvp[2] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = YES;
+					else
+						_threePhaseOvp[2] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = NO;
-				_threePhaseOvp[2] = 0;
+				if (inputVoltage.L3N_L31 < VIN_MAX_REV_VOLTAGE_IEC)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = NO;
+					_threePhaseOvp[2] = 0;
+				}
 			}
 		}
 		else if (ShmSysConfigAndInfo->SysInfo.ChargerType == _CHARGER_TYPE_UL)
 		{
-			if (inputVoltage.L1N_L12 > VIN_MAX_VOLTAGE_UL)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == NO)
 			{
-				PRINTF_FUNC("In Ovp L1N_L12 = %f \n", inputVoltage.L1N_L12);
-				if (_threePhaseOvp[0] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = YES;
-				else
-					_threePhaseOvp[0] += 0;
+				if (inputVoltage.L1N_L12 > VIN_MAX_VOLTAGE_UL)
+				{
+					PRINTF_FUNC("In Ovp L1N_L12 = %f \n", inputVoltage.L1N_L12);
+					if (_threePhaseOvp[0] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = YES;
+					else
+						_threePhaseOvp[0] += 0;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = NO;
-				_threePhaseOvp[0] = 0;
+				if (inputVoltage.L1N_L12 < VIN_MAX_REV_VOLTAGE_UL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = NO;
+					_threePhaseOvp[0] = 0;
+				}
 			}
 
-			if (inputVoltage.L2N_L23 > VIN_MAX_VOLTAGE_UL)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == NO)
 			{
-				PRINTF_FUNC("In Ovp L2N_L23 = %f \n", inputVoltage.L2N_L23);
-				if (_threePhaseOvp[1] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = YES;
-				else
-					_threePhaseOvp[1] += 0;
+				if (inputVoltage.L2N_L23 > VIN_MAX_VOLTAGE_UL)
+				{
+					PRINTF_FUNC("In Ovp L2N_L23 = %f \n", inputVoltage.L2N_L23);
+					if (_threePhaseOvp[1] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = YES;
+					else
+						_threePhaseOvp[1] += 0;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = NO;
-				_threePhaseOvp[1] = 0;
+				if (inputVoltage.L2N_L23 < VIN_MAX_REV_VOLTAGE_UL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = NO;
+					_threePhaseOvp[1] = 0;
+				}
 			}
 
-			if (inputVoltage.L3N_L31 > VIN_MAX_VOLTAGE_UL)
+			if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == NO)
 			{
-				PRINTF_FUNC("In Ovp L3N_L31 = %f \n", inputVoltage.L3N_L31);
-				if (_threePhaseOvp[2] >= 3)
-					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = YES;
-				else
-					_threePhaseOvp[2] += 1;
+				if (inputVoltage.L3N_L31 > VIN_MAX_VOLTAGE_UL)
+				{
+					PRINTF_FUNC("In Ovp L3N_L31 = %f \n", inputVoltage.L3N_L31);
+					if (_threePhaseOvp[2] >= OVP_UVP_CHK_COUNT)
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = YES;
+					else
+						_threePhaseOvp[2] += 1;
+				}
 			}
 			else
 			{
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = NO;
-				_threePhaseOvp[2] = 0;
+				if (inputVoltage.L3N_L31 < VIN_MAX_REV_VOLTAGE_UL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = NO;
+					_threePhaseOvp[2] = 0;
+				}
 			}
 		}
 	}
@@ -1101,54 +1180,6 @@ void SetK1K2RelayStatus(byte index)
 	}
 }
 
-void CheckAcInputOvpStatus(byte index)
-{
-	if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == YES ||
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == YES ||
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == YES)
-	{
-//		if ((_chargingData[index]->SystemStatus >= S_PREPARNING && _chargingData[index]->SystemStatus <= S_CHARGING) ||
-//				(_chargingData[index]->SystemStatus >= S_CCS_PRECHARGE_ST0 && _chargingData[index]->SystemStatus <= S_CCS_PRECHARGE_ST1))
-//		{
-//			if (ShmSysConfigAndInfo->SysInfo.ChargerType == _CHARGER_TYPE_IEC)
-//			{
-//				if (_psuInputVolR > VIN_MAX_VOLTAGE_IEC ||
-//						_psuInputVolS > VIN_MAX_VOLTAGE_IEC ||
-//						_psuInputVolT > VIN_MAX_VOLTAGE_IEC)
-//				{
-//					PRINTF_FUNC("IEC _psuInputVolR = %f, _psuInputVolS = %f, _psuInputVolT = %f \n",
-//							_psuInputVolR, _psuInputVolS, _psuInputVolT);
-//					_chargingData[index]->StopChargeFlag = YES;
-//				}
-//
-//			}
-//			else if (ShmSysConfigAndInfo->SysInfo.ChargerType == _CHARGER_TYPE_UL)
-//			{
-//				if (_psuInputVolR > VIN_MAX_VOLTAGE_UL ||
-//						_psuInputVolS > VIN_MAX_VOLTAGE_UL ||
-//						_psuInputVolT > VIN_MAX_VOLTAGE_UL)
-//				{
-//					PRINTF_FUNC("UL _psuInputVolR = %f, _psuInputVolS = %f, _psuInputVolT = %f \n",
-//							_psuInputVolR, _psuInputVolS, _psuInputVolT);
-//					_chargingData[index]->StopChargeFlag = YES;
-//				}
-//			}
-//		}
-//		else
-			_chargingData[index]->StopChargeFlag = YES;
-	}
-}
-
-void CheckPhaseLossStatus(byte index)
-{
-	if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == YES ||
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == YES ||
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == YES)
-	{
-		_chargingData[index]->StopChargeFlag = YES;
-	}
-}
-
 void SetParalleRelayStatus()
 {
 	// 之後雙槍單模機種,橋接都會上
@@ -1300,63 +1331,6 @@ void SetLedColor(struct ChargingInfoData *chargingData_1, struct ChargingInfoDat
 	else if (ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity == _LED_INTENSITY_MEDIUM)
 		_colorBuf = COLOR_MAX_LV * LED_INTENSITY_MEDIUM;
 
-	if (ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf)
-	{
-		 if ((chargingData_1->SystemStatus == S_BOOTING || chargingData_1->SystemStatus == S_IDLE || chargingData_1->SystemStatus == S_RESERVATION) &&
-				 (chargingData_2->SystemStatus == S_BOOTING || chargingData_2->SystemStatus == S_IDLE || chargingData_2->SystemStatus == S_RESERVATION))
-		 {
-			 led_color.Connect_1_Green = _colorBuf;
-			 led_color.Connect_1_Blue = COLOR_MIN_LV;
-			 led_color.Connect_1_Red = COLOR_MIN_LV;
-			 led_color.Connect_2_Green = _colorBuf;
-			 led_color.Connect_2_Blue = COLOR_MIN_LV;
-			 led_color.Connect_2_Red = COLOR_MIN_LV;
-		 }
-		 else if ((chargingData_1->SystemStatus >= S_AUTHORIZING && chargingData_1->SystemStatus <= S_COMPLETE) ||
-		          	  (chargingData_1->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingData_1->SystemStatus <= S_CCS_PRECHARGE_ST1) ||
-					  (chargingData_2->SystemStatus >= S_AUTHORIZING && chargingData_2->SystemStatus <= S_COMPLETE) ||
-					  (chargingData_2->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingData_2->SystemStatus <= S_CCS_PRECHARGE_ST1))
-		 {
-			 led_color.Connect_1_Green = COLOR_MIN_LV;
-			 led_color.Connect_1_Blue = _colorBuf;
-			 led_color.Connect_1_Red = COLOR_MIN_LV;
-			 led_color.Connect_2_Green = COLOR_MIN_LV;
-			 led_color.Connect_2_Blue = _colorBuf;
-			 led_color.Connect_2_Red = COLOR_MIN_LV;
-		 }
-	}
-	else
-	{
-		if (chargingData_1->SystemStatus == S_BOOTING || chargingData_1->SystemStatus == S_IDLE || chargingData_1->SystemStatus == S_RESERVATION)
-		{
-			led_color.Connect_1_Green = _colorBuf;
-			led_color.Connect_1_Blue = COLOR_MIN_LV;
-			led_color.Connect_1_Red = COLOR_MIN_LV;
-		}
-		else if ((chargingData_1->SystemStatus >= S_AUTHORIZING && chargingData_1->SystemStatus <= S_COMPLETE) ||
-				(chargingData_1->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingData_1->SystemStatus <= S_CCS_PRECHARGE_ST1))
-		{
-			led_color.Connect_1_Green = COLOR_MIN_LV;
-			led_color.Connect_1_Blue = _colorBuf;
-			led_color.Connect_1_Red = COLOR_MIN_LV;
-		}
-
-		// --------------------------------------------------------------------------
-		if (chargingData_2->SystemStatus == S_BOOTING || chargingData_2->SystemStatus == S_IDLE || chargingData_2->SystemStatus == S_RESERVATION)
-		{
-			led_color.Connect_2_Green = _colorBuf;
-			led_color.Connect_2_Blue = COLOR_MIN_LV;
-			led_color.Connect_2_Red = COLOR_MIN_LV;
-		}
-		else if ((chargingData_2->SystemStatus >= S_AUTHORIZING && chargingData_2->SystemStatus <= S_COMPLETE) ||
-				(chargingData_2->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingData_2->SystemStatus <= S_CCS_PRECHARGE_ST1))
-		{
-			led_color.Connect_2_Green = COLOR_MIN_LV;
-			led_color.Connect_2_Blue = _colorBuf;
-			led_color.Connect_2_Red = COLOR_MIN_LV;
-		}
-	}
-
 	if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2)
 	{
 		led_color.Connect_1_Green = COLOR_MIN_LV;
@@ -1366,6 +1340,65 @@ void SetLedColor(struct ChargingInfoData *chargingData_1, struct ChargingInfoDat
 		led_color.Connect_2_Blue = COLOR_MIN_LV;
 		led_color.Connect_2_Red = _colorBuf;
 	}
+	else
+	{
+		if (ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf)
+		{
+			if ((chargingData_1->SystemStatus == S_BOOTING || chargingData_1->SystemStatus == S_IDLE || chargingData_1->SystemStatus == S_RESERVATION) &&
+					(chargingData_2->SystemStatus == S_BOOTING || chargingData_2->SystemStatus == S_IDLE || chargingData_2->SystemStatus == S_RESERVATION))
+			{
+				led_color.Connect_1_Green = _colorBuf;
+				led_color.Connect_1_Blue = COLOR_MIN_LV;
+				led_color.Connect_1_Red = COLOR_MIN_LV;
+				led_color.Connect_2_Green = _colorBuf;
+				led_color.Connect_2_Blue = COLOR_MIN_LV;
+				led_color.Connect_2_Red = COLOR_MIN_LV;
+			}
+			else if ((chargingData_1->SystemStatus >= S_AUTHORIZING && chargingData_1->SystemStatus <= S_COMPLETE) ||
+				     	(chargingData_1->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingData_1->SystemStatus <= S_CCS_PRECHARGE_ST1) ||
+						(chargingData_2->SystemStatus >= S_AUTHORIZING && chargingData_2->SystemStatus <= S_COMPLETE) ||
+						(chargingData_2->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingData_2->SystemStatus <= S_CCS_PRECHARGE_ST1))
+			{
+				led_color.Connect_1_Green = COLOR_MIN_LV;
+				led_color.Connect_1_Blue = _colorBuf;
+				led_color.Connect_1_Red = COLOR_MIN_LV;
+				led_color.Connect_2_Green = COLOR_MIN_LV;
+				led_color.Connect_2_Blue = _colorBuf;
+				led_color.Connect_2_Red = COLOR_MIN_LV;
+			}
+		}
+		else
+		{
+			if (chargingData_1->SystemStatus == S_BOOTING || chargingData_1->SystemStatus == S_IDLE || chargingData_1->SystemStatus == S_RESERVATION)
+			{
+				led_color.Connect_1_Green = _colorBuf;
+				led_color.Connect_1_Blue = COLOR_MIN_LV;
+				led_color.Connect_1_Red = COLOR_MIN_LV;
+			}
+			else if ((chargingData_1->SystemStatus >= S_AUTHORIZING && chargingData_1->SystemStatus <= S_COMPLETE) ||
+						(chargingData_1->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingData_1->SystemStatus <= S_CCS_PRECHARGE_ST1))
+			{
+				led_color.Connect_1_Green = COLOR_MIN_LV;
+				led_color.Connect_1_Blue = _colorBuf;
+				led_color.Connect_1_Red = COLOR_MIN_LV;
+			}
+
+			// --------------------------------------------------------------------------
+			if (chargingData_2->SystemStatus == S_BOOTING || chargingData_2->SystemStatus == S_IDLE || chargingData_2->SystemStatus == S_RESERVATION)
+			{
+				led_color.Connect_2_Green = _colorBuf;
+				led_color.Connect_2_Blue = COLOR_MIN_LV;
+				led_color.Connect_2_Red = COLOR_MIN_LV;
+			}
+			else if ((chargingData_2->SystemStatus >= S_AUTHORIZING && chargingData_2->SystemStatus <= S_COMPLETE) ||
+						(chargingData_2->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingData_2->SystemStatus <= S_CCS_PRECHARGE_ST1))
+			{
+				led_color.Connect_2_Green = COLOR_MIN_LV;
+				led_color.Connect_2_Blue = _colorBuf;
+				led_color.Connect_2_Red = COLOR_MIN_LV;
+			}
+		}
+	}
 
 	if (_checkLedChanged > 0)
 	{
@@ -1771,6 +1804,14 @@ void CheckOutputPowerOverCarReq(byte index)
 					_chargingData[index]->FireChargingVoltage, (_chargingData[index]->EvBatterytargetVoltage * 10));
 			DEBUG_ERROR("[Module_InternalComm]CheckOutputPowerOverCarReq NG : fire = %f, battery = %f \n",
 					_chargingData[index]->FireChargingVoltage, (_chargingData[index]->EvBatterytargetVoltage * 10));
+
+			if (_chargingData[index]->Type == _Type_Chademo)
+				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemChademoOutputOVP = YES;
+			else if (_chargingData[index]->Type == _Type_CCS_2)
+				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemCcsOutputOVP = YES;
+			else if (_chargingData[index]->Type == _Type_GB)
+				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemGbOutputOVP = YES;
+
 			_chargingData[index]->StopChargeFlag = YES;
 		}
 	}
@@ -1799,6 +1840,14 @@ void CheckOutputVolNoneMatchFire(byte index)
 							index, (_chargingData[index]->PresentChargingVoltage * 10), _chargingData[index]->FireChargingVoltage);
 					DEBUG_ERROR("[Module_InternalComm]CheckOutputVolNoneMatchFire NG (%d): pre = %f, fire = %f \n",
 							index, (_chargingData[index]->PresentChargingVoltage * 10), _chargingData[index]->FireChargingVoltage);
+
+					if (_chargingData[index]->Type == _Type_Chademo)
+						ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault = YES;
+					else if (_chargingData[index]->Type == _Type_GB)
+						ShmStatusCodeData->FaultCode.FaultEvents.bits.GbOutputRelayDrivingFault = YES;
+					else if (_chargingData[index]->Type == _Type_CCS_2)
+						ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayDrivingFault = YES;
+
 					_chargingData[index]->StopChargeFlag = YES;
 				}
 			}
@@ -1875,101 +1924,102 @@ void GetPsuTempForFanSpeed()
 
 void GetFanSpeedByFunction()
 {
-	if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES)
-			return;
-
-		// 風控修改 :
-		// ******************************************************* //
-		//
-		//       當前PSU輸出總 KW       PSU Temp
-		// 30 x -------------------- x ---------- + 14 x (PSU Temp - 45)
-		//       當前樁最大功率 KW         45
-		//
-		// ******************************************************* //
-
-		// 當前樁最大功率 KW : ShmPsuData->SystemAvailablePower
-		unsigned int _maxPower = ShmPsuData->SystemAvailablePower;
-		// 當前PSU輸出總 KW & PSU Temp :
-		unsigned char temp = 0;
-		float power = 0;
-
-		for (byte index = 0; index < ShmPsuData->GroupCount; index++)
-		{
-			for (byte count = 0; count < ShmPsuData->PsuGroup[index].GroupPresentPsuQuantity; count++)
-			{
-				if (temp < ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp)
-					temp = ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp;
-			}
-			power += (_chargingData[index]->PresentChargingPower * 10);
-		}
-
-		double _pw_rate = 0;
-		if (_maxPower > 0)
-			_pw_rate = power / (double)_maxPower;
-		double _temp_rate = 0;
-		if (temp > 0)
-			_temp_rate = (double)temp / 45;
-		unsigned char _temp_diff = 0;
-		if (temp > 45)
-			_temp_diff = temp - 45;
-
-		ShmFanModuleData->TestFanSpeed = ((30 * _pw_rate * _temp_rate + 14 * _temp_diff) / 100) * MAX_FAN_SPEED;
-
-		if (ShmFanModuleData->TestFanSpeed > MAX_FAN_SPEED)
-			ShmFanModuleData->TestFanSpeed = MAX_FAN_SPEED;
-
-		if (ShmFanModuleData->TestFanSpeed < 0)
-				ShmFanModuleData->TestFanSpeed = 0;
-
-
-
-
 //	if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES)
-//		return;
+//			return;
 //
-//	// 風控修改 :
-//	// ******************************************************* //
-//	//
-//	//       當前PSU輸出總 KW       PSU Temp
-//	// 50 x -------------------- x ---------- + 0.5 x (PSU Temp - 70)
-//	//       當前樁最大功率 KW         50
-//	//
-//	// ******************************************************* //
+//		// 風控修改 :
+//		// ******************************************************* //
+//		//
+//		//       當前PSU輸出總 KW       PSU Temp
+//		// 30 x -------------------- x ---------- + 14 x (PSU Temp - 45)
+//		//       當前樁最大功率 KW         45
+//		//
+//		// ******************************************************* //
 //
-//	// 當前樁最大功率 KW : ShmPsuData->SystemAvailablePower
-//	unsigned int _maxPower = ShmPsuData->SystemAvailablePower;
-//	// 當前PSU輸出總 KW & PSU Temp :
-//	unsigned char temp = 0;
-//	float power = 0;
+//		// 當前樁最大功率 KW : ShmPsuData->SystemAvailablePower
+//		unsigned int _maxPower = ShmPsuData->SystemAvailablePower;
+//		// 當前PSU輸出總 KW & PSU Temp :
+//		unsigned char temp = 0;
+//		float power = 0;
 //
-//	for (byte index = 0; index < ShmPsuData->GroupCount; index++)
-//	{
-//		for (byte count = 0; count < ShmPsuData->PsuGroup[index].GroupPresentPsuQuantity; count++)
+//		for (byte index = 0; index < ShmPsuData->GroupCount; index++)
 //		{
-//			if (temp < ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp)
-//				temp = ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp;
+//			for (byte count = 0; count < ShmPsuData->PsuGroup[index].GroupPresentPsuQuantity; count++)
+//			{
+//				if (temp < ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp)
+//					temp = ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp;
+//			}
+//			power += (_chargingData[index]->PresentChargingPower * 10);
 //		}
-//		power += (_chargingData[index]->PresentChargingPower * 10);
-//	}
-//
-//	double _pw_rate = 0;
-//	if (_maxPower > 0)
-//		_pw_rate = power / (double)_maxPower;
-//	double _temp_rate = 0;
-//	if (temp > 0)
-//		_temp_rate = (double)temp / 50;
-//	unsigned char _temp_diff = 0;
-//	if (temp > 70)
-//		_temp_diff = temp - 70;
 //
-//	ShmFanModuleData->TestFanSpeed = (((50 * _pw_rate * _temp_rate) + (0.5 * _temp_diff)) / 100) * MAX_FAN_SPEED;
+//		double _pw_rate = 0;
+//		if (_maxPower > 0)
+//			_pw_rate = power / (double)_maxPower;
+//		double _temp_rate = 0;
+//		if (temp > 0)
+//			_temp_rate = (double)temp / 45;
+//		unsigned char _temp_diff = 0;
+//		if (temp > 45)
+//			_temp_diff = temp - 45;
 //
-//	if (ShmFanModuleData->TestFanSpeed > MAX_FAN_SPEED)
-//		ShmFanModuleData->TestFanSpeed = MAX_FAN_SPEED;
+//		ShmFanModuleData->TestFanSpeed = ((30 * _pw_rate * _temp_rate + 14 * _temp_diff) / 100) * MAX_FAN_SPEED;
 //
-//	if (ShmFanModuleData->TestFanSpeed < 0)
-//			ShmFanModuleData->TestFanSpeed = 0;
+//		if (ShmFanModuleData->TestFanSpeed > MAX_FAN_SPEED)
+//			ShmFanModuleData->TestFanSpeed = MAX_FAN_SPEED;
 //
+//		if (ShmFanModuleData->TestFanSpeed < 0)
+//				ShmFanModuleData->TestFanSpeed = 0;
+
+
+
+
+	if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES)
+		return;
+
+	// 風控修改 :
+	// ******************************************************* //
+	//
+	//       當前PSU輸出總 KW       PSU Temp
+	// 50 x -------------------- x ---------- + 0.5 x (PSU Temp - 70)
+	//       當前樁最大功率 KW         50
+	//
+	// ******************************************************* //
+
+	// 當前樁最大功率 KW : ShmPsuData->SystemAvailablePower
+	unsigned int _maxPower = ShmPsuData->SystemAvailablePower;
+	// 當前PSU輸出總 KW & PSU Temp :
+	unsigned char temp = 0;
+	float power = 0;
+
+	for (byte index = 0; index < ShmPsuData->GroupCount; index++)
+	{
+		for (byte count = 0; count < ShmPsuData->PsuGroup[index].GroupPresentPsuQuantity; count++)
+		{
+			if (temp < ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp)
+				temp = ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp;
+		}
+		power += (_chargingData[index]->PresentChargingPower * 10);
+	}
+
+	double _pw_rate = 0;
+	if (_maxPower > 0)
+		_pw_rate = power / (double)_maxPower;
+	double _temp_rate = 0;
+	if (temp > 0)
+		_temp_rate = (double)temp / 50;
+	unsigned char _temp_diff = 0;
+	if (temp > 70)
+		_temp_diff = temp - 70;
+
+	ShmFanModuleData->TestFanSpeed = (((50 * _pw_rate * _temp_rate) + (0.5 * _temp_diff)) / 100) * MAX_FAN_SPEED;
+
+	if (ShmFanModuleData->TestFanSpeed > MAX_FAN_SPEED)
+		ShmFanModuleData->TestFanSpeed = MAX_FAN_SPEED;
+
+	if (ShmFanModuleData->TestFanSpeed < 0)
+			ShmFanModuleData->TestFanSpeed = 0;
+
+// -----------------------------------------------------------------------
 //	printf("power = %f \n", power);
 //	printf("_maxPower = %d \n", _maxPower);
 //	printf("temp = %d \n", temp);
@@ -2326,6 +2376,37 @@ void AcChargeTypeProcess()
 	}
 }
 
+void ResetDetAlarmStatus(byte gun)
+{
+	if (_chargingData[gun]->Type == _Type_Chademo)
+	{
+		if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayWelding == YES)
+			ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayWelding = NO;
+		if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault == YES)
+			ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault = NO;
+		if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemChademoOutputOVP == YES)
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemChademoOutputOVP = NO;
+	}
+	else if (_chargingData[gun]->Type == _Type_GB)
+	{
+		if (ShmStatusCodeData->FaultCode.FaultEvents.bits.GbOutputRelayWelding == YES)
+			ShmStatusCodeData->FaultCode.FaultEvents.bits.GbOutputRelayWelding = NO;
+		if (ShmStatusCodeData->FaultCode.FaultEvents.bits.GbOutputRelayDrivingFault == YES)
+			ShmStatusCodeData->FaultCode.FaultEvents.bits.GbOutputRelayDrivingFault = NO;
+		if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemGbOutputOVP == YES)
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemGbOutputOVP = NO;
+	}
+	else if (_chargingData[gun]->Type == _Type_CCS_2)
+	{
+		if (ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayWelding == YES)
+			ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayWelding = NO;
+		if (ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayDrivingFault == YES)
+			ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayDrivingFault = NO;
+		if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemCcsOutputOVP == YES)
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemCcsOutputOVP = NO;
+	}
+}
+
 int main(void)
 {
 	if(InitShareMemory() == FAIL)
@@ -2438,15 +2519,11 @@ int main(void)
 				// 依據當前各槍的狀態選擇 搭上/放開 Relay
 				SetK1K2RelayStatus(i);
 
-				if (ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy == YES)
-					CheckPhaseLossStatus(i);
-
-				CheckAcInputOvpStatus(i);
-
 				if (_chargingData[i]->SystemStatus == S_IDLE)
 				{
 					_chargingData[i]->RelayWeldingCheck = NO;
 					_isRelayWelding[i] = NO;
+					ResetDetAlarmStatus(i);
 				}
 
 				if (_chargingData[i]->SystemStatus == S_BOOTING	||
@@ -2606,56 +2683,6 @@ int main(void)
 				ShmFanModuleData->SetFan3Speed = ShmFanModuleData->TestFanSpeed;
 				ShmFanModuleData->SetFan4Speed = ShmFanModuleData->TestFanSpeed;
 
-//				if (isCharging)
-//				{
-////					if (ShmFanModuleData->PresentFan1Speed < MAX_FAN_SPEED ||
-////						ShmFanModuleData->PresentFan2Speed < MAX_FAN_SPEED ||
-////						ShmFanModuleData->PresentFan3Speed < MAX_FAN_SPEED ||
-////						ShmFanModuleData->PresentFan4Speed < MAX_FAN_SPEED)
-////					{
-////						ShmFanModuleData->SetFan1Speed = MAX_FAN_SPEED;
-////						ShmFanModuleData->SetFan2Speed = MAX_FAN_SPEED;
-////						ShmFanModuleData->SetFan3Speed = MAX_FAN_SPEED;
-////						ShmFanModuleData->SetFan4Speed = MAX_FAN_SPEED;
-////					}
-//
-//					// 在還沒問到 PSU 溫度~ 還是要有個最小轉速
-//					ShmFanModuleData->SetFan1Speed = MIN_FAN_SPEED;
-//					ShmFanModuleData->SetFan2Speed = MIN_FAN_SPEED;
-//					ShmFanModuleData->SetFan3Speed = MIN_FAN_SPEED;
-//					ShmFanModuleData->SetFan4Speed = MIN_FAN_SPEED;
-//
-//					if (ShmFanModuleData->TestFanSpeed > 0)
-//					{
-//						ShmFanModuleData->SetFan1Speed = ShmFanModuleData->TestFanSpeed;
-//						ShmFanModuleData->SetFan2Speed = ShmFanModuleData->TestFanSpeed;
-//						ShmFanModuleData->SetFan3Speed = ShmFanModuleData->TestFanSpeed;
-//						ShmFanModuleData->SetFan4Speed = ShmFanModuleData->TestFanSpeed;
-//					}
-//				}
-//				else
-//				{
-////					if (ShmFanModuleData->PresentFan1Speed > MIN_FAN_SPEED ||
-////						ShmFanModuleData->PresentFan2Speed > MIN_FAN_SPEED ||
-////						ShmFanModuleData->PresentFan3Speed > MIN_FAN_SPEED ||
-////						ShmFanModuleData->PresentFan4Speed > MIN_FAN_SPEED)
-////					{
-//						ShmFanModuleData->SetFan1Speed = MIN_FAN_SPEED;
-//						ShmFanModuleData->SetFan2Speed = MIN_FAN_SPEED;
-//						ShmFanModuleData->SetFan3Speed = MIN_FAN_SPEED;
-//						ShmFanModuleData->SetFan4Speed = MIN_FAN_SPEED;
-////					}
-//
-//					// 停止時,如溫度還是很高,則需要維持該轉速直到溫度降低
-//					if (ShmFanModuleData->TestFanSpeed >= MAX_FAN_SPEED)
-//					{
-//						ShmFanModuleData->SetFan1Speed = ShmFanModuleData->TestFanSpeed;
-//						ShmFanModuleData->SetFan2Speed = ShmFanModuleData->TestFanSpeed;
-//						ShmFanModuleData->SetFan3Speed = ShmFanModuleData->TestFanSpeed;
-//						ShmFanModuleData->SetFan4Speed = ShmFanModuleData->TestFanSpeed;
-//					}
-//				}
-
 				//PRINTF_FUNC("set fan = %d \n", ShmFanModuleData->SetFan1Speed);
 				SetFanModuleSpeed();
 			}

+ 40 - 14
EVSE/Projects/DS60-120/Apps/Module_LcmContro.h

@@ -84,7 +84,6 @@ byte isChangeBattMap = false;
 short _currentPage = _LCM_NONE;
 short _oldPage = _LCM_NONE;
 byte _gunIndex = 0;
-bool _wifi_conn_status = false;
 bool _battery_display_ani = false;
 byte _curPage_index = 0;
 bool _page_reload = false;
@@ -92,7 +91,9 @@ bool _page_reload = false;
 // LCM - HW
 byte _everyPageRollChange = 0;
 short __conn_status = 0x0030;
-short __ethernet_status = 0x0036;
+short __ethernet_status = 0x0032;
+short __3G4G_status = 0x0036;
+short __3G4G_move_status = 0x0038;
 short __wifi_status = 0x003C;
 
 short __sel_gun_btn = 0x0040;
@@ -109,11 +110,10 @@ short __plug_in_arrow = 0x0060;
 short __conn_line = 0x0066;
 
 short __gun_type_index = 0x0070;
+short __cmp_gun_type_index = 0x0080;
 short __qr_code_pre = 0x0280;
 
-short __side_top = 0x0090;
-short __side_down = 0x0092;
-short __side_mid = 0x0094;
+short __batt_map_empty = 0x0090;
 
 short __conn_line_chag = 0x0096;
 short __batt_map = 0x0100;
@@ -122,6 +122,11 @@ 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;
@@ -132,6 +137,20 @@ short __money_by_rate = 0x0200;
 short __money_rate = 0x0220;
 short __money_rate_map = 0x0230;
 
+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;
+
 // ICON ID
 byte _disappear = 0;
 byte _disconnect = 1;
@@ -139,8 +158,8 @@ byte _connect = 2;
 byte _warning = 3;
 byte _arrow_dark = 4;
 byte _arrow_light = 5;
-byte _ethernet_disconnect = 6;
-byte _ethernet_connect = 7;
+byte _3G4G_disconnect = 6;
+byte _3G4G_connect = 7;
 byte _wifi_disconnect = 8;
 byte _wifi_connect = 9;
 byte _logo = 10;
@@ -185,10 +204,17 @@ byte _battery_eng_map = 48;
 byte _money_map = 49;
 byte _elapse_time_map = 50;
 byte _charging_money = 51;
-byte _side_none_rfid = 52;
-byte _side_rfid = 53;
-byte _side_none_app = 54;
-byte _side_app = 55;
-byte _side_none_qr = 56;
-byte _side_qr = 57;
-
+byte _ethernet_disconnect = 52;
+byte _ethernet_connect = 53;
+byte _chademo_dark_cmp = 54;
+byte _ccs_dark_cmp = 55;
+byte _gbt_dark_cmp = 56;
+byte _actype_dark_cmp = 57;
+byte _chademo_light_cmp = 58;
+byte _ccs_light_cmp = 59;
+byte _gbt_light_cmp = 60;
+byte _actype_light_cmp = 61;
+byte _logo_cmp = 62;
+byte _battery_eng_trp_map = 63;
+byte _money_trp_map = 64;
+byte _elapse_time_trp_map = 65;

+ 249 - 62
EVSE/Projects/DS60-120/Apps/Module_LcmControl.c

@@ -561,7 +561,11 @@ void ChangeBattMapAndValue(short page, int soc)
 //	int max = 90;
 //	soc = rand() % (max - min + 1) + min;
 
-	if (page == _LCM_CHARGING)
+	if (page == _LCM_PRE_CHARGE)
+	{
+		ChangeDisplay2Value(__batt_map_empty, _battery_empty);
+	}
+	else if (page == _LCM_CHARGING)
 	{
 		if (soc < 20)
 		{
@@ -754,32 +758,52 @@ void RefreshPageAnimation(byte value)
 
 void RefreshConnStatus()
 {
-	// Wifi priority is higher than Ethernet
-	if (ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn == YES ||
-			ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == _SYS_WIFI_MODE_AP)
-	{
-		_wifi_conn_status = true;
-		ChangeDisplay2Value(__wifi_status, _wifi_connect);
-		ChangeDisplay2Value(__ethernet_status, _disappear);
-	}
+	// eth
+	if (ShmSysConfigAndInfo->SysInfo.ethInternetConn == YES)
+	{ ChangeDisplay2Value(__ethernet_status, _ethernet_connect); }
 	else
+	{ ChangeDisplay2Value(__ethernet_status, _ethernet_disconnect); }
+
+	// Wifi
+	if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'W' || ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D') &&
+			ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode != _SYS_WIFI_MODE_DISABLE)
 	{
-		_wifi_conn_status = false;
-		ChangeDisplay2Value(__wifi_status, _disappear);
+		if (ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn == YES ||
+				ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == _SYS_WIFI_MODE_AP)
+		{ ChangeDisplay2Value(__wifi_status, _wifi_connect); }
+		else
+		{ ChangeDisplay2Value(__wifi_status, _wifi_disconnect); }
 	}
+	else
+	{ ChangeDisplay2Value(__wifi_status, _disappear); }
 
-	if (!_wifi_conn_status)
+	if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'T' || ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D') &&
+			ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled != NO)
 	{
-		if (ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn == YES ||
-				ShmSysConfigAndInfo->SysInfo.InternetConn == YES)
+		if (ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == _SYS_WIFI_MODE_DISABLE)
 		{
-			ChangeDisplay2Value(__ethernet_status, _ethernet_connect);
+			ChangeDisplay2Value(__3G4G_status, _disappear);
+			// 3G/4G
+			if (ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn == YES)
+			{ ChangeDisplay2Value(__3G4G_move_status, _3G4G_disconnect); }
+			else
+			{ ChangeDisplay2Value(__3G4G_move_status, _3G4G_disconnect); }
 		}
 		else
 		{
-			ChangeDisplay2Value(__ethernet_status, _ethernet_disconnect);
+			ChangeDisplay2Value(__3G4G_move_status, _disappear);
+			// 3G/4G
+			if (ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn == YES)
+			{ ChangeDisplay2Value(__3G4G_status, _3G4G_disconnect); }
+			else
+			{ ChangeDisplay2Value(__3G4G_status, _3G4G_disconnect); }
 		}
 	}
+	else
+	{
+		ChangeDisplay2Value(__3G4G_status, _disappear);
+		ChangeDisplay2Value(__3G4G_move_status, _disappear);
+	}
 
 	// ³s½u¨ì«á¥x
 	if (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == YES)
@@ -825,10 +849,161 @@ bool IsPageReloadChk()
 	return result;
 }
 
+void DisplayInfoCsuVer(bool isShow, unsigned char *modelName)
+{
+	if (isShow)
+	{
+		byte 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 DisplayInfoEthIp(bool isShow, unsigned char *ip)
+{
+	if (isShow)
+	{
+		byte 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 DisplayInfoSN(bool isShow, unsigned char *sn)
+{
+	if (isShow)
+	{
+		byte 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 DisplayInfoGun1Ver(bool isShow, unsigned char *version)
+{
+	if (isShow)
+	{
+		byte 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 DisplayInfoGun2Ver(bool isShow, unsigned char *version)
+{
+	if (isShow)
+	{
+		byte 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 DisplayInfoSpeed(bool isShow, unsigned int fan)
+{
+	if (isShow)
+	{
+		byte 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 InformationShow()
+{
+	bool show = false;
+
+	if(ShmSysConfigAndInfo->SysConfig.ShowInformation == YES)
+	{
+		show = true;
+		DisplayInfoCsuVer(show, ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
+		DisplayInfoSpeed(show, ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
+		DisplayInfoSN(show, ShmSysConfigAndInfo->SysConfig.SerialNumber);
+
+		DisplayInfoEthIp(show, ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
+		DisplayInfoGun1Ver(show, ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
+		if (_totalCount > 1)
+			DisplayInfoGun2Ver(show, ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
+		else
+		{
+			DisplayInfoGun2Ver(false, ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
+		}
+	}
+	else
+	{
+		DisplayInfoCsuVer(show, ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
+		DisplayInfoSpeed(show, ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
+		DisplayInfoSN(show, ShmSysConfigAndInfo->SysConfig.SerialNumber);
+
+		DisplayInfoGun1Ver(show, ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
+		DisplayInfoGun2Ver(show, ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
+		DisplayInfoEthIp(show, ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
+	}
+}
+
 void ProcessPageInfo()
 {
 	_page_reload = IsPageReloadChk();
-
 	switch(_currentPage)
 	{
 		case _LCM_IDLE:
@@ -878,44 +1053,19 @@ void ProcessPageInfo()
 		case _LCM_CHARGING:
 		case _LCM_COMPLETE:
 		{
-			if (_totalCount + acgunCount >= 2)
-			{
-				if (ShmSysConfigAndInfo->SysConfig.isRFID)
-					ChangeDisplay2Value(__side_top, _side_rfid);
-				else
-					ChangeDisplay2Value(__side_top, _side_none_rfid);
-
-				if (ShmSysConfigAndInfo->SysConfig.isQRCode)
-					ChangeDisplay2Value(__side_mid, _side_qr);
-				else
-				{
-					ChangeDisplay2Value(__qr_code_pre, _disappear);
-					ChangeDisplay2Value(__side_mid, _side_none_qr);
-					needReloadQr = true;
-				}
-
-				if (ShmSysConfigAndInfo->SysConfig.isAPP)
-					ChangeDisplay2Value(__side_down, _side_app);
-				else
-					ChangeDisplay2Value(__side_down, _side_none_app);
-
-				ChangeDisplay2Value(__sel_gun_btn, _sel_gun_btn);
-			}
-			else
-			{
-				ChangeDisplay2Value(__side_top, _disappear);
-				ChangeDisplay2Value(__side_mid, _disappear);
-				ChangeDisplay2Value(__side_down, _disappear);
-				ChangeDisplay2Value(__sel_gun_btn, _disappear);
-			}
-
 			bool isShowAc = false;
+			byte gunTargetIndex = 0;
+
 			if (acgunCount > 0)
 			{
+				gunTargetIndex = 2;
 				if (ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc != NO_DEFINE)
 				{
 					isShowAc = true;
-					ChangeDisplay2Value(__gun_type_index + (2 * 2), _actype_light);
+					if (_currentPage == _LCM_COMPLETE)
+						ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _actype_light_cmp);
+					else
+						ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _actype_light);
 
 					if (_currentPage == _LCM_CHARGING)
 					{
@@ -958,7 +1108,7 @@ void ProcessPageInfo()
 						else
 							ChangeChargingPowerValue(0);
 
-						if (ac_chargingInfo[0]->PresentChargedEnergy >= 0.1&&
+						if (ac_chargingInfo[0]->PresentChargedEnergy >= 0.1 &&
 								ac_chargingInfo[0]->PresentChargedEnergy <= ENERGY_MAX_KWH)
 						{
 							ChangeChargingEnergyValue(ac_chargingInfo[0]->PresentChargedEnergy);
@@ -988,24 +1138,39 @@ void ProcessPageInfo()
 					}
 				}
 				else
-					ChangeDisplay2Value(__gun_type_index + (2 * 2), _actype_dark);
+				{
+					if (_currentPage == _LCM_COMPLETE)
+						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);
 
+			gunTargetIndex = 0;
 			for(byte i = 0; i < _totalCount; i++)
 			{
+				if (_totalCount == 1 && acgunCount <= 0)
+					gunTargetIndex = 2;
+				else
+					gunTargetIndex = i;
+
 				switch(_chargingInfoData[i]->Type)
 				{
 					case _Type_Chademo:
 					{
 						if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i && !isShowAc)
 						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _chademo_light);
+							if (_currentPage == _LCM_COMPLETE)
+								ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _chademo_light_cmp);
+							else
+								ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _chademo_light);
 						}
 						else
 						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _chademo_dark);
+							if (_currentPage == _LCM_COMPLETE)
+								ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _chademo_dark_cmp);
+							else
+								ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _chademo_dark);
 						}
 					}
 						break;
@@ -1013,11 +1178,17 @@ void ProcessPageInfo()
 					{
 						if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i && !isShowAc)
 						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _gbt_light);
+							if (_currentPage == _LCM_COMPLETE)
+								ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _gbt_light_cmp);
+							else
+								ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _gbt_light);
 						}
 						else
 						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _gbt_dark);
+							if (_currentPage == _LCM_COMPLETE)
+								ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _gbt_dark_cmp);
+							else
+								ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _gbt_dark);
 						}
 					}
 						break;
@@ -1025,21 +1196,34 @@ void ProcessPageInfo()
 					{
 						if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i && !isShowAc)
 						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _ccs_light);
+							if (_currentPage == _LCM_COMPLETE)
+								ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _ccs_light_cmp);
+							else
+								ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _ccs_light);
 						}
 						else
 						{
-							ChangeDisplay2Value(__gun_type_index + (i * 2), _ccs_dark);
+							if (_currentPage == _LCM_COMPLETE)
+								ChangeDisplay2Value(__cmp_gun_type_index + (gunTargetIndex * 2), _ccs_dark_cmp);
+							else
+								ChangeDisplay2Value(__gun_type_index + (gunTargetIndex * 2), _ccs_dark);
 						}
 					}
 						break;
 				}
 
-				if (_currentPage == _LCM_CHARGING && !isShowAc)
+				if (_currentPage == _LCM_PRE_CHARGE && !isShowAc)
 				{
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i)
 					{
-						ChangeBattMapAndValue(_LCM_CHARGING, _chargingInfoData[i]->EvBatterySoc);
+						ChangeBattMapAndValue(_currentPage, _chargingInfoData[i]->EvBatterySoc);
+					}
+				}
+				else if (_currentPage == _LCM_CHARGING && !isShowAc)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i)
+					{
+						ChangeBattMapAndValue(_currentPage, _chargingInfoData[i]->EvBatterySoc);
 						if (_chargingInfoData[i]->PresentChargedDuration >= 0 &&
 								_chargingInfoData[i]->PresentChargedDuration <= TIME_MAX_SEC)
 							ChangeRemainTime(_chargingInfoData[i]->PresentChargedDuration);
@@ -1068,7 +1252,7 @@ void ProcessPageInfo()
 				{
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == i)
 					{
-						ChangeBattMapAndValue(_LCM_COMPLETE, _chargingInfoData[i]->EvBatterySoc);
+						ChangeBattMapAndValue(_currentPage, _chargingInfoData[i]->EvBatterySoc);
 						if (_chargingInfoData[i]->PresentChargedDuration >= 0 &&
 								_chargingInfoData[i]->PresentChargedDuration <= TIME_MAX_SEC)
 							ChangeRemainTime(_chargingInfoData[i]->PresentChargedDuration);
@@ -1288,7 +1472,10 @@ int main(void)
 			RefreshPageAnimation(_everyPageRollChange);
 
 			if (changeWarningPriority == 0)
+			{
 				ChangeDisplayMoneyInfo();
+				InformationShow();
+			}
 
 			changeWarningPriority >= 15 ? (_battery_display_ani = true) : (_battery_display_ani = false);
 			changeWarningPriority >= 30 ? changeWarningPriority = 0 : changeWarningPriority++;

+ 9 - 18
EVSE/Projects/DS60-120/Apps/Module_PsuComm.c

@@ -731,9 +731,9 @@ void GetMisCallback(byte address, unsigned int value, byte type)
 	else if (type == 2)
 	{
 		//printf("DC - group = %d, index = %d, value = %d \n", group, address, value);
-		ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp1 = value;
-		ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp2 = value;
-		ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp3 = value;
+//		ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp1 = value;
+//		ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp2 = value;
+//		ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp3 = value;
 		ShmPsuData->PsuGroup[group].PsuModule[address].ExletTemp = value;
 	}
 	else if (type == 3)
@@ -1024,7 +1024,7 @@ void GetOutputAndTempCallback(byte address, unsigned short outputVol_s,
 	ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp1 = Temperature;
 	ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp2 = Temperature;
 	ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp3 = Temperature;
-	ShmPsuData->PsuGroup[group].PsuModule[address].ExletTemp = Temperature;
+//	ShmPsuData->PsuGroup[group].PsuModule[address].ExletTemp = Temperature;
 
 //	PRINTF_FUNC("***Output Value and Temp*** group = %d, Vol = %d, Cur = %d \n",
 //			group, outputVol_s, outputCur_s);
@@ -1046,17 +1046,8 @@ void GetModuleStatusCallback(byte address, unsigned char isErr, unsigned char st
 
 	int alarm = (err2 << 24) | (err3 << 16) | (err4 << 8);
 
-//	ShmPsuData->PsuGroup[group1].PsuModule[address].CriticalTemp1 = temp;
-//	ShmPsuData->PsuGroup[group1].PsuModule[address].CriticalTemp2 = temp;
-//	ShmPsuData->PsuGroup[group1].PsuModule[address].CriticalTemp3 = temp;
-//	ShmPsuData->PsuGroup[group1].PsuModule[address].ExletTemp = temp;
 	ShmPsuData->PsuGroup[group1].PsuModule[address].AlarmCode = alarm;
 	AbnormalStopAnalysis(group1, alarm);
-
-	// err2 == state 2
-	// err3 == state 1
-	// err4 == state 0
-	//PRINTF_FUNC("***Status*** address = %d, alarm = %d \n", address, alarm);
 }
 
 void GetModuleInputCallback(byte address, unsigned short inputR,
@@ -1258,8 +1249,7 @@ void PreCheckSmartChargingStep()
 			isCharging = true;
 			if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag == _REASSIGNED_PREPARE_M_TO_A)
 			{
-				if (toAverVolPoint > 0 &&
-						toAverVolPoint == (chargingInfo[index]->EvBatterytargetCurrent * 10))
+				if (toAverVolPoint == (chargingInfo[index]->EvBatterytargetCurrent * 10))
 				{
 					// 欲最大充 -> 均充需要等待充電中的輸出電流拉高到目標電流
 					if ((chargingInfo[index]->PresentChargingCurrent * 10) >=
@@ -1543,7 +1533,7 @@ int main(void)
 					else if (psuCmdSeq == _PSU_CMD_TEMP)
 					{
 						// 取得模塊溫度
-						//GetDcTemperature(groupIndex);
+						GetDcTemperature(groupIndex);
 					}
 				}
 
@@ -2002,8 +1992,9 @@ int main(void)
 							}
 						}
 					}
-					else if (chargingInfo[groupIndex]->SystemStatus >= S_TERMINATING &&
-								chargingInfo[groupIndex]->SystemStatus <= S_COMPLETE)
+					else if ((chargingInfo[groupIndex]->SystemStatus >= S_TERMINATING &&
+								chargingInfo[groupIndex]->SystemStatus <= S_COMPLETE) ||
+								chargingInfo[groupIndex]->SystemStatus == S_ALARM)
 					{
 						if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX)
 						{

+ 7 - 16
EVSE/Projects/DS60-120/Apps/ReadCmdline.c

@@ -435,8 +435,9 @@ void CreateOneError(char *v1)
 {
 	int value = atoi(v1);
 
-	ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = value;
-	ShmSysConfigAndInfo->SysConfig.BillingData.isBilling = value;
+	ShmPrimaryMcuData->InputDet.bits.EmergencyButton = value;
+	//ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = value;
+	//ShmSysConfigAndInfo->SysConfig.BillingData.isBilling = value;
 }
 
 void GetAuthorizeFlag(char *v1)
@@ -604,7 +605,9 @@ void GetPsuTemp()
 	{
 		for (byte count = 0; count < ShmPsuData->PsuGroup[index].GroupPresentPsuQuantity; count++)
 		{
-			printf("PSU Temp = %d \n", ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp);
+			printf("D.D. Temp = %d ------ Env Temp = %d \n",
+					ShmPsuData->PsuGroup[index].PsuModule[count].ExletTemp,
+					ShmPsuData->PsuGroup[index].PsuModule[count].CriticalTemp1);
 		}
 	}
 }
@@ -1279,19 +1282,7 @@ int main(void)
 		}
 		else if (strcmp(newString[0], "test") == 0)
 		{
-			printf("v = %d \n", ShmSysConfigAndInfo->SysInfo.WaitForPlugit);
-
-//			for(int i = 0; i < 2; i++)
-//			{
-//				if (!FindChargingInfoData(i, &_chargingData[0]))
-//				{
-//					printf("FindChargingInfoData error\n");
-//				}
-//				else
-//				{
-//					printf("v = %d, vv = %d \n", _chargingData[i]->SystemStatus, _chargingData[i]->IsAvailable);
-//				}
-//			}
+
 		}
 		else if(strcmp(newString[0], "strchg") == 0)
 		{

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 349 - 189
EVSE/Projects/DS60-120/Apps/main.c


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio