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

Merge branch 'AW-CCS' of https://git.phihong.com.tw:30000/System_Integration/CSU3_AM335x into AW-CCS

8009 3 жил өмнө
parent
commit
d0a6f2b51c
72 өөрчлөгдсөн 479 нэмэгдсэн , 173 устгасан
  1. 64 1
      EVSE/Modularization/ocpp20/MessageHandler.c
  2. 65 0
      EVSE/Modularization/ocppfiles/MessageHandler.c
  3. 22 17
      EVSE/Projects/AW-ChargeLab/Apps/Module_InternalComm.c
  4. 18 3
      EVSE/Projects/AW-ChargeLab/Apps/main.c
  5. 22 17
      EVSE/Projects/AW-Regular/Apps/Module_InternalComm.c
  6. 17 2
      EVSE/Projects/AW-Regular/Apps/main.c
  7. 13 10
      EVSE/Projects/DD360/Apps/CSU/main.c
  8. 2 0
      EVSE/Projects/DD360/Apps/Define/define.h
  9. 6 4
      EVSE/Projects/DD360/Apps/FactoryConfig.c
  10. 1 1
      EVSE/Projects/DD360/Apps/Makefile
  11. 16 4
      EVSE/Projects/DD360/Apps/ModuleEvComm/Module_EvRxComm.c
  12. 28 10
      EVSE/Projects/DD360/Apps/ModuleEvComm/Module_EvTxComm.c
  13. 1 1
      EVSE/Projects/DD360/Apps/Script/init.sh
  14. 4 4
      EVSE/Projects/DD360/Apps/Script/replaceOtherDD360Project.sh
  15. BIN
      EVSE/Projects/DD360/Apps/UnsafetyOutputTask
  16. BIN
      EVSE/Projects/DD360/Images/FactoryDefaultConfig.bin
  17. BIN
      EVSE/Projects/DD360/Images/ramdisk.gz
  18. BIN
      EVSE/Projects/DD360/output/FactoryConfig
  19. BIN
      EVSE/Projects/DD360/output/Module_DoComm
  20. BIN
      EVSE/Projects/DD360/output/Module_EvComm
  21. BIN
      EVSE/Projects/DD360/output/Module_EventLogging
  22. BIN
      EVSE/Projects/DD360/output/Module_InternalComm
  23. BIN
      EVSE/Projects/DD360/output/Module_LcmControl
  24. BIN
      EVSE/Projects/DD360/output/Module_PrimaryComm
  25. BIN
      EVSE/Projects/DD360/output/ReadCmdline
  26. 1 1
      EVSE/Projects/DD360/output/init.sh
  27. BIN
      EVSE/Projects/DD360/output/main
  28. 13 10
      EVSE/Projects/DD360Audi/Apps/CSU/main.c
  29. 2 0
      EVSE/Projects/DD360Audi/Apps/Define/define.h
  30. 6 4
      EVSE/Projects/DD360Audi/Apps/FactoryConfig.c
  31. 1 1
      EVSE/Projects/DD360Audi/Apps/Makefile
  32. 16 4
      EVSE/Projects/DD360Audi/Apps/ModuleEvComm/Module_EvRxComm.c
  33. 28 10
      EVSE/Projects/DD360Audi/Apps/ModuleEvComm/Module_EvTxComm.c
  34. 1 1
      EVSE/Projects/DD360Audi/Apps/Script/init.sh
  35. 4 4
      EVSE/Projects/DD360Audi/Apps/Script/replaceOtherDD360Project.sh
  36. BIN
      EVSE/Projects/DD360Audi/Images/FactoryDefaultConfig.bin
  37. BIN
      EVSE/Projects/DD360Audi/Images/ramdisk.gz
  38. BIN
      EVSE/Projects/DD360Audi/output/FactoryConfig
  39. BIN
      EVSE/Projects/DD360Audi/output/Module_DoComm
  40. BIN
      EVSE/Projects/DD360Audi/output/Module_EvComm
  41. BIN
      EVSE/Projects/DD360Audi/output/Module_EventLogging
  42. BIN
      EVSE/Projects/DD360Audi/output/Module_InternalComm
  43. BIN
      EVSE/Projects/DD360Audi/output/Module_LcmControl
  44. BIN
      EVSE/Projects/DD360Audi/output/Module_PrimaryComm
  45. BIN
      EVSE/Projects/DD360Audi/output/ReadCmdline
  46. 1 1
      EVSE/Projects/DD360Audi/output/init.sh
  47. BIN
      EVSE/Projects/DD360Audi/output/main
  48. 13 10
      EVSE/Projects/DD360ComBox/Apps/CSU/main.c
  49. 2 0
      EVSE/Projects/DD360ComBox/Apps/Define/define.h
  50. 6 4
      EVSE/Projects/DD360ComBox/Apps/FactoryConfig.c
  51. 1 1
      EVSE/Projects/DD360ComBox/Apps/Makefile
  52. 16 4
      EVSE/Projects/DD360ComBox/Apps/ModuleEvComm/Module_EvRxComm.c
  53. 28 10
      EVSE/Projects/DD360ComBox/Apps/ModuleEvComm/Module_EvTxComm.c
  54. 1 1
      EVSE/Projects/DD360ComBox/Apps/Script/init.sh
  55. 4 4
      EVSE/Projects/DD360ComBox/Apps/Script/replaceOtherDD360Project.sh
  56. BIN
      EVSE/Projects/DD360ComBox/Apps/UnsafetyOutputTask
  57. BIN
      EVSE/Projects/DD360ComBox/Images/FactoryDefaultConfig.bin
  58. BIN
      EVSE/Projects/DD360ComBox/Images/ramdisk.gz
  59. BIN
      EVSE/Projects/DD360ComBox/output/FactoryConfig
  60. BIN
      EVSE/Projects/DD360ComBox/output/Module_DoComm
  61. BIN
      EVSE/Projects/DD360ComBox/output/Module_EvComm
  62. BIN
      EVSE/Projects/DD360ComBox/output/Module_EventLogging
  63. BIN
      EVSE/Projects/DD360ComBox/output/Module_InternalComm
  64. BIN
      EVSE/Projects/DD360ComBox/output/Module_LcmControl
  65. BIN
      EVSE/Projects/DD360ComBox/output/Module_PrimaryComm
  66. BIN
      EVSE/Projects/DD360ComBox/output/ReadCmdline
  67. 1 1
      EVSE/Projects/DD360ComBox/output/init.sh
  68. BIN
      EVSE/Projects/DD360ComBox/output/main
  69. 2 2
      EVSE/Projects/Noodoe/Apps/Module_EventLogging.c
  70. 28 23
      EVSE/Projects/Noodoe/Apps/Module_InternalComm.c
  71. 17 3
      EVSE/Projects/Noodoe/Apps/main.c
  72. 8 0
      EVSE/Projects/define.h

