Procházet zdrojové kódy

2022-07-25/Alston Lin
Actions
1. Release and tag V3.01
Files
1. As follow commit history

Alston Lin před 2 roky
rodič
revize
c0caeacda8
1 změnil soubory, kde provedl 37 přidání a 16 odebrání
  1. 37 16
      EVSE/Projects/DS60-120/Apps/main.c

+ 37 - 16
EVSE/Projects/DS60-120/Apps/main.c

@@ -58,6 +58,7 @@
 #define		SYSTEM_MIN_VOL		80
 #define 	MIN_OUTPUT_CUR		0
 #define		AC_OUTPUT_VOL		220
+#define 	NO_RESERVE			-1
 
 #define		NO_DEFINE			255
 #define 	DEFAULT_AC_INDEX	2
@@ -651,7 +652,7 @@ bool CheckWebConfigChargingSOC(byte gunIndex)
 
 	if (ShmSysConfigAndInfo->SysConfig.MaxChargingSoc > 0)
 	{
-		if (chargingInfo[gunIndex]->EvBatterySoc >= ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy)
+		if (chargingInfo[gunIndex]->EvBatterySoc >= ShmSysConfigAndInfo->SysConfig.MaxChargingSoc)
 			result = true;
 	}
 
@@ -2881,6 +2882,8 @@ void ReleaseSysAlarmCode(byte gunIndex)
 	else if (gunIndex == 1)
 		ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AbnormalVoltageOnOutputLine_2 = NO;
 
+	ResetChargerAlarmCode(gunIndex, "023984");
+
 	if (chargingInfo[gunIndex]->Type == _Type_Chademo)
 	{
 		ShmDcCommonData->ConnectErrList[gunIndex].GunBits.ChaGfdTrip = NO;
@@ -3977,7 +3980,7 @@ bool AddGunInfoByConnector(byte typeValue, byte slots)
 
 				// AC 固定 index
 				ac_chargingInfo[_acgunIndex]->Index = DEFAULT_AC_INDEX;
-				ac_chargingInfo[_acgunIndex]->ReservationId = -1;
+				ac_chargingInfo[_acgunIndex]->ReservationId = NO_RESERVE;
 				ac_chargingInfo[_acgunIndex]->SystemStatus = SYS_MODE_BOOTING;
 				ac_chargingInfo[_acgunIndex]->Type = _Type_AC;
 				ac_chargingInfo[_acgunIndex]->IsAvailable = YES;
@@ -4002,7 +4005,7 @@ bool AddGunInfoByConnector(byte typeValue, byte slots)
 			{
 				chargingInfo[_gunIndex] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[_chademoIndex];
 				chargingInfo[_gunIndex]->Index = _gunIndex;
-				chargingInfo[_gunIndex]->ReservationId = -1;
+				chargingInfo[_gunIndex]->ReservationId = NO_RESERVE;
 				chargingInfo[_gunIndex]->slotsIndex = slots;
 				chargingInfo[_gunIndex]->SystemStatus = SYS_MODE_BOOTING;
 				chargingInfo[_gunIndex]->Type = _Type_Chademo;
@@ -4036,7 +4039,7 @@ bool AddGunInfoByConnector(byte typeValue, byte slots)
 				chargingInfo[_gunIndex] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[_ccsIndex];
 
 				chargingInfo[_gunIndex]->Index = _gunIndex;
-				chargingInfo[_gunIndex]->ReservationId = -1;
+				chargingInfo[_gunIndex]->ReservationId = NO_RESERVE;
 				chargingInfo[_gunIndex]->slotsIndex = slots;
 				chargingInfo[_gunIndex]->SystemStatus = SYS_MODE_BOOTING;
 				chargingInfo[_gunIndex]->Type = _Type_CCS;
@@ -4068,7 +4071,7 @@ bool AddGunInfoByConnector(byte typeValue, byte slots)
 				chargingInfo[_gunIndex] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[_gb_Index];
 
 				chargingInfo[_gunIndex]->Index = _gunIndex;
-				chargingInfo[_gunIndex]->ReservationId = -1;
+				chargingInfo[_gunIndex]->ReservationId = NO_RESERVE;
 				chargingInfo[_gunIndex]->slotsIndex = slots;
 				chargingInfo[_gunIndex]->SystemStatus = SYS_MODE_BOOTING;
 				chargingInfo[_gunIndex]->Type = _Type_GB;
@@ -5661,7 +5664,7 @@ void ocpp_ac_chk_reserved_cmd()
 				PRINTF_FUNC ( "***************ChkOcppStatus : (AC) OcppReservedStatus******************** \n" );
 				PRINTF_FUNC ( "ReservationId = %d \n", ShmOCPP16Data->ReserveNow [hasDc].ReservationId );
 				PRINTF_FUNC ( "***********ChkOcppStatus : (AC) Cancel OcppReservedStatus End**************** \n" );
-				ac_chargingInfo [0]->ReservationId = -1;
+				ac_chargingInfo [0]->ReservationId = NO_RESERVE;
 				ac_chargingInfo [0]->SystemStatus = SYS_MODE_IDLE;
 
 				strcpy ( (char *) ShmDcCommonData->_reserved_ac_UserId[0], "" );
@@ -5699,7 +5702,7 @@ void ocpp_ac_chk_reserved_cmd()
 				PRINTF_FUNC ( "***************ChkOcppStatus : (AC) OcppReservedStatus******************** \n" );
 				PRINTF_FUNC ( "ReservationId = %d \n", ShmOCPP20Data->ReserveNow [hasDc].id );
 				PRINTF_FUNC ( "***********ChkOcppStatus : (AC) Cancel OcppReservedStatus End**************** \n" );
-				ac_chargingInfo [0]->ReservationId = -1;
+				ac_chargingInfo [0]->ReservationId = NO_RESERVE;
 				ac_chargingInfo [0]->SystemStatus = SYS_MODE_IDLE;
 
 				strcpy ( (char *) ShmDcCommonData->_reserved_UserId, "" );
@@ -6095,7 +6098,7 @@ void ocpp_chk_reserved_cmd(byte gunIndex)
 				PRINTF_FUNC("***************ChkOcppStatus : OcppReservedStatus******************** \n");
 				PRINTF_FUNC("ReservationId = %d \n", ShmOCPP16Data->ReserveNow[gunIndex + acDirIndex].ReservationId);
 				PRINTF_FUNC("***********ChkOcppStatus : Cancel OcppReservedStatus End**************** \n");
-				chargingInfo[gunIndex]->ReservationId = -1;
+				chargingInfo[gunIndex]->ReservationId = NO_RESERVE;
 				chargingInfo[gunIndex]->SystemStatus = SYS_MODE_IDLE;
 
 				strcpy((char *)ShmDcCommonData->_reserved_UserId[gunIndex], "");
@@ -6133,7 +6136,7 @@ void ocpp_chk_reserved_cmd(byte gunIndex)
 				PRINTF_FUNC("***************ChkOcppStatus : OcppReservedStatus******************** \n");
 				PRINTF_FUNC("ReservationId = %d \n", ShmOCPP20Data->ReserveNow[gunIndex + acDirIndex].id);
 				PRINTF_FUNC("***********ChkOcppStatus : Cancel OcppReservedStatus End**************** \n");
-				chargingInfo[gunIndex]->ReservationId = -1;
+				chargingInfo[gunIndex]->ReservationId = NO_RESERVE;
 				chargingInfo[gunIndex]->SystemStatus = SYS_MODE_IDLE;
 
 				strcpy((char *)ShmDcCommonData->_reserved_UserId[gunIndex], "");
@@ -9394,10 +9397,11 @@ int main(void)
 	}
 	else
 	{
-		for (byte gun_index = 0; gun_index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gun_index++)
-		{
-			SetChargerMode(gun_index, SYS_MODE_IDLE);
-		}
+		//lwmark
+//		for (byte gun_index = 0; gun_index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gun_index++)
+//		{
+//			SetChargerMode(gun_index, SYS_MODE_IDLE);
+//		}
 
 		SetupRebootCount(0);
 	}
@@ -9427,12 +9431,22 @@ int main(void)
 		DB_Reboot_Record(localDb);
 	}
 
