Browse Source

Merge branch 'master' of https://git.phihong.com.tw:30000/System_Integration/CSU3_AM335x into DEV_OCPP_verify

TC_Hsu 4 years ago
parent
commit
47722b62a5
60 changed files with 1939 additions and 1174 deletions
  1. BIN
      .swp
  2. 4 3
      EVSE/Modularization/Module_Wifi.c
  3. 9 9
      EVSE/Modularization/WebService.c
  4. 141 471
      EVSE/Modularization/ocppfiles/MessageHandler.c
  5. 426 33
      EVSE/Modularization/ocppfiles/MessageHandler.h
  6. 10 10
      EVSE/Modularization/ocppfiles/Module_OcppBackend.c
  7. 2 0
      EVSE/Modularization/ocppfiles/Module_OcppBackend.h
  8. 2 2
      EVSE/Modularization/ocppfiles/SystemLogMessage.c
  9. 145 77
      EVSE/Projects/AW-CCS/Apps/Module_AlarmDetect.c
  10. 2 2
      EVSE/Projects/AW-CCS/Apps/Module_FactoryConfig.c
  11. 150 20
      EVSE/Projects/AW-CCS/Apps/Module_InternalComm.c
  12. 650 178
      EVSE/Projects/AW-CCS/Apps/main.c
  13. 91 39
      EVSE/Projects/AW-CCS/Apps/main.h
  14. BIN
      EVSE/Projects/AW-CCS/Images/FactoryDefaultConfig.bin
  15. BIN
      EVSE/Projects/AW-CCS/Images/ramdisk.gz
  16. 2 2
      EVSE/Projects/AW-Regular/Apps/Module_FactoryConfig.c
  17. 1 0
      EVSE/Projects/AW-Regular/Apps/Module_InternalComm.c
  18. 10 2
      EVSE/Projects/AW-Regular/Apps/main.c
  19. BIN
      EVSE/Projects/AW-Regular/Images/FactoryDefaultConfig.bin
  20. BIN
      EVSE/Projects/AW-Regular/Images/MLO
  21. BIN
      EVSE/Projects/AW-Regular/Images/ramdisk.gz
  22. BIN
      EVSE/Projects/AW-Regular/Images/u-boot.img
  23. BIN
      EVSE/Projects/AW-Regular/Images/zImage
  24. 2 2
      EVSE/Projects/BYTON-GB/Apps/Module_FactoryConfig.c
  25. 1 0
      EVSE/Projects/BYTON-GB/Apps/Module_InternalComm.c
  26. 10 2
      EVSE/Projects/BYTON-GB/Apps/main.c
  27. BIN
      EVSE/Projects/BYTON-GB/Images/FactoryDefaultConfig.bin
  28. BIN
      EVSE/Projects/BYTON-GB/Images/MLO
  29. BIN
      EVSE/Projects/BYTON-GB/Images/ramdisk.gz
  30. BIN
      EVSE/Projects/BYTON-GB/Images/u-boot.img
  31. BIN
      EVSE/Projects/BYTON-GB/Images/zImage
  32. 2 2
      EVSE/Projects/Noodoe/Apps/Module_FactoryConfig.c
  33. 1 0
      EVSE/Projects/Noodoe/Apps/Module_InternalComm.c
  34. 10 2
      EVSE/Projects/Noodoe/Apps/main.c
  35. BIN
      EVSE/Projects/Noodoe/Images/FactoryDefaultConfig.bin
  36. BIN
      EVSE/Projects/Noodoe/Images/MLO
  37. BIN
      EVSE/Projects/Noodoe/Images/ramdisk.gz
  38. BIN
      EVSE/Projects/Noodoe/Images/u-boot-spl.bin
  39. BIN
      EVSE/Projects/Noodoe/Images/u-boot.img
  40. BIN
      EVSE/Projects/Noodoe/Images/zImage
  41. 18 5
      EVSE/Projects/define.h
  42. 0 0
      EVSE/rootfs/bin/iwconfig
  43. 0 0
      EVSE/rootfs/bin/iwlist
  44. 0 1
      EVSE/rootfs/root/passwd
  45. 0 1
      EVSE/rootfs/root/shadow
  46. 0 45
      EVSE/rootfs/root/uaputl_config/80211d_domain.conf
  47. 0 155
      EVSE/rootfs/root/uaputl_config/uaputl.conf
  48. 6 0
      EVSE/rootfs/usr/bin/run_tmate_restart.sh
  49. 1 1
      EVSE/rootfs/var/spool/cron/crontabs/root
  50. 6 6
      EVSE/rootfs/var/www/head.php
  51. 94 45
      EVSE/rootfs/var/www/set_charging.php
  52. 0 2
      EVSE/rootfs/var/www/set_charging_action.php
  53. 91 21
      EVSE/rootfs/var/www/set_network.php
  54. 29 21
      EVSE/rootfs/var/www/set_system.php
  55. 2 1
      EVSE/rootfs/var/www/set_system_action.php
  56. 13 5
      EVSE/rootfs/var/www/upgrade_iso.php
  57. 4 3
      EVSE/rootfs/var/www/upgrade_iso_action.php
  58. 1 1
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version
  59. 3 4
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/.am335x-evm.dtb.dts.tmp
  60. 0 1
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts

BIN
.swp


+ 4 - 3
EVSE/Modularization/Module_Wifi.c

@@ -4,7 +4,7 @@
  *  Created on: 2020-01-14
  *  Update on: 2020-05-27
  *  Author: Jerry Wang, Eason Yang, Folus Wen
- *  Version: D0.02
+ *  Version: D0.03
  */
 
 #include 	<sys/time.h>
@@ -558,7 +558,7 @@ int isConnectAP()
 	char buf[512];
 
 	// Get IP address & net mask
-	strcpy(cmd, "/root/iwconfig ");
+	strcpy(cmd, "iwconfig ");
 	strcat(cmd, Wifi.currentInterface);
 	fp = popen(cmd, "r");
 	if(fp == NULL)
@@ -663,7 +663,7 @@ int getLinkQuality()
 	char buf[512];
 	char tmp[512];
 
-	strcpy(cmd, "/root/iwconfig ");
+	strcpy(cmd, "iwconfig ");
 	strcat(cmd, Wifi.currentInterface);
 	fp = popen(cmd, "r");
 	if(fp == NULL)
@@ -3650,6 +3650,7 @@ void proc_ap()
 			}
 			break;
 		case AP_STATE_DEVICE_DETECT:
+			dispReq.isShowed_IP_info = false;
 			if(!isSetWPA_OK && (setWPAconf() == PASS))
 			{
 				isSetWPA_OK = true;

+ 9 - 9
EVSE/Modularization/WebService.c

@@ -359,6 +359,7 @@ int main(int argc, char *argv[]) {
 			json_object *val_obj = NULL;
 			char *SystemId=NULL;
 			char *SystemDateTime = NULL;
+			int PhaseLossPolicy = 0;
 			int FactoryConfiguration = 0;
 			int AuthorisationMode = 0;
 			int RfidCardNumEndian = 0;
@@ -375,6 +376,9 @@ int main(int argc, char *argv[]) {
 			if( json_object_object_get_ex(jobj, "SystemDateTime", &val_obj) ) {
 				SystemDateTime = (char*)json_object_get_string(val_obj);
 			}
+			if( json_object_object_get_ex(jobj, "PhaseLossPolicy", &val_obj) ) {
+				PhaseLossPolicy = json_object_get_int(val_obj);
+			}
 			if( json_object_object_get_ex(jobj, "FactoryConfiguration", &val_obj) ) {
 				FactoryConfiguration = json_object_get_int(val_obj);
 			}
@@ -403,6 +407,7 @@ int main(int argc, char *argv[]) {
 				QRCodeContent = json_object_get_string(val_obj);
 			}
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId,SystemId);
+			ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy = PhaseLossPolicy;
 			ShmSysConfigAndInfo->SysInfo.FactoryConfiguration = FactoryConfiguration;
 			ShmSysConfigAndInfo->SysConfig.AuthorisationMode = AuthorisationMode;
 			ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = RfidCardNumEndian;
@@ -430,7 +435,6 @@ int main(int argc, char *argv[]) {
 			int MaxChargingCurrent = 0;
 			int AcMaxChargingCurrent = 0;
 			int MaxChargingDuration = 0;
-			int PhaseLossPolicy = 0;
 			char *LocalWhiteCard0 = NULL;
 			char *LocalWhiteCard1 = NULL;
 			char *LocalWhiteCard2 = NULL;
@@ -483,9 +487,6 @@ int main(int argc, char *argv[]) {
 			if( json_object_object_get_ex(jobj, "MaxChargingDuration", &val_obj) ) {
 				MaxChargingDuration = json_object_get_int(val_obj);
 			}
-			if( json_object_object_get_ex(jobj, "PhaseLossPolicy", &val_obj) ) {
-				PhaseLossPolicy = json_object_get_int(val_obj);
-			}
 			if( json_object_object_get_ex(jobj, "LocalWhiteCard0", &val_obj) ) {
 				LocalWhiteCard0 = (char*)json_object_get_string(val_obj);
 			}
@@ -599,7 +600,6 @@ int main(int argc, char *argv[]) {
 			ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent = MaxChargingCurrent;
 			ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent = AcMaxChargingCurrent;
 			ShmSysConfigAndInfo->SysConfig.MaxChargingDuration = MaxChargingDuration;
-			ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy = PhaseLossPolicy;
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0],LocalWhiteCard0);
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1],LocalWhiteCard1);
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2],LocalWhiteCard2);
@@ -793,6 +793,7 @@ int main(int argc, char *argv[]) {
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
 		ShmSysConfigAndInfo->SysConfig.AcPhaseCount=1;
+		ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
 		ShmSysConfigAndInfo->SysInfo.FactoryConfiguration=0;
 		ShmSysConfigAndInfo->SysConfig.AuthorisationMode=0;
 		ShmSysConfigAndInfo->SysConfig.DefaultLanguage=0;
@@ -845,7 +846,6 @@ int main(int argc, char *argv[]) {
 		ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0;
 		ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent= 0;
 		ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0;
-		ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333");
@@ -1056,6 +1056,7 @@ int main(int argc, char *argv[]) {
 		struct json_object *SerialNumber;
 		struct json_object *SystemId;
 		struct json_object *AcPhaseCount;
+		struct json_object *PhaseLossPolicy;
 		struct json_object *FactoryConfiguration;
 		struct json_object *AuthorisationMode;
 		struct json_object *DefaultLanguage;
@@ -1117,7 +1118,6 @@ int main(int argc, char *argv[]) {
 		struct json_object *MaxChargingCurrent;
 		struct json_object *AcMaxChargingCurrent;
 		struct json_object *MaxChargingDuration;
-		struct json_object *PhaseLossPolicy;
 		struct json_object *LocalWhiteCard[10];
 		struct json_object *LocalWhiteCardArr= json_object_new_array();
 		struct json_object *isBilling;
@@ -1201,6 +1201,7 @@ int main(int argc, char *argv[]) {
 		SerialNumber = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber);
 		SystemId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SystemId);
 		AcPhaseCount = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPhaseCount);
+		PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
 		FactoryConfiguration = json_object_new_int(ShmSysConfigAndInfo->SysInfo.FactoryConfiguration);
 		AuthorisationMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
 		DefaultLanguage = json_object_new_int(ShmSysConfigAndInfo->SysConfig.DefaultLanguage);
@@ -1274,7 +1275,6 @@ int main(int argc, char *argv[]) {
 		MaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
 		AcMaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent);
 		MaxChargingDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingDuration);
-		PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
 		LocalWhiteCard[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]);
 		LocalWhiteCard[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]);
 		LocalWhiteCard[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]);
@@ -1633,6 +1633,7 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj1,"SerialNumber",SerialNumber);
 		json_object_object_add(jobj1,"SystemId",SystemId);
 		json_object_object_add(jobj1,"AcPhaseCount",AcPhaseCount);
+		json_object_object_add(jobj2,"PhaseLossPolicy",PhaseLossPolicy);
 		json_object_object_add(jobj1,"FactoryConfiguration",FactoryConfiguration);
 		json_object_object_add(jobj1,"AuthorisationMode",AuthorisationMode);
 		json_object_object_add(jobj1,"DefaultLanguage",DefaultLanguage);
@@ -1697,7 +1698,6 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj2,"MaxChargingCurrent",MaxChargingCurrent);
 		json_object_object_add(jobj2,"AcMaxChargingCurrent",AcMaxChargingCurrent);
 		json_object_object_add(jobj2,"MaxChargingDuration",MaxChargingDuration);
-		json_object_object_add(jobj2,"PhaseLossPolicy",PhaseLossPolicy);
 		json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[0]);
 		json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[1]);
 		json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[2]);

File diff suppressed because it is too large
+ 141 - 471
EVSE/Modularization/ocppfiles/MessageHandler.c


+ 426 - 33
EVSE/Modularization/ocppfiles/MessageHandler.h

@@ -1,6 +1,420 @@
 #ifndef MessageHandler_H
 #define MessageHandler_H
 
