浏览代码

2021.06.25 / Jerry Wang

Actions:
1. merge master conflict fixed.

Files:
1. As follow as commit history.
Jerry_Wang 3 年之前
父节点
当前提交
8c7006629c
共有 57 个文件被更改,包括 4487 次插入618 次删除
  1. 117 99
      EVSE/Modularization/DcMeter/Module_DcMeter.c
  2. 9 2
      EVSE/Modularization/DcMeter/meterComm.c
  3. 1 0
      EVSE/Modularization/DcMeter/meterComm.h
  4. 6 6
      EVSE/Modularization/Makefile
  5. 4 4
      EVSE/Modularization/Module_InitUpgrade.c
  6. 2669 190
      EVSE/Modularization/Module_PhBackend.c
  7. 1 1
      EVSE/Modularization/Module_PhBackend.h
  8. 2 2
      EVSE/Modularization/Module_ProduceUtils.c
  9. 59 38
      EVSE/Modularization/Module_Wifi.c
  10. 12 12
      EVSE/Modularization/WebService.c
  11. 52 6
      EVSE/Modularization/ocpp20/MessageHandler.c
  12. 1 0
      EVSE/Modularization/ocpp20/MessageHandler.h
  13. 2 2
      EVSE/Modularization/ocpp20/Module_OcppBackend20.c
  14. 52 6
      EVSE/Modularization/ocppfiles/MessageHandler.c
  15. 1 0
      EVSE/Modularization/ocppfiles/MessageHandler.h
  16. 2 2
      EVSE/Modularization/ocppfiles/Module_OcppBackend.c
  17. 250 37
      EVSE/Projects/AW-CCS/Apps/LCM/Module_LcmControl.c
  18. 315 0
      EVSE/Projects/AW-CCS/Apps/LCM/cbmp.c
  19. 54 0
      EVSE/Projects/AW-CCS/Apps/LCM/cbmp.h
  20. 25 5
      EVSE/Projects/AW-CCS/Apps/LCM/lcmComm_dgus.c
  21. 3 1
      EVSE/Projects/AW-CCS/Apps/LCM/lcmComm_dgus.h
  22. 2 2
      EVSE/Projects/AW-CCS/Apps/Module_ConfigTools.c
  23. 3 3
      EVSE/Projects/AW-CCS/Apps/Module_FactoryConfig.c
  24. 17 19
      EVSE/Projects/AW-CCS/Apps/main.c
  25. 二进制
      EVSE/Projects/AW-CCS/Images/FactoryDefaultConfig.bin
  26. 二进制
      EVSE/Projects/AW-CCS/Images/ramdisk.gz
  27. 2 2
      EVSE/Projects/AW-ChargeLab/Apps/Module_ConfigTools.c
  28. 7 19
      EVSE/Projects/AW-ChargeLab/Apps/Module_FactoryConfig.c
  29. 10 5
      EVSE/Projects/AW-ChargeLab/Apps/main.c
  30. 2 2
      EVSE/Projects/AW-Regular/Apps/Module_ConfigTools.c
  31. 7 19
      EVSE/Projects/AW-Regular/Apps/Module_FactoryConfig.c
  32. 10 5
      EVSE/Projects/AW-Regular/Apps/main.c
  33. 二进制
      EVSE/Projects/AW-Regular/Images/FactoryDefaultConfig.bin
  34. 二进制
      EVSE/Projects/AW-Regular/Images/ramdisk.gz
  35. 4 0
      EVSE/Projects/DD360/Apps/Define/define.h
  36. 4 0
      EVSE/Projects/DD360Audi/Apps/Define/define.h
  37. 二进制
      EVSE/Projects/DD360Audi/Images/ramdisk.gz
  38. 二进制
      EVSE/Projects/DD360Audi/output/FactoryConfig
  39. 二进制
      EVSE/Projects/DD360Audi/output/Module_DoComm
  40. 二进制
      EVSE/Projects/DD360Audi/output/Module_EvComm
  41. 二进制
      EVSE/Projects/DD360Audi/output/Module_EventLogging
  42. 二进制
      EVSE/Projects/DD360Audi/output/Module_InternalComm
  43. 二进制
      EVSE/Projects/DD360Audi/output/Module_LcmControl
  44. 二进制
      EVSE/Projects/DD360Audi/output/Module_PrimaryComm
  45. 二进制
      EVSE/Projects/DD360Audi/output/ReadCmdline
  46. 二进制
      EVSE/Projects/DD360Audi/output/main
  47. 4 0
      EVSE/Projects/DD360ComBox/Apps/Define/define.h
  48. 2 2
      EVSE/Projects/Noodoe/Apps/Module_ConfigTools.c
  49. 7 19
      EVSE/Projects/Noodoe/Apps/Module_FactoryConfig.c
  50. 750 100
      EVSE/Projects/Noodoe/Apps/main.c
  51. 二进制
      EVSE/Projects/Noodoe/Images/FactoryDefaultConfig.bin
  52. 二进制
      EVSE/Projects/Noodoe/Images/ramdisk.gz
  53. 4 0
      EVSE/Projects/define.h
  54. 2 1
      EVSE/rootfs/etc/init.d/rcS
  55. 6 0
      EVSE/rootfs/etc/syslog.conf
  56. 二进制
      EVSE/rootfs/sbin/mtd_debug
  57. 7 7
      EVSE/rootfs/var/www/set_charging.php

+ 117 - 99
EVSE/Modularization/DcMeter/Module_DcMeter.c

@@ -6,6 +6,7 @@
  */
 #include "Module_DcMeter.h"
 #include "meterComm.h"
+#include "Module_RatedCurrent.h"
 
 /**
  * Initial share memory
@@ -52,8 +53,10 @@ int InitShareMemory()
 //==========================================
 int main(void)
 {
-	Meter_Info meter_info;
+	ParsingRatedCur modelnameInfo = {0};
+	Meter_Info meter_info = {0};
 	uint8_t pollingIndex = 0;
+	uint8_t	meterIndex = 0;
 	uint8_t failCount = 0;
 
 #ifndef DEBUG_STANDALONG
@@ -69,6 +72,8 @@ int main(void)
 		sleep(5);
 		return -1;
 	}
+
+	RatedCurrentParsing((char*)ShmSysConfigAndInfo->SysConfig.ModelName, &modelnameInfo);
 #endif//DEBUG_STANDALONG
 
 	// Initialize DC meter model
@@ -81,113 +86,126 @@ int main(void)
 	// Main loop
 	for(;;)
 	{
-		switch(pollingIndex)
+		for(uint8_t gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
 		{
-			case 0:
-				if(readCurrent(&meter_info))
-				{
-#ifndef DEBUG_STANDALONG
-					/*
-					 *	TODO:
-					 *		1. Synchronize data to share memory
-					 */
-#else
-					DEBUG_INFO("Output current: %.3f A\n", meter_info.presentCurrent);
-#endif//DEBUG_STANDALONG
-					pollingIndex++;
-					failCount = 0;
-				}
-				else
-				{
-					if(failCount < 10)
-						failCount++;
-				}
-				break;
-			case 1:
-				if(readVoltage(&meter_info))
-				{
-#ifndef DEBUG_STANDALONG
-					/*
-					 *	TODO:
-					 *		1. Synchronize data to share memory
-					 */
-#else
-					DEBUG_INFO("Output voltage: %.3f V\n", meter_info.presetVoltage);
-#endif//DEBUG_STANDALONG
-					pollingIndex++;
-					failCount = 0;
-				}
-				else
-				{
-					if(failCount < 10)
-						failCount++;
-				}
-				break;
-			case 2:
-				if(readPower(&meter_info))
-				{
-#ifndef DEBUG_STANDALONG
-					/*
-					 *	TODO:
-					 *		1. Synchronize data to share memory
-					 */
-#else
-					DEBUG_INFO("Output power: %.3f kw\n", meter_info.presentPower);
-#endif//DEBUG_STANDALONG
-					pollingIndex++;
-					failCount = 0;
-				}
-				else
-				{
-					if(failCount < 10)
-						failCount++;
-				}
-				break;
-			case 3:
-				if(readEnergy(&meter_info))
+			if(gun_index == 0)
+				meterIndex = 0;
+
+			if(modelnameInfo.ParsingInfo[gun_index].GunType != Gun_Type_AC)
+			{
+				meterApiAssign(meterIndex);
+				switch(pollingIndex)
 				{
-#ifndef DEBUG_STANDALONG
-					/*
-					 *	TODO:
-					 *		1. Synchronize data to share memory
-					 */
-#else
-					DEBUG_INFO("Totalize import energy: %.3f kwh\n", meter_info.totlizeImportEnergy);
-					DEBUG_INFO("Totalize export energy: %.3f kwh\n", meter_info.totlizeExportEnergy);
-#endif//DEBUG_STANDALONG
-					pollingIndex++;
-					failCount = 0;
+					case 0:
+						if(readCurrent(&meter_info))
+						{
+							#ifndef DEBUG_STANDALONG
+							/*
+							 *	TODO:
+							 *		1. Synchronize data to share memory
+							 */
+							#else
+							DEBUG_INFO("Output current: %.3f A\n", meter_info.presentCurrent);
+							#endif//DEBUG_STANDALONG
+							pollingIndex++;
+							failCount = 0;
+						}
+						else
+						{
+							if(failCount < 10)
+								failCount++;
+						}
+						break;
+					case 1:
+						if(readVoltage(&meter_info))
+						{
+							#ifndef DEBUG_STANDALONG
+							/*
+							 *	TODO:
+							 *		1. Synchronize data to share memory
+							 */
+							#else
+							DEBUG_INFO("Output voltage: %.3f V\n", meter_info.presetVoltage);
+							#endif//DEBUG_STANDALONG
+							pollingIndex++;
+							failCount = 0;
+						}
+						else
+						{
+							if(failCount < 10)
+								failCount++;
+						}
+						break;
+					case 2:
+						if(readPower(&meter_info))
+						{
+							#ifndef DEBUG_STANDALONG
+							/*
+							 *	TODO:
+							 *		1. Synchronize data to share memory
+							 */
+							#else
+							DEBUG_INFO("Output power: %.3f kw\n", meter_info.presentPower);
+							#endif//DEBUG_STANDALONG
+							pollingIndex++;
+							failCount = 0;
+						}
+						else
+						{
+							if(failCount < 10)
+								failCount++;
+						}
+						break;
+					case 3:
+						if(readEnergy(&meter_info))
+						{
+							#ifndef DEBUG_STANDALONG
+							/*
+							 *	TODO:
+							 *		1. Synchronize data to share memory
+							 */
+							#else
+							DEBUG_INFO("Totalize import energy: %.3f kwh\n", meter_info.totlizeImportEnergy);
+							DEBUG_INFO("Totalize export energy: %.3f kwh\n", meter_info.totlizeExportEnergy);
+							#endif//DEBUG_STANDALONG
+							pollingIndex++;
+							failCount = 0;
+						}
+						else
+						{
+							if(failCount < 10)
+								failCount++;
+						}
+						break;
+					default:
+						pollingIndex = 0;
+						break;
 				}
-				else
+
+				meterIndex++;
+			}
+
+			if(failCount >= 10)
+			{
+				#ifndef DEBUG_STANDALONG
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout)
 				{
-					if(failCount < 10)
-						failCount++;
+					DEBUG_ERROR("Meter communication timeout");
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout = ON;
 				}
