Ver Fonte

2020.12.24 / Jerry Wang

Actions:
1. update CSU firmware version to V1.03.00.0000.00.
2. fixed FactoryConfig.c module name DDYC182V0UE2AD.

Files:
follow commit history.

Image version: V1.03.XX.XXXX.XX
Image checksum: XXXXXXXX
Jerry_Wang há 4 anos atrás
pai
commit
b72369da0d

+ 266 - 282
EVSE/Projects/DD360Audi/Apps/FactoryConfig.c

@@ -1,323 +1,307 @@
-#include 	<sys/time.h>
-#include 	<sys/timeb.h>
+#include    <sys/time.h>
+#include    <sys/timeb.h>
 #include    <sys/types.h>
 #include    <sys/stat.h>
-#include 	<sys/types.h>
-#include 	<sys/ioctl.h>
-#include 	<sys/socket.h>
-#include 	<sys/ipc.h>
-#include 	<sys/shm.h>
-#include 	<sys/shm.h>
-#include 	<sys/mman.h>
-#include 	<linux/can.h>
-#include 	<linux/can/raw.h>
-#include 	<linux/wireless.h>
-#include 	<arpa/inet.h>
-#include 	<netinet/in.h>
+#include    <sys/types.h>
+#include    <sys/ioctl.h>
+#include    <sys/socket.h>
+#include    <sys/ipc.h>
+#include    <sys/shm.h>
+#include    <sys/shm.h>
+#include    <sys/mman.h>
+#include    <linux/can.h>
+#include    <linux/can/raw.h>
+#include    <linux/wireless.h>
+#include    <arpa/inet.h>
+#include    <netinet/in.h>
 
-#include 	<unistd.h>
-#include 	<stdarg.h>
-#include    <stdio.h>      /*標準輸入輸出定義*/
-#include    <stdlib.h>     /*標準函數庫定義*/
-#include    <unistd.h>     /*Unix 標準函數定義*/
-#include    <fcntl.h>      /*檔控制定義*/
-#include    <termios.h>    /*PPSIX 終端控制定義*/
-#include    <errno.h>      /*錯誤號定義*/
-#include 	<errno.h>
-#include 	<string.h>
-#include	<time.h>
-#include	<ctype.h>
-#include 	<ifaddrs.h>
-#include	"../../define.h"
-#include 	"Config.h"
+#include    <unistd.h>
+#include    <stdarg.h>
+#include    <stdio.h>      /*璅蹱�頛詨�頛詨枂摰𡁶儔*/
+#include    <stdlib.h>     /*璅蹱��賣彍摨怠�蝢�*/
+#include    <unistd.h>     /*Unix 璅蹱��賣彍摰𡁶儔*/
+#include    <fcntl.h>      /*瑼娍綉�嗅�蝢�*/
+#include    <termios.h>    /*PPSIX 蝯�垢�批�摰𡁶儔*/
+#include    <errno.h>      /*�航炊�笔�蝢�*/
+#include    <errno.h>
+#include    <string.h>
+#include    <time.h>
+#include    <ctype.h>
+#include    <ifaddrs.h>
+#include    "../../define.h"
+#include    "Config.h"
 
 #define Debug
-#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
-#define PASS				1
-#define FAIL				-1
-#define OUTPUT_FLASH		0x01
-#define OUTPUT_FILE			0x02
+#define ARRAY_SIZE(A)       (sizeof(A) / sizeof(A[0]))
+#define PASS                1
+#define FAIL                -1
+#define OUTPUT_FLASH        0x01
+#define OUTPUT_FILE         0x02
 
-struct SysConfigData 			SysConfig;
+struct SysConfigData            SysConfig;
 
 int StoreLogMsg(const char *fmt, ...);
 
 int StoreLogMsg(const char *fmt, ...)
 {
-	char Buf[4096+256];
-	char buffer[4096];
-	va_list args;
-	struct timeb  SeqEndTime;
-	struct tm *tm;
+    char Buf[4096 + 256];
+    char buffer[4096];
+    va_list args;
+    struct timeb  SeqEndTime;
+    struct tm *tm;
 
-	va_start(args, fmt);
-	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
-	va_end(args);
+    va_start(args, fmt);
+    int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+    va_end(args);
 
-	memset(Buf,0,sizeof(Buf));
-	ftime(&SeqEndTime);
-	SeqEndTime.time = time(NULL);
-	tm=localtime(&SeqEndTime.time);
+    memset(Buf, 0, sizeof(Buf));
+    ftime(&SeqEndTime);
+    SeqEndTime.time = time(NULL);
+    tm = localtime(&SeqEndTime.time);
 
-	sprintf(Buf,"echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %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,SeqEndTime.millitm,
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1);
-	system(Buf);
+    sprintf(Buf, "echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %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, SeqEndTime.millitm,
+            buffer,
+            tm->tm_year + 1900, tm->tm_mon + 1);
+    system(Buf);
 
-	return rc;
+    return rc;
 }
 
 void helpOutput(void)
 {
-	printf("Usage: Module_FactoryConfig [OPTION]...\r\n\r\n");
-	printf("Generate factory default configuration value\r\n\r\n");
-	printf("OPTION:\r\n");
-	printf("	-a Write to file(/mnt) & flash\r\n");
-	printf("	-f Write to file(/mnt)\r\n");
-	printf("	-m Write to flash\r\n");
+    printf("Usage: Module_FactoryConfig [OPTION]...\r\n\r\n");
+    printf("Generate factory default configuration value\r\n\r\n");
+    printf("OPTION:\r\n");
+    printf("	-a Write to file(/mnt) & flash\r\n");
+    printf("	-f Write to file(/mnt)\r\n");
+    printf("	-m Write to flash\r\n");
 }
 
 /**************************************************************************************/
 /************This task will create Factory default confgiuration file *****************/
- /***********and store it into mtdblock 10,11,12                               ****************/
+/***********and store it into mtdblock 10,11,12                               ****************/
 /**************************************************************************************/