+ 64 - 1
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -11989,7 +11989,9 @@ void createFirmwareVersionByDataTransfer(void)
 
 	sprintf((char*)ShmOCPP20Data->DataTransfer[0].vendorId, "%s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
 	sprintf((char*)ShmOCPP20Data->DataTransfer[0].messageId, "ID_FirmwareVersion");
-	sprintf((char*)ShmOCPP20Data->DataTransfer[0].data, json_object_to_json_string(FirmwareDataTransfer));
+	sprintf((char*)ShmOCPP20Data->DataTransfer[0].data, json_object_to_json_string_ext(FirmwareDataTransfer, JSON_C_TO_STRING_PLAIN));
+
+	json_object_put(FirmwareDataTransfer);
 }
 
 int handleDataTransferRequest(char *uuid, char *payload)
@@ -12059,6 +12061,67 @@ int handleDataTransferRequest(char *uuid, char *payload)
 			}
 			json_object_put(data);
 		}
+		else if(strstr((char*)ShmOCPP20Data->DataTransfer[0].messageId, "ID_ConfigQR") != NULL)
+		{
+			json_object *data;
+			data = json_tokener_parse((char*)ShmOCPP20Data->DataTransfer[0].data);
+
+			if(!is_error(data))
+			{
+				strcpy((char*)ShmOCPP20Data->DataTransfer[0].Response_status, DataTransferStatusEnumTypeStr[DataTransferStatusEnumType_Accepted]);
+
+				if(json_object_object_get(data, "Content_Type") != NULL)
+				{
+					if((0 <= json_object_get_int(json_object_object_get(data, "Content_Type"))) && (json_object_get_int(json_object_object_get(data, "Content_Type")) <= 1))
+					{
+						ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode = json_object_get_int(json_object_object_get(data, "Content_Type"));
+
+						if(json_object_object_get(data, "Customization_Conent") != NULL)
+						{
+							sprintf((char*)ShmSysConfigAndInfo->SysConfig.QRCodeContent, "%s", json_object_get_string(json_object_object_get(data, "Customization_Conent")));
+						}
+					}
+					else
+						strcpy((char*)ShmOCPP20Data->DataTransfer[0].Response_status, DataTransferStatusEnumTypeStr[DataTransferStatusEnumType_Rejected]);
+				}
+
+				StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
+			}
+			else
+			{
+				strcpy((char*)ShmOCPP20Data->DataTransfer[0].Response_status, DataTransferStatusEnumTypeStr[DataTransferStatusEnumType_Rejected]);
+				strcpy((char*)ShmOCPP20Data->DataTransfer[0].Response_data, "Configuration content something wrong.");
+			}
+			json_object_put(data);
+		}
+		else if(strstr((char*)ShmOCPP20Data->DataTransfer[0].messageId, "ID_DsiplayLcdPage") != NULL)
+		{
+			json_object *data;
+			data = json_tokener_parse((char*)ShmOCPP20Data->DataTransfer[0].data);
+
+			if(!is_error(data))
+			{
+				strcpy((char*)ShmOCPP20Data->DataTransfer[0].Response_status, DataTransferStatusEnumTypeStr[DataTransferStatusEnumType_Accepted]);
+
+				if(json_object_object_get(data, "Page_Index") != NULL)
+				{
+					ShmSysConfigAndInfo->SysConfig.LcdOveride.page_index = json_object_get_int(json_object_object_get(data, "Page_Index"));
+				}
+
+				if(json_object_object_get(data, "Duration") != NULL)
+				{
+					ShmSysConfigAndInfo->SysConfig.LcdOveride.duration = json_object_get_int(json_object_object_get(data, "Duration"));
+				}
+
+				ShmSysConfigAndInfo->SysConfig.LcdOveride.isOverideReq = 1;
+			}
+			else
+			{
+				strcpy((char*)ShmOCPP20Data->DataTransfer[0].Response_status, DataTransferStatusEnumTypeStr[DataTransferStatusEnumType_Rejected]);
+				strcpy((char*)ShmOCPP20Data->DataTransfer[0].Response_data, "Configuration content something wrong.");
+			}
+			json_object_put(data);
+		}
 		else
 		{
 			// Can not find valid message id

+ 65 - 0
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -8696,6 +8696,71 @@ int handleDataTransferRequest(char *uuid, char *payload)
 			sprintf(message,"[%d,\"%s\",%s]",MESSAGE_TYPE_CALLRESULT, uuid, json_object_to_json_string_ext(response, JSON_C_TO_STRING_PLAIN));
 			json_object_put(response);
 		}