-				break;
-			default:
-				pollingIndex = 0;
-				break;
-		}
-
-		if(failCount >= 10)
-		{
-#ifndef DEBUG_STANDALONG
-			if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout)
+				#endif//DEBUG_STANDALONG
+			}
+			else
 			{
-				DEBUG_ERROR("Meter communication timeout");
-				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout = ON;
+				#ifndef DEBUG_STANDALONG
+				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout = OFF;
+				#endif//DEBUG_STANDALONG
 			}
-#endif//DEBUG_STANDALONG
-		}
-		else
-		{
-#ifndef DEBUG_STANDALONG
-			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout = OFF;
-#endif//DEBUG_STANDALONG
+			usleep(500000);
 		}
-
-		usleep(500000);
 	}
 
+
+
 	return -1;
 }

+ 9 - 2
EVSE/Modularization/DcMeter/meterComm.c

@@ -16,13 +16,20 @@ char			meterApiAddress[128];
 
 
 /**
- * Meter driver initialize
+ * Meter model initialize
  * @param model
  */
 void meterInitialize(uint8_t model)
 {
 	meterModel = model;
+}
 
+/**
+ * Meter api address assign
+ * @param meterIndex
+ */
+void meterApiAssign(uint8_t meterIndex)
+{
 	switch(meterModel)
 	{
 		case METER_MODEL_LEM_L18005A:
@@ -31,7 +38,7 @@ void meterInitialize(uint8_t model)
 			 * TODO:
 			 * 	1. Check meter actual API address.
 			 */
-			//sprintf(meterApiAddress, "http://192.168.1.2/livemeasure");
+			//sprintf(meterApiAddress, "http://192.168.0.%d/livemeasure", (31 + meterIndex));
 			sprintf(meterApiAddress, "https://foluswen.com/tmate/livemeasure.php"); // Simulator by web server
 
 			break;

+ 1 - 0
EVSE/Modularization/DcMeter/meterComm.h

@@ -52,6 +52,7 @@ enum METER_MODEL
 };
 
 extern void meterInitialize(uint8_t model);
+extern void meterApiAssign(uint8_t meterIndex);
 extern int readVoltage(Meter_Info *meter_info);
 extern int readCurrent(Meter_Info *meter_info);
 extern int readPower(Meter_Info *meter_info);

+ 6 - 6
EVSE/Modularization/Makefile

@@ -3,12 +3,12 @@ export PATH=/bin:/sbin:/usr/bin:$(SDK_PATH_TARGET)/usr/bin:$PATH
 
 #define library variable
 Lib_SQLite3 = "-L../../../Modularization/ocppfiles" -lsqlite3
+Lib_RatedCurrentLib = "-L./" -lModule_RatedCurrent
 
-all: clean Module_RFIDLib Module_Wifi WebServiceLib Ocpp16 \
-     Phihong_PsuCommObj Module_4g Module_UpgradeLib Infypwr_PsuCommObj \
+all: clean Module_RFIDLib Module_RatedCurrentLib Module_UpgradeLib Module_Wifi \
+     WebServiceLib Ocpp16 Phihong_PsuCommObj Module_4g Infypwr_PsuCommObj \
      Module_EventLogging Module_ProduceUtils Module_PhBackend \
-     Ocpp20 Module_InitUpgrade Module_RatedCurrentLib Module_Payment \
-     Module_DcMeter
+     Ocpp20 Module_InitUpgrade Module_Payment Module_DcMeter
 
 clean:
 	rm -f libModule_RFID.a
@@ -109,7 +109,7 @@ Module_EventLogging:
 Module_PhBackend:
 	rm -f Module_Phbackend
 	$(CC) -D $(Project) -I ../Projects -O0 -g3 -Wall -c -fmessage-length=0 -o Module_PhBackend.o Module_PhBackend.c
-	$(CC) -o Module_PhBackend Module_PhBackend.o
+	$(CC) -o Module_PhBackend Module_PhBackend.o ${Lib_RatedCurrentLib}
 	rm -f Module_PhBackend.o
 	mv -f Module_PhBackend ../rootfs/root
 
@@ -129,6 +129,6 @@ Module_Payment:
 
 Module_DcMeter:
 	rm -f Module_DcMeter;
-	$(CC) -D $(Project) "-Wl,-rpath-link,../rootfs/lib" ./DcMeter/Module_DcMeter.c ./DcMeter/meterComm.c ./DcMeter/curlApi.c ./DcMeter/SystemLogMessage.c -I ../Projects -I ../GPL/curl-7.37.1/release/include -I ../GPL/json-c-json-c-0.13.1-20180305/release/include -L ../GPL/json-c-json-c-0.13.1-20180305/release/lib -L ../GPL/curl-7.37.1/release/lib -ljson-c -lcurl -lssl -o Module_DcMeter
+	$(CC) -D $(Project) "-Wl,-rpath-link,../rootfs/lib" ./DcMeter/Module_DcMeter.c ./DcMeter/meterComm.c ./DcMeter/curlApi.c ./DcMeter/SystemLogMessage.c -I ./ -I ../Projects -I ../GPL/curl-7.37.1/release/include -I ../GPL/json-c-json-c-0.13.1-20180305/release/include -L ../GPL/json-c-json-c-0.13.1-20180305/release/lib -L ../GPL/curl-7.37.1/release/lib -ljson-c -lcurl -lssl -o Module_DcMeter ${Lib_RatedCurrentLib}
 	mv -f Module_DcMeter ../rootfs/root/
 

+ 4 - 4
EVSE/Modularization/Module_InitUpgrade.c

@@ -55,7 +55,7 @@
 #define NO							0
 #define true			    		1
 #define false						0
-#define MtdBlockSize				0x600000
+#define MtdBlockSize				0x300000
 
 struct SysConfigAndInfo		*ShmSysConfigAndInfo;
 struct StatusCodeData 		*ShmStatusCodeData;
@@ -143,7 +143,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	{
 		memset(BufTmp,0,MtdBlockSize);
 		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
-		for(i=0;i<MtdBlockSize-4;i++)
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
 			Chk+=*(BufTmp+i);
 		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
 
@@ -169,12 +169,12 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 
 
 		DEBUG_INFO("Erase /dev/mtd10.\n");
-		runShellCmd("flash_erase /dev/mtd10 0 12");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
 		DEBUG_INFO("Write /dev/mtd10.\n");
 		runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
 
 		DEBUG_INFO("Erase /dev/mtd11.\n");
-		runShellCmd("flash_erase /dev/mtd11 0 12");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
 		DEBUG_INFO("Write /dev/mtd11.\n");
 		runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
 

文件差异内容过多而无法显示
+ 2669 - 190
EVSE/Modularization/Module_PhBackend.c


+ 1 - 1
EVSE/Modularization/Module_PhBackend.h

@@ -65,7 +65,7 @@ struct Message
 struct PH_Backend_Info
 {
 	uint32_t	st_hearbeat;
-	uint32_t	st_status;
+	uint32_t	st_status[3];
 
 	uint32_t	interval_heartbeat;
 	uint32_t	interval_status;

+ 2 - 2
EVSE/Modularization/Module_ProduceUtils.c

@@ -36,7 +36,7 @@
 #define FAIL					0
 #define ON						1
 #define OFF						0
-#define MtdBlockSize			0x600000
+#define MtdBlockSize			0x300000
 
 #define LISTEN_PORT				8234
 #define	CONNECTION_LIMIT		3
@@ -214,7 +214,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 		{
 			memset(BufTmp,0,MtdBlockSize);
 			memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
-			for(i=0;i<MtdBlockSize-4;i++)
+			for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
 				Chk+=*(BufTmp+i);
 			memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
 

+ 59 - 38
EVSE/Modularization/Module_Wifi.c

@@ -86,7 +86,7 @@
 #define LISTEN_PORT_TCP				54089
 
 #define	CONNECTION_LIMIT			3
-#define MtdBlockSize				0x600000
+#define MtdBlockSize				0x300000
 
 #define REGISTER					0x01
 #define CLEAR_REGISTER				0x02
@@ -342,6 +342,27 @@ void displayMessage(uint8_t *data, uint16_t len, uint8_t isRX)
 #endif
 }
 
+int runShellCmd(const char*cmd)
+{
+	int result = FAIL;
+	char buf[256];
+	FILE *fp;
+
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			DEBUG_INFO("%s\n", buf);
+		}
+
+		result = PASS;
+	}
+	pclose(fp);
+
+	return result;
+}
+
 //==========================================
 // Init all share memory
 //==========================================
@@ -1636,58 +1657,58 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	int fd,wrd;
 	unsigned int i,Chk;
 	unsigned char *ptr, *BufTmp;
-	
+
 	Chk=0;
 	ptr=(unsigned char *)UsrData;
 	if((BufTmp=malloc(MtdBlockSize))!=NULL)
 	{
 		memset(BufTmp,0,MtdBlockSize);
 		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
-		for(i=0;i<MtdBlockSize-4;i++)
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
 			Chk+=*(BufTmp+i);
-		memcpy(	BufTmp+MtdBlockSize-4,&Chk,4);
-		fd = open("/dev/mtdblock10", O_RDWR);
-		if (fd>0)
+		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
+
+		// Output configuration to file.
+		fd = open("/mnt/EvseConfig.bin", O_RDWR|O_CREAT);
+		if (fd < 0)
 		{
-			wrd=write(fd, BufTmp, MtdBlockSize);
-			close(fd);
-			if(wrd>=MtdBlockSize)
-			{
-				fd = open("/dev/mtdblock11", O_RDWR);
-				if (fd>0)
-				{
-					wrd=write(fd, BufTmp, MtdBlockSize);
-    				close(fd);
-				    if(wrd<MtdBlockSize)
-					{
-						DEBUG_ERROR("write /dev/mtdblock11(backup) NG\n");
-				   		result = FAIL;
-					}
-				}
-				else
-				{
-					DEBUG_ERROR("open /dev/mtdblock11(backup) NG\n");
-					result = FAIL;
-				}
-			}
-			else
-			{
-		    	DEBUG_ERROR("write /dev/mtdblock10 NG\n");
-		    	result = FAIL;
-			}
+			DEBUG_ERROR("open /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
 		}
-		else
+		wrd=write(fd, BufTmp, MtdBlockSize);
+		close(fd);
+		if(wrd<MtdBlockSize)
 		{
-			DEBUG_ERROR("open /dev/mtdblock10 NG\n");
-			result = FAIL;
+			DEBUG_ERROR("write /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
 		}
+		DEBUG_INFO("EvseConfig write to file in /mnt OK.\n");
+
+
+		DEBUG_INFO("Erase /dev/mtd10.\n");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
+		DEBUG_INFO("Write /dev/mtd10.\n");
+		runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
+
+		DEBUG_INFO("Erase /dev/mtd11.\n");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
+		DEBUG_INFO("Write /dev/mtd11.\n");
+		runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
+
+
+		system("rm -f /mnt/EvseConfig.bin");
+		DEBUG_INFO("EvseConfig write to flash OK\n");
 	}
 	else
 	{
-		DEBUG_ERROR("alloc BlockSize NG\n");
-    	result = FAIL;
+		DEBUG_ERROR("alloc BlockSize NG\r\n");
+			result = FAIL;
 	}
-	
+
 	if(BufTmp!=NULL)
 		free(BufTmp);
 

+ 12 - 12
EVSE/Modularization/WebService.c

@@ -41,7 +41,7 @@
 #define PASS				1
 #define FAIL				-1
 
-#define MtdBlockSize 0x600000
+#define MtdBlockSize 0x300000
 
 struct SysConfigAndInfo		*ShmSysConfigAndInfo;
 struct StatusCodeData		*ShmStatusCodeData;
@@ -316,7 +316,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	{
 		memset(BufTmp,0,MtdBlockSize);
 		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
-		for(i=0;i<MtdBlockSize-4;i++)
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
 			Chk+=*(BufTmp+i);
 		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
 
@@ -1759,7 +1759,7 @@ int main(int argc, char *argv[]) {
 				StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
 				StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
 				StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
-				if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0){
+				if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 255){
 					ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
 				}
 				else{
@@ -1785,7 +1785,7 @@ int main(int argc, char *argv[]) {
 				StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
 				StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
 				ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
-				if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 ){
+				if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 255){
 					ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
 				}
 				else{
@@ -1811,7 +1811,7 @@ int main(int argc, char *argv[]) {
 				StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
 				StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
 				ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
-				if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 ){
+				if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 255){
 					ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
 				}
 				else{
@@ -1859,7 +1859,7 @@ int main(int argc, char *argv[]) {
 				StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
 				StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
 				ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
-				if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 ){
+				if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 255){
 					ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
 				}
 				else{
@@ -1885,7 +1885,7 @@ int main(int argc, char *argv[]) {
 				StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
 				StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
 				ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
-				if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 ){
+				if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 255){
 					ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
 				}
 				else{
@@ -1911,7 +1911,7 @@ int main(int argc, char *argv[]) {
 				StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
 				StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
 				ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
-				if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 ){
+				if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 255){
 					ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
 				}
 				else{
@@ -1959,7 +1959,7 @@ int main(int argc, char *argv[]) {
 				StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
 				StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
 				ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
-				if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 ){
+				if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 ||ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 255){
 					ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
 				}
 				else{
@@ -1985,7 +1985,7 @@ int main(int argc, char *argv[]) {
 				StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
 				StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
 				ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
-				if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 ){
+				if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 255){
 					ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
 				}
 				else{
@@ -2011,7 +2011,7 @@ int main(int argc, char *argv[]) {
 				StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
 				StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
 				ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
-				if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 ){
+				if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 255){
 					ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
 				}
 				else{
@@ -2061,7 +2061,7 @@ int main(int argc, char *argv[]) {
 				DDStopDateTime[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StopDateTime);
 				DDStartMethod[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartMethod);
 				DDConnectorTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp);
-				if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp == 0 ){
+				if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp == 255){
 					ConnectorTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp);
 				}
 				else{

+ 52 - 6
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -4813,8 +4813,19 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 											}
 										}
 
-										break;
+										// Delete duplicate period
+										if(compositePeriodIdx > 1)
+										{
+											if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit == compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-2].limit)
+											{
+												compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod = -1;
+												compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit = -1;
+												compositePeriodIdx -= 1;
+											}
+										}
 									}
+									else
+										break;
 								}
 							}
 							else
@@ -4876,8 +4887,19 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 								}
 							}
 
-							break;
+							// Delete duplicate period
+							if(compositePeriodIdx > 1)
+							{
+								if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit == compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-2].limit)
+								{
+									compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod = -1;
+									compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit = -1;
+									compositePeriodIdx -= 1;
+								}
+							}
 						}
