Эх сурвалжийг харах

2020-04-09 /Edward Lien

1.Merge from AW-Regular DVT code.

Files:
1. As follow commit history

Image version: D0.16.60.6007.B0
Image checksum: XXXXXXXX

Hardware PWB P/n : xxxxxxxx
Hardware Version : XXXXXXXX
Edward Lien 5 жил өмнө
parent
commit
b5a85c06c7

+ 80 - 107
EVSE/Projects/BYTON-GB/Apps/main.c

@@ -29,7 +29,7 @@
 #define TMR_IDX_9 						9
 
 #define TIMEOUT_SPEC_HANDSHAKING		180000
-#define TIMEOUT_SPEC_AUTH				10000//30000
+#define TIMEOUT_SPEC_AUTH				10000
 #define TIMEOUT_SPEC_HANDSHAKING_LED	185000
 #define TIMEOUT_SPEC_LOGPPRINTOUT		20000
 
@@ -80,7 +80,7 @@ struct timeb					startChargingTime[AC_QUANTITY];
 struct timeb					endChargingTime[AC_QUANTITY];
 sqlite3 *localDb;
 
-struct SysConfigData			*SysConfigOrg;
+struct SysConfigData			SysConfigOrg;
 
 //=================================
 // Common routine
@@ -249,7 +249,6 @@ int CreatShareMemory()
 	int result = PASS;
 	int MeterSMId;
 
-
 	//creat ShmSysConfigAndInfo
 	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), IPC_CREAT | 0777)) < 0)
 	{
@@ -980,6 +979,9 @@ char* getSystemModeName(unsigned char mode)
 		case SYS_MODE_TERMINATING:
 			result = "terminating";
 			break;
+		case SYS_MODE_COMPLETE:
+			result = "Complete";
+			break;
 		case SYS_MODE_ALARM:
 			result = "alarm";
 			break;
@@ -1068,7 +1070,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.15.60.6007.BT");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.16.60.6007.BT");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -1205,21 +1207,27 @@ int upgrade_check()
 								{
 									if(ShmCharger->fwUpgradeInfo.fwType == CSU_USER_CONFIGURATION)
 									{
-										memcpy(&SysConfigOrg, &ShmSysConfigAndInfo->SysConfig, ARRAY_SIZE(SysConfigOrg));
+										DEBUG_INFO("Restore model name & serial number.\r\n");
+										memcpy(&SysConfigOrg, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
+
 										if(LoadSysConfigAndInfo(&ShmSysConfigAndInfo->SysConfig) != PASS)
 										{
+											DEBUG_INFO("Re-load configuration fail.\r\n");
 											result = FAIL;
 										}
 										else
 										{
-											memcpy(ShmSysConfigAndInfo->SysConfig.ModelName, SysConfigOrg->ModelName, ARRAY_SIZE(SysConfigOrg->ModelName));
-											memcpy(ShmSysConfigAndInfo->SysConfig.SerialNumber, SysConfigOrg->SerialNumber, ARRAY_SIZE(SysConfigOrg->SerialNumber));
-											memcpy(ShmSysConfigAndInfo->SysConfig.SystemId, SysConfigOrg->SystemId, ARRAY_SIZE(SysConfigOrg->SystemId));
+											memcpy(&ShmSysConfigAndInfo->SysConfig.ModelName, &SysConfigOrg.ModelName, ARRAY_SIZE(SysConfigOrg.ModelName));
+											memcpy(&ShmSysConfigAndInfo->SysConfig.SerialNumber, &SysConfigOrg.SerialNumber, ARRAY_SIZE(SysConfigOrg.SerialNumber));
+											memcpy(&ShmSysConfigAndInfo->SysConfig.SystemId, &SysConfigOrg.SystemId, ARRAY_SIZE(SysConfigOrg.SystemId));
 
 											if(StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig) != PASS)
 											{
+												DEBUG_INFO("Re-write configuration fail.\r\n");
 												result = FAIL;
 											}
+											else
+												DEBUG_INFO("Re-write configuration OK.\r\n");
 										}
 									}
 								}
@@ -1891,37 +1899,6 @@ void checkConnectionTimeout()
 	}
 }
 