-int main(int argc,char *argv[])
+int main(int argc, char *argv[])
 {
-	unsigned char outType=0;
-	unsigned int i,Chk, MtdBlockSize=0x600000;
-	unsigned char *ptr;
-	int fd,wrd;
+    unsigned char outType = 0;
+    unsigned int i, Chk, MtdBlockSize = 0x600000;
+    unsigned char *ptr;
+    int fd, wrd;
 
-	ptr=malloc(MtdBlockSize);
-	if(ptr==NULL)
-	{
-		#ifdef SystemLogMessage
-		StoreLogMsg("[FactoryConfig]main: malloc for SysConfigData NG");
-		#endif
-		return 0;
-	}
-	memset(ptr, 0, MtdBlockSize);
-	memset(&SysConfig, 0, sizeof(struct SysConfigData));
+    ptr = malloc(MtdBlockSize);
+    if (ptr == NULL) {
+#ifdef SystemLogMessage
+        StoreLogMsg("[FactoryConfig]main: malloc for SysConfigData NG");
+#endif
+        return 0;
+    }
+    memset(ptr, 0, MtdBlockSize);
+    memset(&SysConfig, 0, sizeof(struct SysConfigData));
 
-	/*
-	 * TODO: Set factory default configuration
-	*/
-	//********** System **********// udhcpc -i eth1 -s ./dhcp_script/eth1.script
-	//
-	strcpy((char *)SysConfig.ModelName, "DDYE182V0UD2AU");
-	strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
+    /*
+     * TODO: Set factory default configuration
+    */
+    //********** System **********// udhcpc -i eth1 -s ./dhcp_script/eth1.script
+    //
+    strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
+    strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
 
-	memset(SysConfig.SystemId, 0x00, sizeof(SysConfig.SystemId));
-	char Dash = '-';
+    memset(SysConfig.SystemId, 0x00, sizeof(SysConfig.SystemId));
+    char Dash = '-';
 
-	strcat((char *)SysConfig.SystemId, (char *)SysConfig.ModelName);
-	strncat((char *)SysConfig.SystemId, &Dash, 1);
-	strcat((char *)SysConfig.SystemId, (char *)SysConfig.SerialNumber);
+    strcat((char *)SysConfig.SystemId, (char *)SysConfig.ModelName);
+    strncat((char *)SysConfig.SystemId, &Dash, 1);
+    strcat((char *)SysConfig.SystemId, (char *)SysConfig.SerialNumber);
 
-	strcpy((char *)SysConfig.SystemDateTime, "");
-	SysConfig.AuthorisationMode = AUTH_MODE_ENABLE;
-	SysConfig.DefaultLanguage = 0;
-	SysConfig.RfidCardNumEndian = 0;
-	SysConfig.AcPlugInTimes = 0;
-	SysConfig.GbPlugInTimes = 0;
-	SysConfig.Ccs1PlugInTime = 0;
-	SysConfig.Ccs2PlugInTimes = 0;
-	SysConfig.ChademoPlugInTimes = 0;
-	SysConfig.BillingData.isBilling = 0;
-	SysConfig.isAPP = 1;
-	SysConfig.isQRCode = 1;
-	SysConfig.isRFID = 1;
-	//********** Charging **********//
-	SysConfig.MaxChargingEnergy = 0;
-	SysConfig.MaxChargingCurrent = 500;		// 最大可輸出電流 (整樁)
-	SysConfig.MaxChargingDuration = 0;
-	SysConfig.AcMaxChargingCurrent = 0;
-	SysConfig.PhaseLossPolicy = 0;
-	/*+++ 20200908, vern, modify it +++*/
-	/*for(unsigned char i = 0; i < 10; i++)
-		strcpy((char *)SysConfig.LocalWhiteCard, "");*/
-	memset(SysConfig.LocalWhiteCard,0,sizeof(SysConfig.LocalWhiteCard));	
-	/*--- 20200908, vern, modify it ---*/
-	strcpy((char *)SysConfig.UserId, "");
-	//********** Network **********//
-	strcpy((char *)SysConfig.FtpServer, "");
-	SysConfig.Eth0Interface.EthDhcpClient = 0;
-	strcpy((char *) SysConfig.Eth0Interface.EthIpAddress, "192.168.1.10");
-	strcpy((char *) SysConfig.Eth0Interface.EthSubmaskAddress, "255.255.255.0");
-	strcpy((char *) SysConfig.Eth0Interface.EthGatewayAddress, "192.168.1.254");
-	SysConfig.Eth1Interface.EthDhcpClient = 0;
-	strcpy((char *) SysConfig.Eth1Interface.EthIpAddress, "192.168.0.10");
-	strcpy((char *) SysConfig.Eth1Interface.EthSubmaskAddress, "255.255.255.0");
-	strcpy((char *) SysConfig.Eth1Interface.EthGatewayAddress, "192.168.0.254");
-	if(SysConfig.ModelName[10] == 'W')
-		SysConfig.AthInterface.WifiMode = 2;
-	else
-		SysConfig.AthInterface.WifiMode = 0;
-	strcpy((char *) SysConfig.AthInterface.WifiSsid, "");
-	strcpy((char *) SysConfig.AthInterface.WifiPassword, "");
-	SysConfig.AthInterface.WifiRssi = 0;
-	SysConfig.AthInterface.WifiDhcpServer = 0;
-	SysConfig.AthInterface.WifiDhcpClient = 0;
-	strcpy((char *) SysConfig.AthInterface.WifiMacAddress, "");
-	strcpy((char *) SysConfig.AthInterface.WifiIpAddress, "");
-	strcpy((char *) SysConfig.AthInterface.WifiSubmaskAddress, "");
-	strcpy((char *) SysConfig.AthInterface.WifiGatewayAddress, "");
-	SysConfig.AthInterface.WifiNetworkConn = 0;
-	strcpy((char *) SysConfig.TelecomInterface.TelcomModelName, "");
-	strcpy((char *) SysConfig.TelecomInterface.TelcomSoftwareVer, "");
-	//strcpy((char *) SysConfig.TelecomInterface.TelcomApn, "Internet");
-	strcpy((char *) SysConfig.TelecomInterface.TelcomApn, "");
-	SysConfig.TelecomInterface.TelcomRssi = 0;
-	strcpy((char *) SysConfig.TelecomInterface.TelcomChapPapId, " ");
-	strcpy((char *) SysConfig.TelecomInterface.TelcomChapPapPwd, " ");
-	strcpy((char *) SysConfig.TelecomInterface.TelcomModemImei, "");
-	strcpy((char *) SysConfig.TelecomInterface.TelcomSimImsi, "");
-	strcpy((char *) SysConfig.TelecomInterface.TelcomSimIccid, "");
-	SysConfig.TelecomInterface.TelcomSimStatus = 0;
-	SysConfig.TelecomInterface.TelcomModemMode = 0;
-	strcpy((char *) SysConfig.TelecomInterface.TelcomIpAddress, "");
-	SysConfig.TelecomInterface.TelcomNetworkConn = 0;
-	strcpy((char *)SysConfig.chargePointVendor, "Phihong Technology");
-	//********** Backend **********//
-	SysConfig.BackendConnTimeout = 300; //300 seconds
-	SysConfig.OfflinePolicy = 2;
-	SysConfig.OfflineMaxChargeEnergy = 0;
-	SysConfig.OfflineMaxChargeDuration = 0;
-	strcpy((char *) SysConfig.OcppServerURL, "");
-	strcpy((char *) SysConfig.ChargeBoxId, "");
-	SysConfig.LedInfo.Intensity = 2;
+    strcpy((char *)SysConfig.SystemDateTime, "");
+    SysConfig.AuthorisationMode = AUTH_MODE_ENABLE;
+    SysConfig.DefaultLanguage = 0;
+    SysConfig.RfidCardNumEndian = 0;
+    SysConfig.AcPlugInTimes = 0;
+    SysConfig.GbPlugInTimes = 0;
+    SysConfig.Ccs1PlugInTime = 0;
+    SysConfig.Ccs2PlugInTimes = 0;
+    SysConfig.ChademoPlugInTimes = 0;
+    SysConfig.BillingData.isBilling = 0;
+    SysConfig.isAPP = 1;
+    SysConfig.isQRCode = 1;
+    SysConfig.isRFID = 1;
+    //********** Charging **********//
+    SysConfig.MaxChargingEnergy = 0;
+    SysConfig.MaxChargingCurrent = 500;     // ��憭批虾頛詨枂�餅� (�湔�)
+    SysConfig.MaxChargingDuration = 0;
+    SysConfig.AcMaxChargingCurrent = 0;
+    SysConfig.PhaseLossPolicy = 0;
+    /*+++ 20200908, vern, modify it +++*/
+    /*for(unsigned char i = 0; i < 10; i++)
+        strcpy((char *)SysConfig.LocalWhiteCard, "");*/
+    memset(SysConfig.LocalWhiteCard, 0, sizeof(SysConfig.LocalWhiteCard));
+    /*--- 20200908, vern, modify it ---*/
+    strcpy((char *)SysConfig.UserId, "");
+    //********** Network **********//
+    strcpy((char *)SysConfig.FtpServer, "");
+    SysConfig.Eth0Interface.EthDhcpClient = 0;
+    strcpy((char *) SysConfig.Eth0Interface.EthIpAddress, "192.168.1.10");
+    strcpy((char *) SysConfig.Eth0Interface.EthSubmaskAddress, "255.255.255.0");
+    strcpy((char *) SysConfig.Eth0Interface.EthGatewayAddress, "192.168.1.254");
+    SysConfig.Eth1Interface.EthDhcpClient = 0;
+    strcpy((char *) SysConfig.Eth1Interface.EthIpAddress, "192.168.0.10");
+    strcpy((char *) SysConfig.Eth1Interface.EthSubmaskAddress, "255.255.255.0");
+    strcpy((char *) SysConfig.Eth1Interface.EthGatewayAddress, "192.168.0.254");
+    if (SysConfig.ModelName[10] == 'W') {
+        SysConfig.AthInterface.WifiMode = 2;
+    } else {
+        SysConfig.AthInterface.WifiMode = 0;
+    }
+    strcpy((char *) SysConfig.AthInterface.WifiSsid, "");
+    strcpy((char *) SysConfig.AthInterface.WifiPassword, "");
+    SysConfig.AthInterface.WifiRssi = 0;
+    SysConfig.AthInterface.WifiDhcpServer = 0;
+    SysConfig.AthInterface.WifiDhcpClient = 0;
+    strcpy((char *) SysConfig.AthInterface.WifiMacAddress, "");
+    strcpy((char *) SysConfig.AthInterface.WifiIpAddress, "");
+    strcpy((char *) SysConfig.AthInterface.WifiSubmaskAddress, "");
+    strcpy((char *) SysConfig.AthInterface.WifiGatewayAddress, "");
+    SysConfig.AthInterface.WifiNetworkConn = 0;
+    strcpy((char *) SysConfig.TelecomInterface.TelcomModelName, "");
+    strcpy((char *) SysConfig.TelecomInterface.TelcomSoftwareVer, "");
+    //strcpy((char *) SysConfig.TelecomInterface.TelcomApn, "Internet");
+    strcpy((char *) SysConfig.TelecomInterface.TelcomApn, "");
+    SysConfig.TelecomInterface.TelcomRssi = 0;
+    strcpy((char *) SysConfig.TelecomInterface.TelcomChapPapId, " ");
+    strcpy((char *) SysConfig.TelecomInterface.TelcomChapPapPwd, " ");
+    strcpy((char *) SysConfig.TelecomInterface.TelcomModemImei, "");
+    strcpy((char *) SysConfig.TelecomInterface.TelcomSimImsi, "");
+    strcpy((char *) SysConfig.TelecomInterface.TelcomSimIccid, "");
+    SysConfig.TelecomInterface.TelcomSimStatus = 0;
+    SysConfig.TelecomInterface.TelcomModemMode = 0;
+    strcpy((char *) SysConfig.TelecomInterface.TelcomIpAddress, "");
+    SysConfig.TelecomInterface.TelcomNetworkConn = 0;
+    strcpy((char *)SysConfig.chargePointVendor, "Phihong Technology");
+    //********** Backend **********//
+    SysConfig.BackendConnTimeout = 300; //300 seconds
+    SysConfig.OfflinePolicy = 2;
+    SysConfig.OfflineMaxChargeEnergy = 0;
+    SysConfig.OfflineMaxChargeDuration = 0;
+    strcpy((char *) SysConfig.OcppServerURL, "");
+    strcpy((char *) SysConfig.ChargeBoxId, "");
+    SysConfig.LedInfo.Intensity = 2;
 
-	//copy default configuration to pointer
-	memcpy(ptr,&SysConfig,sizeof(struct SysConfigData));
+    //copy default configuration to pointer
+    memcpy(ptr, &SysConfig, sizeof(struct SysConfigData));
 
-	//calculate CRC
-	Chk=0;
-	for(i=0;i<(MtdBlockSize-4);i++)
-	{
-		Chk+=*(ptr+i);
-	}
-	memcpy(	ptr+MtdBlockSize-4,&Chk,4);
+    //calculate CRC
+    Chk = 0;
+    for (i = 0; i < (MtdBlockSize - 4); i++) {
+        Chk += *(ptr + i);
+    }
+    memcpy( ptr + MtdBlockSize - 4, &Chk, 4);
 
-	/*
-	* Parameter process
-	*/
-	if (argc > 1)
-	{
-		char *arg = argv[1];
-		switch (arg[0])
-		{
-		case '-':
-			switch (arg[1])
-			{
-				case 'a':
-					outType |= OUTPUT_FILE;
-					outType |= OUTPUT_FLASH;
-					break;
-				case 'f':
-					outType |= OUTPUT_FILE;
-					break;
-				case 'm':
-					outType |= OUTPUT_FLASH;
-					break;
-				default:
-					helpOutput();
-					break;
-			}
-				break;
-			default:
-				helpOutput();
-				break;
-		}
-	}
-	else
-	{
-		helpOutput();
-	}
+    /*
+    * Parameter process
+    */
+    if (argc > 1) {
+        char *arg = argv[1];
+        switch (arg[0]) {
+        case '-':
+            switch (arg[1]) {
+            case 'a':
+                outType |= OUTPUT_FILE;
+                outType |= OUTPUT_FLASH;
+                break;
+            case 'f':
+                outType |= OUTPUT_FILE;
+                break;
+            case 'm':
+                outType |= OUTPUT_FLASH;
+                break;
+            default:
+                helpOutput();
+                break;
+            }
+            break;
+        default:
+            helpOutput();
+            break;
+        }
+    } else {
+        helpOutput();
+    }
 
-	/*
-	 * Configuration bin file generate
-	*/
-	if((outType&OUTPUT_FILE)>0)
-	{
-		fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR | O_CREAT);
-		if (fd < 0)
-		{
-			StoreLogMsg("[FactoryConfig]main: open /mnt/FactoryDefaultConfig.bin NG");
-			free(ptr);
-			return 0;
-		}
-		wrd=write(fd, ptr, MtdBlockSize);
-		close(fd);
-		if(wrd<MtdBlockSize)
-		{
-			StoreLogMsg("write /mnt/FactoryDefaultConfig.bin NG\r\n");
-			free(ptr);
-			return 0;
-		}
-		StoreLogMsg("FactoryConfig write to file in /mnt OK.\r\n");
-	}
+    /*
+     * Configuration bin file generate
+    */
+    if ((outType & OUTPUT_FILE) > 0) {
+        fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR | O_CREAT);
+        if (fd < 0) {
+            StoreLogMsg("[FactoryConfig]main: open /mnt/FactoryDefaultConfig.bin NG");
+            free(ptr);
+            return 0;
+        }
+        wrd = write(fd, ptr, MtdBlockSize);
+        close(fd);
+        if (wrd < MtdBlockSize) {
+            StoreLogMsg("write /mnt/FactoryDefaultConfig.bin NG\r\n");
+            free(ptr);
+            return 0;
+        }
+        StoreLogMsg("FactoryConfig write to file in /mnt OK.\r\n");
+    }
 