+						else
+							break;
 					}
 				}
 				else
@@ -4908,14 +4930,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 				if((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod >= compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].startPeriod) &&
 				   (maxProfile.chargingSchedule[idxSchedule].duration > compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].startPeriod))
 				{
-					tmpPeriod.startPeriod = compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].startPeriod;
+					tmpPeriod.startPeriod = (compositePeriodIdx==0)?0:compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].startPeriod;
 					tmpPeriod.numberPhases = compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].numberPhases;
 					tmpPeriod.limit = maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].limit;
 				}
 
-				if((maxProfile.chargingSchedule[idxSchedule].duration > compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].startPeriod))
+				if((compositePeriodIdx > 0) && (maxProfile.chargingSchedule[idxSchedule].duration > compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].startPeriod))
 				{
-					tmpPeriod.startPeriod = compositeProfile->chargingSchedule[idxSchedule].duration;
+					tmpPeriod.startPeriod = (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod>compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod)?maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod:compositeProfile->chargingSchedule[idxSchedule].duration;
 					tmpPeriod.numberPhases = maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].numberPhases;
 					tmpPeriod.limit = maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].limit;
 				}
@@ -4934,6 +4956,17 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 							memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
 						}
 					}
+
+					// Delete duplicate period
+					if(compositePeriodIdx > 1)
+					{
+						if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit == compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-2].limit)
+						{
+							compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod = -1;
+							compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit = -1;
+							compositePeriodIdx -= 1;
+						}
+					}
 				}
 			}
 		}
@@ -12164,12 +12197,19 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
   			DEBUG_INFO("Composite Period-%02d limit: %f\n", idx, ShmOCPP20Data->GetCompositeSchedule[gun_index].Response_schedule.chargingSchedule.chargingSchedulePeriod[idx].limit);
 
   			if((ShmOCPP20Data->GetCompositeSchedule[gun_index].Response_schedule.chargingSchedule.chargingSchedulePeriod[idx].startPeriod==0) &&
-  			   (ShmOCPP20Data->GetCompositeSchedule[gun_index].Response_schedule.chargingSchedule.chargingSchedulePeriod[idx].limit==0))
+  			   (ShmOCPP20Data->GetCompositeSchedule[gun_index].Response_schedule.chargingSchedule.chargingSchedulePeriod[idx].limit==0) &&
+			   (idx<(ARRAY_SIZE(ShmOCPP20Data->GetCompositeSchedule[gun_index].Response_schedule.chargingSchedule.chargingSchedulePeriod)-1)?(ShmOCPP20Data->GetCompositeSchedule[gun_index].Response_schedule.chargingSchedule.chargingSchedulePeriod[idx+1].startPeriod==0):TRUE))
   			{
   				confirmPeriods = idx;
   				break;
   			}
   		}
+
+  		if((confirmPeriods == 0) && (tmpProfile[0].id > 0))
+  		{
+  			confirmPeriods += 1;
+  		}
+
   		sprintf(comfirmstr, "%s", GetCompositeScheduleStatusEnumTypeStr[GenericStatusEnumType_Accepted]);
   	}
   	else
@@ -17019,6 +17059,12 @@ int GetInternetConn(void)
 	return ShmSysConfigAndInfo->SysInfo.InternetConn;
 }
 
+int GetBackendConnectionTimeout(void)
+{
+	return ShmSysConfigAndInfo->SysConfig.BackendConnTimeout>=0?ShmSysConfigAndInfo->SysConfig.BackendConnTimeout:300;
+}
+
+
 int isConnectorInitMode(int gun_index)
 {
 	int tempIndex = 0;

+ 1 - 0
EVSE/Modularization/ocpp20/MessageHandler.h

@@ -1007,6 +1007,7 @@ void FillStartTransaction(int ConnectorId, unsigned char IdTag[], int MeterStart
 void splitstring(char *src,const char *separator,char **dest,int *num);
 int GetWebSocketPingInterval(void);
 int GetInternetConn(void);
+int GetBackendConnectionTimeout(void);
 int isConnectorInitMode(int gun_index);
 void refreshProcDogTimer();
 int GetServerSign(void);

+ 2 - 2
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -401,8 +401,8 @@ void* ConnectWsServer(void* data)  //int ConnectWsServer()
 	}
 
 	ContextInfo.protocols = protocols;
-	ContextInfo.timeout_secs = GetWebSocketPingInterval();//WebSocketPingInterval;//30;//9999;//30;
-	ContextInfo.ws_ping_pong_interval = GetWebSocketPingInterval();//WebSocketPingInterval;//30;//0 for none, else interval in seconds
+	ContextInfo.timeout_secs = GetBackendConnectionTimeout();
+	ContextInfo.ws_ping_pong_interval = GetWebSocketPingInterval();
 	ContextInfo.ka_time = 20;
 	ContextInfo.keepalive_timeout = 5;
 	ContextInfo.ka_probes = 2;

+ 52 - 6
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -2495,8 +2495,19 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 											}
 										}
 
-										break;
+										// Delete duplicate period
+										if(compositePeriodIdx > 1)
+										{
+											if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
+											{
+												compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
+												compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
+												compositePeriodIdx -= 1;
+											}
+										}
 									}
+									else
+										break;
 								}
 							}
 							else
@@ -2558,8 +2569,20 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 								}
 							}
 
-							break;
+							// Delete duplicate period
+							if(compositePeriodIdx > 1)
+							{
+								if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
+								{
+									compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
+									compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
+									compositePeriodIdx -= 1;
+								}
+							}
 						}
+						else
+
+							break;
 					}
 				}
 				else
@@ -2590,14 +2613,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 				if((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod >= compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].StartPeriod) &&
 				   (maxProfile.ChargingSchedule.Duration > compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].StartPeriod))
 				{
-					tmpPeriod.StartPeriod = compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].StartPeriod;
+					tmpPeriod.StartPeriod = (compositePeriodIdx==0)?0:compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].StartPeriod;
 					tmpPeriod.NumberPhases = compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].NumberPhases;
 					tmpPeriod.Limit = maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].Limit;
 				}
 
-				if((maxProfile.ChargingSchedule.Duration > compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].StartPeriod))
+				if((compositePeriodIdx > 0 ) && (maxProfile.ChargingSchedule.Duration > compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx==0?0:compositePeriodIdx-1].StartPeriod))
 				{
-					tmpPeriod.StartPeriod = compositeProfile->ChargingSchedule.Duration;
+					tmpPeriod.StartPeriod = (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod>compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod)?maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod:compositeProfile->ChargingSchedule.Duration;
 					tmpPeriod.NumberPhases = maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].NumberPhases;
 					tmpPeriod.Limit = maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].Limit;
 				}
@@ -2616,6 +2639,17 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 							memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 						}
 					}
+
+					// Delete duplicate period
+					if(compositePeriodIdx > 1)
+					{
+						if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
+						{
+							compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
+							compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
+							compositePeriodIdx -= 1;
+						}
+					}
 				}
 			}
 		}