+//===================================
+//	Define CP State constant
+//===================================
+#define CP_STATE_UNKNOWN			0
+#define CP_STATE_A					1
+#define CP_STATE_B					2
+#define CP_STATE_C					3
+#define CP_STATE_D					4
+#define CP_STATE_E					5
+#define CP_STATE_F					6
+
+//==========================================
+// Init all Enumeration & Mapping String
+//==========================================
+#define MACROSTR(k) #k
+
+/*ChargePointErrorCode*/
+typedef enum {
+	ConnectorLockFailure,
+	EVCommunicationError,
+	GroundFailure,
+	HighTemperature,
+	InternalError,
+	LocalListConflict,
+	NoError,
+	OtherError,
+	OverCurrentFailure,
+	OverVoltage,
+	PowerMeterFailure,
+	PowerSwitchFailure,
+	ReaderFailure,
+	ResetFailure,
+	UnderVoltage,
+	WeakSignal
+} ChargePointErrorCode;
+
+/*ChargePointStatus*/
+typedef enum {
+	Available =0,
+	Preparing,
+	Charging,
+	SuspendedEVSE,
+	SuspendedEV,
+	Finishing,
+	Reserved,
+	Unavailable,
+	Faulted
+}  ChargePointStatus;
+
+/*AvailabilityType*/
+typedef enum {
+	RegistrationStatus_Accepted,
+	RegistrationStatus_Pending,
+	RegistrationStatus_Rejected
+} RegistrationStatus;
+
+/*AvailabilityType*/
+typedef enum {
+	Inoperative,
+	Operative
+} AvailabilityType;
+
+/*AvailabilityStatus*/
+typedef enum {
+	Accepted,
+	Rejected,
+	Scheduled
+}  AvailabilityStatus;
+
+/*ConfigurationStatus*/
+typedef enum {
+	ConfigurationStatus_Accepted,
+	ConfigurationStatus_Rejected,
+	RebootRequired,
+	NotSupported
+}  ConfigurationStatus;
+
+/*ClearCacheStatus*/
+typedef enum {
+	ClearCacheStatus_Accepted,
+	ClearCacheStatus_Rejected
+}  ClearCacheStatus;
+
+/*ChargingProfilePurposeType*/
+typedef enum {
+	ChargePointMaxProfile,
+	TxDefaultProfile,
+	TxProfile
+}  ChargingProfilePurposeType;
+
+/*ChargingProfileStatus*/
+typedef enum {
+	ChargingProfileStatus_Accepted,
+	ChargingProfileStatus_Rejected,
+	ChargingProfileStatus_NotSupported
+}  ChargingProfileStatus;
+
+/*ClearChargingProfileStatus*/
+typedef enum {
+	ClearChargingProfileStatus_Accepted,
+	ClearChargingProfileStatus_Unknown
+}  ClearChargingProfileStatus;
+
+/*GetCompositeScheduleStatus*/
+typedef enum {
+	GetCompositeScheduleStatus_Accepted,
+	GetCompositeScheduleStatus_Rejected
+}  GetCompositeScheduleStatus;
+
+/*ChargingRateUnitType*/
+typedef enum {
+	ChargingRateUnitType_W,
+	ChargingRateUnitType_A
+}  ChargingRateUnitType;
+
+/*AuthorizationStatus*/
+typedef enum {
+	AuthorizationStatus_Accepted ,
+	AuthorizationStatus_Blocked ,
+	AuthorizationStatus_Expired ,
+	AuthorizationStatus_Invalid ,
+	AuthorizationStatus_ConcurrentTx
+}  AuthorizationStatus;
+
+/*UpdateType*/
+typedef enum {
+	Differential  ,
+	Full
+}  UpdateType;
+
+/*UpdateStatus*/
+typedef enum {
+	UpdateStatus_Accepted   ,
+	UpdateStatus_Failed ,
+	UpdateStatus_NotSupported ,
+	UpdateStatus_VersionMismatch
+}  UpdateStatus;
+
+/*RemoteStartStopStatus*/
+typedef enum {
+	RemoteStartStopStatus_Accepted,
+	RemoteStartStopStatus_Rejected
+
+}  RemoteStartStopStatus;
+
+/*ReservationStatus*/
+typedef enum {
+	ReservationStatus_Accepted,
+	ReservationStatus_Faulted,
+	ReservationStatus_Occupied,
+	ReservationStatus_Rejected,
+	ReservationStatus_Unavailable
+
+}  ReservationStatus;
+
+/*ResetType*/
+typedef enum {
+	Hard,
+	Soft
+}  ResetType;
+
+/*ResetStatus*/
+typedef enum {
+	ResetStatus_Accepted,
+	ResetStatus_Rejected
+}  ResetStatus;
+
+/*DiagnosticsStatus*/
+typedef enum {
+	DiagnosticsStatus_Idle,
+	DiagnosticsStatus_Uploaded,
+	DiagnosticsStatus_UploadFailed,
+	DiagnosticsStatus_Uploading
+}  DiagnosticsStatus;
+
+/*FirmwareStatus*/
+typedef enum {
+	FirmwareStatus_Downloaded,
+	FirmwareStatus_DownloadFailed,
+	FirmwareStatus_Downloading,
+	FirmwareStatus_Idle,
+	FirmwareStatus_InstallationFailed,
+	FirmwareStatus_Installing,
+	FirmwareStatus_Installed
+}  FirmwareStatus;
+
+/*MessageTrigger*/
+typedef enum {
+	BootNotification,
+	DiagnosticsStatusNotification,
+	FirmwareStatusNotification,
+	Heartbeat,
+	MeterValues,
+	StatusNotification
+}   MessageTrigger;
+
+/*TriggerMessageStatus*/
+typedef enum {
+	TriggerMessageStatus_Accepted ,
+	TriggerMessageStatus_Rejected ,
+	TriggerMessageStatus_NotImplemented
+}   TriggerMessageStatus;
+
+/*UnlockStatus*/
+typedef enum {
+	Unlocked,
+	UnlockFailed,
+	UnlockStatus_NotSupported
+}   UnlockStatus;
+
+/*StopTransactionReason*/
+typedef enum {
+	EmergencyStop,
+	EVDisconnected,
+	HardReset,
+	Local,
+	Other,
+	PowerLoss,
+	Reboot,
+	Remote,
+	SoftReset,
+	UnlockCommand,
+	DeAuthorized
+}   StopTransactionReason;
+
+/*CancelReservationStatus*/
+typedef enum {
+	CancelReservationStatus_Accepted,
+	CancelReservationStatus_Rejected
+}   CancelReservationStatus;
+
+/*ReadingContext*/
+typedef enum {
+	ReadingContext_Interruption_Begin,
+	ReadingContext_Interruption_End,
+	ReadingContext_Other,
+	ReadingContext_Sample_Clock,
+	ReadingContext_Sample_Periodic ,
+	ReadingContext_Transaction_Begin ,
+	ReadingContext_Transaction_End,
+	ReadingContext_Trigger
+}  ReadingContext;
+
+/*ValueFormat*/
+typedef enum {
+	Raw,
+	SignedData
+}  ValueFormat;
+
+/*Measurand*/
+typedef enum {
+	Current_Export ,
+	Current_Import,
+	Current_Offered,
+	Energy_Active_Export_Register,
+	Energy_Active_Import_Register,
+	Energy_Reactive_Export_Register,
+	Energy_Reactive_Import_Register,
+	Energy_Active_Export_Interval,
+	Energy_Active_Import_Interval,
+	Energy_Reactive_Export_Interval,
+	Energy_Reactive_Import_Interval,
+	Frequency,
+	Power_Active_Export ,
+	Power_Active_Import,
+	Power_Factor,
+	Power_Offered,
+	Power_Reactive_Export,
+	Power_Reactive_Import,
+	RPM,
+	SoC,
+	Temperature ,
+	Voltage
+}  Measurand;
+
+/*Location*/
+typedef enum {
+	Location_Body,
+	Location_Cable,
+	Location_EV,
+	Location_Inlet ,
+	Location_Outlet
+}  Location;
+
+/*Phase*/
+typedef enum {
+	L1,
+	L2,
+	L3,
+	N,
+	L1_N,
+	L2_N,
+	L3_N,
+	L1_L2,
+	L2_L3,
+	L3_L1
+}  Phase;
+
+/*UnitOfMeasure*/
+typedef enum {
+	UnitOfMeasure_Wh,
+	UnitOfMeasure_kWh ,
+	UnitOfMeasure_varh ,
+	UnitOfMeasure_kvarh ,
+	UnitOfMeasure_W ,
+	UnitOfMeasure_kW ,
+	UnitOfMeasure_VA ,
+	UnitOfMeasure_kVA ,
+	UnitOfMeasure_var ,
+	UnitOfMeasure_kvar ,
+	UnitOfMeasure_A ,
+	UnitOfMeasure_V ,
+	UnitOfMeasure_Celsius ,
+	UnitOfMeasure_Fahrenheit ,
+	UnitOfMeasure_K ,
+	UnitOfMeasure_Percent
+
+}  UnitOfMeasure;
+
+enum LocalAuthListManagementProfile{
+	LocalAuthListEnabled=0,
+	LocalAuthListMaxLength,
+	SendLocalListMaxLength,
+	_LocalAuthListManagementProfile_CNT
+};
+
+enum ReservationProfile{
+	ReserveConnectorZeroSupported
+};
+
+enum SmartChargingProfile{
+	ChargeProfileMaxStackLevel,
+	ChargingScheduleAllowedChargingRateUnit,
+	ChargingScheduleMaxPeriods,
+	ConnectorSwitch3to1PhaseSupported,
+	MaxChargingProfilesInstalled
+};
+
+enum ChargerSystemStatus{
+	ChargerSystemStatus_Booting,
+	ChargerSystemStatus_Idle,
+	ChargerSystemStatus_Authorizing,
+	ChargerSystemStatus_Preparing,
+	ChargerSystemStatus_Charging,
+	ChargerSystemStatus_Terminating,
+	ChargerSystemStatus_Alarm,
+	ChargerSystemStatus_Fault
+};
+
+enum GetConfigurationKey {
+	GetConfiguration_AllowOfflineTxForUnknownId=0,
+	GetConfiguration_AuthorizationCacheEnabled,
+	GetConfiguration_AuthorizeRemoteTxRequests,
+	GetConfiguration_BlinkRepeat,
+	GetConfiguration_ClockAlignedDataInterval,
+	GetConfiguration_ConnectionTimeOut,
+	GetConfiguration_GetConfigurationMaxKeys,
+	GetConfiguration_HeartbeatInterval,
+	GetConfiguration_LightIntensity,
+	GetConfiguration_LocalAuthorizeOffline,
+	GetConfiguration_LocalPreAuthorize,
+	GetConfiguration_MaxEnergyOnInvalidId,
+	GetConfiguration_MeterValuesAlignedData,
+	GetConfiguration_MeterValuesAlignedDataMaxLength,
+	GetConfiguration_MeterValuesSampledData,
+	GetConfiguration_MeterValuesSampledDataMaxLength,
+	GetConfiguration_MeterValueSampleInterval,
+	GetConfiguration_MinimumStatusDuration,
+	GetConfiguration_NumberOfConnectors,
+	GetConfiguration_ResetRetries,
+	GetConfiguration_ConnectorPhaseRotation,
+	GetConfiguration_ConnectorPhaseRotationMaxLength,
+	GetConfiguration_StopTransactionOnEVSideDisconnect,
+	GetConfiguration_StopTransactionOnInvalidId,
+	GetConfiguration_StopTxnAlignedData,
+	GetConfiguration_StopTxnAlignedDataMaxLength,
+	GetConfiguration_StopTxnSampledData,
+	GetConfiguration_StopTxnSampledDataMaxLength,
+	GetConfiguration_SupportedFeatureProfiles,
+	GetConfiguration_SupportedFeatureProfilesMaxLength,
+	GetConfiguration_TransactionMessageAttempts,
+	GetConfiguration_TransactionMessageRetryInterval,
+	GetConfiguration_UnlockConnectorOnEVSideDisconnect,
+	GetConfiguration_WebSocketPingInterval,
+	GetConfiguration_LocalAuthListEnabled,
+	GetConfiguration_LocalAuthListMaxLength,
+	GetConfiguration_SendLocalListMaxLength,
+	GetConfiguration_ReserveConnectorZeroSupported,
+	GetConfiguration_ChargeProfileMaxStackLevel,
+	GetConfiguration_ChargingScheduleAllowedChargingRateUnit,
+	GetConfiguration_ChargingScheduleMaxPeriods,
+	GetConfiguration_ConnectorSwitch3to1PhaseSupported,
+	GetConfiguration_MaxChargingProfilesInstalled,
+};
+
+enum FIRMWARE_NOTIFICATION_STATUS
+{
+	FIRMWARE_STATUS_DOWNLOADED = 0,
+	FIRMWARE_STATUS_DOWNLOAD_DAILED = 1,
+	FIRMWARE_STATUS_DOWNLOADING = 2,
+	FIRMWARE_STATUS_IDLE = 3,
+	FIRMWARE_STATUS_INSTALLATION_FAILED =4,
+	FIRMWARE_STATUS_INSTALLING = 5,
+	FIRMWARE_STATUS_INSTALLED = 6
+};
+
+enum DIAGNOSTIC_NOTIFICATION_STATUS
+{
+	DIAGNOSTIC_STATUS_IDLE = 0,
+	DIAGNOSTIC_STATUS_UPLOADED = 1,
+	DIAGNOSTIC_STATUS_UPLOAD_FAIL = 2,
+	DIAGNOSTIC_STATUS_UPLOADING =3
+};
+
 struct StructPeriod
 {
 	int		StartPeriod;
@@ -15,7 +429,6 @@ struct StructProfile
 	struct StructPeriod	Period[10];
 };
 
-
 //===============================================
 // Common routine
 //===============================================
@@ -36,7 +449,7 @@ int sendHeartbeatRequest(int gun_index);
 int sendStartTransactionRequest(int gun_index);
 int sendStatusNotificationRequest(int gun_index);
 int sendStopTransactionRequest(int gun_index);
-int sendMeterValuesRequest(int gun_index);
+int sendMeterValuesRequest(int gun_index, ReadingContext dataType);
 
 //==========================================
 // send confirm routine
@@ -136,37 +549,17 @@ void InitialSystemValue(void);
 void checkTempStopTransaction(int gun_index);
 void storeTempStopTransaction(int gun_index);
 
- //===============================================
- // sqlite related routine
- //===============================================
- int SettingChargingRecord(int target, int transactionId);
- int addBuff(int gun_idx, int user_id, int cmd_sn);
- void OCPP_getListVerion();
- int OCPP_cleanLocalList();
- int OCPP_addLocalList(int version, char *idTag, char *parentTage, char *expiryDate, char *status);
- int OCPP_addLocalList_1(int version, char *idTag, char *parentTage, char *expiryDate, char *status);
- void OCPP_getIdTag(char idTag[]);
- void OCPP_deleteIdTag(char idTag[]);
-
-
-enum FIRMWARE_NOTIFICATION_STATUS
-{
-	FIRMWARE_STATUS_DOWNLOADED = 0,
-	FIRMWARE_STATUS_DOWNLOAD_DAILED = 1,
-	FIRMWARE_STATUS_DOWNLOADING = 2,
-	FIRMWARE_STATUS_IDLE = 3,
-	FIRMWARE_STATUS_INSTALLATION_FAILED =4,
-	FIRMWARE_STATUS_INSTALLING = 5,
-	FIRMWARE_STATUS_INSTALLED = 6
-};
-
-enum DIAGNOSTIC_NOTIFICATION_STATUS
-{
-	DIAGNOSTIC_STATUS_IDLE = 0,
-	DIAGNOSTIC_STATUS_UPLOADED = 1,
-	DIAGNOSTIC_STATUS_UPLOAD_FAIL = 2,
-	DIAGNOSTIC_STATUS_UPLOADING =3
-};
+//===============================================
+// sqlite related routine
+//===============================================
+int SettingChargingRecord(int target, int transactionId);
+int addBuff(int gun_idx, int user_id, int cmd_sn);
+void OCPP_getListVerion();
+int OCPP_cleanLocalList();
+int OCPP_addLocalList(int version, char *idTag, char *parentTage, char *expiryDate, char *status);
+int OCPP_addLocalList_1(int version, char *idTag, char *parentTage, char *expiryDate, char *status);
+void OCPP_getIdTag(char idTag[]);
+void OCPP_deleteIdTag(char idTag[]);
 
 
 #endif

+ 10 - 10
EVSE/Modularization/ocppfiles/Module_OcppBackend.c

@@ -200,7 +200,7 @@ static int OCPP16Callback(struct lws *wsi, enum lws_callback_reasons reason, voi
 			DEBUG_INFO("LWS_CALLBACK_CLIENT_ESTABLISHED\n");
 
 			char frontUUID[100] ={0};
-			char frontData[1200] ={0};
+			char frontData[QUEUE_MESSAGE_LENGTH] ={0};
 			int queueNotEmpty = FALSE;
 
 			//connected
@@ -450,7 +450,7 @@ int showfront(char *uuid, char *data)
 {
 	FILE *fp;
 	int result = FALSE; // 1: TRUE  0:FALSE
-	char str[1200]={0};
+	char str[QUEUE_MESSAGE_LENGTH]={0};
 	char sstr[50]={ 0 };//sstr[200]={ 0 };
 	int c = 0;
 	char *loc;
@@ -501,7 +501,7 @@ int showfront(char *uuid, char *data)
 		return FALSE;
 	}
 
-	if( fgets (str, 1200, fp)!=NULL ) {
+	if( fgets (str, QUEUE_MESSAGE_LENGTH, fp)!=NULL ) {
 		/* writing content to stdout */
 		//DEBUG_INFO("str=%s",str);
 		if ((str[0] == '\n')||(strcmp(str,"")==0))
@@ -677,7 +677,7 @@ int delq()
 	}
 	else
 	{
-		char buf[1200]={0};
+		char buf[QUEUE_MESSAGE_LENGTH]={0};
 
 		int i = 0;
 		//DEBUG_INFO("Orignal File is not NULL\n");
@@ -766,7 +766,7 @@ int showqueue()
 	}
 
 	FILE *fp = fopen("/Storage/OCPP/TransactionRelatedQueue", "r");
-	char line[1200]={0};
+	char line[QUEUE_MESSAGE_LENGTH]={0};
 	// check if file exist (and you can open it) or not
 	if (fp == NULL) {
 		DEBUG_INFO("can open file TransactionRelatedQueue!");
@@ -796,8 +796,8 @@ int sentqueue(){
 	int IsStopTransaction = FALSE;
 	//int IsconnectorIdNULL = FALSE;
 	//int IsIdtagNULL = FALSE;
-	char str[1200]={0};
-	char strcomposite[1200]={0};
+	char str[QUEUE_MESSAGE_LENGTH]={0};
+	char strcomposite[QUEUE_MESSAGE_LENGTH]={0};
 	char rmFileCmd[100]={0};
 	char connectorStr[2]={0};
 	struct stat stats;
@@ -834,7 +834,7 @@ int sentqueue(){
 		return FALSE;
 	}
 
-	if( fgets (str, 1200, fp)!=NULL ) {
+	if( fgets (str, QUEUE_MESSAGE_LENGTH, fp)!=NULL ) {
 
 		//---- writing content to stdout ---//
 
@@ -1054,7 +1054,7 @@ int sentqueue(){
 void* processTransactionQueue(void* data)
 {
 	char frontUUID[100] ={0};
-	char frontData[1200/*1024*4*/] ={0};
+	char frontData[QUEUE_MESSAGE_LENGTH/*1024*4*/] ={0};
 	int queueNotEmpty = FALSE;
 
 	while(1)
@@ -1158,7 +1158,7 @@ void* processWatchdog()
 void CheckTransactionPacket(char *uuid)
 {
 	char frontUUID[100]={0};
-	char frontData[1200]={0};
+	char frontData[QUEUE_MESSAGE_LENGTH]={0};
 	int queueNotEmpty = FALSE;
 	int cmpResult = 0;
 

+ 2 - 0
EVSE/Modularization/ocppfiles/Module_OcppBackend.h

@@ -72,6 +72,8 @@
 #define QUEUE_OPERATION_SENT		3
 #define QUEUE_OPERATION_ADD			4
 #define QUEUE_OPERATION_STORE		5
+#define QUEUE_MESSAGE_LENGTH		3584
+
 
 extern void CheckSystemValue(void);
 extern int FirstHeartBeatResponse(void);

+ 2 - 2
EVSE/Modularization/ocppfiles/SystemLogMessage.c

@@ -18,7 +18,7 @@ int StoreLogMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >>  /Storage/OCPP/[%04d.%02d]SystemLog",
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >>  /Storage/OCPP/[%04d.%02d]SystemLog",
 			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);
@@ -49,7 +49,7 @@ int StoreOcppMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >>  /Storage/OCPP/[%04d.%02d]OcppMessage",
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >>  /Storage/OCPP/[%04d.%02d]OcppMessage",
 			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);

+ 145 - 77
EVSE/Projects/AW-CCS/Apps/Module_AlarmDetect.c

@@ -52,10 +52,10 @@
 struct{
 	unsigned short int	OV[3];
 	unsigned short int	UV[3];
-	unsigned short int	OC;
+	unsigned short int	OC[3];
 	unsigned short int	OT_AMB;
 	unsigned short int	GMI;
-	unsigned short int	Short;
+	unsigned short int	Short[3];
 	unsigned short int	Leakage;
 	unsigned short int	HandShakingTimeout;
 	unsigned short int	EmrgencyBTN;
@@ -264,15 +264,15 @@ int main(void)
 			//=====================================
 			// Over voltage detection
 			//=====================================
-			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE)
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L1_OVER_VOLTAGE)
 			{
 				if(Alarm_Counter[gun_index].OV[0] > FILTER_SPEC)
 				{
 					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == OFF)
 					{
 						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = ON;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_VOLTAGE;
-						DEBUG_INFO("ALARM_OVER_VOLTAGE : alarm \r\n");
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_VOLTAGE;
+						DEBUG_INFO("ALARM_L1_OVER_VOLTAGE : alarm \r\n");
 					}
 				}
 				else
@@ -280,28 +280,28 @@ int main(void)
 					Alarm_Counter[gun_index].OV[0]++;
 				}
 			}
-			else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE)))
+			else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L1_OVER_VOLTAGE)))
 			{
 				Alarm_Counter[gun_index].OV[0] = 0;
 				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == ON)
 				{
 					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = OFF;
-					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_VOLTAGE;
-					DEBUG_INFO("ALARM_OVER_VOLTAGE : recover \r\n");
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_OVER_VOLTAGE;
+					DEBUG_INFO("ALARM_L1_OVER_VOLTAGE : recover \r\n");
 				}
 			}
 
 			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
 			{
-				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE)
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L2_OVER_VOLTAGE)
 				{
 					if(Alarm_Counter[gun_index].OV[1] > FILTER_SPEC)
 					{
 						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == OFF)
 						{
 							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = ON;
-							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_VOLTAGE;
-							DEBUG_INFO("ALARM_OVER_VOLTAGE : alarm \r\n");
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_OVER_VOLTAGE;
+							DEBUG_INFO("ALARM_L2_OVER_VOLTAGE : alarm \r\n");
 						}
 					}
 					else