-	/*
-	* Flash memory write
-	*/
-	if((outType&OUTPUT_FLASH)>0)
-	{
-		// Save factory default setting value to flash factory default setting block
-		fd = open("/dev/mtdblock12", O_RDWR);
-		if (fd < 0)
-		{
-			StoreLogMsg("open /dev/mtdblock12 NG\r\n");
-			free(ptr);
-			return 0;
-		}
-		wrd=write(fd, ptr, MtdBlockSize);
-		close(fd);
-		if(wrd<MtdBlockSize)
-		{
-			StoreLogMsg("write /dev/mtdblock12 NG\r\n");
-			free(ptr);
-			return 0;
-		}
+    /*
+    * Flash memory write
+    */
+    if ((outType & OUTPUT_FLASH) > 0) {
+        // Save factory default setting value to flash factory default setting block
+        fd = open("/dev/mtdblock12", O_RDWR);
+        if (fd < 0) {
+            StoreLogMsg("open /dev/mtdblock12 NG\r\n");
+            free(ptr);
+            return 0;
+        }
+        wrd = write(fd, ptr, MtdBlockSize);
+        close(fd);
+        if (wrd < MtdBlockSize) {
+            StoreLogMsg("write /dev/mtdblock12 NG\r\n");
+            free(ptr);
+            return 0;
+        }
 
-		// Save factory default setting value to flash backup setting block
-		fd = open("/dev/mtdblock11", O_RDWR);
-		if (fd < 0)
-		{
-			StoreLogMsg("open /dev/mtdblock11 NG\r\n");
-			free(ptr);
-			return 0;
-		}
-		wrd=write(fd, ptr, MtdBlockSize);
-		close(fd);
-		if(wrd<MtdBlockSize)
-		{
-			StoreLogMsg("write /dev/mtdblock11 NG\r\n");
-			free(ptr);
-			return 0;
-		}
+        // Save factory default setting value to flash backup setting block
+        fd = open("/dev/mtdblock11", O_RDWR);
+        if (fd < 0) {
+            StoreLogMsg("open /dev/mtdblock11 NG\r\n");
+            free(ptr);
+            return 0;
+        }
+        wrd = write(fd, ptr, MtdBlockSize);
+        close(fd);
+        if (wrd < MtdBlockSize) {
+            StoreLogMsg("write /dev/mtdblock11 NG\r\n");
+            free(ptr);
+            return 0;
+        }
 
-		// Save factory default setting value to flash setting block
-		fd = open("/dev/mtdblock10", O_RDWR);
-		if (fd < 0)
-		{
-			StoreLogMsg("open /dev/mtdblock10 NG\r\n");
-			free(ptr);
-			return 0;
-		}
-		wrd=write(fd, ptr, MtdBlockSize);
-		close(fd);
-		if(wrd<MtdBlockSize)
-		{
-			StoreLogMsg("write /dev/mtdblock10 NG\r\n");
-			free(ptr);
-			return 0;
-		}
-		StoreLogMsg("FactoryConfig write to flash OK\r\n");
-	}
+        // Save factory default setting value to flash setting block
+        fd = open("/dev/mtdblock10", O_RDWR);
+        if (fd < 0) {
+            StoreLogMsg("open /dev/mtdblock10 NG\r\n");
+            free(ptr);
+            return 0;
+        }
+        wrd = write(fd, ptr, MtdBlockSize);
+        close(fd);
+        if (wrd < MtdBlockSize) {
+            StoreLogMsg("write /dev/mtdblock10 NG\r\n");
+            free(ptr);
+            return 0;
+        }
+        StoreLogMsg("FactoryConfig write to flash OK\r\n");
+    }
 
