浏览代码

2020.01.22 / Folus Wen

Actions:
1. EVSE/Projects/AW-Regular/Apps/main.c RFID & BLE operation flag change to gun_info structure.

Files:
1. As follow commit history

Image version: D0.04.XX.XXXX.PH
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 5 年之前
父节点
当前提交
aec5580814
共有 2 个文件被更改,包括 35 次插入37 次删除
  1. 30 33
      EVSE/Projects/AW-Regular/Apps/main.c
  2. 5 4
      EVSE/Projects/AW-Regular/Apps/main.h

+ 30 - 33
EVSE/Projects/AW-Regular/Apps/main.c

@@ -897,7 +897,7 @@ void get_firmware_version(unsigned char gun_index)
 	}
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.03.40.0007.PH");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.04.40.0007.PH");
 
 	// Get MCU firmware version
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
@@ -1498,11 +1498,11 @@ int main(void)
 		//==========================================
 		// Check RFID
 		//==========================================
-		if(!ShmCharger->rfidReq)
+		if(!ShmCharger->gun_info[ShmCharger->gun_selectd].rfidReq)
 		{
 			if(GetCardSerialNumber()!= FAIL)
 			{
-				ShmCharger->rfidReq = ON;
+				ShmCharger->gun_info[ShmCharger->gun_selectd].rfidReq = ON;
 			}
 		}
 
@@ -1588,6 +1588,8 @@ int main(void)
 					   ShmCharger->gun_info[gun_index].mcuFlag.isSetModelNamePass &&
 					   ShmCharger->gun_info[gun_index].mcuFlag.isSetSerialNumberPass)
 					{
+						ShmCharger->gun_selectd = 0;
+
 						// Firmware version
 						get_firmware_version(gun_index);
 
@@ -1612,9 +1614,9 @@ int main(void)
 					{
 						setLedMotion(gun_index,LED_ACTION_IDLE);
 						setRelay(gun_index,OFF);
-						ShmCharger->rfidReq = OFF;
-						ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStart = OFF;
-						ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStop = OFF;
+						ShmCharger->gun_info[gun_index].rfidReq = OFF;
+						ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart = OFF;
+						ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
 						ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq = OFF;
 						ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq = OFF;
 						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode = 0x00;
@@ -1625,15 +1627,15 @@ int main(void)
 					}
 
 					if(((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_FREE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B)) ||
-					   (ShmCharger->rfidReq == ON) ||
-					   (ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStart == ON) ||
+					   (ShmCharger->gun_info[gun_index].rfidReq == ON) ||
+					   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart == ON) ||
 					   (ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq == ON))
 					{
 						// Clean User id & Card Number
 						memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
 						memset(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].CardNumber, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].CardNumber));
 
-						if((ShmCharger->rfidReq == ON))
+						if((ShmCharger->gun_info[gun_index].rfidReq == ON))
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_RFID;
 							DEBUG_INFO("Start Method : RFID...\r\n");
@@ -1689,7 +1691,7 @@ int main(void)
 							memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, ARRAY_SIZE(ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag));
 							DEBUG_INFO("Start Method : BACKEND...\r\n");
 						}
-						else if(ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStart == ON)
+						else if(ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart == ON)
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BLE;
 							memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmCharger->gun_info[gun_index].bleLoginCentralId.id, ARRAY_SIZE(ShmCharger->gun_info[gun_index].bleLoginCentralId.id));
@@ -1701,9 +1703,9 @@ int main(void)
 							DEBUG_INFO("Start Method : FREE..\r\n");
 						}
 
-						ShmCharger->rfidReq = OFF;
+						ShmCharger->gun_info[gun_index].rfidReq = OFF;
 						ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq = OFF;
-						ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStart = OFF;
+						ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart = OFF;
 
 						setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
 					}
@@ -1721,8 +1723,6 @@ int main(void)
 						{
 							switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
 							{
-								case AUTH_MODE_PH_RFID:
-									break;
 								case AUTH_MODE_BACKEND_OCPP:
 									if(ShmOCPP16Data->OcppConnStatus)
 									{
@@ -1747,8 +1747,6 @@ int main(void)
 										}
 									}
 									break;
-								case AUTH_MODE_BACKEND_PH:
-									break;
 								case AUTH_MODE_FREE:
 								default:
 									break;
@@ -1760,7 +1758,7 @@ int main(void)
 					{
 
 						 // Authorization timeout process.
-						ShmCharger->rfidReq = OFF;
+						ShmCharger->gun_info[gun_index].rfidReq = OFF;
 						setChargerMode(gun_index, SYS_MODE_IDLE);
 						DEBUG_WARN("Authorize timeout!\r\n");
 					}
@@ -1790,7 +1788,7 @@ int main(void)
 										setChargerMode(gun_index, SYS_MODE_IDLE);
 									}
 