@@ -8634,12 +8668,19 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
   			DEBUG_INFO("Composite Period-%02d limit: %f\n", idx, ShmOCPP16Data->GetCompositeSchedule[gun_index].ResponseChargingSchedule.ChargingSchedulePeriod[idx].Limit);
 
   			if((ShmOCPP16Data->GetCompositeSchedule[gun_index].ResponseChargingSchedule.ChargingSchedulePeriod[idx].StartPeriod==0) &&
-  			   (ShmOCPP16Data->GetCompositeSchedule[gun_index].ResponseChargingSchedule.ChargingSchedulePeriod[idx].Limit==0))
+  			   (ShmOCPP16Data->GetCompositeSchedule[gun_index].ResponseChargingSchedule.ChargingSchedulePeriod[idx].Limit==0) &&
+			   (idx<(ARRAY_SIZE(ShmOCPP16Data->GetCompositeSchedule[gun_index].ResponseChargingSchedule.ChargingSchedulePeriod)-1)?(ShmOCPP16Data->GetCompositeSchedule[gun_index].ResponseChargingSchedule.ChargingSchedulePeriod[idx+1].StartPeriod==0):TRUE))
   			{
   				confirmPeriods = idx;
   				break;
   			}
   		}
+
+  		if((confirmPeriods == 0) && (tmpProfile[0].ChargingProfileId > 0))
+  		{
+  			confirmPeriods += 1;
+  		}
+
   		sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
   	}
   	else
@@ -17617,6 +17658,11 @@ int GetInternetConn(void)
 	return ShmSysConfigAndInfo->SysInfo.InternetConn;
 }
 
+int GetBackendConnectionTimeout(void)
+{
+	return ShmSysConfigAndInfo->SysConfig.BackendConnTimeout>=0?ShmSysConfigAndInfo->SysConfig.BackendConnTimeout:300;
+}
+
 int isConnectorInitMode(int gun_index)
 {
 	int tempIndex = 0;

+ 1 - 0
EVSE/Modularization/ocppfiles/MessageHandler.h

@@ -579,6 +579,7 @@ void FillStartTransaction(int ConnectorId, unsigned char IdTag[], int MeterStart
 void splitstring(char *src,const char *separator,char **dest,int *num);
 int GetWebSocketPingInterval(void);
 int GetInternetConn(void);
+int GetBackendConnectionTimeout(void);
 int isConnectorInitMode(int gun_index);
 void refreshProcDogTimer();
 int GetServerSign(void);

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

@@ -462,8 +462,8 @@ void* ConnectWsServer(void* data)  //int ConnectWsServer()
 	}
 
 	ContextInfo.protocols = protocols;
-	ContextInfo.timeout_secs = GetWebSocketPingInterval();//WebSocketPingInterval;//30;//9999;//30;
-	ContextInfo.ws_ping_pong_interval = GetWebSocketPingInterval();//WebSocketPingInterval;//30;//0 for none, else interval in seconds
+	ContextInfo.timeout_secs = GetBackendConnectionTimeout();
+	ContextInfo.ws_ping_pong_interval = GetWebSocketPingInterval();
 	ContextInfo.ka_time = 20;
 	ContextInfo.keepalive_timeout = 5;
 	ContextInfo.ka_probes = 2;

+ 250 - 37
EVSE/Projects/AW-CCS/Apps/LCM/Module_LcmControl.c

@@ -2,7 +2,7 @@
  * Module_LcmControl.c
  *
  * Created on : 2020-10-20
- * Update on : 2021-02-20
+ * Update on : 2021-06-23
  * Author : Folus Wen, Eason Yang
  * Version : D0.01
  *
@@ -12,6 +12,7 @@
 #include	"define.h"
 #include	"main.h"
 #include 	"lcmComm_dgus.h"
+#include	"cbmp.h"
 
 //=======================================
 // Declare share memory
@@ -68,7 +69,6 @@ void setEthernetIcon();
 void setAlarmCodeAndIcon();
 void setBillingFromWebsite();
 
-
 //=======================================
 // Declare Timer
 //=======================================
@@ -116,7 +116,7 @@ uint8_t isCharging	= YES;
 //=======================================
 // Record version and date
 //=======================================
-char *FIRMWARE_UPDATE_IMAGE[3] = {"V0.17", "2021-04-28", "REV.01.00"};
+char *FIRMWARE_UPDATE_IMAGE[3] = {"V0.18", "2021-06-23", "REV.01.00"};
 
 
 //=======================================
@@ -893,7 +893,7 @@ float getPresentFinalCost(uint8_t gun_index)
 
 //=======================================
 // Setting billing ( BACKEND )
-//=======================================-
+//=======================================
 void setBillingFromBackend(uint8_t gun_index, uint8_t system_mode)
 {
 	if((system("pidof -s OcppBackend > /dev/null") != 0))
@@ -1563,35 +1563,50 @@ void setBatteryAnimation(uint8_t gun_index, uint8_t system_mode)
 				// SET BATTERY PERCENTAGE TEXT TO DISAPPEAR
 				setDisplayValue(TEXT_PERCENTAGE, DISAPPEAR);
 
-				// SET BATTERY ANIMATION
-				if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_5))
-				{
-					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_EMPTY);
-					BATTERY_LEVEL_STATUS = BATTERY_LEVEL_0;
-				}
-				else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY)))
-				{
-					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_20);
-					BATTERY_LEVEL_STATUS = BATTERY_LEVEL_1;
-				}
-				else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*2)))
+				if((ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON))
 				{
-					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_40);
-					BATTERY_LEVEL_STATUS = BATTERY_LEVEL_2;
-				}
-				else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_2) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*3)))
-				{
-					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_60);
-					BATTERY_LEVEL_STATUS = BATTERY_LEVEL_3;
-				}
-				else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_3) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*4)))
-				{
-					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_80);
-					BATTERY_LEVEL_STATUS = BATTERY_LEVEL_4;
+					// SET BATTERY ANIMATION
+					if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_5))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_EMPTY);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_0;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_20);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_1;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*2)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_40);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_2;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_2) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*3)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_60);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_3;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_3) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*4)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_80);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_4;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_4) &&  (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*5)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_100);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_5;
+						ftime(&startTime[gun_index][TMR_IDX_BATTERY]);
+					}
 				}
-				else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_4) &&  (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*5)))
+				else
 				{
-					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_100);
+					// SET BATTERY ICON TO EMPTY ICON
+					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_EMPTY);
+
+					// SET BATTERY PERCENTAGE TO DISAPPEAR
+					setDisplayValue(TEXT_PERCENTAGE, DISAPPEAR);
+
+					// RESET TO DEFAULT VALUE
 					BATTERY_LEVEL_STATUS = BATTERY_LEVEL_5;
 					ftime(&startTime[gun_index][TMR_IDX_BATTERY]);
 				}
@@ -1687,16 +1702,34 @@ void setConnectionAnimation(uint8_t gun_index, uint8_t system_mode)
 
 			break;
 		case SYS_MODE_CHARGING:
-			if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION)))
+
+			if((ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON))
 			{
-				setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_ELECTRIC_MARK_1);
-				CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_1;
+				if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION)))
+				{
+					setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_ELECTRIC_MARK_1);
+					CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_1;
+				}
+				else if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION*2)))
+				{
+					setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_ELECTRIC_MARK_2);
+					CONNECTION_LEVEL_STATUS =  CONNECTION_LEVEL_0;
+					ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+				}
 			}
-			else if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION*2)))
+			else
 			{
-				setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_ELECTRIC_MARK_2);
-				CONNECTION_LEVEL_STATUS =  CONNECTION_LEVEL_0;
-				ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+				if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION)))
+				{
+					setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_QUESTION_MARK_1);
+					CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_1;
+				}
+				else if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION*2)))
+				{
+					setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_QUESTION_MARK_2);
+					CONNECTION_LEVEL_STATUS =  CONNECTION_LEVEL_0;
+					ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+				}
 			}
 
 			break;
@@ -2029,6 +2062,186 @@ int InitComPort()
 	return fd;
 }
 