-	free(ptr);
+    free(ptr);
 
-	return FAIL;
+    return FAIL;
 }
 

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

@@ -1635,6 +1635,7 @@ void CheckOutputPowerOverCarReq(byte index)
             (_chargingData[index]->Type == _Type_Chademo ||
              _chargingData[index]->Type == _Type_CCS_2 ||
              _chargingData[index]->Type == _Type_GB)) {
+        printf("fireV = %.2f, %.2f\r\n", fireV, (carV + (carV * 0.1)));
         if (fireV >= (carV + (carV * 0.1))) {
             PRINTF_FUNC("[Module_InternalComm]CheckOutputPowerOverCarReq NG : fire = %f, battery = %f \n",
                         _chargingData[index]->FireChargingVoltage, (_chargingData[index]->EvBatterytargetVoltage * 10));

BIN
EVSE/Projects/DD360Audi/Apps/Module_PsuComm


+ 251 - 283
EVSE/Projects/DD360Audi/Apps/OutputTask.c

@@ -1,150 +1,134 @@
 /*
  * OutputTask.c
  *
- *  Created on: 2020¦~2¤ë25¤é
+ *  Created on: 2020年2月25日
  *      Author: 7564
  */
 
-#include 	"OutputTask.h"
+#include    "OutputTask.h"
 
 bool isOpen;
 
 int InitComPort()
 {
-	int fd;
-	struct termios tios;
-
-	fd = open(priPortName, O_RDWR);
-	if(fd<=0)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("open 407 Communication port NG \n");
-		#endif
-		return -1;
-	}
-	ioctl (fd, TCGETS, &tios);
-	tios.c_cflag = B115200| CS8 | CLOCAL | CREAD;
-	tios.c_lflag = 0;
-	tios.c_iflag = 0;
-	tios.c_oflag = 0;
-	tios.c_cc[VMIN]=0;
-	tios.c_cc[VTIME]=(unsigned char)1;
-	tios.c_lflag=0;
-	tcflush(fd, TCIFLUSH);
-	ioctl (fd, TCSETS, &tios);
-
-	return fd;
+    int fd;
+    struct termios tios;
+
+    fd = open(priPortName, O_RDWR);
+    if (fd <= 0) {
+#ifdef SystemLogMessage
+        DEBUG_ERROR("open 407 Communication port NG \n");
+#endif
+        return -1;
+    }
+    ioctl (fd, TCGETS, &tios);
+    tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
+    tios.c_lflag = 0;
+    tios.c_iflag = 0;
+    tios.c_oflag = 0;
+    tios.c_cc[VMIN] = 0;
+    tios.c_cc[VTIME] = (unsigned char)1;
+    tios.c_lflag = 0;
+    tcflush(fd, TCIFLUSH);
+    ioctl (fd, TCSETS, &tios);
+
+    return fd;
 }
 
 unsigned long GetTimeoutValue(struct timeval _sour_time)
 {
-	struct timeval _end_time;
-	gettimeofday(&_end_time, NULL);
+    struct timeval _end_time;
+    gettimeofday(&_end_time, NULL);
 
-	return 1000000 * (_end_time.tv_sec - _sour_time.tv_sec) + _end_time.tv_usec - _sour_time.tv_usec;
+    return 1000000 * (_end_time.tv_sec - _sour_time.tv_sec) + _end_time.tv_usec - _sour_time.tv_usec;
 }
 
 void ShowMainMsg()
 {
-	printf("Max Vol : %f, Max Cur : %d, POW : %d \n", UnSafeDataInfo->PSU_VOLTAGE,
-			UnSafeDataInfo->PSU_CURRENT, UnSafeDataInfo->PSU_POWER);
-	printf("=> ");
+    printf("Max Vol : %f, Max Cur : %d, POW : %d \n", UnSafeDataInfo->PSU_VOLTAGE,
+           UnSafeDataInfo->PSU_CURRENT, UnSafeDataInfo->PSU_POWER);
+    printf("=> ");
 }
 
 void ChkButtonStatus()
 {
-	if (Button1 == PRESS && !leftBtnPush)
-	{
-		if(!leftBtnPush)
-		{
-			leftBtnPush = true;
-			if (_charging_mode == CHARGING_MODE_STOP)
-			{
-				_charging_mode = CHARGING_MODE_START;
-				printf("****************** Switch to Charging Mode ******************\n");
-			}
-		}
-		else if (Button1 == RELEASE)
-		{
-			if(leftBtnPush)
-			{
-				leftBtnPush = false;
-			}
-		}
-	}
-
-	if (Button2 == PRESS && !rightBtnPush)
-	{
-		if(!rightBtnPush)
-		{
-			rightBtnPush = true;
-			if (_charging_mode == CHARGING_MODE_START)
-			{
-				_charging_mode = CHARGING_MODE_TERMINATING;
-				printf("****************** Switch to Stop Mode ******************\n");
-			}
-		}
-		else if (Button2 == RELEASE)
-		{
-			if(rightBtnPush)
-			{
-				rightBtnPush = false;
-			}
-		}
-	}
+    if (Button1 == PRESS && !leftBtnPush) {
+        if (!leftBtnPush) {
+            leftBtnPush = true;
+            if (_charging_mode == CHARGING_MODE_STOP) {
+                _charging_mode = CHARGING_MODE_START;
+                printf("****************** Switch to Charging Mode ******************\n");
+            }
+        } else if (Button1 == RELEASE) {
+            if (leftBtnPush) {
+                leftBtnPush = false;
+            }
+        }
+    }
+
+    if (Button2 == PRESS && !rightBtnPush) {
+        if (!rightBtnPush) {
+            rightBtnPush = true;
+            if (_charging_mode == CHARGING_MODE_START) {
+                _charging_mode = CHARGING_MODE_TERMINATING;
+                printf("****************** Switch to Stop Mode ******************\n");
+            }
+        } else if (Button2 == RELEASE) {
+            if (rightBtnPush) {
+                rightBtnPush = false;
+            }
+        }
+    }
 }
 
 void GetModuleCountCallback(byte group, byte count)
 {
-	printf("group = %d, count = %d \n", group, count);
-	if (group == SYSTEM_CMD)
-		UnSafeDataInfo->PSU_COUNT = count;
+    printf("group = %d, count = %d \n", group, count);
+    if (group == SYSTEM_CMD) {
+        UnSafeDataInfo->PSU_COUNT = count;
+    }
 }
 
 void GetAvailableCapCallback(byte address, short maxVol, short minVol, short maxCur, short totalPow)
 {
-	int _groupPower = 0, _groupCurrent = 0;
+    int _groupPower = 0, _groupCurrent = 0;
 
-	UnSafeDataInfo->PsuModule[address].PSU_VOLTAGE_INFO = maxVol;
-	UnSafeDataInfo->PsuModule[address].PSU_CURRENT_INFO = maxCur;
-	UnSafeDataInfo->PsuModule[address].PSU_POWER_INFO = totalPow;
+    UnSafeDataInfo->PsuModule[address].PSU_VOLTAGE_INFO = maxVol;
+    UnSafeDataInfo->PsuModule[address].PSU_CURRENT_INFO = maxCur;
+    UnSafeDataInfo->PsuModule[address].PSU_POWER_INFO = totalPow;
 
-	for (byte index = 0; index < UnSafeDataInfo->PSU_COUNT; index++)
-	{
-		_groupCurrent += UnSafeDataInfo->PsuModule[address].PSU_CURRENT_INFO;
-		_groupPower += UnSafeDataInfo->PsuModule[address].PSU_POWER_INFO;
-	}
+    for (byte index = 0; index < UnSafeDataInfo->PSU_COUNT; index++) {
+        _groupCurrent += UnSafeDataInfo->PsuModule[address].PSU_CURRENT_INFO;
+        _groupPower += UnSafeDataInfo->PsuModule[address].PSU_POWER_INFO;
+    }
 
-	UnSafeDataInfo->PSU_VOLTAGE = maxVol;
-	UnSafeDataInfo->PSU_CURRENT = _groupCurrent;
-	UnSafeDataInfo->PSU_POWER = _groupPower;
+    UnSafeDataInfo->PSU_VOLTAGE = maxVol;
+    UnSafeDataInfo->PSU_CURRENT = _groupCurrent;
+    UnSafeDataInfo->PSU_POWER = _groupPower;
 }
 
 void GetStatusCallback(byte group, byte address, byte temp, int alarm)
 {
-	printf("alarm = %d \n", alarm);
+    printf("alarm = %d \n", alarm);
 }
 
 void GetInputVoltageCallback(byte address, unsigned short vol1, unsigned short vol2, unsigned short vol3)
 {
-	printf("vol1 = %d, vol2 = %d, vol3 = %d \n", vol1, vol2, vol3);
+    printf("vol1 = %d, vol2 = %d, vol3 = %d \n", vol1, vol2, vol3);
 }
 
 int CreateShareMemory()
 {
-	int MeterSMId;
-
-	if ((MeterSMId = shmget(ShmTestKey,	sizeof(struct UnSafeData), IPC_CREAT | 0777)) < 0)
-	{
-		return 0;
-	}
-	else if ((UnSafeDataInfo = shmat(MeterSMId, NULL, 0))	== (void *) -1)
-	{
-		return 0;
-	}
-	memset(UnSafeDataInfo, 0, sizeof(struct UnSafeData));
-
-	return 1;
+    int MeterSMId;
+
+    if ((MeterSMId = shmget(ShmTestKey, sizeof(struct UnSafeData), IPC_CREAT | 0777)) < 0) {
+        return 0;
+    } else if ((UnSafeDataInfo = shmat(MeterSMId, NULL, 0))   == (void *) - 1) {
+        return 0;
+    }
+    memset(UnSafeDataInfo, 0, sizeof(struct UnSafeData));
+
+    return 1;
 }
 
 static void get_char(char *word)
@@ -158,216 +142,200 @@ static void get_char(char *word)
     tv.tv_usec = 10; //wait input timout time
 
     //if input
-    if (select(1, &rfds, NULL, NULL, &tv) > 0)
-    {
-    	fgets(word, 128, stdin);
+    if (select(1, &rfds, NULL, NULL, &tv) > 0) {
+        fgets(word, 128, stdin);
     }
 }
 
 void GetInputString()
 {
-	char word[128];
-	char newString[7][10];
-	int i, j, ctr;
-
-	get_char(word);
-
-	if (strlen(word) == 0)
-	    return;
-	//fgets(word, sizeof(word), stdin);
-
-	j = 0;
-	ctr = 0;
-	for (i = 0; i <= (strlen(word)); i++) {
-		if (word[i] == ' ' || word[i] == '\0' || word[i] == 10) {
-			newString[ctr][j] = '\0';
-			ctr++;
-			j = 0;
-		} else {
-			newString[ctr][j] = word[i];
-			j++;
-		}
-	}
-
-	VOLTAGE = atof(newString[0]);
-	CURRENT = atof(newString[1]);
-	if (VOLTAGE <= UnSafeDataInfo->PSU_VOLTAGE && CURRENT <= UnSafeDataInfo->PSU_CURRENT)
-	{
-		//printf("OutputVol = %f, OutputCur = %f \n", VOLTAGE, CURRENT);
-	}
-	else
-	{
-		ShowMainMsg();
-	}
+    char word[128];
+    char newString[7][10];
+    int i, j, ctr;
+
+    get_char(word);
+
+    if (strlen(word) == 0) {
+        return;
+    }
+    //fgets(word, sizeof(word), stdin);
+
+    j = 0;
+    ctr = 0;
+    for (i = 0; i <= (strlen(word)); i++) {
+        if (word[i] == ' ' || word[i] == '\0' || word[i] == 10) {
+            newString[ctr][j] = '\0';
+            ctr++;
+            j = 0;
+        } else {
+            newString[ctr][j] = word[i];
+            j++;
+        }
+    }
+
+    VOLTAGE = atof(newString[0]);
+    CURRENT = atof(newString[1]);
+    if (VOLTAGE <= UnSafeDataInfo->PSU_VOLTAGE && CURRENT <= UnSafeDataInfo->PSU_CURRENT) {
+        //printf("OutputVol = %f, OutputCur = %f \n", VOLTAGE, CURRENT);
+    } else {
+        ShowMainMsg();
+    }
 }
 
 void GetIavailableCallback(byte address, unsigned short Iavail, unsigned short Vext)
 {
-	//printf("address = %d, Iavail = %d, Vext = %d \n", address, Iavail, Vext);
+    //printf("address = %d, Iavail = %d, Vext = %d \n", address, Iavail, Vext);
 }
 
 void GetOutputAndTempCallback(byte address, unsigned short outputVol,
-		unsigned short outputCur, unsigned short outputPower, unsigned char Temperature)
+                              unsigned short outputCur, unsigned short outputPower, unsigned char Temperature)
 {
-	//printf("***Output Value and Temp*** address = %d, Vol = %d, Cur = %d, Pow = %d, Temp = %d \n",
-	//		address, outputVol, outputCur, outputPower, Temperature);
+    //printf("***Output Value and Temp*** address = %d, Vol = %d, Cur = %d, Pow = %d, Temp = %d \n",
+    //      address, outputVol, outputCur, outputPower, Temperature);
 }
 
 void GetModuleStatusCallback(byte address, unsigned char isErr, unsigned char status,
-		unsigned char err1, unsigned char err2, unsigned char err3, unsigned char err4)
+                             unsigned char err1, unsigned char err2, unsigned char err3, unsigned char err4)
 {
-	//int alarm = (err2 << 24) | (err3 << 16) | (err4 << 8);
-
-	// err2 == state 2
-	// err3 == state 1
-	// err4 == state 0
-	//printf("***Status*** address = %d, alarm = %d \n", address, alarm);
-//	printf("***Status*** address = %d, err1 = %d, err2 = %d, err3 = %d, err4 = %d \n",
-//			address, err1,err2,err3,err4);
+    //int alarm = (err2 << 24) | (err3 << 16) | (err4 << 8);
+
+    // err2 == state 2
+    // err3 == state 1
+    // err4 == state 0
+    //printf("***Status*** address = %d, alarm = %d \n", address, alarm);
+//  printf("***Status*** address = %d, err1 = %d, err2 = %d, err3 = %d, err4 = %d \n",
+//          address, err1,err2,err3,err4);
 }
 
 void GetModuleInputCallback(byte address, unsigned short inputR,
-		unsigned short inputS, unsigned short inputT)
+                            unsigned short inputS, unsigned short inputT)
 {
 
 }
 
 int main(void)
 {
-	isOpen =false;
-
-	if(CreateShareMemory() == 0)
-	{
-		printf("CreateShareMemory fail. \n");
-		return 0;
-	}
-	RefreshModuleCount(&GetModuleCountCallback);
-	RefreshAvailableCap(&GetAvailableCapCallback);
-
-	RefreshStatus(&GetStatusCallback);
-	RefreshInputVol(&GetInputVoltageCallback);
-
-	RefreshIavailable(&GetIavailableCallback);
-
-	AutoMode_RefreshOutputAndTemp(&GetOutputAndTempCallback);
-	AutoMode_RefreshModuleStatus(&GetModuleStatusCallback);
-	AutoMode_RefreshModuleInput(&GetModuleInputCallback);
-
-	Uart1Fd = InitComPort();
-	libInitialize = InitialCommunication();
-
-	if (Uart1Fd < 0 || !libInitialize)
-	{
-		printf("Initial port fail. \n");
-		return 0;
-	}
-
-	sleep(5);
-	gettimeofday(&_cmdSubPriority_time, NULL);
-	VOLTAGE = 0.0;
-	CURRENT = 0.0;
-
-	SwitchPower(SYSTEM_CMD, PSU_POWER_OFF);
-//	while (1)
-//	{
-//		printf("++++++++++++++2++++++++++++++++++++++++++++++++++++++\n");
-//		SetWalkInConfig(0, YES, 0);
-//		SetWalkInConfig(1, NO, 0);
-//		printf("++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
-//		sleep(1);
-//	}
+    isOpen = false;
+
+    if (CreateShareMemory() == 0) {
+        printf("CreateShareMemory fail. \n");
+        return 0;
+    }
+    RefreshModuleCount(&GetModuleCountCallback);
+    RefreshAvailableCap(&GetAvailableCapCallback);
+
+    RefreshStatus(&GetStatusCallback);
+    RefreshInputVol(&GetInputVoltageCallback);
+
+    RefreshIavailable(&GetIavailableCallback);
+
+    AutoMode_RefreshOutputAndTemp(&GetOutputAndTempCallback);
+    AutoMode_RefreshModuleStatus(&GetModuleStatusCallback);
+    AutoMode_RefreshModuleInput(&GetModuleInputCallback);
+
+    Uart1Fd = InitComPort();
+    libInitialize = InitialCommunication();
+
+    if (Uart1Fd < 0 || !libInitialize) {
+        printf("Initial port fail. \n");
+        return 0;
+    }
+
+    sleep(5);
+    gettimeofday(&_cmdSubPriority_time, NULL);
+    VOLTAGE = 0.0;
+    CURRENT = 0.0;
+
+    SwitchPower(SYSTEM_CMD, PSU_POWER_OFF);
+//  while (1)
+//  {
+//      printf("++++++++++++++2++++++++++++++++++++++++++++++++++++++\n");
+//      SetWalkInConfig(0, YES, 0);
+//      SetWalkInConfig(1, NO, 0);
+//      printf("++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
+//      sleep(1);
+//  }
 //
-//	sleep(1);
-//		printf("++++++++++++++2++++++++++++++++++++++++++++++++++++++\n");
-//		SetWalkInConfig(SYSTEM_CMD, NO, 0);
-//		printf("++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
-//	return 0;
-	while (1)
-	{
-		GetInputGpioStatus();
-		//ChkButtonStatus();
-		// ¤Á´« Walk-in mode (default 5s -> 2s)
-		SetWalkInConfig(SYSTEM_CMD, NO, 0);
-
-		int time = GetTimeoutValue(_cmdSubPriority_time) / 1000;
-		while(isGetCount == YES)
-		{
-			if (_charging_mode == CHARGING_MODE_START)
-			{
-				// ¨ú±o¼Ò¶ô¿é¥XÃB©w¹q¬y¯à¤O
-				GetModuleIavailable(0);
-			}
-
-			GetInputString();
-			if (VOLTAGE > 150 && CURRENT >= 0)
-				_charging_mode = CHARGING_MODE_START;
-			else
-				_charging_mode = CHARGING_MODE_TERMINATING;
-			//printf("_charging_mode = %d \n", _charging_mode);
-			switch(_charging_mode)
-			{
-				case CHARGING_MODE_START:
-				{
-					//if (!isOpen)
-					{
-						//SwitchPower(SYSTEM_CMD, PSU_POWER_ON);
-						//FlashLed(SYSTEM_CMD, PSU_FLASH_ON);
-						SetDirModulePresentOutput(0,
-												VOLTAGE * 10,
-												CURRENT * 10,
-												0x01,
-												0x01);
-					}
-					//PresentOutputVol(SYSTEM_CMD, VOLTAGE * 10, CURRENT * 10);
-				}
-					break;
-				case CHARGING_MODE_TERMINATING:
-				{
-					//if (isOpen)
-					{
-						SetDirModulePresentOutput(0,
-							VOLTAGE * 10,
-							CURRENT * 10,
-							0x00,
-							0x01);
-						//SwitchPower(SYSTEM_CMD, PSU_POWER_OFF);
-						//FlashLed(SYSTEM_CMD, PSU_FLASH_NORMAL);
-					}
-				}
-					break;
-			}
-			//GetStatus(0);
-			//GetModuleInput(0);
-			sleep(1);
-		}
-
-		if (UnSafeDataInfo->PSU_COUNT <= 0)
-		{
-			if (time > 1000)
-			{
-				printf("Step 1 : GetModuleCount...... \n");
-				GetModuleCount(SYSTEM_CMD);
-				gettimeofday(&_cmdSubPriority_time, NULL);
-			}
-		}
-		else if (time < 5000)
-		{
-			printf("Step 2 : GetModuleCap...... \n");
-			GetModuleCap(0);
-
-			SwitchPower(SYSTEM_CMD, PSU_POWER_OFF);
-			FlashLed(SYSTEM_CMD, PSU_FLASH_NORMAL);
-		}
-		else
-		{
-			ShowMainMsg();
-			isGetCount = YES;
-		}
-
-		sleep(1);
-	}
-
-	return 0;
+//  sleep(1);
+//      printf("++++++++++++++2++++++++++++++++++++++++++++++++++++++\n");
+//      SetWalkInConfig(SYSTEM_CMD, NO, 0);
+//      printf("++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
+//  return 0;
+    while (1) {
+        GetInputGpioStatus();
+        //ChkButtonStatus();
+        // 切� Walk-in mode (default 5s -> 2s)
+        SetWalkInConfig(SYSTEM_CMD, NO, 0);
+
+        int time = GetTimeoutValue(_cmdSubPriority_time) / 1000;
+        while (isGetCount == YES) {
+            if (_charging_mode == CHARGING_MODE_START) {
+                // �得模塊輸出�定電�能力
+                GetModuleIavailable(0);
+            }
+
+            GetInputString();
+            if (VOLTAGE > 150 && CURRENT >= 0) {
+                _charging_mode = CHARGING_MODE_START;
+            } else {
+                _charging_mode = CHARGING_MODE_TERMINATING;
+            }
+            //printf("_charging_mode = %d \n", _charging_mode);
+            switch (_charging_mode) {
+            case CHARGING_MODE_START: {
+                //if (!isOpen)
+                {
+                    //SwitchPower(SYSTEM_CMD, PSU_POWER_ON);
+                    //FlashLed(SYSTEM_CMD, PSU_FLASH_ON);
+                    SetDirModulePresentOutput(0,
+                                              VOLTAGE * 10,
+                                              CURRENT * 10,
+                                              0x01,
+                                              0x01);
+                }
+                //PresentOutputVol(SYSTEM_CMD, VOLTAGE * 10, CURRENT * 10);
+            }
+            break;
+            case CHARGING_MODE_TERMINATING: {
+                //if (isOpen)
+                {
+                    SetDirModulePresentOutput(0,
+                                              VOLTAGE * 10,
+                                              CURRENT * 10,
+                                              0x00,
+                                              0x01);
+                    //SwitchPower(SYSTEM_CMD, PSU_POWER_OFF);
+                    //FlashLed(SYSTEM_CMD, PSU_FLASH_NORMAL);
+                }
+            }
+            break;
+            }
+            //GetStatus(0);
+            //GetModuleInput(0);
+            sleep(1);
+        }
+
+        if (UnSafeDataInfo->PSU_COUNT <= 0) {
+            if (time > 1000) {
+                printf("Step 1 : GetModuleCount...... \n");
+                GetModuleCount(SYSTEM_CMD);
+                gettimeofday(&_cmdSubPriority_time, NULL);
+            }
+        } else if (time < 5000) {
+            printf("Step 2 : GetModuleCap...... \n");
+            GetModuleCap(0);
+
+            SwitchPower(SYSTEM_CMD, PSU_POWER_OFF);
+            FlashLed(SYSTEM_CMD, PSU_FLASH_NORMAL);
+        } else {
+            ShowMainMsg();
+            isGetCount = YES;
+        }
+
+        sleep(1);
+    }
+
+    return 0;
 }
 
 

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