-int isStopTransactionOnInvalidId(uint8_t gun_index)
-{
-	int result = NO;
-
-	if((strcmp((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemData, "TRUE") == 0) && ShmOCPP16Data->OcppConnStatus)
-	{
-		if((strcmp((char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status ,"Accepted") == 0))
-		{
-			ShmCharger->gun_info[gun_index].isDeAuthorized = OFF;
-			result = NO;
-		}
-		else
-		{
-			ShmCharger->gun_info[gun_index].isDeAuthorized = ON;
-			result = YES;
-		}
-	}
-	else
-	{
-		ShmCharger->gun_info[gun_index].isDeAuthorized = OFF;
-		result = NO;
-	}
-
-	DEBUG_INFO("AllowOfflineTxForUnknownId: %s...\r\n",ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemData);
-	DEBUG_INFO("ShmOCPP16Data->OcppConnStatus: %d...\r\n",ShmOCPP16Data->OcppConnStatus);
-	DEBUG_INFO("isDeAuthorized : %d\r\n",ShmCharger->gun_info[gun_index].isDeAuthorized);
-	DEBUG_INFO("ResponseIdTagInfo : %s\r\n",(char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status);
-
-	return result;
-}
-
 //===============================================
 // Main process
 //===============================================
@@ -1931,7 +1908,6 @@ int main(void)
 	if(CreatShareMemory()==0)
 	{
 		DEBUG_ERROR("CreatShareMemory NG\r\n");
-
 		if(ShmStatusCodeData!=NULL)
 		{
 			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
@@ -2218,7 +2194,6 @@ int main(void)
 					{
 						setLedMotion(gun_index,LED_ACTION_IDLE);
 						setRelay(gun_index,OFF);
-						ShmCharger->gun_info[gun_index].isDeAuthorized = OFF;
 						ShmCharger->gun_info[gun_index].isGunPlugged = NO;
 						ShmCharger->gun_info[gun_index].rfidReq = OFF;
 						ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart = OFF;
@@ -2521,8 +2496,7 @@ int main(void)
 					   (ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq == ON)||
 					   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState != CP_STATE_C) ||
 					   (ShmOCPP16Data->MsMsg.bits.ResetReq) ||
-					   (ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON) ||
-					   (isStopTransactionOnInvalidId(gun_index) == YES))
+					   (ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON))
 					{
 						setChargerMode(gun_index, SYS_MODE_TERMINATING);
 					}
@@ -2537,7 +2511,9 @@ int main(void)
 
 						// Response StartTransactionConf
 						if(ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionConf == ON)
+						{
 							ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionConf = OFF;
+						}
 
 						// Checking profile id > 0 and current time is between charging profile validFrom & validTo
 						if((ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfileId>0) &&
@@ -2838,88 +2814,34 @@ int main(void)
 					}
 
 					// End authorize pass
-					if(((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID) && (ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index)) ||
+					if(((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index)) ||
 					   (ShmCharger->gun_info[gun_index].isAuthPassEnd) ||
-					   ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE) && (ShmCharger->gun_info[gun_index].bleConfigData.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) && (strcmp((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnEVSideDisconnect].ItemData, "TRUE") == 0)) ||
 					   (ShmOCPP16Data->MsMsg.bits.ResetReq) ||
-					   (ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON) ||
-					   (isStopTransactionOnInvalidId(gun_index) == YES))
+					   (ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON))
 					{
-						//if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == ON)
-							//setSpeaker(ON,SPEAKER_SHORT);
-						
-						if((ShmCharger->gun_info[gun_index].primaryMcuState.relay_state)&&(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == ON))
+						if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == ON)
 						{
-							if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState != CP_STATE_A) )
+							if(((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index)) ||
+							   (ShmCharger->gun_info[gun_index].isAuthPassEnd))
 							{
 								DEBUG_INFO("End Authorize pass.\r\n");						
 								//setSpeaker(ON,SPEAKER_SHORT);
 								setLedMotion(gun_index,LED_ACTION_RFID_PASS);
 								sleep(3);		
 							}
-							else
-							{}
 						}
 						else
 						{}
-					
+
 						setRelay(gun_index, OFF);
-						setLedMotion(gun_index,LED_ACTION_STOP);
-						
+						setLedMotion(gun_index, LED_ACTION_STOP);
+
 						if(!ShmCharger->gun_info[gun_index].primaryMcuState.relay_state)
 						{
-
-						
-							if(ShmOCPP16Data->MsMsg.bits.ResetReq)
-							{
-								if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard")==0)
-									sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "HardReset");
-								else
-									sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "SoftReset");
-							}
-							else if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq)
-							{
-								sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Remote");
-							}
-							else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
-							{
-								sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Local");
-							}
-							else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
-							{
-								sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "EVDisconnected");
-							}
-							else if(ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON)
-							{
-								sprintf((char*)ShmOCPP16Data->StopTransaction[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].StopReason, "UnlockCommand");
-								sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "Unlocked");
-								ShmOCPP16Data->CsMsg.bits[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].UnlockConnectorConf = ON;
-							}
-							else if(ShmCharger->gun_info[gun_index].isDeAuthorized == ON)
-							{
-								sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "DeAuthorized");
-							}
-							else
-							{
-								sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Other");
-							}
-
-							DEBUG_INFO("Gun-%d : StopReason [%s]...\r\n.",gun_index,ShmOCPP16Data->StopTransaction[gun_index].StopReason);
-
-							memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
-							ShmOCPP16Data->StopTransaction[gun_index].MeterStop = (ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100);
-							ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = ON;
-
-							ShmCharger->gun_info[gun_index].isDeAuthorized = OFF;
-							ShmCharger->gun_info[gun_index].rfidReq = OFF;
-							ShmCharger->gun_info[gun_index].isAuthPassEnd = OFF;
-							ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
-							ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq = OFF;
-
-							DB_Insert_Record(localDb, gun_index);
-							setChargerMode(gun_index, SYS_MODE_IDLE);
+							setChargerMode(gun_index, SYS_MODE_COMPLETE);
 						}
 					}
 					else