+//=======================================
+// Download image
+//=======================================
+int downloadBMP(uint8_t picIdx, char *filename)
+{
+	int result = PASS;
+	BMP *bmp;
+	struct stat fileSt;
+	uint32_t pageSize = 0xf0;
+	uint32_t pixelSize;
+	uint32_t transferedByte=0;
+	uint16_t bufferRamAddr = 0x8000;
+
+	// Reset LCD
+	uint8_t cmd_reset[] = {0x55, 0xaa, 0x5a, 0xa5};
+	if(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0x04, cmd_reset, ARRAY_SIZE(cmd_reset)) == FAIL)
+	{
+		DEBUG_INFO("LCD reset fail.\n");
+	}
+
+	// Get image file size
+	stat(filename, &fileSt);
+	bmp = bopen(filename);
+	uint8_t buf[bmp->width*bmp->height*2];
+
+	DEBUG_INFO("Image filename: %s\n", filename);
+	DEBUG_INFO("Image width: %d height: %d\n", bmp->width, bmp->height);
+	DEBUG_INFO("Image data size: %d\n", ARRAY_SIZE(buf));
+
+	// Get bmp pixel data and convert to 16 bit color
+	for(uint16_t idxY=0 ; idxY<bmp->height ; idxY++)
+	{
+		for(uint16_t idxX=0 ; idxX<bmp->width ; idxX++)
+		{
+			uint8_t r, g, b;
+			get_pixel_rgb(bmp, idxX, (bmp->height-idxY-1), &r, &g, &b);
+			buf[(2*((idxY*bmp->width) + idxX)) + 0] = ((((r>>3)<<11) | ((g>>2)<<5) | (b>>3)) >> 8) & 0xff;
+			buf[(2*((idxY*bmp->width) + idxX)) + 1] = ((((r>>3)<<11) | ((g>>2)<<5) | (b>>3)) >> 0) & 0xff;
+		}
+	}
+	bclose(bmp);
+
+	// Transfer pixel to screen page
+	pixelSize = ARRAY_SIZE(buf);
+	for(uint16_t idxSrcData=0;idxSrcData<(((pixelSize%pageSize)==0)?(pixelSize/pageSize):(pixelSize/pageSize)+1);idxSrcData++)
+	{
+		//DEBUG_INFO("Buffer start data address: 0x%08X\n", (idxSrcData*pageSize));
+		//DEBUG_INFO("  Image start ram address: 0x%08X\n", ((idxSrcData*pageSize) >> 1));
+		uint8_t display_cmd[] ={0x5a, (bufferRamAddr>>8)&0xff, (bufferRamAddr>>0)&0xff, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+		if((idxSrcData+1) != (((pixelSize%pageSize)==0)?(pixelSize/pageSize):(pixelSize/pageSize)+1))
+		{
+			// Data transfer
+			while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, bufferRamAddr, &buf[(idxSrcData*pageSize)], pageSize) != PASS)
+			{
+				DEBUG_INFO("Transfer data to ram 0x%04X fail.\n", transferedByte);
+			}
+			transferedByte += pageSize;
+
+			display_cmd[3] = ((pageSize>>1) >> 8) & 0xff;							// Data length high byte
+			display_cmd[4] = ((pageSize>>1) >> 0) & 0xff;							// Data length low byte
+			display_cmd[5] = (((idxSrcData*pageSize)>>1) >> 16) & 0xff;				// Screen on ram address 1st byte
+			display_cmd[6] = (((idxSrcData*pageSize)>>1) >> 8) & 0xff;				// Screen on ram address 2nd byte
+			display_cmd[7] = (((idxSrcData*pageSize)>>1) >> 0) & 0xff;				// Screen on ram address 3th byte
+		}
+		else
+		{
+			// Last data transfer
+			while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, bufferRamAddr, &buf[(idxSrcData*pageSize)], (pixelSize-(idxSrcData*pageSize))) != PASS)
+			{
+				DEBUG_INFO("Transfer data to ram 0x%04X fail.\n", transferedByte);
+			}
+			transferedByte += (pixelSize-(idxSrcData*pageSize));
+
+			display_cmd[3] = (((pixelSize-(idxSrcData*pageSize))>>1) >> 8) & 0xff;	// Data length high byte
+			display_cmd[4] = (((pixelSize-(idxSrcData*pageSize))>>1) >> 0) & 0xff;	// Data length low byte
+			display_cmd[5] = (((idxSrcData*pageSize)>>1) >> 16) & 0xff;				// Screen on ram address 1st byte
+			display_cmd[6] = (((idxSrcData*pageSize)>>1) >> 8) & 0xff;				// Screen on ram address 2nd byte
+			display_cmd[7] = (((idxSrcData*pageSize)>>1) >> 0) & 0xff;				// Screen on ram address 3th byte
+		}
+
+		// Move data from ram to flash
+		while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0xa2, display_cmd, ARRAY_SIZE(display_cmd)) != PASS)
+		{
+			DEBUG_INFO("Write data to display buffer 0x%04X fail.\n", transferedByte);
+		}
+	}
+
+	// Save image to target address
+	uint8_t save_cmd[] ={0x5a, 0x02, ((picIdx>>8)&0xff), (picIdx&0xff)};
+	while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0x84, save_cmd, ARRAY_SIZE(save_cmd)) != PASS)
+	{
+		DEBUG_INFO("Save image fail.\n");
+	}
+	DEBUG_INFO("Save image success.\n");
+
+	return result;
+}
+
+//=======================================
+// Download image
+//=======================================
+int downloadBIN(uint8_t targetAddr, char *filename)
+{
+	int result = PASS;
+	int fd;
+	struct stat fileSt;
+	uint32_t pageSize = 128;
+	uint32_t blocklSize = 32768;
+	uint32_t transferedByte=0;
+	uint16_t bufferRamAddr = 0x8000;
+
+	// Reset LCD
+	uint8_t cmd_reset[] = {0x55, 0xaa, 0x5a, 0xa5};
+	if(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0x04, cmd_reset, ARRAY_SIZE(cmd_reset)) == FAIL)
+	{
+		DEBUG_INFO("LCD reset fail.\n");
+	}
+
+	// Get image file size
+	stat(filename, &fileSt);
+	uint8_t buf[(fileSt.st_size%32768==0?fileSt.st_size/32768:(fileSt.st_size/32768)+1)*32768];
+
+	DEBUG_INFO("Bin filename: %s\n", filename);
+	DEBUG_INFO("Bin data size: %d\n", fileSt.st_size);
+
+	fd = open(filename, O_RDWR);
+	if (fd < 0)
+	{
+		DEBUG_WARN("Bin can not be open.\n");
+		result = FAIL;
+	}
+	else
+	{
+		for(uint8_t idxBinSrc=0;idxBinSrc<(fileSt.st_size%32768==0?fileSt.st_size/32768:(fileSt.st_size/32768)+1);idxBinSrc++)
+		{
+			// Read data from bin file
+			memset(buf, 0x00, ARRAY_SIZE(buf));
+			read(fd, buf, ARRAY_SIZE(buf));
+			close(fd);
+
+			// Transfer data to ram
+			for(uint16_t idxSrcData=0;idxSrcData<(((blocklSize%pageSize)==0)?(blocklSize/pageSize):(blocklSize/pageSize)+1);idxSrcData++)
+			{
+				//DEBUG_INFO("Buffer start data address: 0x%08X\n", (idxBinSrc*blocklSize)+(idxSrcData*pageSize));
+				//DEBUG_INFO("  Image start ram address: 0x%08X\n", ((idxSrcData*pageSize) >> 1));
+
+				if((idxSrcData+1) != (((blocklSize%pageSize)==0)?(blocklSize/pageSize):(blocklSize/pageSize)+1))
+				{
+					// Data transfer
+					while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, bufferRamAddr+((idxSrcData*pageSize)>>1), &buf[(idxBinSrc*blocklSize)+(idxSrcData*pageSize)], pageSize) != PASS)
+					{
+						DEBUG_INFO("Transfer data to ram 0x%04X fail.\n", transferedByte);
+					}
+					transferedByte += pageSize;
+				}
+				else
+				{
+					// Last data transfer
+					while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, bufferRamAddr+((idxSrcData*pageSize)>>1), &buf[(idxBinSrc*blocklSize)+(idxSrcData*pageSize)], (blocklSize-(idxSrcData*pageSize)))!= PASS)
+					{
+						DEBUG_INFO("Transfer data to ram 0x%04X fail.\n", transferedByte);
+					}
+					transferedByte += (blocklSize-(idxSrcData*pageSize));
+				}
+			}
+
+			// Move data from ram to flash
+			uint8_t save_cmd[] ={0x5a, 0x02, ((((targetAddr*8)+idxBinSrc)>>8)&0xff), ((((targetAddr*8)+idxBinSrc)>>0)&0xff), ((bufferRamAddr>>8)&0xff), ((bufferRamAddr>>0)&0xff), 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};
+			while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0xaa, save_cmd, ARRAY_SIZE(save_cmd)) != PASS)
+			{
+				DEBUG_INFO("Save bin file to 0x%04X fail.\n", ((targetAddr*8)+idxBinSrc));
+			}
+			DEBUG_INFO("Save bin file on 0x%04X success.\n", ((targetAddr*8)+idxBinSrc));
+		}
+	}
+
+	return result;
+}
+
 //=======================================
 // Main process
 //=======================================

+ 315 - 0
EVSE/Projects/AW-CCS/Apps/LCM/cbmp.c

@@ -0,0 +1,315 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include "cbmp.h"
+
+// Constants
+
+#define BITS_PER_BYTE 8
+
+#define BLUE 0
+#define GREEN 1
+#define RED 2
+#define ALPHA 3
+
+#define PIXEL_ARRAY_START_BYTES 4
+#define PIXEL_ARRAY_START_OFFSET 10
+
+#define WIDTH_BYTES 4
+#define WIDTH_OFFSET 18
+
+#define HEIGHT_BYTES 4
+#define HEIGHT_OFFSET 22
+
+#define DEPTH_BYTES 2
+#define DEPTH_OFFSET 28
+
+// Private function declarations
+
+void _throw_error(char* message);
+unsigned int _get_int_from_buffer(unsigned int bytes, 
+                                  unsigned int offset, 
+                                  unsigned char* buffer);
+unsigned int _get_file_byte_number(FILE* fp);
+unsigned char* _get_file_byte_contents(FILE* fp, unsigned int file_byte_number);
+int _validate_file_type(unsigned char* file_byte_contents);
+int _validate_depth(unsigned int depth);
+unsigned int _get_pixel_array_start(unsigned char* file_byte_contents);
+int _get_width(unsigned char* file_byte_contents);
+int _get_height(unsigned char* file_byte_contents);
+unsigned int _get_depth(unsigned char* file_byte_contents);
+void _update_file_byte_contents(BMP* bmp, int index, int offset, int channel);
+void _populate_pixel_array(BMP* bmp);
+void _map(BMP* bmp, void (*f)(BMP* bmp, int, int, int));
+void _get_pixel(BMP* bmp, int index, int offset, int channel);
+
+// Public function implementations
+
+BMP* bopen(char* file_path)
+{
+    FILE* fp = fopen(file_path, "rb");
+  
+    if (fp == NULL)
+    {
+        perror("Error opening file");
+        exit(EXIT_FAILURE);
+    }
+
+    BMP* bmp = (BMP*) malloc(sizeof(BMP));
+    bmp->file_byte_number = _get_file_byte_number(fp);
+    bmp->file_byte_contents = _get_file_byte_contents(fp, bmp->file_byte_number);
+    fclose(fp);
+
+    if(!_validate_file_type(bmp->file_byte_contents))
+    {
+        _throw_error("Invalid file type");
+    }
+
+    bmp->pixel_array_start = _get_pixel_array_start(bmp->file_byte_contents);
+
+    bmp->width = _get_width(bmp->file_byte_contents);
+    bmp->height = _get_height(bmp->file_byte_contents);
+    bmp->depth = _get_depth(bmp->file_byte_contents);
+
+    if(!_validate_depth(bmp->depth))
+    {
+        _throw_error("Invalid file depth");
+    }
+
+    _populate_pixel_array(bmp);
+
+    return bmp;
+}
+
+BMP* b_deep_copy(BMP* to_copy)
+{
+    BMP* copy = (BMP*) malloc(sizeof(BMP));
+    copy->file_byte_number = to_copy->file_byte_number;
+    copy->pixel_array_start = to_copy->pixel_array_start;
+    copy->width = to_copy->width;
+    copy->height = to_copy->height;
+    copy->depth = to_copy->depth;
+
+    copy->file_byte_contents = (unsigned char*) malloc(copy->file_byte_number * sizeof(unsigned char));
+
+    unsigned int i;
+    for (i = 0; i < copy->file_byte_number; i++)
+    {
+        copy->file_byte_contents[i] = to_copy->file_byte_contents[i];
+    }
+
+    copy->pixels = (pixel*) malloc(copy->width * copy->height * sizeof(pixel));
+
+    unsigned int x, y;
+    int index;
+    for (y = 0; y < copy->height; y++)
+    {
+        for (x = 0; x < copy->width; x++)
+        {
+            index = y * copy->width + x;
+            copy->pixels[index].red = to_copy->pixels[index].red;
+            copy->pixels[index].green = to_copy->pixels[index].green;
+            copy->pixels[index].blue = to_copy->pixels[index].blue;
+            copy->pixels[index].alpha = to_copy->pixels[index].alpha;
+        }
+    }
+
+    return copy;
+}
+
+int get_width(BMP* bmp)
+{
+    return bmp->width;
+}
+
+int get_height(BMP* bmp)
+{
+    return bmp->height;
+}
+
+unsigned int get_depth(BMP* bmp)
+{
+    return bmp->depth;
+}
+
+void get_pixel_rgb(BMP* bmp, int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)
+{
+    int index = y * bmp->width + x;
+    *r = bmp->pixels[index].red;
+    *g = bmp->pixels[index].green;
+    *b = bmp->pixels[index].blue;
+}
+
+void set_pixel_rgb(BMP* bmp, int x, int y, unsigned char r, unsigned char g, unsigned char b)
+{
+    int index = y * bmp->width + x;
+    bmp->pixels[index].red = r;
+    bmp->pixels[index].green = g;
+    bmp->pixels[index].blue = b;
+}
+
+void bwrite(BMP* bmp, char* file_name)
+{
+    _map(bmp, _update_file_byte_contents);
+
+    FILE* fp = fopen(file_name, "wb");
+    fwrite(bmp->file_byte_contents, sizeof(char), bmp->file_byte_number, fp);
+    fclose(fp);
+}
+
+void bclose(BMP* bmp)
+{
+    free(bmp->pixels);
+    bmp->pixels = NULL;
+    free(bmp->file_byte_contents);
+    bmp->file_byte_contents = NULL;
+    free(bmp);
+    bmp = NULL;
+}
+
+
+// Private function implementations
+
+void _throw_error(char* message)
+{
+    fprintf(stderr, "%s\n", message);
+    exit(1);
+}
+
+unsigned int _get_int_from_buffer(unsigned int bytes, 
+                                  unsigned int offset, 
+                                  unsigned char* buffer)
+{
+    unsigned char* _buffer = (unsigned char*) malloc(bytes * sizeof(unsigned char));
+
+    unsigned int i;
+    for (i = 0; i < bytes; i++)
+    {
+        _buffer[i] = buffer[i + offset];
+    }
+
+    unsigned int value = *(unsigned int*) _buffer;
+    free(_buffer);
+    return value;
+}
+
+unsigned int _get_file_byte_number(FILE* fp)
+{
+    unsigned int byte_number;
+    fseek(fp, 0, SEEK_END);
+    byte_number = ftell(fp);
+    rewind(fp);
+    return byte_number;
+}
+
+unsigned char* _get_file_byte_contents(FILE* fp, unsigned int file_byte_number)
+{
+    unsigned char* buffer = (unsigned char*) malloc(file_byte_number * sizeof(char));
+    unsigned int result = fread(buffer, 1, file_byte_number, fp);
+
+    if (result != file_byte_number)
+    {
+        _throw_error("There was a problem reading the file");
+    }
+
+
+    return buffer;
+}
+
+int _validate_file_type(unsigned char* file_byte_contents)
+{
+    return file_byte_contents[0] == 'B' && file_byte_contents[1] == 'M';
+}
+
+int _validate_depth(unsigned int depth)
+{
+    return depth == 24 || depth == 32;
+}
+
+unsigned int _get_pixel_array_start(unsigned char* file_byte_contents)
+{
+    return _get_int_from_buffer(PIXEL_ARRAY_START_BYTES, PIXEL_ARRAY_START_OFFSET, file_byte_contents);
+}
+
+int _get_width(unsigned char* file_byte_contents)
+{
+    return (int) _get_int_from_buffer(WIDTH_BYTES, WIDTH_OFFSET, file_byte_contents);
+}
+
+int _get_height(unsigned char* file_byte_contents)
+{
+    return (int) _get_int_from_buffer(HEIGHT_BYTES, HEIGHT_OFFSET, file_byte_contents);
+}
+
+unsigned int _get_depth(unsigned char* file_byte_contents)
+{
+    return _get_int_from_buffer(DEPTH_BYTES, DEPTH_OFFSET, file_byte_contents);
+}
+
+void _update_file_byte_contents(BMP* bmp, int index, int offset, int channel)
+{
+    char value;
+    switch(channel)
+    {
+        case BLUE:
+            value = bmp->pixels[index].blue;
+            break;
+        case GREEN:
+            value = bmp->pixels[index].green;
+            break;
+        case RED:
+            value = bmp->pixels[index].red;
+            break;
+        case ALPHA:
+            value = bmp->pixels[index].alpha;
+            break;
+    }
+    bmp->file_byte_contents[offset + channel] = value;
+}
+
+void _populate_pixel_array(BMP* bmp)
+{
+    bmp->pixels = (pixel*) malloc(bmp->width * bmp->height * sizeof(pixel));
+    _map(bmp, _get_pixel);
+}
+
+void _map(BMP* bmp, void (*f)(BMP*, int, int, int))
+{
+    int channels = bmp->depth / (sizeof(unsigned char) * BITS_PER_BYTE);
+    int row_size = ((int) (bmp->depth * bmp->width + 31) / 32) * 4;
+    int padding = row_size - bmp->width * channels;
+
+    int c;
+    unsigned int x, y, index, offset;
+    for (y = 0; y < bmp->height; y++)
+    {
+        for (x = 0; x < bmp->width; x++)
+        {
+            index = y * bmp->width + x;
+            offset = bmp->pixel_array_start + index * channels + y * padding;
+            for (c = 0; c < channels; c++)
+            {
+                (*f)(bmp, index, offset, c);
+            }
+        }
+    }
+}
+
+void _get_pixel(BMP* bmp, int index, int offset, int channel)
+{
+    unsigned char value = _get_int_from_buffer(sizeof(unsigned char), offset + channel, bmp->file_byte_contents);
+    switch(channel)
+    {
+        case BLUE:
+            bmp->pixels[index].blue = value;
+            break;
+        case GREEN:
+            bmp->pixels[index].green = value;
+            break;
+        case RED:
+            bmp->pixels[index].red = value;
+            break;
+        case ALPHA:
+            bmp->pixels[index].alpha = value;
+            break;
+    }
+}

