瀏覽代碼

2021-10-19 / Eason Yang
Action:
1.Improve : setQRCodeReceipt function. Check OcppReceiptrURL is empty or not.
2.Improve : Sleep mode logic.

File:
1. Module_LcmContorl.c
Action 1
Action 2

LCM version: V0.20
Upgrade date: 2021-10-19

8009 3 年之前
父節點
當前提交
da8a7a45ef

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

@@ -70,7 +70,6 @@ void setEthernetIcon();
 void setAlarmCodeAndIcon();
 void setBillingFromWebsite();
 void setQRCodeReceipt(uint8_t gun_index);
-void setReceiptIcon(uint8_t gun_index);
 
 //=======================================
 // Declare Timer
@@ -119,7 +118,7 @@ uint8_t isCharging	= YES;
 //=======================================
 // Record version and date
 //=======================================
-char *FIRMWARE_UPDATE_IMAGE[3] = {"V0.19", "2021-09-28", "REV.01.00"};
+char *FIRMWARE_UPDATE_IMAGE[3] = {"V0.20", "2021-10-19", "REV.01.00"};
 
 //=======================================
 // Common routine
@@ -279,7 +278,7 @@ void page_idle(uint8_t gun_index, uint8_t system_mode)
 {
 	if(ShmCharger->gun_info[gun_index].isSleepOn == YES)
 	{
-		if((getCurrentPage() != SYSTEM_SCREEN_SLEEP))
+		if((getCurrentPage() != SYSTEM_SCREEN_SLEEP) && (getCurrentPage() != SYSTEM_SCREEN_SLEEP2))
 		{
 			setCurrentPage(SYSTEM_SCREEN_SLEEP);
 		}
@@ -419,7 +418,7 @@ void page_complete(uint8_t gun_index, uint8_t system_mode)
 		setPresentChargedEnergy(gun_index);
 		setPresentChargedDuration(gun_index);
 		setBatteryAnimation(gun_index, system_mode);
-		setReceiptIcon(gun_index);
+		setQRCodeReceipt(gun_index);
 
 		// SHOW FINAL COST AND ACCOUNT BALANCE AFTER THE END OF TRANSACTION
 		if((ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
@@ -475,7 +474,7 @@ void page_terminating(uint8_t gun_index, uint8_t system_mode)
 		setPresentChargedDuration(gun_index);
 		setPresentChargedEnergy(gun_index);
 		setPresentChargingPower(gun_index);
-		setReceiptIcon(gun_index);
+		setQRCodeReceipt(gun_index);
 
 		if((ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
 		{
@@ -1434,35 +1433,40 @@ void setQRCodeIcon()
 void setQRCodeReceipt(uint8_t gun_index)
 {
 	uint8_t length = 0;
-	uint8_t data[128];
+	uint8_t data[512];
 	int TransactionId;
-	unsigned char QRCodeContent[128];
-	unsigned char QRCodeReceipt[128];
+	unsigned char QRCodeContent[512];
+	unsigned char QRCodeReceipt[512];
 
-	memset(QRCodeReceipt, 0x00, ARRAY_SIZE(QRCodeReceipt));
+	memset(QRCodeContent, 0x00, ARRAY_SIZE(QRCodeContent));
 	memset(QRCodeReceipt, 0x00, ARRAY_SIZE(QRCodeReceipt));
 	memset(data, 0x00, ARRAY_SIZE(data));
 
-	strcpy((char*)QRCodeContent, "https://ocpp.phihong.com.tw/CDFA/");
-
+	memcpy((char*)QRCodeContent, (char*)ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL));
 	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		TransactionId = ShmOCPP16Data->StopTransaction[gun_index].TransactionId;
 	}
 	else
-	{}
+	{
+		// TO DO OCPP 2.0
+	}
 
 	sprintf((char *)QRCodeReceipt, "%s%d", QRCodeContent,TransactionId);
 	string2ByteArray(QRCodeReceipt, data);
-
-	if(strstr((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL, "phihong") && (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
+	if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL,"") == 0))
 	{
-		length = strlen((char *)data);
-		setQRcodeContent((char *)data, length, QRCODE_FOR_COMPLETE);
+		setDisplayValue(TEXT_QRCODE_RECEIPT, DISAPPEAR);
+		setDisplayValue(ICON_THE_CHARGE_COMPLETE, APPEAR);
+		setDisplayValue(ICON_CONNECTION_COMPLETE, APPEAR);
 	}
 	else
 	{
-		setDisplayValue(TEXT_QRCODE_RECEIPT, DISAPPEAR);
+		setDisplayValue(ICON_THE_CHARGE_COMPLETE, DISAPPEAR);
+		setDisplayValue(ICON_CONNECTION_COMPLETE, APPEAR);
+
+		length = strlen((char *)data);
+		setQRcodeContent((char *)data, length, QRCODE_FOR_COMPLETE);
 	}
 }
 
@@ -2085,26 +2089,6 @@ void setDefaultValue(uint8_t gun_index, uint8_t system_mode)
 	}
 }
 
-//=======================================
-// Setting receipt icon
-//=======================================
-void setReceiptIcon(uint8_t gun_index)
-{
-	// DISPLAY FOR QR CODE RECEIPT
-	if(strstr((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL, "phihong") && (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
-	{
-		setDisplayValue(ICON_THE_CHARGE_COMPLETE, DISAPPEAR);
-		setDisplayValue(ICON_CONNECTION_COMPLETE, APPEAR);
-		setQRCodeReceipt(gun_index);
-	}
-	else
-	{
-		setDisplayValue(ICON_THE_CHARGE_COMPLETE, APPEAR);
-		setDisplayValue(ICON_CONNECTION_COMPLETE, APPEAR);
-		setQRCodeReceipt(gun_index);
-	}
-}
-
 //=======================================
 // Initial all share memory
 //=======================================

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


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