+		else if(strstr(tempmessageId, "ID_ConfigQR") != NULL)
+		{
+			json_object *data;
+			data = json_tokener_parse(tempdata);
+			if(!is_error(data))
+			{
+				json_object_object_add(response, "status", json_object_new_string("Accepted"));
+
+				if(json_object_object_get(data, "Content_Type") != NULL)
+				{
+					if((0 <= json_object_get_int(json_object_object_get(data, "Content_Type"))) && (json_object_get_int(json_object_object_get(data, "Content_Type")) <= 1))
+					{
+						ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode = json_object_get_int(json_object_object_get(data, "Content_Type"));
+
+						if(json_object_object_get(data, "Customization_Conent") != NULL)
+						{
+							sprintf((char*)ShmSysConfigAndInfo->SysConfig.QRCodeContent, "%s", json_object_get_string(json_object_object_get(data, "Customization_Conent")));
+						}
+					}
+					else
+						json_object_object_add(response, "status", json_object_new_string("Rejected"));
+				}
+
+				StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
+			}
+			else
+			{
+				json_object_object_add(response, "status", json_object_new_string("Rejected"));
+				json_object_object_add(response, "data", json_object_new_string("Configuration content something wrong."));
+			}
+			json_object_put(data);
+
+			sprintf(message,"[%d,\"%s\",%s]",MESSAGE_TYPE_CALLRESULT, uuid, json_object_to_json_string_ext(response, JSON_C_TO_STRING_PLAIN));
+			json_object_put(response);
+		}
+		else if(strstr(tempmessageId, "ID_DsiplayLcdPage") != NULL)
+		{
+			json_object *data;
+			data = json_tokener_parse(tempdata);
+			if(!is_error(data))
+			{
+				json_object_object_add(response, "status", json_object_new_string("Accepted"));
+
+				if(json_object_object_get(data, "Page_Index") != NULL)
+				{
+					ShmSysConfigAndInfo->SysConfig.LcdOveride.page_index = json_object_get_int(json_object_object_get(data, "Page_Index"));
+				}
+
+				if(json_object_object_get(data, "Duration") != NULL)
+				{
+					ShmSysConfigAndInfo->SysConfig.LcdOveride.duration = json_object_get_int(json_object_object_get(data, "Duration"));
+				}
+
+				ShmSysConfigAndInfo->SysConfig.LcdOveride.isOverideReq = 1;
+			}
+			else
+			{
+				json_object_object_add(response, "status", json_object_new_string("Rejected"));
+				json_object_object_add(response, "data", json_object_new_string("Configuration content something wrong."));
+			}
+			json_object_put(data);
+
+			sprintf(message,"[%d,\"%s\",%s]",MESSAGE_TYPE_CALLRESULT, uuid, json_object_to_json_string_ext(response, JSON_C_TO_STRING_PLAIN));
+			json_object_put(response);
+		}
 		else
 		{
 			// Can not find valid message id

+ 22 - 17
EVSE/Projects/AW-ChargeLab/Apps/Module_InternalComm.c

@@ -2037,6 +2037,26 @@ int main(void)
 					}
 				}
 