-									ShmCharger->rfidReq = OFF;
+									ShmCharger->gun_info[gun_index].rfidReq = OFF;
 									ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
 								}
 								break;
@@ -1828,7 +1826,9 @@ int main(void)
 						ShmOCPP16Data->StartTransaction[gun_index].MeterStart = ((float)ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100);
 						memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
 
+						memcpy((char*)ShmOCPP16Data->StartTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StartTransaction[gun_index].IdTag));
 						ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq = ON;
+
 						setChargerMode(gun_index, SYS_MODE_CHARGING);
 					}
 					else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B))
@@ -1840,20 +1840,20 @@ int main(void)
 				case SYS_MODE_CHARGING:
 					if(isModeChange(gun_index))
 					{
-						ShmCharger->rfidReq = OFF;
+						ShmCharger->gun_info[gun_index].rfidReq = OFF;
 						ftime(&startChargingTime[gun_index]);
 					}
 
-					if((ShmCharger->rfidReq == ON) ||
-					   (ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStop == ON) ||
+					if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
+					   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop == ON) ||
 					   (ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq == ON)||
 					   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState != CP_STATE_C) ||
 					   ShmOCPP16Data->MsMsg.bits.ResetReq)
 					{
 						// If RFID SN different with start user, it need to authorize ID
-						if((ShmCharger->rfidReq == ON) && !isMatchStartUser(gun_index))
+						if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
 						{
-							ShmCharger->rfidReq = OFF;
+							ShmCharger->gun_info[gun_index].rfidReq = OFF;
 							if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH)
 							{
 								// Request authorization
@@ -1905,8 +1905,6 @@ int main(void)
 								{
 									switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
 									{
-										case AUTH_MODE_PH_RFID:
-											break;
 										case AUTH_MODE_BACKEND_OCPP:
 											if(ShmOCPP16Data->OcppConnStatus)
 											{
@@ -1931,8 +1929,6 @@ int main(void)
 												}
 											}
 											break;
-										case AUTH_MODE_BACKEND_PH:
-											break;
 										case AUTH_MODE_FREE:
 										default:
 											break;
@@ -1953,7 +1949,7 @@ int main(void)
 										setChargerMode(gun_index, SYS_MODE_TERMINATING);
 									}
 
-									ShmCharger->rfidReq = OFF;
+									ShmCharger->gun_info[gun_index].rfidReq = OFF;
 									ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
 								}
 							}
@@ -1991,9 +1987,9 @@ int main(void)
 						}
 					}
 
-					if(((ShmCharger->rfidReq == ON) && isMatchStartUser(gun_index)) ||
+					if(((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index)) ||
 					   (ShmCharger->gun_info[gun_index].isAuthPassEnd) ||
-					   (ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStop == ON) ||
+					   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop == ON) ||
 					   (ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq == ON) ||
 					   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) ||
 					   ShmOCPP16Data->MsMsg.bits.ResetReq)
@@ -2017,7 +2013,7 @@ int main(void)
 							{
 								sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Remote");
 							}
-							else if(ShmCharger->rfidReq || ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStop)
+							else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
 							{
 								sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Local");
 							}
@@ -2030,6 +2026,7 @@ int main(void)
 								sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Other");
 							}
 
+							memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
 							ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = ON;
 						}
 
@@ -2037,9 +2034,9 @@ int main(void)
 
 						if(!ShmCharger->gun_info[gun_index].primaryMcuState.relay_state)
 						{
-							ShmCharger->rfidReq = OFF;
+							ShmCharger->gun_info[gun_index].rfidReq = OFF;
 							ShmCharger->gun_info[gun_index].isAuthPassEnd = OFF;
-							ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStop = OFF;
+							ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
 							ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq = OFF;
 
 							setChargerMode(gun_index, SYS_MODE_IDLE);

+ 5 - 4
EVSE/Projects/AW-Regular/Apps/main.h

@@ -380,6 +380,7 @@ typedef struct GUN_INFO
 	Gun_Plugin_Times								gunPluginTimes;
 	Mcu_Reset_Request								mcuResetRequest;
 	uint8_t											isAuthPassEnd:1;
+	uint8_t											rfidReq:1;
 }Gun_Info;
 
 struct Charger
@@ -389,10 +390,10 @@ struct Charger
 	Gun_Info 				gun_info[2];
 	Fw_Upgrade_Info			fwUpgradeInfo;
 	
-	unsigned char 			speaker_type;
-	unsigned char			rfidReq:1;
-	unsigned char			isSpeakerOn:1;
-	unsigned char 			isUpdateSuccess:1;
+	uint8_t					gun_selectd;
+	uint8_t	 				speaker_type;
+	uint8_t					isSpeakerOn:1;
+	uint8_t		 			isUpdateSuccess:1;
 };
 
 #endif /* CONFIG_MAIN_H_ */