@@ -309,26 +309,26 @@ int main(void)
 						Alarm_Counter[gun_index].OV[1]++;
 					}
 				}
-				else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE)))
+				else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L2_OVER_VOLTAGE)))
 				{
 					Alarm_Counter[gun_index].OV[1] = 0;
 					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == ON)
 					{
 						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = OFF;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_VOLTAGE;
-						DEBUG_INFO("ALARM_OVER_VOLTAGE : recover \r\n");
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_OVER_VOLTAGE;
+						DEBUG_INFO("ALARM_L2_OVER_VOLTAGE : recover \r\n");
 					}
 				}
 
-				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE)
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L3_OVER_VOLTAGE)
 				{
 					if(Alarm_Counter[gun_index].OV[2] > FILTER_SPEC)
 					{
 						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == OFF)
 						{
 							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = ON;
-							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_VOLTAGE;
-							DEBUG_INFO("ALARM_OVER_VOLTAGE : alarm \r\n");
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_OVER_VOLTAGE;
+							DEBUG_INFO("ALARM_L3_OVER_VOLTAGE : alarm \r\n");
 						}
 					}
 					else
@@ -336,14 +336,14 @@ int main(void)
 						Alarm_Counter[gun_index].OV[2]++;
 					}
 				}
-				else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_VOLTAGE)))
+				else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L3_OVER_VOLTAGE)))
 				{
 					Alarm_Counter[gun_index].OV[2] = 0;
 					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == ON)
 					{
 						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = OFF;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_VOLTAGE;
-						DEBUG_INFO("ALARM_OVER_VOLTAGE : recover \r\n");
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_OVER_VOLTAGE;
+						DEBUG_INFO("ALARM_L3_OVER_VOLTAGE : recover \r\n");
 					}
 				}
 			}
@@ -351,15 +351,15 @@ int main(void)
 			//=====================================
 			// Under voltage detection
 			//=====================================
-			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE)
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L1_UNDER_VOLTAGE)
 			{
 				if(Alarm_Counter[gun_index].UV[0] > FILTER_SPEC)
 				{
 					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == OFF)
 					{
 						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = ON;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_UNDER_VOLTAGE;
-						DEBUG_INFO("ALARM_UNDER_VOLTAGE : alarm \r\n");
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_UNDER_VOLTAGE;
+						DEBUG_INFO("ALARM_L1_UNDER_VOLTAGE : alarm \r\n");
 					}
 				}
 				else
@@ -367,28 +367,28 @@ int main(void)
 					Alarm_Counter[gun_index].UV[0]++;
 				}
 			}
-			else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE)))
+			else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L1_UNDER_VOLTAGE)))
 			{
 				Alarm_Counter[gun_index].UV[0] = 0;
 				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == ON)
 				{
 					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = OFF;
-					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_UNDER_VOLTAGE;
-					DEBUG_INFO("ALARM_UNDER_VOLTAGE : recover \r\n");
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_UNDER_VOLTAGE;
+					DEBUG_INFO("ALARM_L1_UNDER_VOLTAGE : recover \r\n");
 				}
 			}
 
 			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
 			{
-				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE)
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L2_UNDER_VOLTAGE)
 				{
 					if(Alarm_Counter[gun_index].UV[1] > FILTER_SPEC)
 					{
 						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == OFF)
 						{
 							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = ON;
-							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_UNDER_VOLTAGE;
-							DEBUG_INFO("ALARM_UNDER_VOLTAGE : alarm \r\n");
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_UNDER_VOLTAGE;
+							DEBUG_INFO("ALARM_L2_UNDER_VOLTAGE : alarm \r\n");
 						}
 					}
 					else
@@ -396,26 +396,26 @@ int main(void)
 						Alarm_Counter[gun_index].UV[1]++;
 					}
 				}
-				else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE)))
+				else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L2_UNDER_VOLTAGE)))
 				{
 					Alarm_Counter[gun_index].UV[1] = 0;
 					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == ON)
 					{
 						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = OFF;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_UNDER_VOLTAGE;
-						DEBUG_INFO("ALARM_UNDER_VOLTAGE : recover \r\n");
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_UNDER_VOLTAGE;
+						DEBUG_INFO("ALARM_L2_UNDER_VOLTAGE : recover \r\n");
 					}
 				}
 
-				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE)
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L3_UNDER_VOLTAGE)
 				{
 					if(Alarm_Counter[gun_index].UV[2] > FILTER_SPEC)
 					{
 						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == OFF)
 						{
 							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = ON;
-							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_UNDER_VOLTAGE;
-							DEBUG_INFO("ALARM_UNDER_VOLTAGE : alarm \r\n");
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_UNDER_VOLTAGE;
+							DEBUG_INFO("ALARM_L3_UNDER_VOLTAGE : alarm \r\n");
 						}
 					}
 					else
@@ -423,77 +423,78 @@ int main(void)
 						Alarm_Counter[gun_index].UV[2]++;
 					}
 				}
-				else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_UNDER_VOLTAGE)))
+				else if((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L3_UNDER_VOLTAGE)))
 				{
 					Alarm_Counter[gun_index].UV[2] = 0;
 					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == ON)
 					{
 						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = OFF;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_UNDER_VOLTAGE;
-						DEBUG_INFO("ALARM_UNDER_VOLTAGE : recover \r\n");
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_UNDER_VOLTAGE;
+						DEBUG_INFO("ALARM_L3_UNDER_VOLTAGE : recover \r\n");
 					}
 				}
+							
 			}
 
 			//=====================================
 			// Over current detection
 			//=====================================
-			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT)
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L1_OVER_CURRENT)
 			{
 				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == OFF)
 				{
 					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = ON;
-					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_CURRENT;
-					DEBUG_INFO("ALARM_OVER_CURRENT : alarm \r\n");
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_CURRENT;
+					DEBUG_INFO("ALARM_L1_OVER_CURRENT : alarm \r\n");
 				}
 			}
-			else if ((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT)))
+			else if ((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L1_OVER_CURRENT)))
 			{
 				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON)
 				{
 					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = OFF;
-					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_CURRENT;
-					DEBUG_INFO("ALARM_OVER_CURRENT : recover \r\n");
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_OVER_CURRENT;
+					DEBUG_INFO("ALARM_L1_OVER_CURRENT : recover \r\n");
 				}
 			}
 
 			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
 			{
-				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT)
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L2_OVER_CURRENT)
 				{
-					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == OFF)
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 == OFF)
 					{
-						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = ON;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_CURRENT;
-						DEBUG_INFO("ALARM_OVER_CURRENT : alarm \r\n");
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_OVER_CURRENT;
+						DEBUG_INFO("ALARM_L2_OVER_CURRENT : alarm \r\n");
 					}
 				}
-				else if ((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT)))
+				else if ((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L2_OVER_CURRENT)))
 				{
-					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON)
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 == ON)
 					{
-						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = OFF;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_CURRENT;
-						DEBUG_INFO("ALARM_OVER_CURRENT : recover \r\n");
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_OVER_CURRENT;
+						DEBUG_INFO("ALARM_L2_OVER_CURRENT : recover \r\n");
 					}
 				}
 
-				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT)
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L3_OVER_CURRENT)
 				{
-					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == OFF)
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 == OFF)
 					{
-						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = ON;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_CURRENT;
-						DEBUG_INFO("ALARM_OVER_CURRENT : alarm \r\n");
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_OVER_CURRENT;
+						DEBUG_INFO("ALARM_L3_OVER_CURRENT : alarm \r\n");
 					}
 				}
-				else if ((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_OVER_CURRENT)))
+				else if ((!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L3_OVER_CURRENT)))
 				{
-					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON)
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 == ON)
 					{
-						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = OFF;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_CURRENT;
-						DEBUG_INFO("ALARM_OVER_CURRENT : recover \r\n");
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_OVER_CURRENT;
+						DEBUG_INFO("ALARM_L3_OVER_CURRENT : recover \r\n");
 					}
 				}
 			}
@@ -786,30 +787,87 @@ int main(void)
 			//=====================================
 			// Current short detection
 			//=====================================
-			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CURRENT_SHORT)
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L1_CIRCUIT_SHORT)
 			{
-				if(Alarm_Counter[gun_index].Short > FILTER_SPEC)
+				if(Alarm_Counter[gun_index].Short[0] > FILTER_SPEC)
 				{
 					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort == OFF)
 					{
 						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort = ON;
-						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CURRENT_SHORT;
-						DEBUG_INFO("ALARM_CIRCUIT_SHORT : alarm \r\n");
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_CIRCUIT_SHORT;
+						DEBUG_INFO("ALARM_L1_CIRCUIT_SHORT : alarm \r\n");
 					}
 				}
 				else
 				{
-					Alarm_Counter[gun_index].Short++;
+					Alarm_Counter[gun_index].Short[0]++;
 				}
 			}
-			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_CURRENT_SHORT))
+			else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L1_CIRCUIT_SHORT))
 			{
-				Alarm_Counter[gun_index].Short = 0;
+				Alarm_Counter[gun_index].Short[0] = 0;
 				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort == ON)
 				{
 					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort = OFF;
-					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CURRENT_SHORT;
-					DEBUG_INFO("ALARM_CIRCUIT_SHORT : recover \r\n");
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_CIRCUIT_SHORT;
+					DEBUG_INFO("ALARM_L1_CIRCUIT_SHORT : recover \r\n");
+				}
+			}
+			
+			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+			{
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L2_CIRCUIT_SHORT)
+				{
+					if(Alarm_Counter[gun_index].Short[1] > FILTER_SPEC)
+					{
+						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 == OFF)
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_CIRCUIT_SHORT;
+							DEBUG_INFO("ALARM_L2_CIRCUIT_SHORT : alarm \r\n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].Short[1]++;
+					}
+				}
+				else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L2_CIRCUIT_SHORT))
+				{
+					Alarm_Counter[gun_index].Short[1] = 0;
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_CIRCUIT_SHORT;
+						DEBUG_INFO("ALARM_L2_CIRCUIT_SHORT : recover \r\n");
+					}
+				}
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L3_CIRCUIT_SHORT)
+				{
+					if(Alarm_Counter[gun_index].Short[2] > FILTER_SPEC)
+					{
+						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 == OFF)
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_CIRCUIT_SHORT;
+							DEBUG_INFO("ALARM_L3_CIRCUIT_SHORT : alarm \r\n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].Short[2]++;
+					}
+				}
+				else if(!(ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode & ALARM_L3_CIRCUIT_SHORT))
+				{
+					Alarm_Counter[gun_index].Short[2] = 0;
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_CIRCUIT_SHORT;
+						DEBUG_INFO("ALARM_L3_CIRCUIT_SHORT : recover \r\n");
+					}
 				}
 			}
 
@@ -926,15 +984,21 @@ int main(void)
 			//=====================================
 			// OCPP error code message
 			//=====================================
-			if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_VOLTAGE)
+			if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_VOLTAGE) ||
+				(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_VOLTAGE) ||
+				(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_VOLTAGE))
 			{
 				sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OverVoltage");
 			}
-			else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_UNDER_VOLTAGE)
+			else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_UNDER_VOLTAGE) ||
+					(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_UNDER_VOLTAGE) ||
+					(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_UNDER_VOLTAGE))
 			{
 				sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "UnderVoltage");
 			}
-			else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_CURRENT)
+			else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT) ||
+					(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT) ||
+					(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT))
 			{
 				sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OverCurrentFailure");
 			}
@@ -1000,7 +1064,9 @@ int main(void)
 				sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
 				sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "PowerDrop");
 			}
-			else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_SHORT)
+			else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_CIRCUIT_SHORT) ||
+					(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_CIRCUIT_SHORT) ||
+					(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_CIRCUIT_SHORT))
 			{
 				sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
 				sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "CircuitShort");
@@ -1050,6 +1116,8 @@ int main(void)
 				  TODO: Recover latch alarm here
 				*/
 			}
+			
+			ShmCharger->gun_info[gun_index].acCcsInfo.CSUAlarmStatusCode = ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode;
 		}
 
 		usleep(100000);

+ 2 - 2
EVSE/Projects/AW-CCS/Apps/Module_FactoryConfig.c

