Răsfoiți Sursa

2021.07.22 / Wendell

Actions:
1. fix share memory fail after merge master
2. fix factory issue
3. remove add command from replaceOtherDD360Project.sh
4. extend delay time of update psu output to 5s
5. fix DisplayChargingInfo logic
6. fix update psu output logic

Files:
1. As follow as commit history.

Image version : V1.11.XX.XXXX.XX
Jerry_Wang 3 ani în urmă
părinte
comite
10180e646e
69 a modificat fișierele cu 494 adăugiri și 143 ștergeri
  1. 100 4
      EVSE/Modularization/ocpp20/MessageHandler.c
  2. 110 14
      EVSE/Modularization/ocppfiles/MessageHandler.c
  3. 13 10
      EVSE/Projects/DD360/Apps/CSU/main.c
  4. 2 0
      EVSE/Projects/DD360/Apps/Define/define.h
  5. 6 4
      EVSE/Projects/DD360/Apps/FactoryConfig.c
  6. 1 1
      EVSE/Projects/DD360/Apps/Makefile
  7. 16 4
      EVSE/Projects/DD360/Apps/ModuleEvComm/Module_EvRxComm.c
  8. 28 10
      EVSE/Projects/DD360/Apps/ModuleEvComm/Module_EvTxComm.c
  9. 1 1
      EVSE/Projects/DD360/Apps/Script/init.sh
  10. 4 4
      EVSE/Projects/DD360/Apps/Script/replaceOtherDD360Project.sh
  11. BIN
      EVSE/Projects/DD360/Apps/UnsafetyOutputTask
  12. BIN
      EVSE/Projects/DD360/Images/FactoryDefaultConfig.bin
  13. BIN
      EVSE/Projects/DD360/Images/ramdisk.gz
  14. BIN
      EVSE/Projects/DD360/output/FactoryConfig
  15. BIN
      EVSE/Projects/DD360/output/Module_DoComm
  16. BIN
      EVSE/Projects/DD360/output/Module_EvComm
  17. BIN
      EVSE/Projects/DD360/output/Module_EventLogging
  18. BIN
      EVSE/Projects/DD360/output/Module_InternalComm
  19. BIN
      EVSE/Projects/DD360/output/Module_LcmControl
  20. BIN
      EVSE/Projects/DD360/output/Module_PrimaryComm
  21. BIN
      EVSE/Projects/DD360/output/ReadCmdline
  22. 1 1
      EVSE/Projects/DD360/output/init.sh
  23. BIN
      EVSE/Projects/DD360/output/main
  24. 13 10
      EVSE/Projects/DD360Audi/Apps/CSU/main.c
  25. 2 0
      EVSE/Projects/DD360Audi/Apps/Define/define.h
  26. 6 4
      EVSE/Projects/DD360Audi/Apps/FactoryConfig.c
  27. 1 1
      EVSE/Projects/DD360Audi/Apps/Makefile
  28. 16 4
      EVSE/Projects/DD360Audi/Apps/ModuleEvComm/Module_EvRxComm.c
  29. 28 10
      EVSE/Projects/DD360Audi/Apps/ModuleEvComm/Module_EvTxComm.c
  30. 1 1
      EVSE/Projects/DD360Audi/Apps/Script/init.sh
  31. 4 4
      EVSE/Projects/DD360Audi/Apps/Script/replaceOtherDD360Project.sh
  32. BIN
      EVSE/Projects/DD360Audi/Images/FactoryDefaultConfig.bin
  33. BIN
      EVSE/Projects/DD360Audi/Images/ramdisk.gz
  34. BIN
      EVSE/Projects/DD360Audi/output/FactoryConfig
  35. BIN
      EVSE/Projects/DD360Audi/output/Module_DoComm
  36. BIN
      EVSE/Projects/DD360Audi/output/Module_EvComm
  37. BIN
      EVSE/Projects/DD360Audi/output/Module_EventLogging
  38. BIN
      EVSE/Projects/DD360Audi/output/Module_InternalComm
  39. BIN
      EVSE/Projects/DD360Audi/output/Module_LcmControl
  40. BIN
      EVSE/Projects/DD360Audi/output/Module_PrimaryComm
  41. BIN
      EVSE/Projects/DD360Audi/output/ReadCmdline
  42. 1 1
      EVSE/Projects/DD360Audi/output/init.sh
  43. BIN
      EVSE/Projects/DD360Audi/output/main
  44. 13 10
      EVSE/Projects/DD360ComBox/Apps/CSU/main.c
  45. 2 0
      EVSE/Projects/DD360ComBox/Apps/Define/define.h
  46. 6 4
      EVSE/Projects/DD360ComBox/Apps/FactoryConfig.c
  47. 1 1
      EVSE/Projects/DD360ComBox/Apps/Makefile
  48. 16 4
      EVSE/Projects/DD360ComBox/Apps/ModuleEvComm/Module_EvRxComm.c
  49. 28 10
      EVSE/Projects/DD360ComBox/Apps/ModuleEvComm/Module_EvTxComm.c
  50. 1 1
      EVSE/Projects/DD360ComBox/Apps/Script/init.sh
  51. 4 4
      EVSE/Projects/DD360ComBox/Apps/Script/replaceOtherDD360Project.sh
  52. BIN
      EVSE/Projects/DD360ComBox/Apps/UnsafetyOutputTask
  53. BIN
      EVSE/Projects/DD360ComBox/Images/FactoryDefaultConfig.bin
  54. BIN
      EVSE/Projects/DD360ComBox/Images/ramdisk.gz
  55. BIN
      EVSE/Projects/DD360ComBox/output/FactoryConfig
  56. BIN
      EVSE/Projects/DD360ComBox/output/Module_DoComm
  57. BIN
      EVSE/Projects/DD360ComBox/output/Module_EvComm
  58. BIN
      EVSE/Projects/DD360ComBox/output/Module_EventLogging
  59. BIN
      EVSE/Projects/DD360ComBox/output/Module_InternalComm
  60. BIN
      EVSE/Projects/DD360ComBox/output/Module_LcmControl
  61. BIN
      EVSE/Projects/DD360ComBox/output/Module_PrimaryComm
  62. BIN
      EVSE/Projects/DD360ComBox/output/ReadCmdline
  63. 1 1
      EVSE/Projects/DD360ComBox/output/init.sh
  64. BIN
      EVSE/Projects/DD360ComBox/output/main
  65. 2 0
      EVSE/Projects/define.h
  66. 3 1
      EVSE/rootfs/var/www/ocpp_upload.php
  67. 5 5
      Makefile
  68. 7 1
      board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/common/autoboot.c
  69. 51 13
      board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/include/configs/am335x_evm.h

+ 100 - 4
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -875,6 +875,96 @@ typedef union
 }CpinitiateMsg;
 
 CpinitiateMsg cpinitateMsg;
+
+//=========================================
+// Save configuration
+//=========================================
+int runShellCmd(const char*cmd)
+{
+	int result = FAIL;
+	char buf[256];
+	FILE *fp;
+
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			DEBUG_INFO("%s\n", buf);
+		}
+
+		result = PASS;
+	}
+	pclose(fp);
+
+	return result;
+}
+
+int StoreUsrConfigData(struct SysConfigData *UsrData)
+{
+	int result = PASS;
+	int fd,wrd;
+	unsigned int i,Chk;
+	unsigned char *ptr, *BufTmp;
+	int MtdBlockSize = 0x300000;
+
+	Chk=0;
+	ptr=(unsigned char *)UsrData;
+	if((BufTmp=malloc(MtdBlockSize))!=NULL)
+	{
+		memset(BufTmp,0,MtdBlockSize);
+		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
+			Chk+=*(BufTmp+i);
+		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
+
+		// Output configuration to file.
+		fd = open("/mnt/EvseConfig.bin", O_RDWR|O_CREAT);
+		if (fd < 0)
+		{
+			DEBUG_ERROR("open /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		wrd=write(fd, BufTmp, MtdBlockSize);
+		close(fd);
+		if(wrd<MtdBlockSize)
+		{
+			DEBUG_ERROR("write /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		DEBUG_INFO("EvseConfig write to file in /mnt OK.\n");
+
+
+		DEBUG_INFO("Erase /dev/mtd10.\n");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
+		DEBUG_INFO("Write /dev/mtd10.\n");
+		runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
+
+		DEBUG_INFO("Erase /dev/mtd11.\n");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
+		DEBUG_INFO("Write /dev/mtd11.\n");
+		runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
+
+
+		system("rm -f /mnt/EvseConfig.bin");
+		DEBUG_INFO("EvseConfig write to flash OK\n");
+	}
+	else
+	{
+		DEBUG_ERROR("alloc BlockSize NG\r\n");
+			result = FAIL;
+	}
+
+	if(BufTmp!=NULL)
+		free(BufTmp);
+
+	return result;
+}
+
 //=========================================
 // Date time related function
 //=========================================
@@ -2124,7 +2214,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableCharacteristics.maxLimit = 40;
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_WriteOnly]);
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableAttribute[0].value, " ");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableAttribute[0].value, "%s", ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword);
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword]);
 
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_Identity].component.name, "SecurityCtrlr");
@@ -2158,7 +2248,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_SecurityProfile].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_integer]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_SecurityProfile].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_SecurityProfile].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
-		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_SecurityProfile].variableAttribute[0].value, "0");
+		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_SecurityProfile].variableAttribute[0].value, "%d", ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_SecurityProfile]);
 
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_AdditionalRootCertificateCheck].component.name, "SecurityCtrlr");
@@ -12585,7 +12675,7 @@ void* GetLogProcess(void* data)
 				   protocol, user, password, host, &port, path);
 	}
 
