Browse Source

2022-09-01/Liwi Yang
action
1.Fix parsing gun index process at initial stage.
2.Enable 4g function
3.Add 4g dongle reset pin for dc type
4.Remove some debug info

Liwei 2 years ago
parent
commit
24d0686db8

BIN
EVSE/Projects/EVSE-Emulator/Apps/CCS/SeccComm


+ 99 - 37
EVSE/Projects/EVSE-Emulator/Apps/main.c

@@ -42,11 +42,12 @@
 // GPIO constant define
 //==========================
 #define GPIO_OUT_RST_RFID														62
-#define GPIO_OUT_RST_4G															114
+#define GPIO_AC_OUT_RST_4G															114
 #define GPIO_OUT_RST_QCA														115
 #define GPIO_OUT_RST_ETH															56
 #define GPIO_IN_WAKEUP															63
-#define GPIO_OUT_RST_4G_WIFI													59
+#define GPIO_AC_OUT_RST_4G_WIFI													59
+#define GPIO_DC_OUT_RST_4G_WIFI											104 //lwtest
 
 #define MtdBlockSize 																	0x300000
 
@@ -4277,6 +4278,25 @@ int isValidLocalWhiteCard()
 //==========================================
 void checkTask()
 {
+	//lwtest
+	if ((ShmSysConfigAndInfo->SysConfig.ModelName[INTERNET_TYPE] == 'T') || (ShmSysConfigAndInfo->SysConfig.ModelName[INTERNET_TYPE] == 'D'))
+	{
+		if (system("pidof -s Module_4g > /dev/null") != 0)
+		{
+			DEBUG_INFO("Module_4g not running, restart it.\n");
+			system("/root/Module_4g &");
+		}
+	}
+
+	if ((ShmSysConfigAndInfo->SysConfig.ModelName[INTERNET_TYPE] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[INTERNET_TYPE] == 'D'))
+	{
+		if (system("pidof -s Module_Wifi > /dev/null") != 0)
+		{
+			DEBUG_INFO("Module_Wifi not running, restart it.\n");
+			system("/root/Module_Wifi &");
+		}
+	}
+
 	if (system("pidof -s Module_EventLogging > /dev/null") != 0)
 	{
 		DEBUG_INFO("Module_EventLogging not running, restart it.\n");
@@ -4595,7 +4615,7 @@ void checkChargingProfileLimit(uint8_t gun_index, uint8_t system_mode)
 			else
 				ShmCharger->gun_info[gun_index].targetCurrent = ShmSysConfigAndInfo->SysConfig.RatingCurrent;
 
-			printf("Gun %d charging targetCurrent %d\n", gun_index, ShmCharger->gun_info[gun_index].targetCurrent);
+			//printf("Gun %d charging targetCurrent %d\n", gun_index, ShmCharger->gun_info[gun_index].targetCurrent);
 		}
 
 		// Get max charging profile limit
@@ -4611,8 +4631,8 @@ void checkChargingProfileLimit(uint8_t gun_index, uint8_t system_mode)
 					{
 						//lwtest
 						MaxChargingProfileChargingCurrent = ShmOCPP16Data->MaxChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit;
-						printf("Gun %d Get Max Profile limit = %.2f\n", gun_index,
-						        ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
+//						printf("Gun %d Get Max Profile limit = %.2f\n", gun_index,
+//						        ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 					}
 					else
 						break;
@@ -5730,11 +5750,11 @@ int main(void)
 				}
 
 				//lwtest
-				if (ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
-					printf("=== AC 3 phase R=%.2f v | S=%.2f v | T%.2f v\n", ShmSysConfigAndInfo->SysInfo.InputVoltageR,
-					        ShmSysConfigAndInfo->SysInfo.InputVoltageS, ShmSysConfigAndInfo->SysInfo.InputVoltageT);
-				else
-					printf("=== AC 1 phase R=%.2f v\n", ShmSysConfigAndInfo->SysInfo.InputVoltageR);
+//				if (ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+//					printf("=== AC 3 phase R=%.2f v | S=%.2f v | T%.2f v\n", ShmSysConfigAndInfo->SysInfo.InputVoltageR,
+//					        ShmSysConfigAndInfo->SysInfo.InputVoltageS, ShmSysConfigAndInfo->SysInfo.InputVoltageT);
+//				else
+//					printf("=== AC 1 phase R=%.2f v\n", ShmSysConfigAndInfo->SysInfo.InputVoltageR);
 				//------------------------------------------------------------------------------------
 				// Current
 				uint16_t _targetCurrent = ShmCharger->gun_info[gun_index].targetCurrent/ShmSysConfigAndInfo->SysConfig.AcPhaseCount;
@@ -5763,14 +5783,14 @@ int main(void)
 				}
 
 				//lwtest
-				if (ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
-					printf("=== AC 3 phase Gun %d Current I1=%.2f A| I2=%.2f A| I3=%.2f A\n", gun_index,
-					        getTargetChargingInfoData(gun_index)->PresentChargingCurrent,
-					        getTargetChargingInfoData(gun_index)->PresentChargingCurrentL2,
-					        getTargetChargingInfoData(gun_index)->PresentChargingCurrentL3);
-				else
-					printf("=== AC 1 phase Gun %d Current=%.2f A\n", gun_index,
-					        getTargetChargingInfoData(gun_index)->PresentChargingCurrent);
+//				if (ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+//					printf("=== AC 3 phase Gun %d Current I1=%.2f A| I2=%.2f A| I3=%.2f A\n", gun_index,
+//					        getTargetChargingInfoData(gun_index)->PresentChargingCurrent,
+//					        getTargetChargingInfoData(gun_index)->PresentChargingCurrentL2,
+//					        getTargetChargingInfoData(gun_index)->PresentChargingCurrentL3);
+//				else
+//					printf("=== AC 1 phase Gun %d Current=%.2f A\n", gun_index,
+//					        getTargetChargingInfoData(gun_index)->PresentChargingCurrent);
 				//------------------------------------------------------------------------------------
 				// Energy
 				tsNow[gun_index] = current_timestamp();
@@ -5811,17 +5831,17 @@ int main(void)
 						(float) (((rand() % 10) + ((AC_OUTPUT_VOL * 10) - SIM_DEVIATION)) / 10.0);
 
 				//lwtest
-				printf("=== DC input Voltage R=%.2f v| S=%.2f v| T=%.2f v\n",
-				        ShmSysConfigAndInfo->SysInfo.InputVoltageR, ShmSysConfigAndInfo->SysInfo.InputVoltageS,
-				        ShmSysConfigAndInfo->SysInfo.InputVoltageT);
+//				printf("=== DC input Voltage R=%.2f v| S=%.2f v| T=%.2f v\n",
+//				        ShmSysConfigAndInfo->SysInfo.InputVoltageR, ShmSysConfigAndInfo->SysInfo.InputVoltageS,
+//				        ShmSysConfigAndInfo->SysInfo.InputVoltageT);
 				//------------------------------------------------------------------------------------
 				// Output Voltage
 				getTargetChargingInfoData(gun_index)->PresentChargingVoltage =
 				        (float) (getTargetChargingInfoData(gun_index)->SystemStatus == SYS_MODE_CHARGING
 				        		? (((rand() % 10) + ((DC_SIMULATE_OUTPUT_VOL * 10) - 100)) / 10.0) : 0);
 				//lwtest
-				printf("=== DC Gun %d Present Charging Voltage %.2f v\n", gun_index,
-				        getTargetChargingInfoData(gun_index)->PresentChargingVoltage);
+//				printf("=== DC Gun %d Present Charging Voltage %.2f v\n", gun_index,
+//				        getTargetChargingInfoData(gun_index)->PresentChargingVoltage);
 				//------------------------------------------------------------------------------------
 				// Current
 				getTargetChargingInfoData(gun_index)->PresentChargingCurrent =
@@ -5837,9 +5857,9 @@ int main(void)
 					getTargetChargingInfoData(gun_index)->PresentChargingCurrent = 0;
 				}
 
-				//lwtest
-				printf("=== DC Gun %d Present Charging Current %.2f A\n", gun_index,
-				        getTargetChargingInfoData(gun_index)->PresentChargingCurrent);
+//				//lwtest
+//				printf("=== DC Gun %d Present Charging Current %.2f A\n", gun_index,
+//				        getTargetChargingInfoData(gun_index)->PresentChargingCurrent);
 				//------------------------------------------------------------------------------------
 				// Energy
 				tsNow[gun_index] = current_timestamp();
@@ -5848,6 +5868,9 @@ int main(void)
 				        * ((tsNow[gun_index] - tsLast[gun_index]) / 360000.0));
 				ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption = tmpPowerConsumption[gun_index];
 				tsLast[gun_index] = tsNow[gun_index];
+
+				//lwtest
+//				printf("=== DC Gun %d power_consumption %.2lld v\n", gun_index, ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption);
 				//------------------------------------------------------------------------------------
 				//Power Offered , Current Offered
 				//lwtest
@@ -5916,8 +5939,8 @@ int main(void)
 				ShmSysConfigAndInfo->SysConfig.RatingCurrent = modelnameInfo.ratedPower / DC_SIMULATE_OUTPUT_VOL;
 
 			//lwtest
-			printf("=== Rating Current %d, ratedPower  = %d\n", ShmSysConfigAndInfo->SysConfig.RatingCurrent,
-			        modelnameInfo.ratedPower);
+//			printf("=== Rating Current %d, ratedPower  = %d\n", ShmSysConfigAndInfo->SysConfig.RatingCurrent,
+//			        modelnameInfo.ratedPower);
 
 			//==========================================
 			// Synchronize present charging power
@@ -5935,8 +5958,8 @@ int main(void)
 					if (getTargetChargingInfoData(gun_index)->PresentChargingPower <= (ShmSysConfigAndInfo->SysConfig.RatingCurrent * 0.01))
 						getTargetChargingInfoData(gun_index)->PresentChargingPower = ShmSysConfigAndInfo->SysConfig.RatingCurrent * 0.01;
 
-					printf("===Gun %d 1 Phase relay ON  Rating Pow %.2f w\n", gun_index,
-					        getTargetChargingInfoData(gun_index)->PresentChargingPower);
+//					printf("===Gun %d 1 Phase relay ON  Rating Pow %.2f w\n", gun_index,
+//					        getTargetChargingInfoData(gun_index)->PresentChargingPower);
 				}
 				else
 					getTargetChargingInfoData(gun_index)->PresentChargingPower = 0;