@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
 	
 	sprintf((char*)SysConfig.SystemId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
 	sprintf((char*)SysConfig.SystemDateTime, "%d-%d-%d %d:%d:%d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
-	SysConfig.AuthorisationMode = 0;	// 0:PH card	1: OCPP backend		2: PH backend	3: Free Mode
+	SysConfig.AuthorisationMode = 0;	// 0: enable, 1: disable
 	SysConfig.DefaultLanguage  = 0;		// 0:English	1:Big5				2: GB			3: JN		4: Français 	5: Italiano		6: Español		7: Deutsch		8: Nederland	9: Norsk	10: Suomalainen		11: Svenska		12: Pусский		13: ไทย
 	SysConfig.RfidCardNumEndian = 0;	// 0: Little endian		1: Big endian
 
@@ -281,7 +281,7 @@ int main(int argc, char *argv[])
 
 	// Backend configuration
 	SysConfig.BackendConnTimeout=300; 		// 300 seconds
-	SysConfig.OfflinePolicy = 0;			// 0: Local list	1: PH RFID		2: Free		3: Deny
+	SysConfig.OfflinePolicy = 2;			// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
 	SysConfig.OfflineMaxChargeEnergy = 0;	// 0: Same as MaxChargeEnergy	Other: 1~65535KWH
 	SysConfig.OfflineMaxChargeDuration = 0; // 0: Same as MaxChargeDuration Other: 1~65535 minutes
 	strcpy((char*)SysConfig.OcppServerURL, "");

+ 150 - 20
EVSE/Projects/AW-CCS/Apps/Module_InternalComm.c

@@ -799,9 +799,9 @@ unsigned char Query_AC_MCU_Alarm(unsigned char fd, unsigned char targetAddr, Ac_
 			(rx[3] == tx[3]))
 		{
 			//rx[6]
-			Ret_Buf->bits.OVP = (((rx[6]>>0)&0x01)?1:0);
-			Ret_Buf->bits.UVP = (((rx[6]>>1)&0x01)?1:0);
-			Ret_Buf->bits.OCP = (((rx[6]>>2)&0x01)?1:0);
+			Ret_Buf->bits.OVP_L1 = (((rx[6]>>0)&0x01)?1:0);
+			Ret_Buf->bits.UVP_L1 = (((rx[6]>>1)&0x01)?1:0);
+			Ret_Buf->bits.OCP_L1 = (((rx[6]>>2)&0x01)?1:0);
 			Ret_Buf->bits.OTP = (((rx[6]>>3)&0x01)?1:0);
 			Ret_Buf->bits.gmi_fault = (((rx[6]>>4)&0x01)?1:0);
 			Ret_Buf->bits.cp_fault = (((rx[6]>>5)&0x01)?1:0);
@@ -818,12 +818,22 @@ unsigned char Query_AC_MCU_Alarm(unsigned char fd, unsigned char targetAddr, Ac_
 			Ret_Buf->bits.locker_fault = (((rx[7]>>6)&0x01)?1:0);
 			Ret_Buf->bits.power_drop = (((rx[7]>>7)&0x01)?1:0);
 
-			//rx[8] 3~7bits reserved
-			Ret_Buf->bits.circuit_short = (((rx[8]>>0)&0x01)?1:0);
-			Ret_Buf->bits.set_circuit = (((rx[8]>>1)&0x01)?1:0);
+			//rx[8] 3 bits reserved
+			Ret_Buf->bits.short_circuit_L1 = (((rx[8]>>0)&0x01)?1:0);
+			Ret_Buf->bits.rotate_switch_fault = (((rx[8]>>1)&0x01)?1:0);
 			Ret_Buf->bits.relay_drive_fault = (((rx[8]>>2)&0x01)?1:0);
-
-			//rx[9] 0~7bits reserved
+			
+			Ret_Buf->bits.OVP_L2 = (((rx[8]>>4)&0x01)?1:0);
+			Ret_Buf->bits.OVP_L3 = (((rx[8]>>5)&0x01)?1:0);
+			Ret_Buf->bits.UVP_L2 = (((rx[8]>>6)&0x01)?1:0);
+			Ret_Buf->bits.UVP_L3 = (((rx[8]>>7)&0x01)?1:0);			
+			
+
+			//rx[9] 2~7bits reserved
+			Ret_Buf->bits.OCP_L2 = (((rx[9]>>0)&0x01)?1:0);
+			Ret_Buf->bits.OCP_L3 = (((rx[9]>>1)&0x01)?1:0);		
+			Ret_Buf->bits.short_circuit_L2 = (((rx[9]>>2)&0x01)?1:0);
+			Ret_Buf->bits.short_circuit_L3 = (((rx[9]>>3)&0x01)?1:0);			
 
 			result = PASS;
 		}
@@ -1830,7 +1840,64 @@ int main(void)
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotVoltage = ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive;
 					ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltagePositive = ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive;
 					ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltageNegative = ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive;
-
+					
+					//pass info 2 CCS task
+					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_UNKNOWN)
+					{
+							if(ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltageNegative >= -12)
+							{
+									ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState = CCS_CP_STATE_G;
+							}
+							else
+							{
+									ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState = CCS_CP_STATE_H;
+							}
+					}
+					else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
+					{
+							ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState = CCS_CP_STATE_A;
+					}
+					else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B)
+					{
+							if(ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltageNegative == 0.0)
+							{
+									ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState = CCS_CP_STATE_B1;
+							}
+							else
+							{
+									ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState = CCS_CP_STATE_B2;
+							}
+					}
+					else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)
+					{
+							ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState = CCS_CP_STATE_C;
+					}
+					else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_D)
+					{
+							ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState = CCS_CP_STATE_D;
+					}
+					else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_E)
+					{
+							ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState = CCS_CP_STATE_E;
+					}	
+					else	//CP_STATE_F
+					{
+							ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState = CCS_CP_STATE_F;
+					}
+					ShmCharger->gun_info[gun_index].acCcsInfo.CpPositiveVoltage = ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltagePositive;
+					ShmCharger->gun_info[gun_index].acCcsInfo.CpNegativeVoltage = ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltageNegative;					
+					ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentPWMDuty = ShmCharger->gun_info[gun_index].primaryMcuState.current_limit;
+					
+					if(ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][0]>0)
+					{
+						ShmCharger->gun_info[gun_index].acCcsInfo.OutputRelayStatus = ON;
+					}
+					else
+					{
+						ShmCharger->gun_info[gun_index].acCcsInfo.OutputRelayStatus = OFF;	
+					}					
+					
+					
 					failCount[gun_index] = 0;
 				}
 				else
@@ -1859,17 +1926,17 @@ int main(void)
 					//================================================
 					// Byte[6]
 					//================================================
-					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP == 0x01)
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L1 == 0x01)
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<0;
 					else
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<0);
 
-					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP == 0x01)
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L1 == 0x01)
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<1;
 					else
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<1);
 
-					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP == 0x01)
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L1 == 0x01)
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<2;
 					else
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<2);
@@ -1945,12 +2012,12 @@ int main(void)
 					//================================================
 					// Byte[8]
 					//================================================
-					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.circuit_short == 0x01)
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L1 == 0x01)
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<16;
 					else
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<16);
 
-					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit == 0x01)
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.rotate_switch_fault == 0x01)
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<17;
 					else
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<17);
@@ -1959,12 +2026,53 @@ int main(void)
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<18;
 					else
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<18);
+					
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L2 == 0x01)
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<20;
+					else
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<20);
+
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L3 == 0x01)
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<21;
+					else
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<21);
+
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L2 == 0x01)
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<22;
+					else
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<22);
+
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L3 == 0x01)
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<23;
+					else
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<23);					
 
 					//================================================
-					// Byte[9] Reserved
+					// Byte[9] 
 					//================================================
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L2 == 0x01)
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<24;
+					else
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<24);
+
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L3 == 0x01)
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<25;
+					else
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<25);			
+
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L2 == 0x01)
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<26;
+					else
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<26);
+
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L3 == 0x01)
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<27;
+					else
+						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<27);							
 
 					failCount[gun_index] = 0;
+					
+					ShmCharger->gun_info[gun_index].acCcsInfo.CSUAlarmStatusCode = ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode;
 				}
 				else
 				{
@@ -2106,9 +2214,15 @@ int main(void)
 						DEBUG_INFO("**************************************************\r\n");
 						DEBUG_INFO("********* High priority polling : Case 4 *********\r\n");
 						DEBUG_INFO("**************************************************\r\n");
-						DEBUG_INFO("MCU-%d get OVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP);
-						DEBUG_INFO("MCU-%d get UVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP);
-						DEBUG_INFO("MCU-%d get OCP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP);
+						DEBUG_INFO("MCU-%d get OVP_L1 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L1);
+						DEBUG_INFO("MCU-%d get UVP_L1 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L1);
+						DEBUG_INFO("MCU-%d get OCP_L1 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L1);
+						DEBUG_INFO("MCU-%d get OVP_L2 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L2);
+						DEBUG_INFO("MCU-%d get UVP_L2 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L2);
+						DEBUG_INFO("MCU-%d get OCP_L2 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L2);
+						DEBUG_INFO("MCU-%d get OVP_L3 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L3);
+						DEBUG_INFO("MCU-%d get UVP_L3 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L3);
+						DEBUG_INFO("MCU-%d get OCP_L3 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L3);						
 						DEBUG_INFO("MCU-%d get OTP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP);
 						DEBUG_INFO("MCU-%d get gmi_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault);
 						DEBUG_INFO("MCU-%d get cp_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault);
@@ -2122,8 +2236,10 @@ int main(void)
 						DEBUG_INFO("MCU-%d get shutter_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault);
 						DEBUG_INFO("MCU-%d get locker_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault);
 						DEBUG_INFO("MCU-%d get power_drop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop);
-						DEBUG_INFO("MCU-%d get circuit_short : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.circuit_short);
-						DEBUG_INFO("MCU-%d get set_circuit : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit);
+						DEBUG_INFO("MCU-%d get rotate_switch_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.rotate_switch_fault);
+						DEBUG_INFO("MCU-%d get short_circuit_L1 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L1);
+						DEBUG_INFO("MCU-%d get short_circuit_L2 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L2);
+						DEBUG_INFO("MCU-%d get short_circuit_L3 : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L3);
 						DEBUG_INFO("MCU-%d get relay_drive_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
 						DEBUG_INFO("MCU-%d get InputAlarmCode : %x\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
 					}
@@ -2174,8 +2290,15 @@ int main(void)
 							ShmSysConfigAndInfo->SysInfo.InputVoltageR = ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12;
 							ShmSysConfigAndInfo->SysInfo.InputVoltageS = ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23;
 							ShmSysConfigAndInfo->SysInfo.InputVoltageT = ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31;
+							
 
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage = ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12;
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL2 = ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23;
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL3 = ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31;
+							
+							ShmCharger->gun_info[gun_index].acCcsInfo.GridVoltage[0] = ShmSysConfigAndInfo->SysInfo.InputVoltageR;
+							ShmCharger->gun_info[gun_index].acCcsInfo.GridVoltage[1] = ShmSysConfigAndInfo->SysInfo.InputVoltageS;
+							ShmCharger->gun_info[gun_index].acCcsInfo.GridVoltage[2] = ShmSysConfigAndInfo->SysInfo.InputVoltageT;
 
 							failCount[gun_index] = 0;
 						}
@@ -2195,6 +2318,13 @@ int main(void)
 						if(Query_Present_OutputCurrent(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].outputCurrent) == PASS)
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL2 = (float)ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0];
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL3 = (float)ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0];
+							
+							
+							ShmCharger->gun_info[gun_index].acCcsInfo.EVSEPresentCurrent[0] = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
+							ShmCharger->gun_info[gun_index].acCcsInfo.EVSEPresentCurrent[1] = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
+							ShmCharger->gun_info[gun_index].acCcsInfo.EVSEPresentCurrent[2] = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];							
 
 							failCount[gun_index] = 0;
 						}

File diff suppressed because it is too large
+ 650 - 178
EVSE/Projects/AW-CCS/Apps/main.c


+ 91 - 39
EVSE/Projects/AW-CCS/Apps/main.h

@@ -53,6 +53,20 @@
 #define CP_STATE_E					5
 #define CP_STATE_F					6
 
+//===================================
+//	Define CCS CP State constant
+//===================================
+#define CCS_CP_STATE_UNKNOWN			0
+#define CCS_CP_STATE_A					1	//A (12V, no PWM)
+#define CCS_CP_STATE_B1					2	//B1 (9V, no PWM)
+#define CCS_CP_STATE_B2					3	//B2 (9V, with PWM)
+#define CCS_CP_STATE_C					4	//C (6V, with PWM)
+#define CCS_CP_STATE_D					5	//D (3V, with PWM)
+#define CCS_CP_STATE_E					6	//E (0V, no PWM)
+#define CCS_CP_STATE_F					7	//F (-12V, no PWM)
+#define CCS_CP_STATE_G					8	//G (>12V)
+#define CCS_CP_STATE_H					9	//H  (<12V)
+
 //===================================
 // Define start mode constant
 //===================================
@@ -75,25 +89,37 @@
 //===================================
 // Define Alarm code constant
 //===================================
-#define ALARM_OVER_VOLTAGE          0x000001
-#define ALARM_UNDER_VOLTAGE         0x000002
-#define ALARM_OVER_CURRENT          0x000004
-#define ALARM_OVER_TEMPERATURE      0x000008
-#define ALARM_GROUND_FAIL           0x000010
-#define ALARM_CP_ERROR              0x000020
-#define ALARM_CURRENT_LEAK_AC       0x000040
-#define ALARM_CURRENT_LEAK_DC       0x000080
-#define ALARM_MCU_TESTFAIL          0x000100
-#define ALARM_HANDSHAKE_TIMEOUT     0x000200
-#define ALARM_EMERGENCY_STOP        0x000400
-#define ALARM_RELAY_WELDING         0x000800
-#define ALARM_LEAK_MODULE_FAIL      0x001000
-#define ALARM_SHUTTER_FAULT         0x002000
-#define ALARM_LOCKER_FAULT          0x004000
-#define ALARM_POWER_DROP            0x008000
-#define ALARM_CURRENT_SHORT         0x010000
-#define ALARM_ROTATORY_SWITCH_FAULT 0x020000
-#define ALARM_RELAY_DRIVE_FAULT     0x040000
+#define ALARM_L1_OVER_VOLTAGE					0x00000001
+#define ALARM_L1_UNDER_VOLTAGE					0x00000002
+#define ALARM_L1_OVER_CURRENT					0x00000004
+#define ALARM_OVER_TEMPERATURE	                0x00000008
+#define ALARM_GROUND_FAIL						0x00000010
+#define ALARM_CP_ERROR							0x00000020
+#define ALARM_CURRENT_LEAK_AC                   0x00000040
+#define ALARM_CURRENT_LEAK_DC                   0x00000080
+
+#define ALARM_MCU_TESTFAIL						0x00000100
+#define ALARM_HANDSHAKE_TIMEOUT                 0x00000200
+#define ALARM_EMERGENCY_STOP                    0x00000400
+#define ALARM_RELAY_WELDING                     0x00000800
+#define ALARM_LEAK_MODULE_FAIL                  0x00001000 
+#define ALARM_SHUTTER_FAULT                     0x00002000
+#define ALARM_LOCKER_FAULT                      0x00004000  
+#define ALARM_POWER_DROP                        0x00008000
+  
+#define ALARM_L1_CIRCUIT_SHORT                  0x00010000 
+#define ALARM_ROTATORY_SWITCH_FAULT             0x00020000 
+#define ALARM_RELAY_DRIVE_FAULT                 0x00040000 
+#define ALARM_BLE_MODULE_BROKEN                 0x00080000 
+#define ALARM_L2_OVER_VOLTAGE                   0x00100000 
+#define ALARM_L3_OVER_VOLTAGE                   0x00200000
+#define ALARM_L2_UNDER_VOLTAGE                  0x00400000 
+#define ALARM_L3_UNDER_VOLTAGE                  0x00800000
+
+#define ALARM_L2_OVER_CURRENT					0x01000000
+#define ALARM_L3_OVER_CURRENT					0x02000000
+#define ALARM_L2_CIRCUIT_SHORT                  0x04000000 
+#define ALARM_L3_CIRCUIT_SHORT                  0x08000000
 
 //===================================
 // Define Led constant
@@ -120,21 +146,28 @@
 //=================================
 //CCS related define
 //=================================
+//#define CCS_SIMULATION_DATA
+
 #define CCS_PWM_DUTY_CP_STAT_E			0			
 #define CCS_PWM_DUTY_5					5
 #define CCS_PWM_DUTY_100				100
 
 
 #define HANDSHAKE_DUTY_5				1
-#define HANDSHAKE_CCS					2
-#define HANDSHAKE_CP_STATE_E			3
-#define HANDSHAKE_SET_MAX_CURRENT		4
-#define HANDSHAKE_NORMAL_CP				5
-#define HANDSHAKE_NORMAL_CCS			6
+#define HANDSHAKE_DUTY_5_CHECK			2
+#define HANDSHAKE_CCS					3
+#define HANDSHAKE_CP_STATE_E			4
+#define HANDSHAKE_SET_MAX_CURRENT		5
+#define HANDSHAKE_BS_MODE				6
+#define HANDSHAKE_HLC_MODE				7
 
 #define	CHARGING_MODE_BS				0
 #define	CHARGING_MODE_HLC				1
 
+#define	HLC_STOP_MODE					0
+#define	HLC_START_MODE					1
+#define	HLC_RENEGOTIATE_MODE			2
+#define	HLC_STANDBY_MODE				3
 
 #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
 #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
@@ -273,9 +306,9 @@ typedef struct AC_PRIMARY_MCU_ALARM
 		unsigned long InputAlarmCode;
 		struct
 		{
-			unsigned long OVP:1;
-			unsigned long UVP:1;
-			unsigned long OCP:1;
+			unsigned long OVP_L1:1;
+			unsigned long UVP_L1:1;
+			unsigned long OCP_L1:1;
 			unsigned long OTP:1;
 			unsigned long gmi_fault:1;
 			unsigned long cp_fault:1;
@@ -289,10 +322,18 @@ typedef struct AC_PRIMARY_MCU_ALARM
 			unsigned long shutter_fault:1;
 			unsigned long locker_fault:1;
 			unsigned long power_drop:1;
-			unsigned long circuit_short:1;
-			unsigned long set_circuit:1;
+			unsigned long rotate_switch_fault:1;
+			unsigned long short_circuit_L1:1;
 			unsigned long relay_drive_fault:1;
 			unsigned long comm_timeout:1;
+			unsigned long OVP_L2:1;
+			unsigned long UVP_L2:1;
+			unsigned long OCP_L2:1;
+			unsigned long OVP_L3:1;
+			unsigned long UVP_L3:1;
+			unsigned long OCP_L3:1;	
+			unsigned long short_circuit_L2:1;
+			unsigned long short_circuit_L3:1;			
 		}bits;
 	};
 }Ac_Primary_Mcu_Alarm;
@@ -479,26 +520,26 @@ typedef struct CCS_INFO
 	uint8_t		EVSEID[40];
 	uint8_t		CCSLibRev[32];
 	uint8_t		EVSEModelName[32];
-	uint16_t	CSUAlarmStatusCode;
+	uint32_t	CSUAlarmStatusCode;
 	uint16_t	CCSAlarmStatusCode;
 	uint8_t		PaymentOption;					/* 0x00 EIM, 0x01 Pnc */
 	float		EVSEMaxCurrent;					/*unit: 1 amp*/
 	float		EVSEMinCurrent;					/*unit: 1 amp*/
-	float		EVSENominalVoltage;				/*unit: 1 volt*/
+	float		GridVoltage[3];				    /*unit: 1 volt*/
 	uint8_t		MeterID[32];					/*unit: 1 amp*/
-	float		MeterReadingValue;				/*unit: Wh*/
+	float		MeterReadingValue;				/*unit: 1Wh*/
 	uint8_t		EVOperation;					/*0:Charge, 1:Discharge*/
 	uint8_t		EVChargeProgress;				/*0: Stop
 													1: Start
 													2: Renegotiate
 													3: Standby */
-	uint8_t		SetCPPWMDuty;					/*unit: 1%
+	uint8_t		CpSetPWMDuty;					/*unit: 1%
 													0: 0%
 													5: 5%
 													100: 100%*/
-	uint8_t		SetCP2StateE;					/*0:disable, 1:enable*/
-	uint8_t		CPPresentPWMDuty;				/*unit:1%*/
-	uint8_t		CPPresentState;					/*1: A (12V, no PWM)
+	uint8_t		CpSetStateE;					/*0:disable, 1:enable*/
+	uint8_t		CpPresentPWMDuty;				/*unit:1%*/
+	uint8_t		CpPresentState;					/*1: A (12V, no PWM)
 													2: B1 (9V, no PWM)
 													3: B2 (9V, with PWM)
 													4: C (6V, with PWM)
@@ -507,8 +548,14 @@ typedef struct CCS_INFO
 													7: F (-12V, no PWM)
 													8: G (>12V)
 													9: H  (<12V)*/
-	float		CPPositiveVoltage;				/*uint: 1V*/
-	float		CPNegativeVoltage;				/*uint: 1V*/
+	float		CpPositiveVoltage;				/*uint: 1V*/
+	float		CpNegativeVoltage;				/*uint: 1V*/
+	uint32_t	CcsHeartBeat;					/*unit: 1*/
+	float 		EVSEPresentCurrent[3];				//unit: 1A
+	float 		AvailableChargingPower;			//1KW
+	uint8_t		EVSENotification;				/*0: None
+													1: StopCharging
+													2: ReNegotiation*/
 	uint16_t 	ChargingPermission:1;				/*0x00: Not ready yet, stay in idle mode or go into terminating process.
 												  0x01: start charging process*/
 	uint16_t 	ConnectorLockerStatus:1;			/*0x00: released
@@ -516,7 +563,8 @@ typedef struct CCS_INFO
 												 
 	uint16_t	RcdStatus:1;					/* 0x00 no error
 												   0x01 an error */
-	uint16_t	TempFlag3:1;
+	uint16_t	OutputRelayStatus:1;			/*0: OFF
+												1: ON*/
 	uint16_t	TempFlag4:1;
 	uint16_t	TempFlag5:1;
 	uint16_t	TempFlag6:1;
@@ -557,8 +605,10 @@ typedef struct GUN_INFO
 	Set_Led_Brightness								setLedBrightness;
 	Ac_Ccs_Info										acCcsInfo;
 	uint8_t											ccsHandshakeState;
+	uint8_t											PreviousEVChargeProgress;	
 	uint8_t											chargingMode;
 	uint16_t										targetCurrent;
+	
 	uint16_t										isAuthPassEnd:1;
 	uint16_t										rfidReq:1;
 	uint16_t										isGunPlugged:1;
@@ -567,6 +617,8 @@ typedef struct GUN_INFO
 	uint16_t										isSetLedBrightness:1;
 	uint16_t										isUnlockerConnetor:1;
 	uint16_t										isOperactive:1;
+	uint16_t										isCCSWaitChangeDuty:1;
+	uint16_t										isCCSStartTransation:1;
 }Gun_Info;
 
 struct Charger

BIN
EVSE/Projects/AW-CCS/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/AW-CCS/Images/ramdisk.gz


+ 2 - 2
EVSE/Projects/AW-Regular/Apps/Module_FactoryConfig.c

@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
 	
 	sprintf((char*)SysConfig.SystemId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
 	sprintf((char*)SysConfig.SystemDateTime, "%d-%d-%d %d:%d:%d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
-	SysConfig.AuthorisationMode = 0;	// 0:PH card	1: OCPP backend		2: PH backend	3: Free Mode
+	SysConfig.AuthorisationMode = 0;	// 0: enable, 1: disable
 	SysConfig.DefaultLanguage  = 0;		// 0:English	1:Big5				2: GB			3: JN		4: Français 	5: Italiano		6: Español		7: Deutsch		8: Nederland	9: Norsk	10: Suomalainen		11: Svenska		12: Pусский		13: ไทย
 	SysConfig.RfidCardNumEndian = 0;	// 0: Little endian		1: Big endian
 
@@ -281,7 +281,7 @@ int main(int argc, char *argv[])
 
 	// Backend configuration
 	SysConfig.BackendConnTimeout=300; 		// 300 seconds
-	SysConfig.OfflinePolicy = 0;			// 0: Local list	1: PH RFID		2: Free		3: Deny
+	SysConfig.OfflinePolicy = 2;			// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
 	SysConfig.OfflineMaxChargeEnergy = 0;	// 0: Same as MaxChargeEnergy	Other: 1~65535KWH
 	SysConfig.OfflineMaxChargeDuration = 0; // 0: Same as MaxChargeDuration Other: 1~65535 minutes
 	strcpy((char*)SysConfig.OcppServerURL, "");

+ 1 - 0
EVSE/Projects/AW-Regular/Apps/Module_InternalComm.c

@@ -2217,6 +2217,7 @@ int main(void)
 						if(Query_Temperature(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].temperature) == PASS)
 						{
 							ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ConnectorTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
 
 							failCount[gun_index] = 0;
 						}

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

@@ -1181,7 +1181,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.44.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.47.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -2356,6 +2356,7 @@ int main(void)
 						else
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_FREE;
+							memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
 							DEBUG_INFO("Start Method : FREE..\r\n");
 						}
 
@@ -2603,6 +2604,8 @@ int main(void)
 											ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 											DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 										}
+										else
+											break;
 									}
 								}
 							}
@@ -2621,6 +2624,8 @@ int main(void)
 											ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 											DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 										}
+										else
+											break;
 									}
 								}
 							}
@@ -2641,6 +2646,8 @@ int main(void)
 												ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 												DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 											}
+											else
+												break;
 										}
 									}
 									else
@@ -2654,6 +2661,8 @@ int main(void)
 												ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 												DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 											}
+											else
+												break;
 										}
 									}
 								}
@@ -2711,7 +2720,6 @@ int main(void)
 						}
 						else
 						{
-
 							// Off-line max condition check
 							if((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
 							   ((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_ENABLE) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE)))

BIN
EVSE/Projects/AW-Regular/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/AW-Regular/Images/MLO


BIN
EVSE/Projects/AW-Regular/Images/ramdisk.gz


BIN
EVSE/Projects/AW-Regular/Images/u-boot.img


BIN
EVSE/Projects/AW-Regular/Images/zImage


+ 2 - 2
EVSE/Projects/BYTON-GB/Apps/Module_FactoryConfig.c

@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
 	
 	sprintf((char*)SysConfig.SystemId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
 	sprintf((char*)SysConfig.SystemDateTime, "%d-%d-%d %d:%d:%d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
-	SysConfig.AuthorisationMode = 0;	// 0:PH card	1: OCPP backend		2: PH backend	3: Free Mode
+	SysConfig.AuthorisationMode = 0;	// 0: enable, 1: disable
 	SysConfig.DefaultLanguage  = 0;		// 0:English	1:Big5				2: GB			3: JN		4: Français 	5: Italiano		6: Español		7: Deutsch		8: Nederland	9: Norsk	10: Suomalainen		11: Svenska		12: Pусский		13: ไทย
 	SysConfig.RfidCardNumEndian = 0;	// 0: Little endian		1: Big endian
 
@@ -281,7 +281,7 @@ int main(int argc, char *argv[])
 
 	// Backend configuration
 	SysConfig.BackendConnTimeout=300; 		// 300 seconds
-	SysConfig.OfflinePolicy = 0;			// 0: Local list	1: PH RFID		2: Free		3: Deny
+	SysConfig.OfflinePolicy = 2;			// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
 	SysConfig.OfflineMaxChargeEnergy = 0;	// 0: Same as MaxChargeEnergy	Other: 1~65535KWH
 	SysConfig.OfflineMaxChargeDuration = 0; // 0: Same as MaxChargeDuration Other: 1~65535 minutes
 	strcpy((char*)SysConfig.OcppServerURL, "");

+ 1 - 0
EVSE/Projects/BYTON-GB/Apps/Module_InternalComm.c

@@ -2217,6 +2217,7 @@ int main(void)
 						if(Query_Temperature(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].temperature) == PASS)
 						{
 							ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ConnectorTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
 
 							failCount[gun_index] = 0;
 						}

+ 10 - 2
EVSE/Projects/BYTON-GB/Apps/main.c

@@ -1181,7 +1181,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.30.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.33.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -2431,6 +2431,7 @@ int main(void)
 						else
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_FREE;
+							memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
 							DEBUG_INFO("Start Method : FREE..\r\n");
 						}
 
@@ -2699,6 +2700,8 @@ int main(void)
 											ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 											DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 										}
+										else
+											break;
 									}
 								}
 							}