@@ -2937,6 +2859,57 @@ int main(void)
 							setChargerMode(gun_index, SYS_MODE_CHARGING);
 						}
 					}
+					break;
+				case SYS_MODE_COMPLETE:
+					if(isModeChange(gun_index))
+					{
+						setLedMotion(gun_index, LED_ACTION_STOP);
+					}
+
+					if(ShmOCPP16Data->MsMsg.bits.ResetReq)
+					{
+						if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard")==0)
+							sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "HardReset");
+						else
+							sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "SoftReset");
+					}
+					else if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq)
+					{
+						sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Remote");
+					}
+					else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
+					{
+						sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Local");
+					}
+					else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
+					{
+						sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "EVDisconnected");
+					}
+					else if(ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON)
+					{
+						sprintf((char*)ShmOCPP16Data->StopTransaction[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].StopReason, "UnlockCommand");
+						sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "Unlocked");
+						ShmOCPP16Data->CsMsg.bits[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].UnlockConnectorConf = ON;
+					}
+					else
+					{
+						sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Other");
+					}
+
+					DEBUG_INFO("Gun-%d : StopReason [ %s ]...\r\n.",gun_index,ShmOCPP16Data->StopTransaction[gun_index].StopReason);
+
+					memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
+					ShmOCPP16Data->StopTransaction[gun_index].MeterStop = (ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100);
+					ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = ON;
+
+					ShmCharger->gun_info[gun_index].rfidReq = OFF;
+					ShmCharger->gun_info[gun_index].isAuthPassEnd = OFF;
+					ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
+					ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq = OFF;
+
+					DB_Insert_Record(localDb, gun_index);
+					setChargerMode(gun_index, SYS_MODE_IDLE);
+
 					break;
 				case SYS_MODE_ALARM:
 					if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode == 0))

+ 0 - 1
EVSE/Projects/BYTON-GB/Apps/main.h

@@ -427,7 +427,6 @@ typedef struct GUN_INFO
 	uint16_t											isSetBreatheLedTiming:1;
 	uint16_t											isSetLedBrightness:1;
 	uint16_t											isUnlockerConnetor:1;
-	uint16_t											isDeAuthorized:1;
 	uint16_t											isGunPlug:1;
 	uint16_t											isHandshakeTimeOn:1;
 }Gun_Info;

BIN
EVSE/Projects/BYTON-GB/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/BYTON-GB/Images/MLO


BIN
EVSE/Projects/BYTON-GB/Images/ramdisk.gz


BIN
EVSE/Projects/BYTON-GB/Images/ramdisk_merged.gz


BIN
EVSE/Projects/BYTON-GB/Images/u-boot.img


BIN
EVSE/Projects/BYTON-GB/Images/zImage


+ 1 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_System.map

@@ -70318,7 +70318,7 @@ c0d4b848 T __initramfs_start
 c0d4b848 t __irf_start
 c0d4b848 T __security_initcall_end
 c0d4b848 T __security_initcall_start
-c0d4b8cf t __irf_end
+c0d4b8ce t __irf_end
 c0d4b8d0 T __initramfs_size
 c0e00000 D __data_loc
 c0e00000 D __init_end

+ 1 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms1.S

@@ -70319,7 +70319,7 @@ kallsyms_offsets:
 	.long	0xc43848
 	.long	0xc43848
 	.long	0xc43848
-	.long	0xc438cf
+	.long	0xc438ce
 	.long	0xc438d0
 	.long	0xcf8000
 	.long	0xcf8000

+ 1 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms2.S

@@ -70319,7 +70319,7 @@ kallsyms_offsets:
 	.long	0xd43848
 	.long	0xd43848
 	.long	0xd43848
-	.long	0xd438cf
+	.long	0xd438ce
 	.long	0xd438d0
 	.long	0xdf8000
 	.long	0xdf8000

BIN
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux1


BIN
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux2


+ 1 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version

@@ -1 +1 @@
-41
+43