+ 54 - 0
EVSE/Projects/AW-CCS/Apps/LCM/cbmp.h

@@ -0,0 +1,54 @@
+#ifndef CBMP_CBMP_H
+#define CBMP_CBMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Pixel structure
+// Not meant to be edited directly
+// Please use the API
+
+typedef struct pixel_data
+{
+    unsigned char red;
+    unsigned char green;
+    unsigned char blue;
+    unsigned char alpha;
+} pixel;
+
+// BMP structure
+// Not meant to be edited directly
+// Please use the API
+
+typedef struct BMP_data
+{
+    unsigned int file_byte_number;
+    unsigned char* file_byte_contents;
+
+    unsigned int pixel_array_start;
+
+    unsigned int width;
+    unsigned int height;
+    unsigned int depth;
+
+    pixel* pixels;
+} BMP;
+
+// Public function declarations
+
+BMP* bopen(char* file_path);
+BMP* b_deep_copy(BMP* to_copy);
+int get_width(BMP* bmp);
+int get_height(BMP* bmp);
+unsigned int get_depth(BMP* bmp);
+void get_pixel_rgb(BMP* bmp, int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);
+void set_pixel_rgb(BMP* bmp, int x, int y, unsigned char r, unsigned char g, unsigned char b);
+void bwrite(BMP* bmp, char* file_name);
+void bclose(BMP* bmp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CBMP_CBMP_H

+ 25 - 5
EVSE/Projects/AW-CCS/Apps/LCM/lcmComm_dgus.c

@@ -2,7 +2,7 @@
  * lcmComm_dgus.c
  *
  * Created on : 2020-10-20
- * Update on : 2021-02-20
+ * Update on : 2021-06-23
  * Author : Folus Wen, Eason Yang
  * Version : D0.01
  *
@@ -51,7 +51,27 @@ int transceiverDgus(int32_t fd, uint8_t *tx, uint16_t tx_len, uint8_t *rx, uint1
 	{
 		if(tx[3] == CMD_REG_WRITE_DATA)
 		{
-			result = PASS;
+			len = read(fd, rx, rx_len);
+			if(len > 0)
+			{
+				if((rx[0] == CMD_HEADER_1) && (rx[1] == CMD_HEADER_2))
+				{
+					if((rx[3] == CMD_REG_WRITE_DATA) && ((rx[4] == CMD_ACK_VALUE_1) && (rx[5] == CMD_ACK_VALUE_2)))
+					{
+						#ifdef isDebugPrint
+						displayMessageDgus(rx, len, YES);
+						#endif
+
+						result = PASS;
+					}
+					else
+					{}
+				}
+				else
+				{}
+			}
+			else
+			{}
 		}
 		else if(tx[3] == CMD_REG_READ_DATA)
 		{
@@ -62,9 +82,9 @@ int transceiverDgus(int32_t fd, uint8_t *tx, uint16_t tx_len, uint8_t *rx, uint1
 				{
 					if(rx[3] == CMD_REG_READ_DATA)
 					{
-
+						#ifdef isDebugPrint
 						displayMessageDgus(rx, len, YES);
-
+						#endif
 
 						result = PASS;
 					}
@@ -122,7 +142,7 @@ int8_t lcdRegisterWrite(int32_t fd, uint8_t regType, uint16_t address, uint8_t *
 
 	if(fd > 0)
 	{
-		if(transceiverDgus(fd, tx, ARRAY_SIZE(tx), rx, ARRAY_SIZE(rx)))
+		if(transceiverDgus(fd, tx, ARRAY_SIZE(tx), rx, ARRAY_SIZE(rx)) == PASS)
 		{
 			result = PASS;
 		}

+ 3 - 1
EVSE/Projects/AW-CCS/Apps/LCM/lcmComm_dgus.h

@@ -2,7 +2,7 @@
  * lcmComm_dwin.h
  *
  * Created on : 2020-10-20
- * Update on : 2021-02-20
+ * Update on : 2021-06-23
  * Author : Folus Wen, Eason Yang
  * Version : D0.01
  *
@@ -79,6 +79,8 @@
 #define CMD_REG_READ						0x81
 #define CMD_REG_WRITE_DATA					0x82
 #define CMD_REG_READ_DATA					0x83
+#define CMD_ACK_VALUE_1						0x4F
+#define CMD_ACK_VALUE_2						0x4B
 
 //=======================================
 // LCD system screen

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

@@ -52,7 +52,7 @@
 #define NO								0
 #define ON								1
 #define OFF								0
-#define MtdBlockSize 					0x600000
+#define MtdBlockSize 					0x300000
 
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData			*ShmStatusCodeData;
@@ -126,7 +126,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	{
 		memset(BufTmp,0,MtdBlockSize);
 		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
-		for(i=0;i<MtdBlockSize-4;i++)
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
 			Chk+=*(BufTmp+i);
 		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
 

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

@@ -230,7 +230,7 @@ void helpOutput(void)
 int main(int argc, char *argv[])
 {
 	unsigned char outType=0;
-	unsigned int i,Chk,MtdBlockSize=0x600000;
+	unsigned int i,Chk,MtdBlockSize=0x300000;
 	unsigned char *ptr;
 	int fd,wrd;
 
@@ -347,7 +347,7 @@ int main(int argc, char *argv[])
 
 	// Calculate CRC
 	Chk=0;
-	for(i=0;i<(MtdBlockSize-4);i++)
+	for(i=ARRAY_SIZE(SysConfig.CsuBootLoadFwRev);i<(MtdBlockSize-4);i++)
 	{
 		Chk+=*(ptr+i);
 	}
@@ -393,7 +393,7 @@ int main(int argc, char *argv[])
 	 * Configuration bin file generate
 	 */
 	// Save factory default setting value to file
-	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT);
+	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT|O_TRUNC);
 	if (fd < 0)
 	{
 

+ 17 - 19
EVSE/Projects/AW-CCS/Apps/main.c

@@ -39,7 +39,7 @@
 #define GPIO_OUT_RST_QCA				115
 #define GPIO_OUT_RST_ETH				89
 
-#define MtdBlockSize 					0x600000
+#define MtdBlockSize 					0x300000
 
 #define DB_FILE							"/Storage/ChargeLog/localCgargingRecord.db"
 //==========================
@@ -1782,12 +1782,15 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 		sleep(5);
 		system("reboot -f");
 	}
+
 	ChkSum=0;
-	for(wrd=0;wrd<MtdBlockSize-4;wrd++)
+	for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
 	{
 		ChkSum+=buf[wrd];
 	}
 	memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+	memcpy(&ptr->ModelName,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)),ARRAY_SIZE(ptr->ModelName));
+	memcpy(&ptr->SerialNumber,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)),ARRAY_SIZE(ptr->SerialNumber));
 
 	//================================================
 	// Load configuration from mtdblock11
@@ -1796,7 +1799,7 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 	{
 		DEBUG_ERROR("Primary SysConfigData checksum NG, read backup\n");
 		system("nanddump /dev/mtd11 -f /mnt/EvseConfig.bin");
-		fd = open("/mnt/EvseConfig", O_RDWR);
+		fd = open("/mnt/EvseConfig.bin", O_RDWR);
 		if (fd < 0)
 		{
 			free(buf);
@@ -1830,8 +1833,9 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 			sleep(5);
 			system("reboot -f");
 		}
+
 		ChkSum=0;
-		for(wrd=0;wrd<MtdBlockSize-4;wrd++)
+		for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
 		{
 			ChkSum+=buf[wrd];
 		}
@@ -1876,12 +1880,16 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 				sleep(5);
 				system("reboot -f");
 			}
+
 			ChkSum=0;
-			for(wrd=0;wrd<MtdBlockSize-4;wrd++)
+			for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
 			{
 				ChkSum+=buf[wrd];
 			}
 			memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)), &ptr->ModelName, ARRAY_SIZE(ptr->ModelName));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)), &ptr->SerialNumber, ARRAY_SIZE(ptr->SerialNumber));