@@ -2717,6 +2720,8 @@ int main(void)
 											ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 											DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 										}
+										else
+											break;
 									}
 								}
 							}
@@ -2737,6 +2742,8 @@ int main(void)
 												ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 												DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 											}
+											else
+												break;
 										}
 									}
 									else
@@ -2750,6 +2757,8 @@ int main(void)
 												ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 												DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 											}
+											else
+												break;
 										}
 									}
 								}
@@ -2807,7 +2816,6 @@ int main(void)
 						}
 						else
 						{
-
 							// Off-line max condition check
 							if((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
 							   ((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_ENABLE) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE)) ||

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


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


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


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


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


+ 2 - 2
EVSE/Projects/Noodoe/Apps/Module_FactoryConfig.c

@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
 	
 	sprintf((char*)SysConfig.SystemId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
 	sprintf((char*)SysConfig.SystemDateTime, "%d-%d-%d %d:%d:%d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
-	SysConfig.AuthorisationMode = 0;	// 0:PH card	1: OCPP backend		2: PH backend	3: Free Mode
+	SysConfig.AuthorisationMode = 0;	// 0: enable, 1: disable
 	SysConfig.DefaultLanguage  = 0;		// 0:English	1:Big5				2: GB			3: JN		4: Français 	5: Italiano		6: Español		7: Deutsch		8: Nederland	9: Norsk	10: Suomalainen		11: Svenska		12: Pусский		13: ไทย
 	SysConfig.RfidCardNumEndian = 0;	// 0: Little endian		1: Big endian
 
@@ -281,7 +281,7 @@ int main(int argc, char *argv[])
 
 	// Backend configuration
 	SysConfig.BackendConnTimeout=300; 		// 300 seconds
-	SysConfig.OfflinePolicy = 0;			// 0: Local list	1: PH RFID		2: Free		3: Deny
+	SysConfig.OfflinePolicy = 2;			// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
 	SysConfig.OfflineMaxChargeEnergy = 0;	// 0: Same as MaxChargeEnergy	Other: 1~65535KWH
 	SysConfig.OfflineMaxChargeDuration = 0; // 0: Same as MaxChargeDuration Other: 1~65535 minutes
 	strcpy((char*)SysConfig.OcppServerURL, "");

+ 1 - 0
EVSE/Projects/Noodoe/Apps/Module_InternalComm.c

@@ -2217,6 +2217,7 @@ int main(void)
 						if(Query_Temperature(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].temperature) == PASS)
 						{
 							ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ConnectorTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
 
 							failCount[gun_index] = 0;
 						}

+ 10 - 2
EVSE/Projects/Noodoe/Apps/main.c

@@ -1181,7 +1181,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.33.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.36.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -2365,6 +2365,7 @@ int main(void)
 						else
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_FREE;
+							memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
 							DEBUG_INFO("Start Method : FREE..\r\n");
 						}
 
@@ -2614,6 +2615,8 @@ int main(void)
 											ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 											DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 										}
+										else
+											break;
 									}
 								}
 							}
@@ -2632,6 +2635,8 @@ int main(void)
 											ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 											DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 										}
+										else
+											break;
 									}
 								}
 							}
@@ -2652,6 +2657,8 @@ int main(void)
 												ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 												DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 											}
+											else
+												break;
 										}
 									}
 									else
@@ -2665,6 +2672,8 @@ int main(void)
 												ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/220:ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
 												DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\r\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 											}
+											else
+												break;
 										}
 									}
 								}
@@ -2722,7 +2731,6 @@ int main(void)
 						}
 						else
 						{
-
 							// Off-line max condition check
 							if((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
 							   ((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_ENABLE) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE)))

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


BIN
EVSE/Projects/Noodoe/Images/MLO


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


BIN
EVSE/Projects/Noodoe/Images/u-boot-spl.bin


BIN
EVSE/Projects/Noodoe/Images/u-boot.img


BIN
EVSE/Projects/Noodoe/Images/zImage


+ 18 - 5
EVSE/Projects/define.h

@@ -436,6 +436,11 @@ struct ChargingInfoData
 	unsigned char 		EvConnAlarmCode[7];
 	float 				ChargingProfileCurrent;	//0~6553.5 amp
 	float 				ChargingProfilePower;	//0~6553.5 kW
+	float 				PresentChargingVoltageL2;	//0~6553.5 volt
+	float 				PresentChargingVoltageL3;	//0~6553.5 volt
+	float 				PresentChargingCurrentL2;		//0~6553.5 amp	
+	float 				PresentChargingCurrentL3;		//0~6553.5 amp
+	char 				RemoteStartFlag;
 };
 
 struct SysInfoData
@@ -719,7 +724,7 @@ char AlarmStatusCode[128][6]=
 	"012213",	//System L2 input drop
 	"012214",	//System L3 input drop
 	"012215",	//System AC output OVP
-	"012216",	//System AC output OCP
+	"012216",	//System AC output OCP L1
 	"012217",	//System CHAdeMO output OVP
 	"012218",	//System CHAdeMO output OCP
 	"012219",	//System CCS output OVP
@@ -765,7 +770,7 @@ char AlarmStatusCode[128][6]=
 	"012259",	//CHAdeMO groundfault detection timeout (GFD)
 	"012260",	//CCS groundfault detection timeout (GFD)
 	"012261",	//GB groundfault detection timeout (GFD)
-	"012262",	//Circuit Short
+	"012262",	//Circuit Short L1
 	"012263",	// PSU Duplicate ID
 	"012264", 	// PSU Output Short Circuit
 	"012265", 	// PSU Discharge Abnormal
@@ -796,12 +801,16 @@ char AlarmStatusCode[128][6]=
 	"012290",	// GBT output UVP
 	"012291",	// Self test Failed due to communication of GBTboard failure
 	"012292",	// Self test Failed due to communication of AC failure
-	"012293",	// Reserved
+	"012293",	// Self test Failed due to communication of Ledboard failure
 	"012294",	// Ac input OVP
 	"012295",	// Ac input UVP
 	"012296",	// CHAdeMO groundfault detection - warning
 	"012297",	// CCS groundfault detection - warning
 	"012298",	// GB groundfault detection - warning
+	"012299",	//System AC output OCP L2
+	"012300",	//System AC output OCP L3
+	"012301",	//Circuit Short L2
+	"012302",	//Circuit Short L3
 
 };
 struct AlarmCodeData
@@ -917,14 +926,18 @@ struct AlarmCodeData
 			unsigned char GbtOutputUVPFail :1;					//bit 2
 			unsigned char GbtboardStestFail :1;					//bit 3
 			unsigned char AcConnectorStestFail:1;				//bit 4
-			unsigned char :1;									//bit 5
+			unsigned char LedboardStestFail:1;									//bit 5
 			unsigned char AcSystemInputOVP:1;									//bit 6
 			unsigned char AcSystemInputUVP:1;									//bit 7
 			//AlarmVal[12]
 			unsigned char ChademoGroundWarning :1;					//bit 0
 			unsigned char CcsGroundfaultWarning :1;					//bit 1
 			unsigned char GbGroundfaultWarning :1;					//bit 2