@@ -5958,8 +5981,8 @@ int main(void)
 						getTargetChargingInfoData(gun_index)->PresentChargingPower = ShmSysConfigAndInfo->SysConfig.RatingCurrent * 0.01;
 
 					//lwtest
-					printf("===Gun %d 3 Phase relay ON  Rating Pow %.2f\n", gun_index,
-					        getTargetChargingInfoData(gun_index)->PresentChargingPower);
+//					printf("===Gun %d 3 Phase relay ON  Rating Pow %.2f\n", gun_index,
+//					        getTargetChargingInfoData(gun_index)->PresentChargingPower);
 				}
 				else
 				{
@@ -6057,6 +6080,11 @@ int main(void)
 				case SYS_MODE_BOOTING:
 					if (isModeChange(gun_index))
 					{
+						uint8_t idxCHAdeMO = 0;
+						uint8_t idxCCS = 0;
+						uint8_t idxGB = 0;
+						uint8_t idxAC = 0;
+
 						DEBUG_INFO("========== SYS_MODE_BOOTING (%d) ========== \n", gun_index);
 
 						//CSU Initialization & task spawn
@@ -6074,19 +6102,23 @@ int main(void)
 						{
 							if (modelnameInfo.ParsingInfo[gun_index].GunType == Gun_Type_Chademo)
 							{
-								ShmSysConfigAndInfo->SysInfo.ChademoChargingData[gun_index].Index = gun_index;
+								ShmSysConfigAndInfo->SysInfo.ChademoChargingData[idxCHAdeMO].Index = gun_index;
+								idxCHAdeMO ++;
 							}
 							else if (modelnameInfo.ParsingInfo[gun_index].GunType == Gun_Type_CCS_2)
 							{
-								ShmSysConfigAndInfo->SysInfo.CcsChargingData[gun_index].Index = gun_index;
+								ShmSysConfigAndInfo->SysInfo.CcsChargingData[idxCCS].Index = gun_index;
+								idxCCS ++;
 							}
 							else if (modelnameInfo.ParsingInfo[gun_index].GunType == Gun_Type_GB)
 							{
-								ShmSysConfigAndInfo->SysInfo.GbChargingData[gun_index].Index = gun_index;
+								ShmSysConfigAndInfo->SysInfo.GbChargingData[idxGB].Index = gun_index;
+								idxGB ++;
 							}
 							else if (modelnameInfo.ParsingInfo[gun_index].GunType == Gun_Type_AC)
 							{
-								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].Index = gun_index;
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[idxAC].Index = gun_index;
+								idxAC ++;
 							}
 						}
 					}