+				//===============================
+				// Case 8 : Config primary set CP PWN duty
+				//===============================
+				if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == ON)
+				{
+					if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
+					{
+						failCount[gun_index] = 0;
+						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
+					}
+					else
+					{
+						DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\n", gun_index, failCount[gun_index]);
+						if(failCount[gun_index]<1000)
+						{
+							failCount[gun_index]++;
+						}
+					}
+				}
+
 				//==========================================================
 				// High priority polling log print out
 				//==========================================================
@@ -2246,24 +2266,9 @@ int main(void)
 						break;
 					case 9:
 						//===============================
-						// Config primary set CP PWN duty
+						// Reserve
 						//===============================
-						if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == ON)
-						{
-							if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
-							{
-								failCount[gun_index] = 0;
-								ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
-							}
-							else
-							{
-								DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\n", gun_index, failCount[gun_index]);
-								if(failCount[gun_index]<1000)
-								{
-									failCount[gun_index]++;
-								}
-							}
-						}
+
 						break;
 					case 11:
 						//===============================

+ 18 - 3
EVSE/Projects/AW-ChargeLab/Apps/main.c

@@ -3598,7 +3598,7 @@ int main(void)
 				{
 					setLedMotion(gun_index,LED_ACTION_INIT);
 				}
-
+				
 				sleep(5);
 				system("cd /root;./Module_FactoryConfig -m");
 				system("rm -f /Storage/OCPP/OCPPConfiguration");
@@ -3787,7 +3787,7 @@ int main(void)
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration = 0;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy = 0;
 						ShmCharger->gun_info[gun_index].targetCurrent = 0xFF;