-			unsigned char :5;					//bit 3 ~ 7
+			unsigned char SystemAcOutputOCPL2:1;					//bit 3
+			unsigned char SystemAcOutputOCPL3:1;					//bit 4
+			unsigned char CircuitShortL2:1;							//bit 5
+			unsigned char CircuitShortL3:1;							//bit 6
+			unsigned char :1;										//bit 7
 		}bits;
 	}AlarmEvents;
 };

+ 0 - 0
EVSE/rootfs/root/iwconfig → EVSE/rootfs/bin/iwconfig


+ 0 - 0
EVSE/rootfs/root/iwlist → EVSE/rootfs/bin/iwlist


+ 0 - 1
EVSE/rootfs/root/passwd

@@ -1 +0,0 @@
-vern:x:0:0:Linux User,,,:/root/:/bin/sh

+ 0 - 1
EVSE/rootfs/root/shadow

@@ -1 +0,0 @@
-vern:$1$Vc2FHhm3$mZgNr5Z.v3.t.QkK4H8vm.:0:0:99999:7:::

+ 0 - 45
EVSE/rootfs/root/uaputl_config/80211d_domain.conf

@@ -1,45 +0,0 @@
-/* Domain and country mapping are in this section */
-/* Domain name followed by supported countries */
-
-COUNTRY: DOMAIN_CODE_FCC AE AM AN AR AZ BH BL BN BR CL CN CR CS DZ EC EG GE HN HK ID IL IR JM JO KP KW KZ LB LK MA MO NP OM PE PG PH PK PT QA SA SG SV SY TH TT TN UY YE ZA ZW VN
-COUNTRY: DOMAIN_CODE_FCC1 US UZ CA CO DO GT MX PA PR TW NZ BO BZ VE
-COUNTRY: DOMAIN_CODE_MKK JP
-COUNTRY: DOMAIN_CODE_ETSI AL AD AT AU BY BE BA BG HR CY CZ DK EE FI FR MK DE GB GR HU IS IE IT KR LV LI LT LU MT MD MC ME NL NO PL RO RU SM RS SI SK ES SE CH TR UA UK
-COUNTRY: DOMAIN_CODE_IN IN
-COUNTRY: DOMAIN_CODE_MY MY
-
-
-/* Domain specific sub-band information */
-/* Domain name followed by set of triplets separated by comma */
-/* 1st number in triplet is First channel, */
-/* 2nd number in triplet is Number of channels followed from the First channel  */
-/* 3rd number in triplet is Max-TX-power in dbm */
-
-DOMAIN: DOMAIN_CODE_FCC     1 13 20
-DOMAIN: DOMAIN_CODE_FCC1    1 11 30
-DOMAIN: DOMAIN_CODE_ETSI    1 13 20
-DOMAIN: DOMAIN_CODE_MKK     1 14 23
-DOMAIN: DOMAIN_CODE_IN      1 11 30
-DOMAIN: DOMAIN_CODE_MY      1 13 20
-DOMAIN: DOMAIN_CODE_TEST    1 1 20, 2 1 16, 3 6 30, 11 1 10
-DOMAIN: DOMAIN_CODE_TEST1  1 11 30, 36 1 17, 40 1 17,  44 1 17,  48 1 17,  52 1 24,    56 1 24,  60 1 24,  64 1 24,  149 1 23,  153 1 23,  157 1 23,  161 1 23,  165 1 23,
-DOMAIN: DOMAIN_CODE_END
-
-/*
- * Information for channels in A Band.
- */
-
-*** 5GHz ***
-
-DOMAIN: DOMAIN_CODE_FCC     36 1 20, 40 1 20, 44 1 20, 48 1 20, 52 1 20, 56 1 20, 60 1 20, 64 1 20, 100 1 20, 104 1 20, 108 1 20, 112 1 20, 116 1 20, 120 1 20, 124 1 20, 128 1 20, 132 1 20, 136 1 20, 140 1 20, 144 1 20, 149 1 20, 153 1 20, 157 1 20, 161 1 20, 165 1 20,
-DOMAIN: DOMAIN_CODE_FCC1     36 1 30, 40 1 30, 44 1 30, 48 1 30, 52 1 30, 56 1 30, 60 1 30, 64 1 30, 100 1 30, 104 1 30, 108 1 30, 112 1 30, 116 1 30, 120 1 30, 124 1 30, 128 1 30, 132 1 30, 136 1 30, 140 1 30, 144 1 30, 149 1 30, 153 1 30, 157 1 30, 161 1 30, 165 1 30,
-
-DOMAIN: DOMAIN_CODE_MKK     8 1 24, 12 1 24, 16 1 24, 36 1 23, 40 1 23, 44 1 23, 48 1 23, 52 1 23, 56 1 23, 60 1 23, 64 1 23, 100 1 23, 104 1 23, 108 1 23, 112 1 23, 116 1 23, 120 1 23, 124 1 23, 128 1 23, 132 1 23, 136 1 23, 140 1 23,
-
-DOMAIN: DOMAIN_CODE_ETSI    36 1 20, 40 1 20, 44 1 20, 48 1 20, 52 1 20, 56 1 20, 60 1 20, 64 1 20, 100 1 20, 104 1 20, 108 1 20, 112 1 20, 116 1 20, 120 1 20, 124 1 20, 128 1 20, 132 1 20, 136 1 20, 140 1 20, 149 1 20, 153 1 20, 157 1 20, 161 1 20, 165 1 20,
-
-DOMAIN: DOMAIN_CODE_IN    36 1 30, 40 1 30, 44 1 30, 48 1 30, 52 1 30, 56 1 30, 60 1 30, 64 1 30, 149 1 30, 153 1 30, 157 1 30, 161 1 30, 165 1 30,
-
-DOMAIN: DOMAIN_CODE_MY    36 1 20, 40 1 20, 44 1 20, 48 1 20, 52 1 20, 56 1 20, 60 1 20, 64 1 20, 149 1 20, 153 1 20, 157 1 20, 161 1 20, 165 1 20,
-
-DOMAIN: DOMAIN_CODE_5G_END

+ 0 - 155
EVSE/rootfs/root/uaputl_config/uaputl.conf

@@ -1,155 +0,0 @@
-#   File : uaputl.conf
-
-
-ap_config={
-    SSID="EVSE_AP"         	    # SSID of Micro AP, use '\' as an escape character before '"' character in SSID
-#   BeaconPeriod=100                # Beacon period in TU
-    Channel=6                       # Radio Channel	6
-#   Channel=0,1                     # auto channel select (MCS mode)
-#   Channel=6,2                     # primary channel 6, secondary channel above.
-#   Channel=6,4                     # primary channel 6, secondary channel below
-    ChanList=1,6,11                 # Scan channel list
-#   AP_MAC=00:34:22:77:46:41        # MAC address of AP
-    RxAntenna=0                     # 0 for Antenna A
-                                    # 1 for Antenna B
-    TxAntenna=0                     # 0 for Antenna A
-                                    # 1 for Antenna B
-    Rate=0x82,0x84,0x8b,0x96,0x0C,0x12,0x18,0x24,0x30,0x48,0x60,0x6c
-                                    # Set of data rate that a station
-                                    # in the BSS may use
-                                    # (in unit of 500 kilobit/s)
-    TxPowerLevel=13                 # Transmit power level in dBm
-    BroadcastSSID=1                 # Broadcast SSID feature
-                                    # 1: Enable  0:Disable
-    RTSThreshold=2347               # RTS threshold value
-    FragThreshold=2346              # Fragmentation threshold value
-    DTIMPeriod=1                    # DTIM period in beacon periods
-    MCBCdataRate=0                  # MCBC rate to use for packet transmission
-                                    # 0:auto
-                                    # >0 fix rate (in unit of 500 kilobit/s)
-#    TxBeaconRate=0                 # Beacon rate to use for Beacon transmission
-                                    # 0:auto
-                                    # >0 fix rate (in unit of 500 kilobit/s)
-    PktFwdCtl=1                     # Packet forwarding control
-                                    # 0: forward all packets to the host
-                                    # 1: firmware handles intr-BSS packets
-    StaAgeoutTimer=1800             # Inactive client station age out timer value
-                                    # in units of 100ms
-    PSStaAgeoutTimer=400            # Inactive client PS station age out timer value
-                                    # in units of 100ms
-    MaxStaNum=8                     # Max number of stations allowed to connect
-    Retrylimit=7                    # Retry limit to use for packet transmissions
-    AuthMode=0                      # 0:Open authentication
-                                    # 1:shared key authentication
-				    # 3: WPA3 SAE
-    Protocol=1                      # protocol to use
-                                    # 1: No security  	2: Static WEP
-                                    # 8: WPA	32: WPA2    40:WPA2 Mixed Mode
-				    # 64: WPA3 SAE
-    RSNReplayProtection=0           # RSN replay protection 0: disabled, 1: enabled
-    PairwiseUpdateTimeout=100       #Pairwise Handshake update timeout: 100ms
-    PairwiseHandshakeRetries=3      #Pairwise Handshake retries: 3
-    GroupwiseUpdateTimeout=100      #Groupwise Handshake update timeout: 100ms
-    GroupwiseHandshakeRetries=3           #Groupwise Handshake retries: 3
-
-# **** WEP security setting******
-#   KeyIndex=0                      # Index of WEP key to use (0 to 3)
-#   Sample Key configurations are
-#       Key_0="55555"
-#       Key_1=1234567890
-#       Key_2="1234567890123"
-#       Key_3=12345678901234567890123456
-
-# **** Pairwise Cipher setting******
-#    Configure both of the following for Protocol=40
-#    PwkCipherWPA=4                 # Pairwise cipher type
-                                    # 4: TKIP     8: AES CCMP
-                                    # 12: AES CCMP + TKIP
-#    PwkCipherWPA2=8                # Pairwise cipher type
-                                    # 4: TKIP     8: AES CCMP
-                                    # 12: AES CCMP + TKIP
-
-# **** Group Cipher setting******
-
-#    GwkCipher=4                    # group cipher type
-                                    # 4: TKIP     8: AES CCMP
-
-#if defined(DRV_EMBEDDED_AUTHENTICATOR)
-#    PSK="1234567890"               # WPA/WPA2 passphrase
-     GroupRekeyTime= 86400          # Group key re-key interval, in second.
-                                    # 0 mean never re-key
-#endif
-
-    Enable11n=1                     # 1 to enable, 0 to disable
-    HTCapInfo=0x111c                # HTCapInfo
-                                    # Bit 15-13: Reserved set to 0
-                                    # Bit 12: DSS/CCK mode in 40MHz enable/disable
-                                    # Bit 11-10: Reserved set to 0
-                                    # Bit 9-8: Reserved set to 0x01
-                                    # Bit 7: Reserved set to 0
-                                    # Bit 6: Short GI in 40 Mhz enable/disable
-                                    # Bit 5: Short GI in 20 Mhz enable/disable
-                                    # Bit 4: Green field enable/disble
-                                    # Bit 3-2: Reserved set to 1
-                                    # Bit 1: 20/40 Mhz enable disable.
-                                    # Bit 0: Reserved set to 0
-    AMPDU=0x03                      # AMPDU
-                                    # Bit 7-5: Reserved set to 0
-                                    # Bit 4-2: Minimum MPDU Start spacing
-                                    #          Set to 0 for no restriction
-                                    #          Set to 1 for 1/4 us
-                                    #          Set to 2 for 1/2 us
-                                    #          Set to 3 for 1 us
-                                    #          Set to 4 for 2 us
-                                    #          Set to 5 for 4 us
-                                    #          Set to 6 for 8 us
-                                    #          Set to 7 for 16 us
-                                    # Bit 1-0: Max A-MPDU length
-     HT_MCS_MAP=0x000000ff          # Bit 7-0: MCS_SET_0
-                                    # Bit 15-8:MCS_SET_1
-#    Enable2040Coex=1                #Enable 20/40 coex feature
-
-                                    #802.11D specific configuration
-    11d_enable=1                    # 0-disable 1-enable
-    country=TW                      # country information
-
-}
-
-
-
-ap_mac_filter={
-    FilterMode=0                    # Mode of filter table
-                                    # 0: filter table is disabled
-                                    # 1: allow MAC address in the filter table to associate
-                                    # 2: block MAC address in the filter table
-    Count=0                         # Number of entries in filter table,up to 16
-#Sample mac settings are
-#    mac_1=00:50:23:45:76:22         # mac address
-#    mac_2=00:34:22:77:46:34         # mac address
-}
-
-# Wmm param setting
-Wmm_parameters={
-    Qos_info=0x80
-    AC_BE
-    Aifsn=1
-    Ecw_max=1
-    Ecw_min=1
-    Tx_op=1
-    AC_BK
-    Aifsn=2
-    Ecw_max=2
-    Ecw_min=2
-    Tx_op=2
-    AC_VI
-    Aifsn=3
-    Ecw_max=3
-    Ecw_min=3
-    Tx_op=3
-    AC_VO
-    Aifsn=4
-    Ecw_max=4
-    Ecw_min=4
-    Tx_op=4
-}
-

+ 6 - 0
EVSE/rootfs/usr/bin/run_tmate_restart.sh

@@ -0,0 +1,6 @@
+#!/bin/sh
+
+/usr/bin/pkill tmate
+/bin/sleep 1
+/usr/bin/check_tmate.sh
+

+ 1 - 1
EVSE/rootfs/var/spool/cron/crontabs/root

@@ -21,5 +21,5 @@
 #
 # m h  dom mon dow   command
 0 0 * * * cat "" > /Storage/SystemLog/check_tmate.log
-* * * * * /usr/bin/check_tmate.sh >> /Storage/SystemLog/check_tmate.log 2>&1
+#* * * * * /usr/bin/check_tmate.sh >> /Storage/SystemLog/check_tmate.log 2>&1
 0 * * * * /sbin/logrotate /etc/logrotate.conf

+ 6 - 6
EVSE/rootfs/var/www/head.php

@@ -72,6 +72,11 @@
 		$showWifi="none";
 		$showTelcom="block";
 	}
+	if(substr($model,10,1)=="D"){
+		$showEthernet="block";
+		$showWifi="block";
+		$showTelcom="block";
+	}
 	
 	//$ModelName='AC Net';
 	 //$ModelName='AC Eco';
@@ -225,12 +230,7 @@
 					</ul> 
 				</li>
 				<li<?php echo ($tag_header=='upgrade'?' class="active"':''); ?>>
-					<a href="#" accesskey="2" title="Upgrade"><?php echo $lang->showWord("upgrade"); ?></a>
-					<ul>	
-						<li>
-						  <a href="upgrade_iso.php"><?php echo "Image"; ?></a>
-						</li>
-					</ul> 
+					<a href="upgrade_iso.php" accesskey="2" title="Upgrade"><?php echo $lang->showWord("upgrade"); ?></a>
 				</li>
 				<li<?php echo ($tag_header=='other'?' class="active"':''); ?>>
 					<a href="#" accesskey="3" title="Other"><?php echo $lang->showWord("other"); ?></a>

+ 94 - 45
EVSE/rootfs/var/www/set_charging.php