+
 			if(ChkSum!=ChkSumOrg)
 			{
 				DEBUG_WARN("factory default  SysConfigData checksum NG, restore factory default\n");
@@ -3822,7 +3830,7 @@ void checkChargingProfileLimit(uint8_t gun_index)
 						  )
 						{
 							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].NumberPhases):ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
-							DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
+							//DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
 						}
 						else
 							break;
@@ -5276,7 +5284,6 @@ int main(void)
 								if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
 								{
 									setRelay(gun_index, OFF);
-									setRequest(gun_index, OFF);
 									ShmCharger->gun_info[gun_index].isChargerStopByCondition = YES;
 								}
 								else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
@@ -5291,7 +5298,6 @@ int main(void)
 								if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
 								{
 									setRelay(gun_index, OFF);
-									setRequest(gun_index, OFF);
 									ShmCharger->gun_info[gun_index].isChargerStopByCondition = YES;
 								}
 								else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
@@ -5329,7 +5335,6 @@ int main(void)
 									if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
 									{
 										setRelay(gun_index, OFF);
-										setRequest(gun_index, OFF);
 										ShmCharger->gun_info[gun_index].isChargerStopByCondition = YES;
 									}
 									else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
@@ -5344,7 +5349,6 @@ int main(void)
 									if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
 									{
 										setRelay(gun_index, OFF);
-										setRequest(gun_index, OFF);
 										ShmCharger->gun_info[gun_index].isChargerStopByCondition = YES;
 									}
 									else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
@@ -5373,12 +5377,10 @@ int main(void)
 							}
 							else
 							{
-								if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
-								{
-									setRequest(gun_index, OFF);
-								}
+								if(ShmCharger->gun_info[gun_index].primaryMcuState.relay_state > 0)
+									DEBUG_INFO("Connector-%d can not charging in off line\n", gun_index);
+
 								setRelay(gun_index, OFF);
-								DEBUG_INFO("Connector-%d can not charging in off line\n", gun_index);
 							}
 						}
 
@@ -5433,9 +5435,6 @@ int main(void)
 					   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStop == ON) ||
 					   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_STOP_MODE)))
 					{
-						if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
-							setRequest(gun_index, OFF);
-
 						setRelay(gun_index, OFF);
 						setLedMotion(gun_index, LED_ACTION_STOP);
 
@@ -5534,7 +5533,6 @@ int main(void)
 					else
 					{
 						setRelay(gun_index, OFF);
-						setRequest(gun_index, OFF);	
 					}
 
 					if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode == 0))

二进制
EVSE/Projects/AW-CCS/Images/FactoryDefaultConfig.bin


二进制
EVSE/Projects/AW-CCS/Images/ramdisk.gz


+ 2 - 2
EVSE/Projects/AW-ChargeLab/Apps/Module_ConfigTools.c

@@ -52,7 +52,7 @@
 #define NO								0
 #define ON								1
 #define OFF								0
-#define MtdBlockSize 					0x600000
+#define MtdBlockSize 					0x300000
 
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData			*ShmStatusCodeData;
@@ -126,7 +126,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	{
 		memset(BufTmp,0,MtdBlockSize);
 		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
-		for(i=0;i<MtdBlockSize-4;i++)
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
 			Chk+=*(BufTmp+i);
 		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
 

+ 7 - 19
EVSE/Projects/AW-ChargeLab/Apps/Module_FactoryConfig.c

@@ -69,22 +69,10 @@ int StoreLogMsg(const char *fmt, ...)
 	tm=localtime(&CurrentTime);
 	gettimeofday(&tv, NULL); // get microseconds, 10^-6
 
-	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
-	{
-		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
-					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
-					buffer,
-					tm->tm_year+1900,tm->tm_mon+1,
-					ShmSysConfigAndInfo->SysConfig.ModelName,
-					ShmSysConfigAndInfo->SysConfig.SerialNumber);
-	}
-	else
-	{
-		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
-					buffer,
-					tm->tm_year+1900,tm->tm_mon+1);
-	}
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
 
 #ifdef SystemLogMessage
 	system(Buf);
@@ -241,7 +229,7 @@ void helpOutput(void)
 int main(int argc, char *argv[])
 {
 	unsigned char outType=0;
-	unsigned int i,Chk,MtdBlockSize=0x600000;
+	unsigned int i,Chk,MtdBlockSize=0x300000;
 	unsigned char *ptr;
 	int fd,wrd;
 
@@ -344,7 +332,7 @@ int main(int argc, char *argv[])
 
 	// Calculate CRC
 	Chk=0;
-	for(i=0;i<(MtdBlockSize-4);i++)
+	for(i=ARRAY_SIZE(SysConfig.CsuBootLoadFwRev);i<(MtdBlockSize-4);i++)
 	{
 		Chk+=*(ptr+i);
 	}
@@ -390,7 +378,7 @@ int main(int argc, char *argv[])
 	 * Configuration bin file generate
 	 */
 	// Save factory default setting value to file
-	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT);
+	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT|O_TRUNC);
 	if (fd < 0)
 	{
 

+ 10 - 5
EVSE/Projects/AW-ChargeLab/Apps/main.c

@@ -34,7 +34,7 @@
 #define TIMEOUT_SPEC_PROFILE_PREPARE	5000
 #define TIMEOUT_SPEC_PWN_CHANGE			5000
 
-#define MtdBlockSize 					0x600000
+#define MtdBlockSize 					0x300000
 
 #define DB_FILE							"/Storage/ChargeLog/localCgargingRecord.db"
 //==========================
@@ -1485,11 +1485,13 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 		system("reboot -f");
 	}
 	ChkSum=0;
-	for(wrd=0;wrd<MtdBlockSize-4;wrd++)
+	for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
 	{
 		ChkSum+=buf[wrd];
 	}
 	memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+	memcpy(&ptr->ModelName,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)),ARRAY_SIZE(ptr->ModelName));
+	memcpy(&ptr->SerialNumber,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)),ARRAY_SIZE(ptr->SerialNumber));
 
 	//================================================
 	// Load configuration from mtdblock11
@@ -1498,7 +1500,7 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 	{
 		DEBUG_ERROR("Primary SysConfigData checksum NG, read backup\n");
 		system("nanddump /dev/mtd11 -f /mnt/EvseConfig.bin");
-		fd = open("/mnt/EvseConfig", O_RDWR);
+		fd = open("/mnt/EvseConfig.bin", O_RDWR);
 		if (fd < 0)
 		{
 			free(buf);
@@ -1533,7 +1535,7 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 			system("reboot -f");
 		}
 		ChkSum=0;
-		for(wrd=0;wrd<MtdBlockSize-4;wrd++)
+		for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
 		{
 			ChkSum+=buf[wrd];
 		}
@@ -1579,11 +1581,14 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 				system("reboot -f");
 			}
 			ChkSum=0;
-			for(wrd=0;wrd<MtdBlockSize-4;wrd++)
+			for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
 			{
 				ChkSum+=buf[wrd];
 			}
 			memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)), &ptr->ModelName, ARRAY_SIZE(ptr->ModelName));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)), &ptr->SerialNumber, ARRAY_SIZE(ptr->SerialNumber));
+
 			if(ChkSum!=ChkSumOrg)
 			{
 				DEBUG_WARN("factory default  SysConfigData checksum NG, restore factory default\n");

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

@@ -52,7 +52,7 @@
 #define NO								0
 #define ON								1
 #define OFF								0
-#define MtdBlockSize 					0x600000
+#define MtdBlockSize 					0x300000
 
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData			*ShmStatusCodeData;
@@ -126,7 +126,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	{
 		memset(BufTmp,0,MtdBlockSize);
 		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
-		for(i=0;i<MtdBlockSize-4;i++)
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
 			Chk+=*(BufTmp+i);
 		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
 

+ 7 - 19
EVSE/Projects/AW-Regular/Apps/Module_FactoryConfig.c

@@ -69,22 +69,10 @@ int StoreLogMsg(const char *fmt, ...)
 	tm=localtime(&CurrentTime);
 	gettimeofday(&tv, NULL); // get microseconds, 10^-6
 
-	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
-	{
-		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
-					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
-					buffer,
-					tm->tm_year+1900,tm->tm_mon+1,
-					ShmSysConfigAndInfo->SysConfig.ModelName,
-					ShmSysConfigAndInfo->SysConfig.SerialNumber);
-	}
-	else
-	{
-		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
-					buffer,
-					tm->tm_year+1900,tm->tm_mon+1);
-	}
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
 
 #ifdef SystemLogMessage
 	system(Buf);
@@ -241,7 +229,7 @@ void helpOutput(void)
 int main(int argc, char *argv[])
 {
 	unsigned char outType=0;
-	unsigned int i,Chk,MtdBlockSize=0x600000;
+	unsigned int i,Chk,MtdBlockSize=0x300000;
 	unsigned char *ptr;
 	int fd,wrd;
 
@@ -341,7 +329,7 @@ int main(int argc, char *argv[])
 
 	// Calculate CRC
 	Chk=0;
-	for(i=0;i<(MtdBlockSize-4);i++)
+	for(i=ARRAY_SIZE(SysConfig.CsuBootLoadFwRev);i<(MtdBlockSize-4);i++)
 	{
 		Chk+=*(ptr+i);
 	}
@@ -387,7 +375,7 @@ int main(int argc, char *argv[])
 	 * Configuration bin file generate
 	 */
 	// Save factory default setting value to file
-	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT);
+	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT|O_TRUNC);
 	if (fd < 0)
 	{
 

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

@@ -34,7 +34,7 @@
 #define TIMEOUT_SPEC_PROFILE_PREPARE	5000
 #define TIMEOUT_SPEC_PWN_CHANGE			5000
 
-#define MtdBlockSize 					0x600000
+#define MtdBlockSize 					0x300000
 
 #define DB_FILE							"/Storage/ChargeLog/localCgargingRecord.db"
 //==========================
@@ -1485,11 +1485,13 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 		system("reboot -f");
 	}
 	ChkSum=0;