-						ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = (ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent > 0) ? ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent<ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].primaryMcuState.rating_current) : ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+
 						ocpp_set_unlocker_req(gun_index, OFF);
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId = -1;
 
@@ -3877,6 +3877,22 @@ int main(void)
 						ShmCharger->gun_info[gun_index].isGunPlugged = NO;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStart = OFF;
 
+						// Get target current
+						ocpp_set_profile_req(gun_index, ON);
+						sleep(1);
+						checkChargingProfileLimit(gun_index);
+						if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+						{
+							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+						}
+						else
+						{
+							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+						}
+						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
+
 						setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
 					}
 					else
@@ -3920,7 +3936,6 @@ int main(void)
 									break;
 							}
 						}
-						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
 					}
 					
 					if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH)

+ 22 - 17
EVSE/Projects/AW-Regular/Apps/Module_InternalComm.c

@@ -2037,6 +2037,26 @@ int main(void)
 					}
 				}
 
+				//===============================
+				// Case 8 : Config primary set CP PWN duty
+				//===============================
+				if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == ON)
+				{
+					if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
+					{
+						failCount[gun_index] = 0;
+						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
+					}
+					else
+					{
+						DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\n", gun_index, failCount[gun_index]);
+						if(failCount[gun_index]<1000)
+						{
+							failCount[gun_index]++;
+						}
+					}
+				}
+
 				//==========================================================
 				// High priority polling log print out
 				//==========================================================
@@ -2246,24 +2266,9 @@ int main(void)
 						break;
 					case 9:
 						//===============================
-						// Config primary set CP PWN duty
+						// Reserve
 						//===============================
-						if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == ON)
-						{
-							if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
-							{
-								failCount[gun_index] = 0;
-								ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
-							}
-							else
-							{
-								DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\n", gun_index, failCount[gun_index]);
-								if(failCount[gun_index]<1000)
-								{
-									failCount[gun_index]++;
-								}
-							}
-						}
+
 						break;
 					case 11:
 						//===============================

+ 17 - 2
EVSE/Projects/AW-Regular/Apps/main.c

@@ -3787,7 +3787,7 @@ int main(void)
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration = 0;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy = 0;
 						ShmCharger->gun_info[gun_index].targetCurrent = 0xFF;
-						ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = (ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent > 0) ? ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent<ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].primaryMcuState.rating_current) : ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+
 						ocpp_set_unlocker_req(gun_index, OFF);
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId = -1;
 
@@ -3877,6 +3877,22 @@ int main(void)
 						ShmCharger->gun_info[gun_index].isGunPlugged = NO;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStart = OFF;
 
+						// Get target current
+						ocpp_set_profile_req(gun_index, ON);
+						sleep(1);
+						checkChargingProfileLimit(gun_index);
+						if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+						{
+							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+						}
+						else
+						{
+							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+						}
+						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
+
 						setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
 					}
 					else
@@ -3920,7 +3936,6 @@ int main(void)
 									break;
 							}
 						}
-						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
 					}
 					
 					if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH)

+ 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 - 2
EVSE/Projects/Noodoe/Apps/Module_EventLogging.c

@@ -96,7 +96,7 @@ int StoreEventLogMsg(const char *fmt, ...)
 
 	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]%s_%s_EventLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]%s_%s_EventLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1,
@@ -105,7 +105,7 @@ int StoreEventLogMsg(const char *fmt, ...)
 	}
 	else
 	{
-		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]EventLog",
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]EventLog",
 					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 					buffer,
 					tm->tm_year+1900,tm->tm_mon+1);

+ 28 - 23
EVSE/Projects/Noodoe/Apps/Module_InternalComm.c

@@ -15,12 +15,12 @@
 
 #include 	<unistd.h>
 #include 	<stdarg.h>