@@ -6125,6 +6157,35 @@ int main(void)
 						ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = OFF;
 						ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = OFF;
 
+						//lwtest
+						switch (ShmSysConfigAndInfo->SysConfig.ModelName[INTERNET_TYPE])
+						{
+							case 'E':
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = OFF;
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = OFF;
+
+								break;
+							case 'W':
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = ON;
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = OFF;
+
+								break;
+							case 'T':
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = OFF;
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = ON;
+
+								break;
+							case 'D':
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = ON;
+								ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = ON;
+
+								break;
+						}
+
 						// If Web Server OPCC URL is empty kill Module_OcppBackend
 						if ((strcmp((char *) &ShmSysConfigAndInfo->SysConfig.OcppServerURL, "") == 0))
 						{
@@ -6564,7 +6625,6 @@ int main(void)
 					//lwtest
 					if (getTargetChargingInfoData(gun_index)->schedule.isTriggerStop == ON)
 					{
-						DEBUG_INFO("LW debug Message : Command trigger stop.\n");
 						setChargerMode(gun_index, SYS_MODE_TERMINATING);
 					}
 
@@ -7266,6 +7326,7 @@ int main(void)
 				case SYS_MODE_BOOKING:
 					if (isModeChange(gun_index))
 					{
+						DEBUG_INFO("========== SYS_MODE_BOOKING (%d)========== \n", gun_index);
 					}
 
 					break;
@@ -7273,6 +7334,7 @@ int main(void)
 					if (isModeChange(gun_index))
 					{
 						setLedMotion(gun_index, LED_ACTION_DEBUG);
+						DEBUG_INFO("========== SYS_MODE_DEBUG (%d)========== \n", gun_index);
 					}
 
 					break;

BIN
EVSE/Projects/EVSE-Emulator/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/EVSE-Emulator/Images/ramdisk.gz


BIN
EVSE/rootfs/root/Module_Payment_Bazel8


BIN
EVSE/rootfs/root/Module_Payment_Enegate


BIN
EVSE/rootfs/root/Module_PowerSharing