-	if((strcmp(protocol,"ftp")!=0)&&(strcmp(protocol,"http")!=0))
+	if((strcmp(protocol,"ftp")!=0)&&(strcmp(protocol,"http")!=0)&&(strcmp(protocol,"https")!=0))
 	{
 		DEBUG_INFO("protocol is not ftp/http ! \n");
 		sprintf((char*)ShmOCPP20Data->LogStatusNotification.status, "%s", UploadLogStatusEnumTypeStr[UploadLogStatusEnumType_UploadFailure]);
@@ -15120,6 +15210,12 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 							}
 							else
 								strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_Accepted]);
+
+							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "SecurityCtrlr") != NULL) &&
+							   ((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "SecurityProfile") != NULL) || (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "BasicAuthPassword") != NULL)))
+							{
+								StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
+							}
 						}
 					}
 				}
@@ -17039,7 +17135,7 @@ uint8_t GetOcppSecurityProfile()
 
 void GetOcppChargerBoxId(uint8_t *data)
 {
-	sprintf((char*)data, "%s", ShmOCPP20Data->ChargeBoxId);
+	sprintf((char*)data, "%s", ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
 }
 
 void GetOcppSecurityPassword(uint8_t *data)

+ 110 - 14
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -405,6 +405,95 @@ static char * UnitOfMeasureStr[] = {
 	MACROSTR(Percent)
 };
 
+//=========================================
+// Save configuration
+//=========================================
+int runShellCmd(const char*cmd)
+{
+	int result = FAIL;
+	char buf[256];
+	FILE *fp;
+
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			DEBUG_INFO("%s\n", buf);
+		}
+
+		result = PASS;
+	}
+	pclose(fp);
+
+	return result;
+}
+
+int StoreUsrConfigData(struct SysConfigData *UsrData)
+{
+	int result = PASS;
+	int fd,wrd;
+	unsigned int i,Chk;
+	unsigned char *ptr, *BufTmp;
+	int MtdBlockSize = 0x300000;
+
+	Chk=0;
+	ptr=(unsigned char *)UsrData;
+	if((BufTmp=malloc(MtdBlockSize))!=NULL)
+	{
+		memset(BufTmp,0,MtdBlockSize);
+		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
+			Chk+=*(BufTmp+i);
+		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
+
+		// Output configuration to file.
+		fd = open("/mnt/EvseConfig.bin", O_RDWR|O_CREAT);
+		if (fd < 0)
+		{
+			DEBUG_ERROR("open /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		wrd=write(fd, BufTmp, MtdBlockSize);
+		close(fd);
+		if(wrd<MtdBlockSize)
+		{
+			DEBUG_ERROR("write /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		DEBUG_INFO("EvseConfig write to file in /mnt OK.\n");
+
+
+		DEBUG_INFO("Erase /dev/mtd10.\n");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
+		DEBUG_INFO("Write /dev/mtd10.\n");
+		runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
+
+		DEBUG_INFO("Erase /dev/mtd11.\n");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
+		DEBUG_INFO("Write /dev/mtd11.\n");
+		runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
+
+
+		system("rm -f /mnt/EvseConfig.bin");
+		DEBUG_INFO("EvseConfig write to flash OK\n");
+	}
+	else
+	{
+		DEBUG_ERROR("alloc BlockSize NG\r\n");
+			result = FAIL;
+	}
+
+	if(BufTmp!=NULL)
+		free(BufTmp);
+
+	return result;
+}
+
 //=========================================
 // Sqlite3 related function
 //=========================================
@@ -9012,7 +9101,7 @@ void* GetDiagnosticsProcess(void* data)
 				   protocol, user, password, host, &port, path);
 	}
 
-	if((strcmp(protocol,"ftp")!=0)&&(strcmp(protocol,"http")!=0))
+	if((strcmp(protocol,"ftp")!=0)&&(strcmp(protocol,"http")!=0)&&(strcmp(protocol,"https")!=0))
 	{
 		DEBUG_INFO("protocol is not ftp/http ! \n");
 		sprintf((char*)ShmOCPP16Data->DiagnosticsStatusNotification.Status, "%s", DiagnosticsStatusStr[DiagnosticsStatus_UploadFailed]);
@@ -11017,8 +11106,8 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 				{
-					if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_CHARGING) ||
-					   (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_TERMINATING)) // S_CHARGING
+					if((SYS_MODE_PREPARING <= ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus) &&
+					   (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_TERMINATING)) // S_CHARGING
 					{
 						if(transactionIdInt == ShmOCPP16Data->StartTransaction[connectorIdInt -1].ResponseTransactionId)
 						{
@@ -11044,8 +11133,8 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 				{
-					if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_CHARGING) ||
-					   (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_TERMINATING)) // S_CHARGING
+					if((SYS_MODE_PREPARING <= ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus) &&
+					   (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_TERMINATING)) // S_CHARGING
 					{
 						if(transactionIdInt == ShmOCPP16Data->StartTransaction[connectorIdInt -1].ResponseTransactionId)
 						{
@@ -11072,8 +11161,8 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 				{
-					if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_CHARGING) ||
-					   (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_TERMINATING)) // S_CHARGING
+					if((SYS_MODE_PREPARING <= ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus) &&
+					   (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus <= SYS_MODE_TERMINATING)) // S_CHARGING
 					{
 						if(transactionIdInt == ShmOCPP16Data->StartTransaction[connectorIdInt -1].ResponseTransactionId)
 						{
@@ -11092,8 +11181,8 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
 				{
-					if((ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_CHARGING) ||
-					   (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_TERMINATING)) // S_CHARGING
+					if((SYS_MODE_PREPARING <= ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus) &&
+					   (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus <= SYS_MODE_TERMINATING)) // S_CHARGING
 					{
 						if(transactionIdInt == ShmOCPP16Data->StartTransaction[connectorIdInt -1].ResponseTransactionId)
 						{
@@ -12997,14 +13086,14 @@ int initialConfigurationTable(void)
 		// AuthorizationKey
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility = 1;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemName, "AuthorizationKey");
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "" );
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, (char*)ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword);
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthorizationKey", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData);
 
 		// SecurityProfile
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemAccessibility = 1;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemName, "SecurityProfile");
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "0" );
+		sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "%d", ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","SecurityProfile", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData);
 
@@ -13405,13 +13494,14 @@ int initialConfigurationTable(void)
 				if(strcmp(keystr, "AuthorizationKey") == 0)
 				{
 					ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
-					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "%s", valuestr);
+					//sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "%s", valuestr);
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "%s", ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword);
 				}
 
 				if(strcmp(keystr, "SecurityProfile") == 0)
 				{
 					ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
-					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "%d", atoi(valuestr) );
+					sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "%d", ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
 				}
 
 				if(strcmp(keystr, "DefaultPrice") == 0)
@@ -15734,6 +15824,9 @@ int setKeyValue(char *key, char *value)
     	{
     		strcpy(str, (const char*)value);
     		sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "%s", str);
+    		strcpy((char*)ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword, (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData);
+    		StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
+
     		isSuccess = ConfigurationStatus_Accepted;
     	}
     	else
@@ -15760,6 +15853,9 @@ int setKeyValue(char *key, char *value)
     			if(atoi((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData) <= (check_ascii - 0x30))
     			{
     				sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "%d", atoi(value) );
+    				ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile = atoi(value);
+    				StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
+
     				isSuccess = ConfigurationStatus_Accepted;
     			}
     			else
@@ -17622,7 +17718,7 @@ uint8_t GetOcppSecurityProfile()
 
 void GetOcppChargerBoxId(uint8_t *data)
 {
-	sprintf((char*)data, "%s", ShmOCPP16Data->ChargeBoxId);
+	sprintf((char*)data, "%s", ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
 }
 
 void GetOcppSecurityPassword(uint8_t *data)

+ 13 - 10
EVSE/Projects/DD360/Apps/CSU/main.c

@@ -77,7 +77,7 @@ uint8_t bd0_2_status = 0;
 uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
-char *fwVersion = "V1.10.00.0000.00"; // "V0.16.00.0000.00";
+char *fwVersion = "V1.11.00.0000.00"; // "V0.16.00.0000.00";
 
 //sqlite3 *localDb;
 bool isDb_ready;
@@ -1056,7 +1056,7 @@ int LoadSysConfigAndInfo()
             if (ChkSum != ChkSumOrg) {
                 log_warn("factory default  SysConfigData checksum NG, restore factory default\n");
                 free(buf);
-                system("cd /root;./Module_FactoryConfig -m");
+                system("cd /root;./FactoryConfig -m");
                 system("rm -f /Storage/OCPP/OCPPConfiguration");
                 system("sync");
                 sleep(5);
@@ -1108,7 +1108,7 @@ int LoadSysConfigAndInfo()
             log_info("SystemId over length.\n");
         }
 
-        system("cd /root;./Module_FactoryConfig -m");
+        system("cd /root;./FactoryConfig -m");
         sleep(3);
         system("/usr/bin/run_evse_restart.sh");
     }
@@ -1487,7 +1487,7 @@ void DisplayChargingInfo()
 
     log_info("*********** DisplayChargingInfo *********** \n");
     for (i = 0; i < pSysConfig->TotalConnectorCount; i++) {
-        pAcChargingInfo =  (struct ChargingInfoData *)GetAcChargingInfoData(i);
+        pAcChargingInfo =  (struct ChargingInfoData *)GetDcChargingInfoData(i);
 
         if (pAcChargingInfo->SystemStatus != S_IDLE &&
                 pAcChargingInfo->SystemStatus != S_RESERVATION) {
@@ -1496,13 +1496,16 @@ void DisplayChargingInfo()
         }
     }
 
-    pAcChargingInfo =  (struct ChargingInfoData *)GetAcChargingInfoData(0);
-
     if (pSysConfig->AcConnectorCount > 0 &&
-            pSysInfo->CurGunSelectedByAc == NO_DEFINE &&
-            pAcChargingInfo->SystemStatus >= S_PREPARNING &&
-            pAcChargingInfo->SystemStatus <= S_COMPLETE) {
-        pSysInfo->CurGunSelectedByAc = DEFAULT_AC_INDEX;
+            pSysInfo->CurGunSelectedByAc == NO_DEFINE)
+    {
+        pAcChargingInfo = (struct ChargingInfoData*)GetAcChargingInfoData(0);
+
+        if (pAcChargingInfo->SystemStatus >= S_PREPARNING &&
+            pAcChargingInfo->SystemStatus <= S_COMPLETE)
+        {
+            pSysInfo->CurGunSelectedByAc = DEFAULT_AC_INDEX;
+        }
     }
 
     usleep(50000);

+ 2 - 0
EVSE/Projects/DD360/Apps/Define/define.h

@@ -473,6 +473,8 @@ struct SysConfigData
 	unsigned char 			OcppServerURL[512];			//http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
 	unsigned char 			ChargeBoxId[128];
 	unsigned char			chargePointVendor[20];		//the Vendor of the ChargePoint
+	unsigned char			OcppSecurityProfile;		//OCPP security profile 0~3
+	unsigned char			OcppSecurityPassword[41];	//OCPP AuthorizationKey for security profile
 	unsigned int 			Checksum;					//4 bytes checksum
 	struct LED				LedInfo;					// LED configuration info
 	unsigned char			ShowInformation;

+ 6 - 4
EVSE/Projects/DD360/Apps/FactoryConfig.c

@@ -160,8 +160,10 @@ int main(int argc, char *argv[])
     if (InitShareMemory() == FAIL) {
         log_error("InitShareMemory NG\n");
 
-        strcpy((char *)SysConfig.ModelName, "");
-        strcpy((char *)SysConfig.SerialNumber, "");
+        //strcpy((char *)SysConfig.ModelName, "");
+        //strcpy((char *)SysConfig.SerialNumber, "");
+        strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
+        strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
         sleep(5);
     } else {
         memcpy((char *)SysConfig.ModelName,
@@ -180,8 +182,8 @@ int main(int argc, char *argv[])
     */
     //********** System **********// udhcpc -i eth1 -s ./dhcp_script/eth1.script
     //
-    strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
-    strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
+    //strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
+    //strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
 
     memset(SysConfig.SystemId, 0x00, sizeof(SysConfig.SystemId));
     char Dash = '-';

+ 1 - 1
EVSE/Projects/DD360/Apps/Makefile

@@ -186,7 +186,7 @@ UnsafetyOutputTool:
 
 FactoryConfigApp:
 	@echo "===== Module_FactoryConfig_Task =================================="
-	rm -f Module_FactoryConfig
+	rm -f FactoryConfig
 	gcc $(DEFINE) -o FactoryConfig FactoryConfig.c
 	mkdir -p /Storage/SystemLog
 	./FactoryConfig -f;true

+ 16 - 4
EVSE/Projects/DD360/Apps/ModuleEvComm/Module_EvRxComm.c

@@ -208,7 +208,9 @@ void CANReceiver(int fd)
         uint8_t printChillerTemp = NO;
         uint8_t printConnTemp = NO;
         uint8_t maxChillerTemp = 0;
+        uint8_t lastChillerTemp = 0;
         uint8_t maxConnTemp = 0;
+        uint8_t lastConnTemp[2] = {0, 0};
         struct can_frame frame;
         ChillerTemp chiilerTemp = {0};
         struct ChargingInfoData *pDcChargingInfo = NULL;
@@ -479,19 +481,29 @@ void CANReceiver(int fd)
                     getChillerTemperature(&chiilerTemp);
                     maxChillerTemp = getMaxConnectTemp(chiilerTemp.Temp[0], chiilerTemp.Temp[1]);
 
-                    if ((maxChillerTemp - 3) >= pDcChargingInfo->ChillerTemp) {
+                    //if ((maxChillerTemp - 3) >= pDcChargingInfo->ChillerTemp) {
+                    //    printChillerTemp = YES;
+                    //}
+                    if(maxChillerTemp > (lastChillerTemp + 1) || maxChillerTemp < (lastChillerTemp - 1))
+                    {
+                        lastChillerTemp = maxChillerTemp;
                         printChillerTemp = YES;
                     }
 
-                    pDcChargingInfo->ChillerTemp = getMaxConnectTemp(chiilerTemp.Temp[0], chiilerTemp.Temp[1]);
+                    pDcChargingInfo->ChillerTemp = maxChillerTemp;
                 }
 
                 maxConnTemp = getMaxConnectTemp(frame.data[1], frame.data[2]);
-                if ((maxConnTemp - 3) >= pDcChargingInfo->ConnectorTemp) {
+                //if ((maxConnTemp - 3) >= pDcChargingInfo->ConnectorTemp) {
+                //    printConnTemp = YES;
+                //}
+                if(maxConnTemp > (lastConnTemp[targetGun] + 1) || maxConnTemp < (lastConnTemp[targetGun] - 1))
+                {
+                    lastConnTemp[targetGun] = maxConnTemp;
                     printConnTemp = YES;
                 }
 
-                pDcChargingInfo->ConnectorTemp = getMaxConnectTemp(frame.data[1], frame.data[2]);
+                pDcChargingInfo->ConnectorTemp = maxConnTemp;
 
                 //紀錄槍頭和水冷機溫度, 在系統狀態變化或溫度大於150
                 if ((ShmDcCommonData->SystemModeChange[targetGun] == YES) ||

+ 28 - 10
EVSE/Projects/DD360/Apps/ModuleEvComm/Module_EvTxComm.c

@@ -52,6 +52,8 @@ static float maxChargingPow = 0;                   // 限制最大充電能量
 static float LogInfo[2][10]; //DS60-120 add
 static int CanFd = -1;
 
+bool psuOutputReady[2] = {0, 0};
+
 //------------------------------------------------------------------------------
 extern void CANReceiver(int fd);
 extern void ClearAbnormalStatus_Chademo(uint8_t gun_index);
@@ -465,9 +467,9 @@ static void SetPresentChargingOutputFromPcPsu(uint8_t gunCount)
         break;
     }
 
-    vol1 = (((float)pPcPsuOutput0->Voltage));
+    vol1 = pPcPsuOutput0->Voltage == 0 ? chargingData0->FireChargingVoltage : (((float)pPcPsuOutput0->Voltage));
     cur1 = (chargingData0->PresentChargingCurrent * 10);//(((float)pPcPsuOutput0->Current) * 0.1);
-    vol2 = (((float)pPcPsuOutput1->Voltage));
+    vol2 = pPcPsuOutput1->Voltage == 0 ? chargingData1->FireChargingVoltage : (((float)pPcPsuOutput1->Voltage));
     cur2 = (chargingData1->PresentChargingCurrent * 10);//(((float)pPcPsuOutput1->Current) * 0.1);
 
     if (
@@ -499,20 +501,35 @@ static void SetPresentChargingOutputPower(void)
 {
     float vol1 = 0, cur1 = 0;
     float vol2 = 0, cur2 = 0;
+    PcPsuOutput *pPcPsuOutput1 = NULL;
+    PcPsuOutput *pPcPsuOutput2 = NULL;
     struct ChargingInfoData *chargingData_1 = NULL;
     struct ChargingInfoData *chargingData_2 = NULL;
+    bool isPsuOutput1 = false, isPsuOutput2 = false;
 
     if (pSysConfig->TotalConnectorCount == 1) {
+        pPcPsuOutput1 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[0];
+        pPcPsuOutput2 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[0];
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
         chargingData_2 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
     } else if (pSysConfig->TotalConnectorCount == 2) {
+        pPcPsuOutput1 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[0];
+        pPcPsuOutput2 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[1];
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
         chargingData_2 = (struct ChargingInfoData *)GetDcChargingInfoData(1);
     }
 
-    vol1 = chargingData_1->FireChargingVoltage;
+    psuOutputReady[0] = chargingData_1->SystemStatus != S_CHARGING ? false : psuOutputReady[0];
+    psuOutputReady[1] = chargingData_2->SystemStatus != S_CHARGING ? false : psuOutputReady[1];
+
+    isPsuOutput1 = (pPcPsuOutput1->Voltage != 0 && psuOutputReady[0] == true);
+    isPsuOutput2 = (pPcPsuOutput2->Voltage != 0 && psuOutputReady[1] == true);
+
+    //vol1 = chargingData_1->FireChargingVoltage;
+    vol1 = isPsuOutput1 == false ? chargingData_1->FireChargingVoltage : (((float)pPcPsuOutput1->Voltage));
     cur1 = (chargingData_1->PresentChargingCurrent * 10);
-    vol2 = chargingData_2->FireChargingVoltage;
+    //vol2 = chargingData_2->FireChargingVoltage;
+    vol2 = isPsuOutput2 == false ? chargingData_2->FireChargingVoltage : (((float)pPcPsuOutput2->Voltage));
     cur2 = (chargingData_2->PresentChargingCurrent * 10);
 
     //DS60-120 add
@@ -525,9 +542,11 @@ static void SetPresentChargingOutputPower(void)
             (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] >= cur2 + CHK_CUR_RANGE) ||
             (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] <= cur2 - CHK_CUR_RANGE)
        ) {
-        log_info("G1 -> Output Vol = %.1f, Output Cur = %.1f -- G2 -> Output Vol = %.1f, Output Cur = %.1f\r\n",
+        log_info("G1 -> Output Vol(%s) = %.1f, Output Cur = %.1f -- G2 -> Output Vol(%s) = %.1f, Output Cur = %.1f\r\n",
+                 isPsuOutput1 == true ? "P" : "R",
                  vol1 / 10,
                  cur1 / 10,
+                 isPsuOutput2 == true ? "P" : "R",
                  vol2 / 10,
                  cur2 / 10);
 
@@ -998,12 +1017,11 @@ int main(int argc, char *argv[])
 
                 // 設定當前輸出
                 ftime(&nowTime);
-                if (DiffTimeb(waitChargingTime, nowTime) < 3000 ||
-                        DiffTimeb(waitChargingTime, nowTime) < 0) {
-                    SetPresentChargingOutputPower();
-                } else {
-                    SetPresentChargingOutputFromPcPsu(pSysConfig->TotalConnectorCount);
+                if (!(DiffTimeb(waitChargingTime, nowTime) < 5000 ||
+                        DiffTimeb(waitChargingTime, nowTime) < 0)) {
+                    psuOutputReady[gunIndex] = true;
                 }
+                SetPresentChargingOutputPower();
 
                 // for test end
                 if (priorityLow % 5 == 0) {

+ 1 - 1
EVSE/Projects/DD360/Apps/Script/init.sh

@@ -10,4 +10,4 @@ chmod 777 kill.sh
 chmod 777 ReadCmdline
 chmod 777 Module_DoComm
 chmod 777 SearchIP.sh
-chmod 777 Module_FactoryConfig
+chmod 777 FactoryConfig

+ 4 - 4
EVSE/Projects/DD360/Apps/Script/replaceOtherDD360Project.sh

@@ -17,7 +17,7 @@ rm -rf $ProjectPath/DD360ComBox/Apps/;
 cp -r $ProjectPath/DD360Audi/Apps/ $ProjectPath/DD360ComBox/Apps;
 cp -r $ProjectPath/DD360Audi/ModelNameList.txt $ProjectPath/DD360ComBox/ModelNameList.txt;
 
-git add $ProjectPath/DD360;
-git add $ProjectPath/DD360Audi;
-git add $ProjectPath/DD360ComBox;
-git status;
+# git add $ProjectPath/DD360;
+# git add $ProjectPath/DD360Audi;
+# git add $ProjectPath/DD360ComBox;
+# git status;

BIN
EVSE/Projects/DD360/Apps/UnsafetyOutputTask


BIN
EVSE/Projects/DD360/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/DD360/Images/ramdisk.gz


BIN
EVSE/Projects/DD360/output/FactoryConfig


BIN
EVSE/Projects/DD360/output/Module_DoComm


BIN
EVSE/Projects/DD360/output/Module_EvComm


BIN
EVSE/Projects/DD360/output/Module_EventLogging


BIN
EVSE/Projects/DD360/output/Module_InternalComm


BIN
EVSE/Projects/DD360/output/Module_LcmControl


BIN
EVSE/Projects/DD360/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360/output/ReadCmdline


+ 1 - 1
EVSE/Projects/DD360/output/init.sh

@@ -10,4 +10,4 @@ chmod 777 kill.sh
 chmod 777 ReadCmdline
 chmod 777 Module_DoComm
 chmod 777 SearchIP.sh
-chmod 777 Module_FactoryConfig
+chmod 777 FactoryConfig

BIN
EVSE/Projects/DD360/output/main


+ 13 - 10
EVSE/Projects/DD360Audi/Apps/CSU/main.c

@@ -77,7 +77,7 @@ uint8_t bd0_2_status = 0;
 uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
-char *fwVersion = "V1.10.00.0000.00"; // "V0.16.00.0000.00";
+char *fwVersion = "V1.11.00.0000.00"; // "V0.16.00.0000.00";
 
 //sqlite3 *localDb;
 bool isDb_ready;
@@ -1056,7 +1056,7 @@ int LoadSysConfigAndInfo()
             if (ChkSum != ChkSumOrg) {
                 log_warn("factory default  SysConfigData checksum NG, restore factory default\n");
                 free(buf);
-                system("cd /root;./Module_FactoryConfig -m");
+                system("cd /root;./FactoryConfig -m");
                 system("rm -f /Storage/OCPP/OCPPConfiguration");
                 system("sync");
                 sleep(5);
@@ -1108,7 +1108,7 @@ int LoadSysConfigAndInfo()
             log_info("SystemId over length.\n");
         }
 
-        system("cd /root;./Module_FactoryConfig -m");
+        system("cd /root;./FactoryConfig -m");
         sleep(3);
         system("/usr/bin/run_evse_restart.sh");
     }
@@ -1487,7 +1487,7 @@ void DisplayChargingInfo()
 
     log_info("*********** DisplayChargingInfo *********** \n");
     for (i = 0; i < pSysConfig->TotalConnectorCount; i++) {
-        pAcChargingInfo =  (struct ChargingInfoData *)GetAcChargingInfoData(i);
+        pAcChargingInfo =  (struct ChargingInfoData *)GetDcChargingInfoData(i);
 
         if (pAcChargingInfo->SystemStatus != S_IDLE &&
                 pAcChargingInfo->SystemStatus != S_RESERVATION) {
@@ -1496,13 +1496,16 @@ void DisplayChargingInfo()
         }
     }
 
-    pAcChargingInfo =  (struct ChargingInfoData *)GetAcChargingInfoData(0);
-
     if (pSysConfig->AcConnectorCount > 0 &&
-            pSysInfo->CurGunSelectedByAc == NO_DEFINE &&
-            pAcChargingInfo->SystemStatus >= S_PREPARNING &&
-            pAcChargingInfo->SystemStatus <= S_COMPLETE) {
-        pSysInfo->CurGunSelectedByAc = DEFAULT_AC_INDEX;
+            pSysInfo->CurGunSelectedByAc == NO_DEFINE)
+    {
+        pAcChargingInfo = (struct ChargingInfoData*)GetAcChargingInfoData(0);
+
+        if (pAcChargingInfo->SystemStatus >= S_PREPARNING &&
+            pAcChargingInfo->SystemStatus <= S_COMPLETE)
+        {
+            pSysInfo->CurGunSelectedByAc = DEFAULT_AC_INDEX;
+        }
     }
 
     usleep(50000);

+ 2 - 0
EVSE/Projects/DD360Audi/Apps/Define/define.h

@@ -473,6 +473,8 @@ struct SysConfigData
 	unsigned char 			OcppServerURL[512];			//http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
 	unsigned char 			ChargeBoxId[128];
 	unsigned char			chargePointVendor[20];		//the Vendor of the ChargePoint
+	unsigned char			OcppSecurityProfile;		//OCPP security profile 0~3
+	unsigned char			OcppSecurityPassword[41];	//OCPP AuthorizationKey for security profile
 	unsigned int 			Checksum;					//4 bytes checksum
 	struct LED				LedInfo;					// LED configuration info
 	unsigned char			ShowInformation;

+ 6 - 4
EVSE/Projects/DD360Audi/Apps/FactoryConfig.c

@@ -160,8 +160,10 @@ int main(int argc, char *argv[])
     if (InitShareMemory() == FAIL) {
         log_error("InitShareMemory NG\n");
 
-        strcpy((char *)SysConfig.ModelName, "");
-        strcpy((char *)SysConfig.SerialNumber, "");
+        //strcpy((char *)SysConfig.ModelName, "");
+        //strcpy((char *)SysConfig.SerialNumber, "");
+        strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
+        strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
         sleep(5);
     } else {
         memcpy((char *)SysConfig.ModelName,
@@ -180,8 +182,8 @@ int main(int argc, char *argv[])
     */
     //********** System **********// udhcpc -i eth1 -s ./dhcp_script/eth1.script
     //
-    strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
-    strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
+    //strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
+    //strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
 
     memset(SysConfig.SystemId, 0x00, sizeof(SysConfig.SystemId));
     char Dash = '-';

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/Makefile

@@ -186,7 +186,7 @@ UnsafetyOutputTool:
 
 FactoryConfigApp:
 	@echo "===== Module_FactoryConfig_Task =================================="
-	rm -f Module_FactoryConfig
+	rm -f FactoryConfig
 	gcc $(DEFINE) -o FactoryConfig FactoryConfig.c
 	mkdir -p /Storage/SystemLog
 	./FactoryConfig -f;true

+ 16 - 4
EVSE/Projects/DD360Audi/Apps/ModuleEvComm/Module_EvRxComm.c

@@ -208,7 +208,9 @@ void CANReceiver(int fd)
         uint8_t printChillerTemp = NO;
         uint8_t printConnTemp = NO;
         uint8_t maxChillerTemp = 0;
+        uint8_t lastChillerTemp = 0;
         uint8_t maxConnTemp = 0;
+        uint8_t lastConnTemp[2] = {0, 0};
         struct can_frame frame;
         ChillerTemp chiilerTemp = {0};
         struct ChargingInfoData *pDcChargingInfo = NULL;
@@ -479,19 +481,29 @@ void CANReceiver(int fd)
                     getChillerTemperature(&chiilerTemp);
                     maxChillerTemp = getMaxConnectTemp(chiilerTemp.Temp[0], chiilerTemp.Temp[1]);
 
-                    if ((maxChillerTemp - 3) >= pDcChargingInfo->ChillerTemp) {
+                    //if ((maxChillerTemp - 3) >= pDcChargingInfo->ChillerTemp) {
+                    //    printChillerTemp = YES;
+                    //}
+                    if(maxChillerTemp > (lastChillerTemp + 1) || maxChillerTemp < (lastChillerTemp - 1))
+                    {
+                        lastChillerTemp = maxChillerTemp;
                         printChillerTemp = YES;
                     }
 
-                    pDcChargingInfo->ChillerTemp = getMaxConnectTemp(chiilerTemp.Temp[0], chiilerTemp.Temp[1]);
+                    pDcChargingInfo->ChillerTemp = maxChillerTemp;
                 }
 
                 maxConnTemp = getMaxConnectTemp(frame.data[1], frame.data[2]);
-                if ((maxConnTemp - 3) >= pDcChargingInfo->ConnectorTemp) {
+                //if ((maxConnTemp - 3) >= pDcChargingInfo->ConnectorTemp) {
+                //    printConnTemp = YES;
+                //}
+                if(maxConnTemp > (lastConnTemp[targetGun] + 1) || maxConnTemp < (lastConnTemp[targetGun] - 1))
+                {
+                    lastConnTemp[targetGun] = maxConnTemp;
                     printConnTemp = YES;
                 }
 
-                pDcChargingInfo->ConnectorTemp = getMaxConnectTemp(frame.data[1], frame.data[2]);
+                pDcChargingInfo->ConnectorTemp = maxConnTemp;
 
                 //紀錄槍頭和水冷機溫度, 在系統狀態變化或溫度大於150
                 if ((ShmDcCommonData->SystemModeChange[targetGun] == YES) ||

+ 28 - 10
EVSE/Projects/DD360Audi/Apps/ModuleEvComm/Module_EvTxComm.c

@@ -52,6 +52,8 @@ static float maxChargingPow = 0;                   // 限制最大充電能量
 static float LogInfo[2][10]; //DS60-120 add
 static int CanFd = -1;
 
+bool psuOutputReady[2] = {0, 0};
+
 //------------------------------------------------------------------------------
 extern void CANReceiver(int fd);
 extern void ClearAbnormalStatus_Chademo(uint8_t gun_index);
@@ -465,9 +467,9 @@ static void SetPresentChargingOutputFromPcPsu(uint8_t gunCount)
         break;
     }
 
-    vol1 = (((float)pPcPsuOutput0->Voltage));
+    vol1 = pPcPsuOutput0->Voltage == 0 ? chargingData0->FireChargingVoltage : (((float)pPcPsuOutput0->Voltage));
     cur1 = (chargingData0->PresentChargingCurrent * 10);//(((float)pPcPsuOutput0->Current) * 0.1);
-    vol2 = (((float)pPcPsuOutput1->Voltage));
+    vol2 = pPcPsuOutput1->Voltage == 0 ? chargingData1->FireChargingVoltage : (((float)pPcPsuOutput1->Voltage));
     cur2 = (chargingData1->PresentChargingCurrent * 10);//(((float)pPcPsuOutput1->Current) * 0.1);
 
     if (
@@ -499,20 +501,35 @@ static void SetPresentChargingOutputPower(void)
 {
     float vol1 = 0, cur1 = 0;
     float vol2 = 0, cur2 = 0;
+    PcPsuOutput *pPcPsuOutput1 = NULL;
+    PcPsuOutput *pPcPsuOutput2 = NULL;
     struct ChargingInfoData *chargingData_1 = NULL;
     struct ChargingInfoData *chargingData_2 = NULL;
+    bool isPsuOutput1 = false, isPsuOutput2 = false;
 
     if (pSysConfig->TotalConnectorCount == 1) {
+        pPcPsuOutput1 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[0];
+        pPcPsuOutput2 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[0];
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
         chargingData_2 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
     } else if (pSysConfig->TotalConnectorCount == 2) {
+        pPcPsuOutput1 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[0];
+        pPcPsuOutput2 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[1];
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
         chargingData_2 = (struct ChargingInfoData *)GetDcChargingInfoData(1);
     }
 
-    vol1 = chargingData_1->FireChargingVoltage;
+    psuOutputReady[0] = chargingData_1->SystemStatus != S_CHARGING ? false : psuOutputReady[0];
+    psuOutputReady[1] = chargingData_2->SystemStatus != S_CHARGING ? false : psuOutputReady[1];
+
+    isPsuOutput1 = (pPcPsuOutput1->Voltage != 0 && psuOutputReady[0] == true);
+    isPsuOutput2 = (pPcPsuOutput2->Voltage != 0 && psuOutputReady[1] == true);
+
+    //vol1 = chargingData_1->FireChargingVoltage;
+    vol1 = isPsuOutput1 == false ? chargingData_1->FireChargingVoltage : (((float)pPcPsuOutput1->Voltage));
     cur1 = (chargingData_1->PresentChargingCurrent * 10);
-    vol2 = chargingData_2->FireChargingVoltage;
+    //vol2 = chargingData_2->FireChargingVoltage;
+    vol2 = isPsuOutput2 == false ? chargingData_2->FireChargingVoltage : (((float)pPcPsuOutput2->Voltage));
     cur2 = (chargingData_2->PresentChargingCurrent * 10);
 
     //DS60-120 add
@@ -525,9 +542,11 @@ static void SetPresentChargingOutputPower(void)
             (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] >= cur2 + CHK_CUR_RANGE) ||
             (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] <= cur2 - CHK_CUR_RANGE)
        ) {
-        log_info("G1 -> Output Vol = %.1f, Output Cur = %.1f -- G2 -> Output Vol = %.1f, Output Cur = %.1f\r\n",
+        log_info("G1 -> Output Vol(%s) = %.1f, Output Cur = %.1f -- G2 -> Output Vol(%s) = %.1f, Output Cur = %.1f\r\n",
+                 isPsuOutput1 == true ? "P" : "R",
                  vol1 / 10,
                  cur1 / 10,
+                 isPsuOutput2 == true ? "P" : "R",
                  vol2 / 10,
                  cur2 / 10);
 
@@ -998,12 +1017,11 @@ int main(int argc, char *argv[])
 
                 // 設定當前輸出
                 ftime(&nowTime);
-                if (DiffTimeb(waitChargingTime, nowTime) < 3000 ||
-                        DiffTimeb(waitChargingTime, nowTime) < 0) {
-                    SetPresentChargingOutputPower();
-                } else {
-                    SetPresentChargingOutputFromPcPsu(pSysConfig->TotalConnectorCount);
+                if (!(DiffTimeb(waitChargingTime, nowTime) < 5000 ||
+                        DiffTimeb(waitChargingTime, nowTime) < 0)) {
+                    psuOutputReady[gunIndex] = true;
                 }
+                SetPresentChargingOutputPower();
 
                 // for test end
                 if (priorityLow % 5 == 0) {

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/Script/init.sh

@@ -10,4 +10,4 @@ chmod 777 kill.sh
 chmod 777 ReadCmdline
 chmod 777 Module_DoComm
 chmod 777 SearchIP.sh
-chmod 777 Module_FactoryConfig
+chmod 777 FactoryConfig

+ 4 - 4
EVSE/Projects/DD360Audi/Apps/Script/replaceOtherDD360Project.sh

@@ -17,7 +17,7 @@ rm -rf $ProjectPath/DD360ComBox/Apps/;
 cp -r $ProjectPath/DD360Audi/Apps/ $ProjectPath/DD360ComBox/Apps;
 cp -r $ProjectPath/DD360Audi/ModelNameList.txt $ProjectPath/DD360ComBox/ModelNameList.txt;
 
-git add $ProjectPath/DD360;
-git add $ProjectPath/DD360Audi;
-git add $ProjectPath/DD360ComBox;
-git status;
+# git add $ProjectPath/DD360;
+# git add $ProjectPath/DD360Audi;
+# git add $ProjectPath/DD360ComBox;
+# git status;

BIN
EVSE/Projects/DD360Audi/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/DD360Audi/Images/ramdisk.gz


BIN
EVSE/Projects/DD360Audi/output/FactoryConfig


BIN
EVSE/Projects/DD360Audi/output/Module_DoComm


BIN
EVSE/Projects/DD360Audi/output/Module_EvComm


BIN
EVSE/Projects/DD360Audi/output/Module_EventLogging


BIN
EVSE/Projects/DD360Audi/output/Module_InternalComm


BIN
EVSE/Projects/DD360Audi/output/Module_LcmControl


BIN
EVSE/Projects/DD360Audi/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360Audi/output/ReadCmdline


+ 1 - 1
EVSE/Projects/DD360Audi/output/init.sh

@@ -10,4 +10,4 @@ chmod 777 kill.sh
 chmod 777 ReadCmdline
 chmod 777 Module_DoComm
 chmod 777 SearchIP.sh
-chmod 777 Module_FactoryConfig
+chmod 777 FactoryConfig

BIN
EVSE/Projects/DD360Audi/output/main


+ 13 - 10
EVSE/Projects/DD360ComBox/Apps/CSU/main.c

@@ -77,7 +77,7 @@ uint8_t bd0_2_status = 0;
 uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
-char *fwVersion = "V1.10.00.0000.00"; // "V0.16.00.0000.00";
+char *fwVersion = "V1.11.00.0000.00"; // "V0.16.00.0000.00";
 
 //sqlite3 *localDb;
 bool isDb_ready;
@@ -1056,7 +1056,7 @@ int LoadSysConfigAndInfo()
             if (ChkSum != ChkSumOrg) {
                 log_warn("factory default  SysConfigData checksum NG, restore factory default\n");
                 free(buf);
-                system("cd /root;./Module_FactoryConfig -m");
+                system("cd /root;./FactoryConfig -m");
                 system("rm -f /Storage/OCPP/OCPPConfiguration");
                 system("sync");
                 sleep(5);
@@ -1108,7 +1108,7 @@ int LoadSysConfigAndInfo()
             log_info("SystemId over length.\n");
         }
 
-        system("cd /root;./Module_FactoryConfig -m");
+        system("cd /root;./FactoryConfig -m");
         sleep(3);
         system("/usr/bin/run_evse_restart.sh");
     }
@@ -1487,7 +1487,7 @@ void DisplayChargingInfo()
 
     log_info("*********** DisplayChargingInfo *********** \n");
     for (i = 0; i < pSysConfig->TotalConnectorCount; i++) {
-        pAcChargingInfo =  (struct ChargingInfoData *)GetAcChargingInfoData(i);
+        pAcChargingInfo =  (struct ChargingInfoData *)GetDcChargingInfoData(i);
 
         if (pAcChargingInfo->SystemStatus != S_IDLE &&
                 pAcChargingInfo->SystemStatus != S_RESERVATION) {
@@ -1496,13 +1496,16 @@ void DisplayChargingInfo()
         }
     }
 
-    pAcChargingInfo =  (struct ChargingInfoData *)GetAcChargingInfoData(0);
-
     if (pSysConfig->AcConnectorCount > 0 &&
-            pSysInfo->CurGunSelectedByAc == NO_DEFINE &&
-            pAcChargingInfo->SystemStatus >= S_PREPARNING &&
-            pAcChargingInfo->SystemStatus <= S_COMPLETE) {
-        pSysInfo->CurGunSelectedByAc = DEFAULT_AC_INDEX;
+            pSysInfo->CurGunSelectedByAc == NO_DEFINE)
+    {
+        pAcChargingInfo = (struct ChargingInfoData*)GetAcChargingInfoData(0);
+
+        if (pAcChargingInfo->SystemStatus >= S_PREPARNING &&
+            pAcChargingInfo->SystemStatus <= S_COMPLETE)
+        {
+            pSysInfo->CurGunSelectedByAc = DEFAULT_AC_INDEX;
+        }
     }
 
     usleep(50000);

+ 2 - 0
EVSE/Projects/DD360ComBox/Apps/Define/define.h

@@ -473,6 +473,8 @@ struct SysConfigData
 	unsigned char 			OcppServerURL[512];			//http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
 	unsigned char 			ChargeBoxId[128];
 	unsigned char			chargePointVendor[20];		//the Vendor of the ChargePoint
+	unsigned char			OcppSecurityProfile;		//OCPP security profile 0~3
+	unsigned char			OcppSecurityPassword[41];	//OCPP AuthorizationKey for security profile
 	unsigned int 			Checksum;					//4 bytes checksum
 	struct LED				LedInfo;					// LED configuration info
 	unsigned char			ShowInformation;

+ 6 - 4
EVSE/Projects/DD360ComBox/Apps/FactoryConfig.c

@@ -160,8 +160,10 @@ int main(int argc, char *argv[])
     if (InitShareMemory() == FAIL) {
         log_error("InitShareMemory NG\n");
 
-        strcpy((char *)SysConfig.ModelName, "");
-        strcpy((char *)SysConfig.SerialNumber, "");
+        //strcpy((char *)SysConfig.ModelName, "");
+        //strcpy((char *)SysConfig.SerialNumber, "");
+        strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
+        strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
         sleep(5);
     } else {
         memcpy((char *)SysConfig.ModelName,
@@ -180,8 +182,8 @@ int main(int argc, char *argv[])
     */
     //********** System **********// udhcpc -i eth1 -s ./dhcp_script/eth1.script
     //
-    strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
-    strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
+    //strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
+    //strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
 
     memset(SysConfig.SystemId, 0x00, sizeof(SysConfig.SystemId));
     char Dash = '-';

+ 1 - 1
EVSE/Projects/DD360ComBox/Apps/Makefile

@@ -186,7 +186,7 @@ UnsafetyOutputTool:
 
 FactoryConfigApp:
 	@echo "===== Module_FactoryConfig_Task =================================="
-	rm -f Module_FactoryConfig
+	rm -f FactoryConfig
 	gcc $(DEFINE) -o FactoryConfig FactoryConfig.c
 	mkdir -p /Storage/SystemLog
 	./FactoryConfig -f;true

+ 16 - 4
EVSE/Projects/DD360ComBox/Apps/ModuleEvComm/Module_EvRxComm.c

@@ -208,7 +208,9 @@ void CANReceiver(int fd)
         uint8_t printChillerTemp = NO;
         uint8_t printConnTemp = NO;
         uint8_t maxChillerTemp = 0;
+        uint8_t lastChillerTemp = 0;
         uint8_t maxConnTemp = 0;
+        uint8_t lastConnTemp[2] = {0, 0};
         struct can_frame frame;
         ChillerTemp chiilerTemp = {0};
         struct ChargingInfoData *pDcChargingInfo = NULL;
@@ -479,19 +481,29 @@ void CANReceiver(int fd)
                     getChillerTemperature(&chiilerTemp);
                     maxChillerTemp = getMaxConnectTemp(chiilerTemp.Temp[0], chiilerTemp.Temp[1]);
 
-                    if ((maxChillerTemp - 3) >= pDcChargingInfo->ChillerTemp) {
+                    //if ((maxChillerTemp - 3) >= pDcChargingInfo->ChillerTemp) {
+                    //    printChillerTemp = YES;
+                    //}
+                    if(maxChillerTemp > (lastChillerTemp + 1) || maxChillerTemp < (lastChillerTemp - 1))
+                    {
+                        lastChillerTemp = maxChillerTemp;
                         printChillerTemp = YES;
                     }
 
-                    pDcChargingInfo->ChillerTemp = getMaxConnectTemp(chiilerTemp.Temp[0], chiilerTemp.Temp[1]);
+                    pDcChargingInfo->ChillerTemp = maxChillerTemp;
                 }
 
                 maxConnTemp = getMaxConnectTemp(frame.data[1], frame.data[2]);
-                if ((maxConnTemp - 3) >= pDcChargingInfo->ConnectorTemp) {
+                //if ((maxConnTemp - 3) >= pDcChargingInfo->ConnectorTemp) {
+                //    printConnTemp = YES;
+                //}
+                if(maxConnTemp > (lastConnTemp[targetGun] + 1) || maxConnTemp < (lastConnTemp[targetGun] - 1))
+                {
+                    lastConnTemp[targetGun] = maxConnTemp;
                     printConnTemp = YES;
                 }
 
-                pDcChargingInfo->ConnectorTemp = getMaxConnectTemp(frame.data[1], frame.data[2]);
+                pDcChargingInfo->ConnectorTemp = maxConnTemp;
 
                 //紀錄槍頭和水冷機溫度, 在系統狀態變化或溫度大於150
                 if ((ShmDcCommonData->SystemModeChange[targetGun] == YES) ||

+ 28 - 10
EVSE/Projects/DD360ComBox/Apps/ModuleEvComm/Module_EvTxComm.c

@@ -52,6 +52,8 @@ static float maxChargingPow = 0;                   // 限制最大充電能量
 static float LogInfo[2][10]; //DS60-120 add
 static int CanFd = -1;
 
+bool psuOutputReady[2] = {0, 0};
+
 //------------------------------------------------------------------------------
 extern void CANReceiver(int fd);
 extern void ClearAbnormalStatus_Chademo(uint8_t gun_index);
@@ -465,9 +467,9 @@ static void SetPresentChargingOutputFromPcPsu(uint8_t gunCount)
         break;
     }
 
-    vol1 = (((float)pPcPsuOutput0->Voltage));
+    vol1 = pPcPsuOutput0->Voltage == 0 ? chargingData0->FireChargingVoltage : (((float)pPcPsuOutput0->Voltage));
     cur1 = (chargingData0->PresentChargingCurrent * 10);//(((float)pPcPsuOutput0->Current) * 0.1);
-    vol2 = (((float)pPcPsuOutput1->Voltage));
+    vol2 = pPcPsuOutput1->Voltage == 0 ? chargingData1->FireChargingVoltage : (((float)pPcPsuOutput1->Voltage));
     cur2 = (chargingData1->PresentChargingCurrent * 10);//(((float)pPcPsuOutput1->Current) * 0.1);
 
     if (
@@ -499,20 +501,35 @@ static void SetPresentChargingOutputPower(void)
 {
     float vol1 = 0, cur1 = 0;
     float vol2 = 0, cur2 = 0;
+    PcPsuOutput *pPcPsuOutput1 = NULL;
+    PcPsuOutput *pPcPsuOutput2 = NULL;
     struct ChargingInfoData *chargingData_1 = NULL;
     struct ChargingInfoData *chargingData_2 = NULL;
+    bool isPsuOutput1 = false, isPsuOutput2 = false;
 
     if (pSysConfig->TotalConnectorCount == 1) {
+        pPcPsuOutput1 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[0];
+        pPcPsuOutput2 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[0];
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
         chargingData_2 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
     } else if (pSysConfig->TotalConnectorCount == 2) {
+        pPcPsuOutput1 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[0];
+        pPcPsuOutput2 = (PcPsuOutput *)&ShmDcCommonData->PcPsuOutput[1];
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
         chargingData_2 = (struct ChargingInfoData *)GetDcChargingInfoData(1);
     }
 
-    vol1 = chargingData_1->FireChargingVoltage;
+    psuOutputReady[0] = chargingData_1->SystemStatus != S_CHARGING ? false : psuOutputReady[0];
+    psuOutputReady[1] = chargingData_2->SystemStatus != S_CHARGING ? false : psuOutputReady[1];
+
+    isPsuOutput1 = (pPcPsuOutput1->Voltage != 0 && psuOutputReady[0] == true);
+    isPsuOutput2 = (pPcPsuOutput2->Voltage != 0 && psuOutputReady[1] == true);
+
+    //vol1 = chargingData_1->FireChargingVoltage;
+    vol1 = isPsuOutput1 == false ? chargingData_1->FireChargingVoltage : (((float)pPcPsuOutput1->Voltage));
     cur1 = (chargingData_1->PresentChargingCurrent * 10);
-    vol2 = chargingData_2->FireChargingVoltage;
+    //vol2 = chargingData_2->FireChargingVoltage;
+    vol2 = isPsuOutput2 == false ? chargingData_2->FireChargingVoltage : (((float)pPcPsuOutput2->Voltage));
     cur2 = (chargingData_2->PresentChargingCurrent * 10);
 
     //DS60-120 add
@@ -525,9 +542,11 @@ static void SetPresentChargingOutputPower(void)
             (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] >= cur2 + CHK_CUR_RANGE) ||
             (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] <= cur2 - CHK_CUR_RANGE)
        ) {
-        log_info("G1 -> Output Vol = %.1f, Output Cur = %.1f -- G2 -> Output Vol = %.1f, Output Cur = %.1f\r\n",
+        log_info("G1 -> Output Vol(%s) = %.1f, Output Cur = %.1f -- G2 -> Output Vol(%s) = %.1f, Output Cur = %.1f\r\n",
+                 isPsuOutput1 == true ? "P" : "R",
                  vol1 / 10,
                  cur1 / 10,
+                 isPsuOutput2 == true ? "P" : "R",
                  vol2 / 10,
                  cur2 / 10);
 
@@ -998,12 +1017,11 @@ int main(int argc, char *argv[])
 
                 // 設定當前輸出
                 ftime(&nowTime);
-                if (DiffTimeb(waitChargingTime, nowTime) < 3000 ||
-                        DiffTimeb(waitChargingTime, nowTime) < 0) {
-                    SetPresentChargingOutputPower();
-                } else {
-                    SetPresentChargingOutputFromPcPsu(pSysConfig->TotalConnectorCount);
+                if (!(DiffTimeb(waitChargingTime, nowTime) < 5000 ||
+                        DiffTimeb(waitChargingTime, nowTime) < 0)) {
+                    psuOutputReady[gunIndex] = true;
                 }
+                SetPresentChargingOutputPower();
 
                 // for test end
                 if (priorityLow % 5 == 0) {

+ 1 - 1
EVSE/Projects/DD360ComBox/Apps/Script/init.sh

@@ -10,4 +10,4 @@ chmod 777 kill.sh
 chmod 777 ReadCmdline
 chmod 777 Module_DoComm
 chmod 777 SearchIP.sh
-chmod 777 Module_FactoryConfig
+chmod 777 FactoryConfig

+ 4 - 4
EVSE/Projects/DD360ComBox/Apps/Script/replaceOtherDD360Project.sh

@@ -17,7 +17,7 @@ rm -rf $ProjectPath/DD360ComBox/Apps/;
 cp -r $ProjectPath/DD360Audi/Apps/ $ProjectPath/DD360ComBox/Apps;
 cp -r $ProjectPath/DD360Audi/ModelNameList.txt $ProjectPath/DD360ComBox/ModelNameList.txt;
 
-git add $ProjectPath/DD360;
-git add $ProjectPath/DD360Audi;
-git add $ProjectPath/DD360ComBox;
-git status;
+# git add $ProjectPath/DD360;
+# git add $ProjectPath/DD360Audi;
+# git add $ProjectPath/DD360ComBox;
+# git status;

BIN
EVSE/Projects/DD360ComBox/Apps/UnsafetyOutputTask


BIN
EVSE/Projects/DD360ComBox/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/DD360ComBox/Images/ramdisk.gz


BIN
EVSE/Projects/DD360ComBox/output/FactoryConfig


BIN
EVSE/Projects/DD360ComBox/output/Module_DoComm


BIN
EVSE/Projects/DD360ComBox/output/Module_EvComm


BIN
EVSE/Projects/DD360ComBox/output/Module_EventLogging


BIN
EVSE/Projects/DD360ComBox/output/Module_InternalComm


BIN
EVSE/Projects/DD360ComBox/output/Module_LcmControl


BIN
EVSE/Projects/DD360ComBox/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360ComBox/output/ReadCmdline


+ 1 - 1
EVSE/Projects/DD360ComBox/output/init.sh

@@ -10,4 +10,4 @@ chmod 777 kill.sh
 chmod 777 ReadCmdline
 chmod 777 Module_DoComm
 chmod 777 SearchIP.sh
-chmod 777 Module_FactoryConfig
+chmod 777 FactoryConfig

BIN
EVSE/Projects/DD360ComBox/output/main


+ 2 - 0
EVSE/Projects/define.h

@@ -473,6 +473,8 @@ struct SysConfigData
 	unsigned char 			OcppServerURL[512];			//http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
 	unsigned char 			ChargeBoxId[128];
 	unsigned char			chargePointVendor[20];		//the Vendor of the ChargePoint
+	unsigned char			OcppSecurityProfile;		//OCPP security profile 0~3
+	unsigned char			OcppSecurityPassword[41];	//OCPP AuthorizationKey for security profile
 	unsigned int 			Checksum;					//4 bytes checksum
 	struct LED				LedInfo;					// LED configuration info
 	unsigned char			ShowInformation;

+ 3 - 1
EVSE/rootfs/var/www/ocpp_upload.php

@@ -20,7 +20,9 @@ curl_setopt_array($curl, array(
   CURLOPT_CONNECTTIMEOUT => 30,
   CURLOPT_STDERR          => $curl_log,
   CURLOPT_FOLLOWLOCATION => 0,
-  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS,
+  CURLOPT_SSL_VERIFYPEER => 0,
+  CURLOPT_SSL_VERIFYHOST => 0,
   CURLOPT_CUSTOMREQUEST => "POST",
   CURLOPT_POSTFIELDS => array(''=> new CURLFILE(trim($content[1]),"application/zip",$file)),
   CURLOPT_HTTPHEADER => array(

+ 5 - 5
Makefile

@@ -545,7 +545,7 @@ AW-Regular-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[AW-Regular]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F8G08
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/AW-Regular/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/AW-Regular/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/AW-Regular/Images/
@@ -617,7 +617,7 @@ BYTON-GB-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[BYTON-GB]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/BYTON-GB/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/BYTON-GB/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/BYTON-GB/Images/
@@ -1041,7 +1041,7 @@ Noodoe-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[Noodoe]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F8G08
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/Noodoe/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/Noodoe/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/Noodoe/Images/
@@ -1187,7 +1187,7 @@ AW-CCS-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[AW-CCS]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F8G08
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F8G08_BCH16
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/AW-CCS/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/AW-CCS/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/AW-CCS/Images/
@@ -1623,7 +1623,7 @@ AW-ChargeLab-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[AW-ChargeLab]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F8G08
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/AW-ChargeLab/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/AW-ChargeLab/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/AW-ChargeLab/Images/

+ 7 - 1
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/common/autoboot.c

@@ -17,7 +17,13 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define uboot_version "01.02"
+#if defined(MT29F16G08_BCH16)
+	#define uboot_version "02.01"
+#elif defined(MT29F8G08_BCH16)
+	#define uboot_version "03.01"
+#else
+	#define uboot_version "01.01"
+#endif
 
 #define MAX_DELAY_STOP_STR 32
 

+ 51 - 13
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/include/configs/am335x_evm.h

@@ -230,7 +230,7 @@
 
 #ifdef CONFIG_NAND
 /* NAND: device related configs */
-#if defined(MT29F8G08)
+#if defined(MT29F8G08_BCH16)
 	#define CONFIG_SYS_NAND_ECCPOS	{ 2, 3, 4, 5, 6, 7, 8, 9, \
 					  10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \
 					  20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \
@@ -257,6 +257,33 @@
 	#define CONFIG_SYS_NAND_OOBSIZE		256//64 /*++++ vern,NAND,20161127 ---*/
 	#define CONFIG_SYS_NAND_PAGE_SIZE	4096//2048 /*++++ vern,NAND,20161127 ---*/
 	#define CONFIG_SYS_NAND_BLOCK_SIZE	(64*4096)//(128*1024)/*++++ vern,NAND,20161127 ---*/
+#elif defined(MT29F16G08_BCH16)
+	#define CONFIG_SYS_NAND_ECCPOS  { 2, 3, 4, 5, 6, 7, 8, 9, \
+                                          10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \
+                                          20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \
+                                          30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \
+                                          40, 41, 42, 43, 44, 45, 46, 47, 48, 49, \
+                                          50, 51, 52, 53, 54, 55, 56, 57, 58, 59, \
+                                          60, 61, 62, 63, 64, 65, 66, 67, 68, 69, \
+                                          70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \
+                                          80, 81, 82, 83, 84, 85, 86, 87, 88, 89, \
+                                          90, 91, 92, 93, 94, 95, 96, 97, 98, 99, \
+                                          100, 101, 102, 103, 104, 105, 106, 107, 108, 109, \
+                                          110, 111, 112, 113, 114, 115, 116, 117, 118, 119, \
+                                          120, 121, 122, 123, 124, 125, 126, 127, 128, 129, \
+                                          130, 131, 132, 133, 134, 135, 136, 137, 138, 139, \
+                                          140, 141, 142, 143, 144, 145, 146, 147, 148, 149, \
+                                          150, 151, 152, 153, 154, 155, 156, 157, 158, 159, \
+                                          160, 161, 162, 163, 164, 165, 166, 167, 168, 169, \
+                                          170, 171, 172, 173, 174, 175, 176, 177, 178, 179, \
+                                          180, 181, 182, 183, 184, 185, 186, 187, 188, 189, \
+                                          190, 191, 192, 193, 194, 195, 196, 197, 198, 199, \
+                                          200, 201, 202, 203, 204, 205, 206, 207, 208, 209, }
+        #define CONFIG_SYS_NAND_ECCBYTES        26
+        #define CONFIG_NAND_OMAP_ECCSCHEME      OMAP_ECC_BCH16_CODE_HW
+        #define CONFIG_SYS_NAND_OOBSIZE         224//64 /*++++ vern,NAND,20161127 ---*/
+        #define CONFIG_SYS_NAND_PAGE_SIZE       4096//2048 /*++++ vern,NAND,20161127 ---*/
+        #define CONFIG_SYS_NAND_BLOCK_SIZE      (64*4096)//(128*1024)/*++++ vern,NAND,20161127 ---*/
 #elif defined(MT29F16G08)
 	#define CONFIG_SYS_NAND_ECCPOS	{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \
 					 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, \
@@ -274,18 +301,29 @@
 	#define CONFIG_SYS_NAND_PAGE_SIZE	4096//2048 /*++++ vern,NAND,20161127 ---*/
 	#define CONFIG_SYS_NAND_BLOCK_SIZE	(64*4096)//(128*1024)/*++++ vern,NAND,20161127 ---*/
 #else
-	#define CONFIG_SYS_NAND_ECCPOS  {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \
-                                         16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, \
-                                         28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \
-                                         40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, \
-                                         52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, \
-                                         64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, \
-                                         76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, \
-                                         88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, \
-                                         100, 101, 102, 103, 104, 105, 106, 107, 108, 109, \
-                                         110, 111, 112, 113 }
-        #define CONFIG_SYS_NAND_ECCBYTES        14
-        #define CONFIG_NAND_OMAP_ECCSCHEME      OMAP_ECC_BCH8_CODE_HW
+	#define CONFIG_SYS_NAND_ECCPOS  { 2, 3, 4, 5, 6, 7, 8, 9, \
+                                          10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \
+                                          20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \
+                                          30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \
+                                          40, 41, 42, 43, 44, 45, 46, 47, 48, 49, \
+                                          50, 51, 52, 53, 54, 55, 56, 57, 58, 59, \
+                                          60, 61, 62, 63, 64, 65, 66, 67, 68, 69, \
+                                          70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \
+                                          80, 81, 82, 83, 84, 85, 86, 87, 88, 89, \
+                                          90, 91, 92, 93, 94, 95, 96, 97, 98, 99, \
+                                          100, 101, 102, 103, 104, 105, 106, 107, 108, 109, \
+                                          110, 111, 112, 113, 114, 115, 116, 117, 118, 119, \
+                                          120, 121, 122, 123, 124, 125, 126, 127, 128, 129, \
+                                          130, 131, 132, 133, 134, 135, 136, 137, 138, 139, \
+                                          140, 141, 142, 143, 144, 145, 146, 147, 148, 149, \
+                                          150, 151, 152, 153, 154, 155, 156, 157, 158, 159, \
+                                          160, 161, 162, 163, 164, 165, 166, 167, 168, 169, \
+                                          170, 171, 172, 173, 174, 175, 176, 177, 178, 179, \
+                                          180, 181, 182, 183, 184, 185, 186, 187, 188, 189, \
+                                          190, 191, 192, 193, 194, 195, 196, 197, 198, 199, \
+                                          200, 201, 202, 203, 204, 205, 206, 207, 208, 209, }
+        #define CONFIG_SYS_NAND_ECCBYTES        26
+        #define CONFIG_NAND_OMAP_ECCSCHEME      OMAP_ECC_BCH16_CODE_HW
         #define CONFIG_SYS_NAND_OOBSIZE         224//64 /*++++ vern,NAND,20161127 ---*/
         #define CONFIG_SYS_NAND_PAGE_SIZE       4096//2048 /*++++ vern,NAND,20161127 ---*/
         #define CONFIG_SYS_NAND_BLOCK_SIZE      (64*4096)//(128*1024)/*++++ vern,NAND,20161127 ---*/