-#include  	<stdio.h>      /*標準輸入輸出定義*/
-#include  	<stdlib.h>     /*標準函數庫定義*/
-#include  	<unistd.h>     /*Unix 標準函數定義*/
-#include  	<fcntl.h>      /*檔控制定義*/
-#include  	<termios.h>    /*PPSIX 終端控制定義*/
-#include 	<errno.h>      /*錯誤號定義*/
+#include  	<stdio.h>
+#include  	<stdlib.h>
+#include  	<unistd.h>
+#include  	<fcntl.h>
+#include  	<termios.h>
+#include 	<errno.h>
 #include 	<errno.h>
 #include 	<string.h>
 #include	<time.h>
@@ -2035,6 +2035,26 @@ int main(void)
 					}
 				}
 
+				//===============================
+				// Case 8 : Config primary set CP PWN duty
+				//===============================
+				if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == ON)
+				{
+					if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
+					{
+						failCount[gun_index] = 0;
+						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
+					}
+					else
+					{
+						DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\n", gun_index, failCount[gun_index]);
+						if(failCount[gun_index]<1000)
+						{
+							failCount[gun_index]++;
+						}
+					}
+				}
+
 				//==========================================================
 				// High priority polling log print out
 				//==========================================================
@@ -2244,24 +2264,9 @@ int main(void)
 						break;
 					case 9:
 						//===============================
-						// Config primary set CP PWN duty
+						// Reserve
 						//===============================
-						if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == ON)
-						{
-							if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
-							{
-								failCount[gun_index] = 0;
-								ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
-							}
-							else
-							{
-								DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\n", gun_index, failCount[gun_index]);
-								if(failCount[gun_index]<1000)
-								{
-									failCount[gun_index]++;
-								}
-							}
-						}
+
 						break;
 					case 11:
 						//===============================

+ 17 - 3
EVSE/Projects/Noodoe/Apps/main.c

@@ -3615,7 +3615,7 @@ int main(void)
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration = 0;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy = 0;
 						ShmCharger->gun_info[gun_index].targetCurrent = 0xFF;
-						ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = (ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent > 0) ? ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent<ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].primaryMcuState.rating_current) : ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+
 						ocpp_set_unlocker_req(gun_index, OFF);
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId = -1;
 
@@ -3714,6 +3714,22 @@ int main(void)
 						ShmCharger->gun_info[gun_index].isGunPlugged = NO;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStart = OFF;
 
+						// Get target current
+						ocpp_set_profile_req(gun_index, ON);
+						sleep(1);
+						checkChargingProfileLimit(gun_index);
+						if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+						{
+							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+						}
+						else
+						{
+							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+						}
+						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
+
 						setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
 					}
 					else
@@ -3757,7 +3773,6 @@ int main(void)
 									break;
 							}
 						}
-						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
 					}
 					
 					if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH)
@@ -3780,7 +3795,6 @@ int main(void)
 								   (!ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST) && (strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0)))
 								{
 									DEBUG_INFO("ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status: %s \n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status);
-
 									if(ocpp_get_auth_result(gun_index) ||
 									   (!ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)) ||
 									   (!ocpp_get_connection_status() && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)))

+ 8 - 0
EVSE/Projects/define.h

@@ -378,6 +378,13 @@ struct LED
 	unsigned char			Blue[3];					// Blue color	0~100, element 0: IDLE		1: CHARGING		2: FAULT
 };
 
+struct LCD_OVERRIDE
+{
+	unsigned char			page_index;					// LCD override page index
+	unsigned char			duration;					// LCD override duration
+	unsigned char			isOverideReq:1;				// LCD override request
+};
+
 struct Schedule
 {
 	unsigned char   isEnable;     						// 0: disable schedule function  1: enable schedule function
@@ -481,6 +488,7 @@ struct SysConfigData
 	unsigned char           isReqFirstUpgrade;          //EVSE is request first upgrade from PH server
 	unsigned char           isEnableLocalPowerSharging; //0: Disable power sharing  1: Enable power sharing
 	unsigned char           StopChargingByButton;       //0: Disable  1: Enable
+	struct LCD_OVERRIDE		LcdOveride;					// LCD override info
 
     /************PowerCabinet************/
     WiringInfoData          WiringInfo;