+	//lwmark
+	for (int _index = 0; _index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; _index ++)
+	{
+		if (chargingInfo [_index]->IsAvailable == NO)
+			SetChargerMode ( _index, SYS_MODE_MAINTAIN );
+		else
+			SetChargerMode ( _index, SYS_MODE_IDLE );
+	}
+
 	if (NetworkDB_Open(networkDb) != PASS)
 	{
 		PRINTF_FUNC("NetworkDB_Open fail. \n");
 	}
 
 	ChangeLcmByIndex(_LCM_IDLE);
+
 	sleep(1);
 	CreateRfidFork();
 	sleep(1);
@@ -9693,13 +9707,17 @@ int main(void)
 						if (chargingInfo[gun_index]->SystemStatus == SYS_MODE_IDLE)
 						{
 							PRINTF_FUNC("================= SYS_MODE_IDLE (%x) ================  \n", gun_index);
-							chargingInfo[gun_index]->ReservationId = -1;
+							chargingInfo[gun_index]->ReservationId = NO_RESERVE;
 						}
 						else if (chargingInfo[gun_index]->SystemStatus == SYS_MODE_RESERVATION)
 						{
 							PRINTF_FUNC("================= SYS_MODE_RESERVATION (%x) ================  \n", gun_index);
 							PRINTF_FUNC("================= Id : %s ================  \n", ShmDcCommonData->_reserved_UserId[gun_index]);
 						}
+						else if (chargingInfo[gun_index]->SystemStatus == SYS_MODE_MAINTAIN)
+						{
+							PRINTF_FUNC("================= SYS_MODE_MAINTAIN (%x) ================  \n", gun_index);
+						}
 						chargingInfo[gun_index]->PresentChargedDuration = 0;
 						chargingInfo[gun_index]->RemainChargingDuration = 0;
 						chargingInfo[gun_index]->PresentChargingVoltage = 0;
@@ -9735,7 +9753,9 @@ int main(void)
 					if (chargingInfo[gun_index]->deratingByConnOtp.deratingIndex != 0)
 						chargingInfo[gun_index]->deratingByConnOtp.deratingIndex = 0;
 
-					if (chargingInfo[gun_index]->IsAvailable == NO)
+					//lwmark
+					if (chargingInfo [gun_index]->IsAvailable == NO &&
+							chargingInfo[gun_index]->SystemStatus != SYS_MODE_MAINTAIN)
 					{
 						SetChargerMode(gun_index, SYS_MODE_MAINTAIN);
 					}
@@ -9764,7 +9784,8 @@ int main(void)
 								SetChargerMode(gun_index, SYS_MODE_IDLE);
 							}
 
-							CcidAuthorizationProcessing(gun_index);
+							if (chargingInfo[gun_index]->ReservationId == NO_RESERVE)
+								CcidAuthorizationProcessing(gun_index);
 
 							//
 							{