@@ -279,42 +279,35 @@ img {
 									<header><?php echo $lang->showWord("charging_relevant_parameters"); ?><i class="fa fa-plus"></i></header>
 									<section>
 										<div class="form-group" style="display:<?php echo $am111;?>">
-											<label>Max Charging Energy</label>
+											<label id="MaxChargingEnergyLbl">Max Charging Energy</label>
 											<small class="form-text text-muted-red">kWh</small>
-											<input type="text" name="MaxChargingEnergy" id="MaxChargingEnergy" class="form-control" value="<?php echo $obj['MaxChargingEnergy'];?>" placeholder="<?php echo ($obj['MaxChargingEnergy']==0||$obj['MaxChargingEnergy']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('MaxChargingEnergy').id,document.getElementById('MaxChargingEnergyText').id);">
+											<input type="text" name="MaxChargingEnergy" id="MaxChargingEnergy" class="form-control" value="<?php echo $obj['MaxChargingEnergy'];?>" placeholder="<?php echo ($obj['MaxChargingEnergy']==0||$obj['MaxChargingEnergy']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<small class="form-text text-muted-red"><label id="MaxChargingEnergyText" style="display:none;">'0' means unlimit</label></small>
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
-											<label>Max Charging Power</label>
+											<label id="MaxChargingPowerLbl">Max Charging Power</label>
 											<small class="form-text text-muted-red">kW</small>
-											<input type="text" name="MaxChargingPower" id="MaxChargingPower" class="form-control" value="<?php echo $obj['MaxChargingPower'];?>" placeholder="<?php echo ($obj['MaxChargingPower']==0||$obj['MaxChargingPower']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('MaxChargingPower').id,document.getElementById('MaxChargingPowerText').id);">
+											<input type="text" name="MaxChargingPower" id="MaxChargingPower" class="form-control" value="<?php echo $obj['MaxChargingPower'];?>" placeholder="<?php echo ($obj['MaxChargingPower']==0||$obj['MaxChargingPower']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<input type="hidden" name="RatingPower" id="RatingPower" value="<?php echo $RatingPower;?>">
 											<small class="form-text text-muted-red"><label id="MaxChargingPowerText" style="display:none;">'0' means unlimit</label></small>
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label id="MaxChargingCurrentLbl">Max Charging Current</label>
 											<small class="form-text text-muted-red">amp</small>
-											<input type="text" name="MaxChargingCurrent" id="MaxChargingCurrent" class="form-control" value="<?php echo $obj['MaxChargingCurrent'];?>" placeholder="<?php echo ($obj['MaxChargingCurrent']==0||$obj['MaxChargingCurrent']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('MaxChargingCurrent').id,document.getElementById('MaxChargingCurrentText').id);">
+											<input type="text" name="MaxChargingCurrent" id="MaxChargingCurrent" class="form-control" value="<?php echo $obj['MaxChargingCurrent'];?>" placeholder="<?php echo ($obj['MaxChargingCurrent']==0||$obj['MaxChargingCurrent']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<input type="hidden" name="RatingCurrent" id="RatingCurrent" value="<?php echo $RatingCurrent;?>">
 											<small class="form-text text-muted-red"><label id="MaxChargingCurrentText" style="display:none;">'0' means unlimit</label></small>
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
-											<label>Max Charging Duration</label>
+											<label id="MaxChargingDurationLbl">Max Charging Duration</label>
 											<small class="form-text text-muted-red">minutes</small>
-											<input type="text" name="MaxChargingDuration" id="MaxChargingDuration" class="form-control" value="<?php echo $obj['MaxChargingDuration'];?>" placeholder="<?php echo ($obj['MaxChargingDuration']==0||$obj['MaxChargingDuration']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('MaxChargingDuration').id,document.getElementById('MaxChargingDurationText').id);">
+											<input type="text" name="MaxChargingDuration" id="MaxChargingDuration" class="form-control" value="<?php echo $obj['MaxChargingDuration'];?>" placeholder="<?php echo ($obj['MaxChargingDuration']==0||$obj['MaxChargingDuration']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<small class="form-text text-muted-red"><label id="MaxChargingDurationText" style="display:none;">'0' means unlimit</label></small>
 										</div>
-										<div class="form-group" style="display:<?php echo $am001;?>">
-											<label>AC Phase Loss Policy</label>
-											<select class="form-control" id="PhaseLossPolicy" name="PhaseLossPolicy">
-												<option value="0" <?php echo $obj['PhaseLossPolicy']=="0"?"selected":""?>>de-rating</option>
-												<option value="1" <?php echo $obj['PhaseLossPolicy']=="1"?"selected":""?>>stop charging</option>
-											</select>
-										</div>
 										<div class="form-group" id="AcMaxChargingCurrentDiv">
 											<label>AC Max Charging Current</label>
 											<small class="form-text text-muted-red">amp</small>
-											<input type="text" name="AcMaxChargingCurrent" id="AcMaxChargingCurrent" class="form-control" value="<?php echo $obj['AcMaxChargingCurrent'];?>" placeholder="<?php echo ($obj['AcMaxChargingCurrent']==0||$obj['AcMaxChargingCurrent']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('AcMaxChargingCurrent').id,document.getElementById('AcMaxChargingCurrentText').id);">
+											<input type="text" name="AcMaxChargingCurrent" id="AcMaxChargingCurrent" class="form-control" value="<?php echo $obj['AcMaxChargingCurrent'];?>" placeholder="<?php echo ($obj['AcMaxChargingCurrent']==0||$obj['AcMaxChargingCurrent']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<input type="hidden" name="AcRatingCurrent" id="AcRatingCurrent" value="<?php echo $AcRatingCurrent;?>">
 											<small class="form-text text-muted-red"><label id="AcMaxChargingCurrentText" style="display:none;">'0' means unlimit</label></small>
 										</div>
@@ -573,22 +566,22 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Present Charging Voltage</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingVoltage'];?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['PresentChargingVoltage'],2);?> volt">
 											<input type="hidden" name="PresentChargingVoltage1" id="PresentChargingVoltage1" value="<?php echo $obj['ChargingInfo1']['PresentChargingVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Present Charging Current</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingCurrent'];?> amp">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['PresentChargingCurrent'],2);?> amp">
 											<input type="hidden" name="PresentChargingCurrent1" id="PresentChargingCurrent1" value="<?php echo $obj['ChargingInfo1']['PresentChargingCurrent'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Present Charging Power</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingPower'];?> kW">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['PresentChargingPower'],2);?> kW">
 											<input type="hidden" name="PresentChargingPower1" id="PresentChargingPower1" value="<?php echo $obj['ChargingInfo1']['PresentChargingPower'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Present Charging Energy</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargedEnergy'];?> kWh">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['PresentChargedEnergy'],2);?> kWh">
 											<input type="hidden" name="PresentChargedEnergy1" id="PresentChargedEnergy1" value="<?php echo $obj['ChargingInfo1']['PresentChargedEnergy'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
@@ -603,12 +596,12 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EV Battery Max Voltage</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatteryMaxVoltage'];?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['EvBatteryMaxVoltage'],2);?> volt">
 											<input type="hidden" name="EvBatteryMaxVoltage1" id="EvBatteryMaxVoltage1" value="<?php echo $obj['ChargingInfo1']['EvBatteryMaxVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EV Battery Target Voltage</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatterytargetVoltage'];?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['EvBatterytargetVoltage'],2);?> volt">
 											<input type="hidden" name="EvBatterytargetVoltage1" id="EvBatterytargetVoltage1" value="<?php echo $obj['ChargingInfo1']['EvBatterytargetVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
@@ -819,12 +812,55 @@ img {
 			if(document.getElementById("AcMaxChargingCurrent").value=="0" || document.getElementById("AcMaxChargingCurrent").value==""){
 				document.getElementById("AcMaxChargingCurrentText").style.display="block";
 			}
+			document.getElementById("MaxChargingEnergyLbl").innerHTML="DC MaxCharging Energy";
+			document.getElementById("MaxChargingPowerLbl").innerHTML="DC MaxCharging Power";
 			document.getElementById("MaxChargingCurrentLbl").innerHTML="DC MaxCharging Current";
+			document.getElementById("MaxChargingDurationLbl").innerHTML="DC MaxCharging Duration";
 		}
 		else{
 			document.getElementById("AcMaxChargingCurrentDiv").style.display="none";
 		}
 		isBilling_clicked();