-	for(wrd=0;wrd<MtdBlockSize-4;wrd++)
+	for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
 	{
 		ChkSum+=buf[wrd];
 	}
 	memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+	memcpy(&ptr->ModelName,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)),ARRAY_SIZE(ptr->ModelName));
+	memcpy(&ptr->SerialNumber,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)),ARRAY_SIZE(ptr->SerialNumber));
 
 	//================================================
 	// Load configuration from mtdblock11
@@ -1498,7 +1500,7 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 	{
 		DEBUG_ERROR("Primary SysConfigData checksum NG, read backup\n");
 		system("nanddump /dev/mtd11 -f /mnt/EvseConfig.bin");
-		fd = open("/mnt/EvseConfig", O_RDWR);
+		fd = open("/mnt/EvseConfig.bin", O_RDWR);
 		if (fd < 0)
 		{
 			free(buf);
@@ -1533,7 +1535,7 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 			system("reboot -f");
 		}
 		ChkSum=0;
-		for(wrd=0;wrd<MtdBlockSize-4;wrd++)
+		for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
 		{
 			ChkSum+=buf[wrd];
 		}
@@ -1579,11 +1581,14 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 				system("reboot -f");
 			}
 			ChkSum=0;
-			for(wrd=0;wrd<MtdBlockSize-4;wrd++)
+			for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
 			{
 				ChkSum+=buf[wrd];
 			}
 			memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)), &ptr->ModelName, ARRAY_SIZE(ptr->ModelName));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)), &ptr->SerialNumber, ARRAY_SIZE(ptr->SerialNumber));
+
 			if(ChkSum!=ChkSumOrg)
 			{
 				DEBUG_WARN("factory default  SysConfigData checksum NG, restore factory default\n");

二进制
EVSE/Projects/AW-Regular/Images/FactoryDefaultConfig.bin


二进制
EVSE/Projects/AW-Regular/Images/ramdisk.gz


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

@@ -570,6 +570,10 @@ struct ChargingInfoData
 	int 				EvBatteryStartSoc;				// 0~100%
 	unsigned char 		NormalStopChargeFlag;			// for EV board
 	ChargingStop        ChargingStopFlag;
+	char 				ReservedStartFlag;
+	float 				ConnectorMaxVoltage;			// 0~6553.5 volt
+	float 				ConnectorMaxCurrent;			// 0~6553.5 volt
+	unsigned char 		ModelType;
 };
 
 typedef union

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

@@ -570,6 +570,10 @@ struct ChargingInfoData
 	int 				EvBatteryStartSoc;				// 0~100%
 	unsigned char 		NormalStopChargeFlag;			// for EV board
 	ChargingStop        ChargingStopFlag;
+	char 				ReservedStartFlag;
+	float 				ConnectorMaxVoltage;			// 0~6553.5 volt
+	float 				ConnectorMaxCurrent;			// 0~6553.5 volt
+	unsigned char 		ModelType;
 };
 
 typedef union

二进制
EVSE/Projects/DD360Audi/Images/ramdisk.gz


二进制
EVSE/Projects/DD360Audi/output/FactoryConfig


二进制
EVSE/Projects/DD360Audi/output/Module_DoComm


二进制
EVSE/Projects/DD360Audi/output/Module_EvComm


二进制
EVSE/Projects/DD360Audi/output/Module_EventLogging


二进制
EVSE/Projects/DD360Audi/output/Module_InternalComm


二进制
EVSE/Projects/DD360Audi/output/Module_LcmControl


二进制
EVSE/Projects/DD360Audi/output/Module_PrimaryComm


二进制
EVSE/Projects/DD360Audi/output/ReadCmdline


二进制
EVSE/Projects/DD360Audi/output/main


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

@@ -570,6 +570,10 @@ struct ChargingInfoData
 	int 				EvBatteryStartSoc;				// 0~100%
 	unsigned char 		NormalStopChargeFlag;			// for EV board
 	ChargingStop        ChargingStopFlag;
+	char 				ReservedStartFlag;
+	float 				ConnectorMaxVoltage;			// 0~6553.5 volt
+	float 				ConnectorMaxCurrent;			// 0~6553.5 volt
+	unsigned char 		ModelType;
 };
 
 typedef union

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

@@ -52,7 +52,7 @@
 #define NO								0
 #define ON								1
 #define OFF								0
-#define MtdBlockSize 					0x600000
+#define MtdBlockSize 					0x300000
 
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData			*ShmStatusCodeData;
@@ -126,7 +126,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	{
 		memset(BufTmp,0,MtdBlockSize);
 		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
-		for(i=0;i<MtdBlockSize-4;i++)
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
 			Chk+=*(BufTmp+i);
 		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
 

+ 7 - 19
EVSE/Projects/Noodoe/Apps/Module_FactoryConfig.c

@@ -69,22 +69,10 @@ int StoreLogMsg(const char *fmt, ...)
 	tm=localtime(&CurrentTime);
 	gettimeofday(&tv, NULL); // get microseconds, 10^-6
 
-	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
-	{
-		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
-					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
-					buffer,
-					tm->tm_year+1900,tm->tm_mon+1,
-					ShmSysConfigAndInfo->SysConfig.ModelName,
-					ShmSysConfigAndInfo->SysConfig.SerialNumber);
-	}
-	else
-	{
-		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
-					buffer,
-					tm->tm_year+1900,tm->tm_mon+1);
-	}
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
 
 #ifdef SystemLogMessage
 	system(Buf);
@@ -241,7 +229,7 @@ void helpOutput(void)
 int main(int argc, char *argv[])
 {
 	unsigned char outType=0;
-	unsigned int i,Chk,MtdBlockSize=0x600000;
+	unsigned int i,Chk,MtdBlockSize=0x300000;
 	unsigned char *ptr;
 	int fd,wrd;
 
@@ -333,7 +321,7 @@ int main(int argc, char *argv[])
 
 	// Calculate CRC
 	Chk=0;
-	for(i=0;i<(MtdBlockSize-4);i++)
+	for(i=ARRAY_SIZE(SysConfig.CsuBootLoadFwRev);i<(MtdBlockSize-4);i++)
 	{
 		Chk+=*(ptr+i);
 	}
@@ -379,7 +367,7 @@ int main(int argc, char *argv[])
 	 * Configuration bin file generate
 	 */
 	// Save factory default setting value to file
-	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT);
+	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT|O_TRUNC);
 	if (fd < 0)
 	{
 

文件差异内容过多而无法显示
+ 750 - 100
EVSE/Projects/Noodoe/Apps/main.c


二进制
EVSE/Projects/Noodoe/Images/FactoryDefaultConfig.bin


二进制
EVSE/Projects/Noodoe/Images/ramdisk.gz


+ 4 - 0
EVSE/Projects/define.h

@@ -570,6 +570,10 @@ struct ChargingInfoData
 	int 				EvBatteryStartSoc;				// 0~100%
 	unsigned char 		NormalStopChargeFlag;			// for EV board
 	ChargingStop        ChargingStopFlag;
+	char 				ReservedStartFlag;
+	float 				ConnectorMaxVoltage;			// 0~6553.5 volt
+	float 				ConnectorMaxCurrent;			// 0~6553.5 volt
+	unsigned char 		ModelType;
 };
 
 typedef union

+ 2 - 1
EVSE/rootfs/etc/init.d/rcS

@@ -116,4 +116,5 @@ echo 3 > /proc/sys/kernel/panic
 #echo 1 > /proc/sys/kernel/panic_on_oops
 #echo 1 > /proc/sys/kernel/panic_on_warn
 #echo 1 > /proc/sys/kernel/panic_on_rcu_stall
-
+/sbin/klogd
+/sbin/syslogd -f /etc/syslog.conf

+ 6 - 0
EVSE/rootfs/etc/syslog.conf

@@ -0,0 +1,6 @@
+*.warning       /Storage/SystemLog/osWarnLog
+*.err           /Storage/SystemLog/osErrLog
+*.crit          /Storage/SystemLog/osCritLog
+*.alert         /Storage/SystemLog/osAlertLog
+*.emerg         /Storage/SystemLog/osEmergLog
+

二进制
EVSE/rootfs/sbin/mtd_debug


+ 7 - 7
EVSE/rootfs/var/www/set_charging.php

@@ -834,7 +834,7 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Connector Temperature</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['DDChargingInfo1']['ConnectorTemp'];?> ℃">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['DDChargingInfo1']['ConnectorTemp']!=255?$obj['DDChargingInfo1']['ConnectorTemp']:"not supported";?> ℃">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Present Charging Voltage</label>
@@ -906,7 +906,7 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Connector Temperature</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['DDChargingInfo2']['ConnectorTemp'];?> ℃">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['DDChargingInfo2']['ConnectorTemp']!=255?$obj['DDChargingInfo2']['ConnectorTemp']:"not supported";?> ℃">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Present Charging Voltage</label>
@@ -978,7 +978,7 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Connector Temperature</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['DDChargingInfo3']['ConnectorTemp'];?> ℃">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['DDChargingInfo3']['ConnectorTemp']!=255?$obj['DDChargingInfo3']['ConnectorTemp']:"not supported";?> ℃">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Present Charging Voltage</label>
@@ -1050,7 +1050,7 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Connector Temperature</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['DDChargingInfo4']['ConnectorTemp'];?> ℃">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['DDChargingInfo4']['ConnectorTemp']!=255?$obj['DDChargingInfo4']['ConnectorTemp']:"not supported";?> ℃">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Present Charging Voltage</label>
@@ -1128,7 +1128,7 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Connector Temperature</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['ConnectorTemp'];?> ℃">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['ConnectorTemp']!=255?$obj['ChargingInfo1']['ConnectorTemp']:"not supported";?> ℃">
 											<input type="hidden" name="ConnectorTemp1" id="ConnectorTemp1" value="<?php echo $obj['ChargingInfo1']['ConnectorTemp'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
@@ -1215,7 +1215,7 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Connector Temperature</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['ConnectorTemp'];?> ℃">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo2']['ConnectorTemp']!=255?$obj['ChargingInfo2']['ConnectorTemp']:"not supported";?> ℃">
 											<input type="hidden" name="ConnectorTemp2" id="ConnectorTemp2" value="<?php echo $obj['ChargingInfo2']['ConnectorTemp'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
@@ -1302,7 +1302,7 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Connector Temperature</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['ConnectorTemp'];?> ℃">
+											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo3']['ConnectorTemp']!=255?$obj['ChargingInfo3']['ConnectorTemp']:"not supported";?> ℃">
 											<input type="hidden" name="ConnectorTemp3" id="ConnectorTemp3" value="<?php echo $obj['ChargingInfo3']['ConnectorTemp'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">

部分文件因为文件数量过多而无法显示