@@ -4,7 +4,7 @@ chmod 777 Module_LcmControl
 chmod 777 Module_InternalComm
 chmod 777 Module_EventLogging
 chmod 777 Module_EvComm
-chmod 777 Module_PsuComm
+#chmod 777 Module_PsuComm
 chmod 777 OcppBackend
 chmod 777 kill.sh
 chmod 777 ReadCmdline

+ 27 - 1
EVSE/Projects/DD360Audi/Apps/main.c

@@ -155,7 +155,7 @@ bool isModelNameMatch = true;
 
 int rfidFd = -1;
 char *rfidPortName = "/dev/ttyS2";
-char *fwVersion = "V1.02.00.0000.00"; // "V0.16.00.0000.00";
+char *fwVersion = "V1.03.00.0000.00"; // "V0.16.00.0000.00";
 
 sqlite3 *localDb;
 bool isDb_ready;
@@ -2567,6 +2567,32 @@ void CheckErrorOccurStatus(byte index)
             InformOcppErrOccur(6);
         }
     }
+
+    if (chargingInfo[index]->Type == _Type_Chademo) {
+        if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayWelding == YES) {
+            memcpy(chargingInfo[index]->ConnectorAlarmCode, "011011", 6);
+        } else if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault == YES) {
+            memcpy(chargingInfo[index]->ConnectorAlarmCode, "011012", 6);
+        } else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemChademoOutputOVP == YES) {
+            memcpy(chargingInfo[index]->ConnectorAlarmCode, "012217", 6);
+        }
+    } else if (chargingInfo[index]->Type == _Type_GB) {
+        if (ShmStatusCodeData->FaultCode.FaultEvents.bits.GbOutputRelayWelding == YES) {
+            memcpy(chargingInfo[index]->ConnectorAlarmCode, "011015", 6);
+        } else if (ShmStatusCodeData->FaultCode.FaultEvents.bits.GbOutputRelayDrivingFault == YES) {
+            memcpy(chargingInfo[index]->ConnectorAlarmCode, "011016", 6);
+        } else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemGbOutputOVP == YES) {
+            memcpy(chargingInfo[index]->ConnectorAlarmCode, "012221", 6);
+        }
+    } else if (chargingInfo[index]->Type == _Type_CCS_2) {
+        if (ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayWelding == YES) {
+            memcpy(chargingInfo[index]->ConnectorAlarmCode, "011013", 6);
+        } else if (ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayDrivingFault == YES) {
+            memcpy(chargingInfo[index]->ConnectorAlarmCode, "011014", 6);
+        } else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemCcsOutputOVP == YES) {
+            memcpy(chargingInfo[index]->ConnectorAlarmCode, "012219", 6);
+        }
+    }
 }
 
 //===============================================

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/web.sh

@@ -1 +1 @@
-/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf  -m /lib
+/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf  -m /lib

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


BIN
EVSE/Projects/DD360Audi/output/Module_InternalComm


BIN
EVSE/Projects/DD360Audi/output/main