+		document.getElementById("MaxChargingEnergy").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
+		document.getElementById("MaxChargingPower").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
+		document.getElementById("MaxChargingCurrent").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
+		document.getElementById("MaxChargingDuration").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
+		document.getElementById("AcMaxChargingCurrent").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
 	});
 
 	document.getElementById("save").onclick = function() {
@@ -842,7 +878,6 @@ img {
 						"&MaxChargingCurrent=" + document.getElementById("MaxChargingCurrent").value+
 						"&AcMaxChargingCurrent=" + document.getElementById("AcMaxChargingCurrent").value+
 						"&MaxChargingDuration=" + document.getElementById("MaxChargingDuration").value+
-						"&PhaseLossPolicy=" + document.getElementById("PhaseLossPolicy").value+
 						"&LocalWhiteCard0=" + document.getElementById("LocalWhiteCard0").value+
 						"&LocalWhiteCard1=" + document.getElementById("LocalWhiteCard1").value+
 						"&LocalWhiteCard2=" + document.getElementById("LocalWhiteCard2").value+
@@ -991,6 +1026,12 @@ img {
 				return false;
 			}
 		}
+		if(MaxChargingEnergy =="")
+		{
+			alert("Fill Max Charging Energy !");
+			document.getElementById("MaxChargingEnergy").focus();
+			return false;
+		}
 		if(MaxChargingEnergy >65535)
 		{
 			alert("Max Charging Energy must <= 65535!");
@@ -1003,16 +1044,10 @@ img {
 			document.getElementById("MaxChargingEnergy").focus();
 			return false;
 		}
-		if(AcMaxChargingCurrent >65535)
-		{
-			alert("Ac Max Charging Current must <= 65535!");
-			document.getElementById("AcMaxChargingCurrent").focus();
-			return false;
-		}
-		if(AcMaxChargingCurrent < 0)
+		if(MaxChargingPower =="")
 		{
-			alert("Ac Max Charging Current must >= 0!");
-			document.getElementById("AcMaxChargingCurrent").focus();
+			alert("Fill Max Charging Power !");
+			document.getElementById("MaxChargingPower").focus();
 			return false;
 		}
 		if(RatingPower!="" && RatingPower!=0){
@@ -1031,10 +1066,10 @@ img {
 				return false;
 			}
 		}
-		if(MaxChargingPower < 0)
+		if(MaxChargingCurrent =="")
 		{
-			alert("Max Charging Power must >= 0!");
-			document.getElementById("MaxChargingPower").focus();
+			alert("Fill Max Charging Current !");
+			document.getElementById("MaxChargingCurrent").focus();
 			return false;
 		}
 		if(RatingCurrent!="" && RatingCurrent!=0){
@@ -1053,6 +1088,12 @@ img {
 				return false;
 			}
 		}
+		if(document.getElementById("ModelName").value.substr(8,1)!= "0" && AcMaxChargingCurrent =="")
+		{
+			alert("Fill AC Max Charging Current !");
+			document.getElementById("AcMaxChargingCurrent").focus();
+			return false;
+		}
 		if(AcRatingCurrent!="" && AcRatingCurrent!=0){
 			if(parseFloat(AcMaxChargingCurrent) > parseFloat(AcRatingCurrent))
 			{
@@ -1068,6 +1109,18 @@ img {
 				document.getElementById("AcMaxChargingCurrent").focus();
 				return false;
 			}
+			if(AcMaxChargingCurrent < 0)
+			{
+				alert("Ac Max Charging Current must >= 0!");
+				document.getElementById("AcMaxChargingCurrent").focus();
+				return false;
+			}
+		}
+		if(MaxChargingCurrent =="")
+		{
+			alert("Fill Max Charging Current !");
+			document.getElementById("MaxChargingCurrent").focus();
+			return false;
 		}
 		if(MaxChargingCurrent < 0)
 		{
@@ -1077,7 +1130,13 @@ img {
 		}
 		if(MaxChargingDuration >65535)
 		{
-		    alert("MaxChargingDuration must <= 65535!");
+			alert("MaxChargingDuration must <= 65535!");
+			document.getElementById("MaxChargingDuration").focus();
+			return false;
+		}
+		if(MaxChargingDuration =="")
+		{
+			alert("Fill Max Charging Duration !");
 			document.getElementById("MaxChargingDuration").focus();
 			return false;
 		}
@@ -1090,16 +1149,6 @@ img {
 		
 		return true;
 	}
-
-	function MaxValue_changed(id,id2){
-		if(document.getElementById(id).value == "0" || document.getElementById(id).value == ""){
-			document.getElementById(id2).style.display="block";
-		}
-		else{
-			document.getElementById(id2).style.display="none";
-		}
-	}
-
 	function isBilling_clicked(){
 		if(document.getElementById("isBilling").checked){
 			document.getElementById("CurrencyDiv").style.display="block";

+ 0 - 2
EVSE/rootfs/var/www/set_charging_action.php

@@ -27,7 +27,6 @@
 		checkMaxValue("MaxChargingCurrent");
 		checkMaxValue("AcMaxChargingCurrent");
 		checkMaxValue("MaxChargingDuration");
-		checkValue("PhaseLossPolicy");
 //		$json = json_decode(file_get_contents("charging.txt"), true);
 //		$json = string[];
 		$json['MaxChargingEnergy']			= (int)$_POST['MaxChargingEnergy'];
@@ -35,7 +34,6 @@
 		$json['MaxChargingCurrent']			= (int)$_POST['MaxChargingCurrent'];
 		$json['AcMaxChargingCurrent']		= (int)$_POST['AcMaxChargingCurrent'];
 		$json['MaxChargingDuration'] 		= (int)$_POST['MaxChargingDuration'];
-		$json['PhaseLossPolicy']			= (int)$_POST['PhaseLossPolicy'];
 		$json['LocalWhiteCard0']			= isset($_POST['LocalWhiteCard0'])?$_POST['LocalWhiteCard0']:"";
 		$json['LocalWhiteCard1']	 		= isset($_POST['LocalWhiteCard1'])?$_POST['LocalWhiteCard1']:"";
 		$json['LocalWhiteCard2']			= isset($_POST['LocalWhiteCard2'])?$_POST['LocalWhiteCard2']:"";

+ 91 - 21
EVSE/rootfs/var/www/set_network.php

@@ -3,6 +3,9 @@
 	$tag_header = 'set';
 	include 'head.php';
 	$obj = json_decode(trim($output[2]));//var_dump($obj);
+	$system = json_decode(trim($output[0]),true);//var_dump($obj);
+	$ModelName = $system['ModelName'];
+	$SerialNumber = $system['SerialNumber'];
 	$InternetConn='';
 	switch ($obj->{'InternetConn'}){
 		case 0:
@@ -121,7 +124,7 @@ img {
 									<section>
 										<div class="form-group">
 											<label>DHCP Client</label>
-											<select class="form-control" id="Eth0DhcpClient" name="Eth0DhcpClient">
+											<select class="form-control" id="Eth0DhcpClient" name="Eth0DhcpClient" onchange="EthDhcp_changed();">
 												<option value="0" <?php echo $obj->{'Eth0DhcpClient'}=="0"?"selected":""?>>enable</option>
 												<option value="1" <?php echo $obj->{'Eth0DhcpClient'}=="1"?"selected":""?>>disable</option>
 											</select>
@@ -188,51 +191,51 @@ img {
 <?php /*												<option value="3" <?php echo $obj->{'WifiMode'}=="3"?"selected":""?>>Ad-Hoc</option>*/?>
 											</select>
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiSsidDiv">
 											<label>SSID</label>
 											<input type="text" name="WifiSsid" id="WifiSsid" class="form-control" value="<?php echo $obj->{'WifiSsid'};?>">
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiPasswordDiv">
 											<label>Password</label>
 											<input type="text" name="WifiPassword" id="WifiPassword" class="form-control" value="<?php echo $obj->{'WifiPassword'};?>">
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiRssiDiv">
 											<label>RSSI</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'WifiRssi'};?> dBm">
 											<input type="hidden" name="WifiRssi" id="WifiRssi" value="<?php echo $obj->{'WifiRssi'};?>">
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiDhcpServerDiv">
 											<label>DHCP Server</label>
 											<select class="form-control" id="WifiDhcpServer" name="WifiDhcpServer">
 												<option value="0" <?php echo $obj->{'WifiDhcpServer'}=="0"?"selected":""?>>enable</option>
 												<option value="1" <?php echo $obj->{'WifiDhcpServer'}=="1"?"selected":""?>>disable</option>
 											</select>
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiDhcpClientDiv">
 											<label>DHCP Client</label>
-											<select class="form-control" id="WifiDhcpClient" name="WifiDhcpClient">
+											<select class="form-control" id="WifiDhcpClient" name="WifiDhcpClient" onchange="WifiDhcp_changed();">
 												<option value="0" <?php echo $obj->{'WifiDhcpClient'}=="0"?"selected":""?>>enable</option>
 												<option value="1" <?php echo $obj->{'WifiDhcpClient'}=="1"?"selected":""?>>disable</option>
 											</select>
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiMacAddressDiv">
 											<label>Mac Address</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'WifiMacAddress'};?>">
 											<input type="hidden" name="WifiMacAddress" id="WifiMacAddress" value="<?php echo $obj->{'WifiMacAddress'};?>">
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiIpAddressDiv">
 											<label>IP Address</label>
 											<input type="text" name="WifiIpAddress" id="WifiIpAddress" class="form-control" value="<?php echo $obj->{'WifiIpAddress'};?>">
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiSubmaskAddressDiv">
 											<label>Submask Address</label>
 											<input type="text" name="WifiSubmaskAddress" id="WifiSubmaskAddress" class="form-control" value="<?php echo $obj->{'WifiSubmaskAddress'};?>">
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiGatewayAddressDiv">
 											<label>Gateway Address</label>
 											<input type="text" name="WifiGatewayAddress" id="WifiGatewayAddress" class="form-control" value="<?php echo $obj->{'WifiGatewayAddress'};?>">
 										</div>
-										<div class="form-group">
+										<div class="form-group" id="WifiNetworkConnDiv">
 											<label>Network Connection Status</label>
 											<input type="text" readonly class="form-control" value="<?php echo $WifiNetworkConn;?>">
 											<input type="hidden" name="WifiNetworkConn" id="WifiNetworkConn" value="<?php echo $obj->{'WifiNetworkConn'};?>">
@@ -340,6 +343,8 @@ img {
 <script type="text/JavaScript">
 	$(document).ready(function(){
 		WifiMode_changed();
+		EthDhcp_changed();
+		WifiDhcp_changed();
 	});
 
 	document.getElementById("save").onclick = function() {
@@ -435,32 +440,97 @@ img {
 		if(document.getElementById("WifiMode").value=="0"){
 			document.getElementById("WifiDhcpServer").disabled=true;
 			document.getElementById("WifiDhcpClient").disabled=true;
-//			document.getElementById("WifiDhcpServer").selectedIndex=1;
-//			document.getElementById("WifiDhcpClient").selectedIndex=1;
 			document.getElementById("WifiSsid").disabled=true;
 			document.getElementById("WifiPassword").disabled=true;
-			document.getElementById("WifiSsid").value="";
-			document.getElementById("WifiPassword").value="";
+			document.getElementById("WifiIpAddress").disabled=true;
+			document.getElementById("WifiSubmaskAddress").disabled=true;
+			document.getElementById("WifiGatewayAddress").disabled=true;
+			document.getElementById("WifiDhcpServerDiv").style.display="none";
+			document.getElementById("WifiDhcpClientDiv").style.display="none";
+			document.getElementById("WifiSsidDiv").style.display="none";
+			document.getElementById("WifiPasswordDiv").style.display="none";
+			document.getElementById("WifiRssiDiv").style.display="none";
+			document.getElementById("WifiMacAddressDiv").style.display="none";
+			document.getElementById("WifiIpAddressDiv").style.display="none";
+			document.getElementById("WifiSubmaskAddressDiv").style.display="none";
+			document.getElementById("WifiGatewayAddressDiv").style.display="none";
+			document.getElementById("WifiNetworkConnDiv").style.display="none";
 		}
 		if(document.getElementById("WifiMode").value=="1"){
 			document.getElementById("WifiDhcpServer").disabled=true;
 			document.getElementById("WifiDhcpClient").disabled=false;
-//			document.getElementById("WifiDhcpServer").selectedIndex=1;
-//			document.getElementById("WifiDhcpClient").selectedIndex=0;
 			document.getElementById("WifiSsid").disabled=false;
 			document.getElementById("WifiPassword").disabled=false;
 			document.getElementById("WifiSsid").value="<?php echo $obj->{'WifiSsid'};?>";
 			document.getElementById("WifiPassword").value="<?php echo $obj->{'WifiPassword'};?>";
+			document.getElementById("WifiIpAddress").disabled=false;
+			document.getElementById("WifiSubmaskAddress").disabled=false;
+			document.getElementById("WifiGatewayAddress").disabled=false;
+			document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
+			document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
+			document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
+			document.getElementById("WifiDhcpServerDiv").style.display="none";
+			document.getElementById("WifiDhcpClientDiv").style.display="block";
+			document.getElementById("WifiSsidDiv").style.display="block";
+			document.getElementById("WifiPasswordDiv").style.display="block";
+			document.getElementById("WifiRssiDiv").style.display="block";
+			document.getElementById("WifiMacAddressDiv").style.display="block";
+			document.getElementById("WifiIpAddressDiv").style.display="block";
+			document.getElementById("WifiSubmaskAddressDiv").style.display="block";
+			document.getElementById("WifiGatewayAddressDiv").style.display="block";
+			document.getElementById("WifiNetworkConnDiv").style.display="block";
 		}
 		if(document.getElementById("WifiMode").value=="2"){
 			document.getElementById("WifiDhcpServer").disabled=false;
 			document.getElementById("WifiDhcpClient").disabled=true;
-//			document.getElementById("WifiDhcpServer").selectedIndex=0;
-//			document.getElementById("WifiDhcpClient").selectedIndex=1;
 			document.getElementById("WifiSsid").disabled=true;
 			document.getElementById("WifiPassword").disabled=true;
-			document.getElementById("WifiSsid").value="";
+			document.getElementById("WifiSsid").value="<?php echo $ModelName.$SerialNumber?>";
 			document.getElementById("WifiPassword").value="";
+			document.getElementById("WifiIpAddress").disabled=true;
+			document.getElementById("WifiSubmaskAddress").disabled=true;
+			document.getElementById("WifiGatewayAddress").disabled=true;
+			document.getElementById("WifiDhcpServerDiv").style.display="block";
+			document.getElementById("WifiDhcpClientDiv").style.display="none";
+			document.getElementById("WifiSsidDiv").style.display="block";
+			document.getElementById("WifiPasswordDiv").style.display="block";
+			document.getElementById("WifiRssiDiv").style.display="block";
+			document.getElementById("WifiMacAddressDiv").style.display="block";
+			document.getElementById("WifiIpAddressDiv").style.display="none";
+			document.getElementById("WifiSubmaskAddressDiv").style.display="none";
+			document.getElementById("WifiGatewayAddressDiv").style.display="none";
+			document.getElementById("WifiNetworkConnDiv").style.display="block";
+		}
+		WifiDhcp_changed();
+	}
+	function EthDhcp_changed(){
+		if(document.getElementById("Eth0DhcpClient").value=="0"){
+			document.getElementById("Eth0IpAddress").disabled=true;
+			document.getElementById("Eth0SubmaskAddress").disabled=true;
+			document.getElementById("Eth0GatewayAddress").disabled=true;
+		}
+		if(document.getElementById("Eth0DhcpClient").value=="1"){
+			document.getElementById("Eth0IpAddress").disabled=false;
+			document.getElementById("Eth0SubmaskAddress").disabled=false;
+			document.getElementById("Eth0GatewayAddress").disabled=false;
+			document.getElementById("Eth0IpAddress").value="<?php echo $obj->{'Eth0IpAddress'};?>";
+			document.getElementById("Eth0SubmaskAddress").value="<?php echo $obj->{'Eth0SubmaskAddress'};?>";
+			document.getElementById("Eth0GatewayAddress").value="<?php echo $obj->{'Eth0GatewayAddress'};?>";
+		}
+	}
+	function WifiDhcp_changed(){
+		if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="0"){
+			document.getElementById("WifiIpAddress").disabled=true;
+			document.getElementById("WifiSubmaskAddress").disabled=true;
+			document.getElementById("WifiGatewayAddress").disabled=true;
+		}
+		if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="1"){
+			document.getElementById("WifiIpAddress").disabled=false;
+			document.getElementById("WifiSubmaskAddress").disabled=false;
+			document.getElementById("WifiGatewayAddress").disabled=false;
+			document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
+			document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
+			document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
 		}
 	}
 

+ 29 - 21
EVSE/rootfs/var/www/set_system.php

@@ -83,9 +83,9 @@ img {
 		<section class="envor-section">
 			<div class="container">
 				<div class="row">
-					<div class="col-lg-12">         
+					<div class="col-lg-12">
 						<div class="envor-sorting" id="faq-sorting">
-							<div class="envor-toggle">                
+							<div class="envor-toggle">
 								<!--System Information-->
 								<article class="envor-sorting-item css">
 									<header><?php echo $lang->showWord("system_information"); ?><i class="fa fa-plus"></i></header>
@@ -119,6 +119,13 @@ img {
 												</span>
 											</div>
 										</div>
+										<div class="form-group" style="display:<?php echo $am001;?>">
+											<label>AC Phase Loss Policy</label>
+											<select class="form-control" id="PhaseLossPolicy" name="PhaseLossPolicy">
+												<option value="0" <?php echo $obj->{'PhaseLossPolicy'}=="0"?"selected":""?>>de-rating</option>
+												<option value="1" <?php echo $obj->{'PhaseLossPolicy'}=="1"?"selected":""?>>stop charging</option>
+											</select>
+										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>
 											<input type="checkbox" id="FactoryConfiguration" name="FactoryConfiguration" <?php echo $obj->{'FactoryConfiguration'}==1?"checked":"";?>>
@@ -137,17 +144,17 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Input Voltage R</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'InputVoltageR'};?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj->{'InputVoltageR'},2);?> volt">
 											<input type="hidden" name="InputVoltageR" id="InputVoltageR" value="<?php echo $obj->{'InputVoltageR'};?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Input Voltage S</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'InputVoltageS'};?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj->{'InputVoltageS'},2);?> volt">
 											<input type="hidden" name="InputVoltageS" id="InputVoltageS" value="<?php echo $obj->{'InputVoltageS'};?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Input Voltage T</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'InputVoltageT'};?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj->{'InputVoltageT'},2);?> volt">
 											<input type="hidden" name="InputVoltageT" id="InputVoltageT" value="<?php echo $obj->{'InputVoltageT'};?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
@@ -331,6 +338,7 @@ img {
 			// POST 參數須使用 send() 發送
 			var data =  "SystemId=" + document.getElementById("SystemId").value+
 						"&SystemDateTime=" + document.getElementById("SystemDateTime").value+
+						"&PhaseLossPolicy=" + document.getElementById("PhaseLossPolicy").value+
 						"&FactoryConfiguration=" + (document.getElementById("FactoryConfiguration").checked?1:0)+
 						"&AuthorisationMode=" + document.getElementById("AuthorisationMode").value+
 						"&isAPP=" + (document.getElementById("isAPP").checked?1:0)+
@@ -340,7 +348,7 @@ img {
 						"&QRCodeContent=" + document.getElementById("QRCodeContent").value+
 						"&RfidCardNumEndian=" + document.getElementById("RfidCardNumEndian").value+
 						"&PsuAcInputType=" + document.getElementById("PsuAcInputType").value;
-			
+
 			// POST 請求必須設置表頭在 open() 下面,send() 上面
 			request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
 			request.send(data);
@@ -348,7 +356,7 @@ img {
 			request.onreadystatechange = function() {
 				// 伺服器請求完成
 				if (request.readyState == 4) {
-					 document.getElementById("loading").style.display="none";
+					document.getElementById("loading").style.display="none";
 					// 伺服器回應成功
 					if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
 						alert("<?php echo $lang->showWord("done")?>");
@@ -361,21 +369,21 @@ img {
 			}
 		}
 	}
-	
+
 	function formCheck()
 	{
 		var SystemId = document.getElementById("SystemId").value;
 		var SystemDateTime = document.getElementById("SystemDateTime").value;
 		var result=true;
-		 
-/*		 
+
+/*
 		if(SystemId.length < 1)
 		{
 			alert("SystemId format is not correct, ID is required .");
 			document.getElementById("SystemId").focus();
 			result = false;
 		}
-		
+
 */
 		return result;
 	}
@@ -409,15 +417,15 @@ img {
 		}
 	}
 
-	Date.prototype.Format = function (fmt) { //author: meizz 
+	Date.prototype.Format = function (fmt) { //author: meizz
 		var o = {
-			"M+": this.getMonth() + 1, //月份 
-			"d+": this.getDate(), //日 
-			"h+": this.getHours(), //小时 
-			"m+": this.getMinutes(), //分 
-			"s+": this.getSeconds(), //秒 
-			"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
-			"S": this.getMilliseconds() //毫秒 
+			"M+": this.getMonth() + 1, //月份
+			"d+": this.getDate(), //日
+			"h+": this.getHours(), //小时
+			"m+": this.getMinutes(), //分
+			"s+": this.getSeconds(), //秒
+			"q+": Math.floor((this.getMonth() + 3) / 3), //季度
+			"S": this.getMilliseconds() //毫秒
 		};
 		if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
 		for (var k in o)
@@ -428,10 +436,10 @@ img {
 	function isNumberKey(evt)
 	{
 		var charCode = (evt.which) ? evt.which : event.keyCode
-		
+
 		if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 46))
 			return false;
-		
+
 		return true;
 	}
 

+ 2 - 1
EVSE/rootfs/var/www/set_system_action.php

@@ -22,6 +22,7 @@
 		}
 //		checkValue("AcPhaseCount",1);
 //		checkValue("FactoryConfiguration",1);
+		checkValue("PhaseLossPolicy",2);
 		checkValue("AuthorisationMode",2);
 		checkValue("isAPP",2);
 		checkValue("isQRCode",2);
@@ -32,7 +33,7 @@
 //		$json = json_decode(file_get_contents("system.txt"), true);
 		$json['SystemId']				= $_POST["SystemId"];
 		$json['SystemDateTime']			= $_POST['SystemDateTime'];
-//		$json['AcPhaseCount']			= $_POST['AcPhaseCount'];
+		$json['PhaseLossPolicy']		= (int)$_POST['PhaseLossPolicy'];
 		$json['FactoryConfiguration']	= $_POST['FactoryConfiguration'];
 		$json['AuthorisationMode']		= (int)$_POST['AuthorisationMode'];
 		$json['isAPP']					= (int)$_POST['isAPP'];

+ 13 - 5
EVSE/rootfs/var/www/upgrade_iso.php

@@ -1,7 +1,15 @@
 <?php
+	ini_set('error_reporting', E_ALL | E_STRICT);
 	$tag_header = 'upgrade';
 	include 'head.php';
 ?>
+<style>
+img {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+</style>
 	<div class="envor-content">
 		<!--
 		Page Title start
@@ -61,6 +69,7 @@
 		if(formCheck("iso"))
 		{
 			window.location="#loadinghref";
+			document.getElementById("loading").style.display="block";
 			var fileInput = document.getElementById('file_iso');
 			
 			// 發送 Ajax 查詢請求並處理
@@ -76,25 +85,25 @@
 
 			// POST 請求必須設置表頭在 open() 下面,send() 上面
 			request.upload.onprogress = function(e) {
-			   document.getElementById("createResult").innerHTML = "Upload " + (Math.round( (e.loaded/e.total) *10000)/100) + "%";
+				document.getElementById("createResult").innerHTML = "Upload " + (Math.round( (e.loaded/e.total) *10000)/100) + "%";
 			}
-
 			request.send(formData);
-
 			request.onreadystatechange = function() {
 				// 伺服器請求完成
 				if (request.readyState == 4) {
+					document.getElementById("loading").style.display="none";
 					// 伺服器回應成功
 					if (request.status == 200) {
 						document.getElementById("createResult").innerHTML = "";
 						document.getElementById("createResult").innerHTML = request.responseText;
+						//location.href="upgrade_iso.php";
 					} else {
 						alert(JSON.parse(request.responseText).message);
 					}
 					request = null;
 				}
 				else{
-					document.getElementById("createResult").innerHTML = request.responseText;	
+					document.getElementById("createResult").innerHTML = request.responseText;
 				}
 			}
 		}
@@ -143,4 +152,3 @@
 	
 </script>
 
-

+ 4 - 3
EVSE/rootfs/var/www/upgrade_iso_action.php

@@ -20,8 +20,8 @@
 		$message = $lang->showWord("message_upgrade");
 
 		chdir('/root');
-		echo '<font color=#ff0000>Work directory: '.getcwd().'<br>';
-		echo 'System date/time: '.nl2br(shell_exec('date +%Y-%m-%d_%H:%M:%S')).'</font>';
+//		echo '<font color=#ff0000>Work directory: '.getcwd().'<br>';
+//		echo 'System date/time: '.nl2br(shell_exec('date +%Y-%m-%d_%H:%M:%S')).'</font>';
 		// ini_set('max_execution_time','120');
 		// ini_set('max_input_time','120');
 		// ini_set('post_max_size','2048M');
@@ -46,7 +46,8 @@
 			chdir("/root");
 			$str_json=json_encode($json);
 			exec("'./WebService' 'upgrade' '".$_FILES["file"]["name"]."'",$output,$return_var);
-			echo 'Result:'.json_decode(trim($output[0]))->{'Result'}.'    Message:'.json_decode(trim($output[0]))->{'Message'};
+//			echo 'Result:'.json_decode(trim($output[0]))->{'Result'}.'    Message:'.json_decode(trim($output[0]))->{'Message'};
+			echo '<font color=#ff0000>'.json_decode(trim($output[0]))->{'Message'}.'</font>';
 			//printf($output);
 		}
 		shell_exec('sync;sync;sync');

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

@@ -1 +1 @@
-1
+6

+ 3 - 4
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/.am335x-evm.dtb.dts.tmp

@@ -1444,7 +1444,6 @@
                 compatible = "nxp,pcf85063";
                 reg = <0x51>;
         };
-
 };
 
 &usb {
@@ -1479,7 +1478,7 @@
 &elm {
  status = "okay";
 };
-# 403 "arch/arm/boot/dts/am335x-evm.dts"
+# 402 "arch/arm/boot/dts/am335x-evm.dts"
 &gpmc {
  status = "okay";
  pinctrl-names = "default", "sleep";
@@ -1665,7 +1664,7 @@
   };
  };
 };
-# 509 "arch/arm/boot/dts/am335x-evm.dts" 2
+# 508 "arch/arm/boot/dts/am335x-evm.dts" 2
 
 &tps {
  vcc1-supply = <&vbat>;
@@ -1764,7 +1763,7 @@
   phy-mode = "mii";
 
 };
-# 615 "arch/arm/boot/dts/am335x-evm.dts"
+# 614 "arch/arm/boot/dts/am335x-evm.dts"
 &tscadc {
  status = "okay";
 

+ 0 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts

@@ -344,7 +344,6 @@
                 compatible = "nxp,pcf85063";
                 reg = <0x51>;
         };
-
 };
 #endif
 &usb {

Some files were not shown because too many files changed in this diff