Browse Source

2021-09-28 / Eason Yang
Action
1. Improve: Start button screen for sleep mode.
2. Improve: Check power consumption for CDFA.
3. Improve: QR code receipt for CDFA.
4. Improve: Upgrade_check() replace free(ptr) postion.
5. Imprvoe: Get target current on Idle mode.
6. Improve: Led logic on Idle mode. non-sleep & sleep mode.
7. Improve: Logic for check power consumption, when user press the start button for second.

File :
1. main.c
Action 4
Action 5
Action 6
Action 7

2. Module_LcmControl.c
Action 1
Action 2
Action 3

Lcm Version: V0.19
Firmware Version: D0.55.XX.XXXX.XX

8009 3 years ago
parent
commit
33adeeca2d

+ 148 - 25
EVSE/Projects/AW-CCS/Apps/LCM/Module_LcmControl.c

@@ -46,7 +46,8 @@ void setPresentChargedEnergy(uint8_t gun_index);
 void setPresentChargingPower(uint8_t gun_index);
 void setBatteryPercentageValue(uint8_t gun_index);
 void setPresentChargedDuration(uint8_t gun_index);
-void setQRcodeContent(char *input, uint8_t length);
+void setPresentPowerConsumption(uint8_t gun_index);
+void setQRcodeContent(char *input, uint8_t length, uint8_t mode);
 void setDisplayValue(uint16_t address, uint8_t value);
 void setGunPluginAnimation(uint8_t gun_index);
 void setBatteryAnimation(uint8_t gun_index, uint8_t system_mode);
@@ -54,6 +55,7 @@ void setConnectionAnimation(uint8_t gun_index, uint8_t system_mode);
 void setPresentFinalCost(float cost);
 float getPresentFinalCost(uint8_t gun_index);
 void setDefaultValue(uint8_t gun_index, uint8_t system_mode);
+void setStartButtonAnimation(uint8_t gun_index);
 
 void setUserPrice(uint8_t type);
 void setDefaultPrice(uint8_t type);
@@ -68,6 +70,7 @@ void setBackendIcon();
 void setEthernetIcon();
 void setAlarmCodeAndIcon();
 void setBillingFromWebsite();
+void setQRCodeReceipt(uint8_t gun_index);
 
 //=======================================
 // Declare Timer
@@ -80,7 +83,7 @@ enum TMR_IDX
 	TMR_IDX_ALARM,
 	TMR_IDX_PRICE,
 	TMR_IDX_EMULATOR,
-	TMR_IDX_6,
+	TMR_IDX_STARTBUTTON,
 	TMR_IDX_7,
 	TMR_IDX_8,
 	TMR_IDX_SHOW_AUTH_RESULT
@@ -91,8 +94,9 @@ struct timeb					startTime[AC_QUANTITY][10];
 #define TIME_ANIMATION_PLUGIN			1000
 #define TIME_ANIMATION_BATTERY			1000
 #define TIME_ANIMATION_CONNECTION		1000
+#define TIME_ANIMATION_START_BUTTON		1000
 #define TIME_ANIMATION_ALARM			5000
-#define TIME_REFRESH_TIME				2000
+#define TIME_REFRESH_TIME				5000
 #define TIME_AUTH_RESULT_TIME			5000
 
 //=======================================
@@ -101,6 +105,7 @@ struct timeb					startTime[AC_QUANTITY][10];
 uint8_t BATTERY_LEVEL_STATUS = BATTERY_LEVEL_5;
 uint8_t CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_0;
 uint8_t GUN_PLUGING_LEVEL_STATUS = GUN_PLUGING_LEVEL_0;
+uint8_t START_BUTTON_LEVEL_STATUS = START_BUTTON_LEVEL_0;
 uint8_t WarningCount = 255;
 
 int Uart1Fd;
@@ -116,8 +121,7 @@ uint8_t isCharging	= YES;
 //=======================================
 // Record version and date
 //=======================================
-char *FIRMWARE_UPDATE_IMAGE[3] = {"V0.18", "2021-06-23", "REV.01.00"};
-
+char *FIRMWARE_UPDATE_IMAGE[3] = {"V0.19", "2021-09-28", "REV.01.00"};
 
 //=======================================
 // Common routine
@@ -275,23 +279,46 @@ void page_booting()
 
 void page_idle(uint8_t gun_index, uint8_t system_mode)
 {
-	if((getCurrentPage() != SYSTEM_SCREEN_IDLE) && (ShmCharger->gun_info[gun_index].resultAuthorization != VALIDATED_RFID))
+	if(ShmCharger->gun_info[gun_index].isSleepOn == YES)
 	{
-		setCurrentPage(SYSTEM_SCREEN_IDLE);
-		setDefaultValue(gun_index, system_mode);
-		DEBUG_INFO("Setting page to idle.\n");
+		if((getCurrentPage() != SYSTEM_SCREEN_SLEEP))
+		{
+			setCurrentPage(SYSTEM_SCREEN_SLEEP);
+			START_BUTTON_LEVEL_STATUS = START_BUTTON_LEVEL_0;
+			ftime(&startTime[gun_index][TMR_IDX_STARTBUTTON]);
+		}
+		else
+			setStartButtonAnimation(gun_index);
 	}
 	else
 	{
-		setRfidIcon();
-		setQRCodeIcon();
-
-		if(isEmulator == YES)
+		if(ShmCharger->gun_info[gun_index].isCheckPowerConsumption == YES)
 		{
-			//if(isCharging == YES)
-				//PERCENTAGE = 0;
-			//else
-				//PERCENTAGE = 100;
+			setCurrentPage(SYSTEM_SCREEN_POWER_CONSUMPTION);
+			setDisplayValue(ICON_POWER_CONSUMPTION, APPEAR);
+			setPresentPowerConsumption(gun_index);
+		}
+		else
+		{
+			if((getCurrentPage() != SYSTEM_SCREEN_IDLE) && (ShmCharger->gun_info[gun_index].resultAuthorization != VALIDATED_RFID))
+			{
+				setCurrentPage(SYSTEM_SCREEN_IDLE);
+				setDefaultValue(gun_index, system_mode);
+				DEBUG_INFO("Setting page to idle.\n");
+			}
+			else
+			{
+				setRfidIcon();
+				setQRCodeIcon();
+
+				if(isEmulator == YES)
+				{
+					//if(isCharging == YES)
+						//PERCENTAGE = 0;
+					//else
+						//PERCENTAGE = 100;
+				}
+			}
 		}
 	}
 }
@@ -393,10 +420,23 @@ void page_complete(uint8_t gun_index, uint8_t system_mode)
 	}
 	else
 	{
-		setPresentChargedDuration(gun_index);
 		setPresentChargedEnergy(gun_index);
+		setPresentChargedDuration(gun_index);
 		setBatteryAnimation(gun_index, system_mode);
 
+		// DISPLAY FOR QR CODE RECEIPT
+		if(strstr((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL, "phihong"))
+		{
+			setDisplayValue(ICON_THE_CHARGE_COMPLETE, DISAPPEAR);
+			setDisplayValue(ICON_CONNECTION_COMPLETE, DISAPPEAR);
+			setQRCodeReceipt(gun_index);
+		}
+		else
+		{
+			setDisplayValue(ICON_THE_CHARGE_COMPLETE, APPEAR);
+			setDisplayValue(ICON_CONNECTION_COMPLETE, APPEAR);
+		}
+
 		// SHOW FINAL COST AND ACCOUNT BALANCE AFTER THE END OF TRANSACTION
 		if((ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
 		{
@@ -578,7 +618,7 @@ void page_header(uint8_t gun_index, uint8_t system_mode)
 	}
 	else
 	{
-		// EVERY 2 SECONDS TO UPDATE PRICE
+		// EVERY 5 SECONDS TO UPDATE PRICE
 		if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PRICE]) > (TIME_REFRESH_TIME))
 		{
 			ftime(&startTime[gun_index][TMR_IDX_PRICE]);
@@ -878,6 +918,7 @@ void setPresentFinalCost(float cost)
 
 	memset(data, 0x00, ARRAY_SIZE(data));
 	memset(finalCost, 0x00, ARRAY_SIZE(finalCost));
+
 	sprintf((char *)finalCost, "%.2f", cost);
 	string2ByteArray(finalCost, data);
 	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_COST_COMPLETE, data, ARRAY_SIZE(data));
@@ -937,7 +978,7 @@ void setBillingFromBackend(uint8_t gun_index, uint8_t system_mode)
 						{
 							/*
 							 * 1. SEARCHING USER PRICE FOR PRICE TEXT
-							 * 2. SEARCHING USER PRICE FOR URRENCY AND UNIT TO APPEAR
+							 * 2. SEARCHING USER PRICE FOR CURRENCY AND UNIT TO APPEAR
 							 */
 							setUserPrice(CURRENT_RATE);
 							setCurrencyAndUnitFromBackend(SET_USER_PRICE, CURRENT_RATE,gun_index);
@@ -1357,12 +1398,12 @@ void setQRCodeIcon()
 		if(ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode == NO)
 		{
 			length = strlen((char *)ShmSysConfigAndInfo->SysConfig.SystemId);
-			setQRcodeContent((char *)ShmSysConfigAndInfo->SysConfig.SystemId, length);
+			setQRcodeContent((char *)ShmSysConfigAndInfo->SysConfig.SystemId, length, QRCODE_FOR_IDLE);
 		}
 		else
 		{
 			length = strlen((char *)ShmSysConfigAndInfo->SysConfig.QRCodeContent);
-			setQRcodeContent((char *)ShmSysConfigAndInfo->SysConfig.QRCodeContent, length);
+			setQRcodeContent((char *)ShmSysConfigAndInfo->SysConfig.QRCodeContent, length, QRCODE_FOR_IDLE);
 		}
 	}
 	else
@@ -1372,10 +1413,48 @@ void setQRCodeIcon()
 	}
 }
 
+//=======================================
+// Setting QRCODE icon for receipt
+//=======================================
+void setQRCodeReceipt(uint8_t gun_index)
+{
+	uint8_t length = 0;
+	uint8_t data[128];
+	int TransactionId;
+	unsigned char QRCodeContent[128];
+	unsigned char QRCodeReceipt[128];
+
+	memset(QRCodeReceipt, 0x00, ARRAY_SIZE(QRCodeReceipt));
+	memset(QRCodeReceipt, 0x00, ARRAY_SIZE(QRCodeReceipt));
+	memset(data, 0x00, ARRAY_SIZE(data));
+
+	strcpy((char*)QRCodeContent, "https://ocpp.phihong.com.tw/CDFA/");
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		TransactionId = ShmOCPP16Data->StopTransaction[gun_index].TransactionId;
+	}
+	else
+	{}
+
+	sprintf((char *)QRCodeReceipt, "%s%d", QRCodeContent,TransactionId);
+	string2ByteArray(QRCodeReceipt, data);
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON)
+	{
+		length = strlen((char *)data);
+		setQRcodeContent((char *)data, length, QRCODE_FOR_COMPLETE);
+	}
+	else
+	{
+		setDisplayValue(TEXT_QRCODE_RECEIPT, DISAPPEAR);
+	}
+}
+
 //=======================================
 // Setting QR code content
 //=======================================
-void setQRcodeContent(char *input, uint8_t length)
+void setQRcodeContent(char *input, uint8_t length, uint8_t mode)
 {
 	uint8_t output[length];
 	int loop = 0;
@@ -1389,7 +1468,18 @@ void setQRcodeContent(char *input, uint8_t length)
 		loop++;
 	}
 
-	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_QRCODE_CONTENT, output, ARRAY_SIZE(output)+1);
+	switch(mode)
+	{
+		case QRCODE_FOR_IDLE:
+			lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_QRCODE_CONTENT, output, ARRAY_SIZE(output)+1);
+			break;
+		case QRCODE_FOR_COMPLETE:
+			lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_QRCODE_RECEIPT, output, ARRAY_SIZE(output)+1);
+			break;
+		default:
+			lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_QRCODE_CONTENT, output, ARRAY_SIZE(output)+1);
+			break;
+	}
 }
 
 //=======================================
@@ -1709,7 +1799,6 @@ void setConnectionAnimation(uint8_t gun_index, uint8_t system_mode)
 
 			break;
 		case SYS_MODE_CHARGING:
-
 			if((ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON))
 			{
 				if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION)))
@@ -1786,6 +1875,24 @@ void setGunPluginAnimation(uint8_t gun_index)
 	}
 }
 
+//=======================================
+// Setting start button animation
+//=======================================
+void setStartButtonAnimation(uint8_t gun_index)
+{
+	if((START_BUTTON_LEVEL_STATUS ==  START_BUTTON_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_STARTBUTTON]) > (TIME_ANIMATION_START_BUTTON)))
+	{
+		setDisplayValue(ICON_START_BUTTON, APPEAR);
+		START_BUTTON_LEVEL_STATUS = START_BUTTON_LEVEL_1;
+	}
+	else if((START_BUTTON_LEVEL_STATUS ==  START_BUTTON_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_STARTBUTTON]) > (TIME_ANIMATION_START_BUTTON*2)))
+	{
+		setDisplayValue(ICON_START_BUTTON, DISAPPEAR);
+		START_BUTTON_LEVEL_STATUS = START_BUTTON_LEVEL_0;
+		ftime(&startTime[gun_index][TMR_IDX_STARTBUTTON]);
+	}
+}
+
 //=======================================
 // Setting battery SOC value
 //=======================================
@@ -1834,6 +1941,22 @@ void setPresentChargedEnergy(uint8_t gun_index)
 	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_ENERGY_CHARGING, data, ARRAY_SIZE(data));
 }
 
+//=======================================
+// Setting present power consumption
+//=======================================
+void setPresentPowerConsumption(uint8_t gun_index)
+{
+	uint8_t data[32];
+	uint8_t powerConsumption[32];
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(powerConsumption, 0x00, ARRAY_SIZE(powerConsumption));
+
+	sprintf((char *)powerConsumption, "%.4f kWh", ((float)ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0));
+	string2ByteArray(powerConsumption, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_POWER_CONSUMPTION, data, ARRAY_SIZE(data));
+}
+
 //=======================================
 // Setting present charged duration
 //=======================================

+ 22 - 4
EVSE/Projects/AW-CCS/Apps/LCM/lcmComm_dgus.h

@@ -97,7 +97,8 @@
 #define SYSTEM_SCREEN_AUTH_UNKNOW			0x09
 #define SYSTEM_SCREEN_TERMINATING			0X0A
 #define SYSTEM_SCREEN_EMERGENCY				0x0B
-#define SYSTEM_SCREEN_THREE_BAR_PATTERN		0x0C
+#define SYSTEM_SCREEN_SLEEP					0x0C
+#define SYSTEM_SCREEN_POWER_CONSUMPTION		0x0D
 
 //=======================================
 // Parameter to change icon status
@@ -183,6 +184,9 @@
 #define ICON_BALANCE_WALLET					0x101D
 #define ICON_DEFAULT_START_PRICE			0x101E
 #define ICON_DEFAULT_ENERGY					0x101F
+#define ICON_START_BUTTON					0x1020
+#define ICON_POWER_CONSUMPTION				0x1021
+#define ICON_THE_CHARGE_COMPLETE			0x1022
 
 #define ICON_LOGO							0x1500
 #define ICON_LOGO_CHARGING					0x1501
@@ -209,13 +213,21 @@
 #define TEXT_CURRENCY_COMPLETE				0x20CE // size 16
 #define TEXT_DEFUALT_START_PRICE			0x20DE // size 16
 #define TEXT_DEFAULT_ENERGY					0x20EE // size 16
+#define TEXT_POWER_CONSUMPTION				0x20FE // size 32
 
 #define TEXT_RTC							0X2500 // size 32
 
 //=======================================
-// QR Code content address start from 5000
+// QR Code content address start from 3000
 //=======================================
-#define TEXT_QRCODE_CONTENT					0x3000
+#define TEXT_QRCODE_CONTENT					0x3000 // size 256
+#define TEXT_QRCODE_RECEIPT					0x3100 // size 256
+
+//=======================================
+// QR Code mode define
+//=======================================
+#define QRCODE_FOR_IDLE						1
+#define QRCODE_FOR_COMPLETE					2
 
 //=======================================
 // 4G + WIFI connection flags (Header)
@@ -237,7 +249,7 @@
 #define BATTERY_LEVEL_5						0x05
 
 //=======================================
-// CConnection level status (Charging)
+// Connection level status (Charging)
 //=======================================
 #define CONNECTION_LEVEL_0					0x00
 #define CONNECTION_LEVEL_1					0x01
@@ -248,6 +260,12 @@
 #define GUN_PLUGING_LEVEL_0					0x00
 #define GUN_PLUGING_LEVEL_1					0x01
 
+//=======================================
+// Start button level status (Sleep in Idle)
+//=======================================
+#define START_BUTTON_LEVEL_0				0x00
+#define START_BUTTON_LEVEL_1				0x01
+
 //=======================================
 // RFID authorization constant
 //=======================================

+ 74 - 25
EVSE/Projects/AW-CCS/Apps/main.c

@@ -33,6 +33,7 @@
 #define TIMEOUT_SPEC_POWERSAVING_RFID			120000
 #define TIMEOUT_SPEC_POWERSAVING_METER			120000
 #define TIMEOUT_SPEC_POWERSAVING_LED_STATUS		120000
+#define TIMEOUT_SPEC_CEHCK_POWER_CONSUMPTION	10000
 
 //==========================
 // GPIO constant define
@@ -2983,6 +2984,7 @@ int upgrade_check()
 
 					ShmCharger->fwUpgradeInfo.fwType = ((ptr[0x13]<<0) | (ptr[0x12]<<8) | (ptr[0x11]<<16) | (ptr[0x10]<<24));
 					substr(ShmCharger->fwUpgradeInfo.modelName, (char *)ptr, 0, 0x10);
+					free(ptr);
 					DEBUG_INFO("New firmware type: %X\n", ShmCharger->fwUpgradeInfo.fwType);
 					DEBUG_INFO("New firmware model name: %s, %s\n", ShmCharger->fwUpgradeInfo.modelName, ShmSysConfigAndInfo->SysConfig.ModelName);
 
@@ -3091,7 +3093,6 @@ int upgrade_check()
 						sprintf(cmd, "yes|rm %s", ShmCharger->fwUpgradeInfo.location);
 						system(cmd);
 					}
-					free(ptr);
 				}
 				else
 				{
@@ -4273,7 +4274,7 @@ void checkStopReason(uint8_t gun_index)
 		{
 			sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Other");
 		}
-		DEBUG_INFO("Gun-%d : StopReason [ %s ]...\n.",gun_index,ShmOCPP16Data->StopTransaction[gun_index].StopReason);
+		DEBUG_INFO("Gun-%d : StopReason [ %s ]...\n",gun_index,ShmOCPP16Data->StopTransaction[gun_index].StopReason);
 
 		ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption = (ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0);
 		presentChargedEnergyUpdate(gun_index);
@@ -4340,7 +4341,7 @@ void checkStopReason(uint8_t gun_index)
 		{
 			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "Other");
 		}
-		DEBUG_INFO("Gun-%d : StopReason [ %s ]...\n.", gun_index, ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason);
+		DEBUG_INFO("Gun-%d : StopReason [ %s ]...\n", gun_index, ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason);
 
 		ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption = (ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0);
 		presentChargedEnergyUpdate(gun_index);
@@ -4819,6 +4820,18 @@ int main(void)
 					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
 					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
 					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]);
+
+					if(((gpio_get_value(GPIO_IN_WAKEUP) == OFF) || (ShmCharger->gun_info[gun_index].GPIO_Input.Button_Mode_Switch == ON)) &&
+					   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_IDLE) &&
+					   (DiffTimebWithNow(startTime[ShmCharger->gun_selectd][TMR_IDX_CHECK_POWER_CONSUMPTION]) > TIMEOUT_SPEC_CEHCK_POWER_CONSUMPTION))
+					{
+						ShmCharger->gun_info[gun_index].isCheckPowerConsumption = YES;
+					}
+				}
+				else
+				{
+					ftime(&startTime[gun_index][TMR_IDX_CHECK_POWER_CONSUMPTION]);
+					ShmCharger->gun_info[gun_index].isCheckPowerConsumption = NO;
 				}
 			}
 
@@ -4874,21 +4887,21 @@ int main(void)
 					ShmCharger->gun_info[gun_index].isMeterOn = ON;
 				}
 			}
-			
+
 			if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]) > TIMEOUT_SPEC_POWERSAVING_LED_STATUS)
 			{
-				if(ShmCharger->gun_info[gun_index].isSleepOn == OFF)
+				if(ShmCharger->gun_info[gun_index].isSleepOn == NO)
 				{
 					DEBUG_INFO("LED status into power saving...%d\n", DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]));
-					ShmCharger->gun_info[gun_index].isSleepOn = ON;
+					ShmCharger->gun_info[gun_index].isSleepOn = YES;
 				}
 			}
 			else
 			{
-				if(ShmCharger->gun_info[gun_index].isSleepOn == ON)
+				if(ShmCharger->gun_info[gun_index].isSleepOn == YES)
 				{
 					DEBUG_INFO("LED status exit power saving...%d\n", DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]));
-					ShmCharger->gun_info[gun_index].isSleepOn = OFF;
+					ShmCharger->gun_info[gun_index].isSleepOn = NO;
 				}
 			}
 
@@ -5058,9 +5071,9 @@ int main(void)
 
 						// Default LCM brightness to 100
 						ShmCharger->isLcdOn = ON;
-						
+
 						// Defaule led status to not sleep mode
-						ShmCharger->gun_info[gun_index].isSleepOn = OFF;
+						ShmCharger->gun_info[gun_index].isSleepOn = NO;
 
 						// If Web Server OPCC URL is empty kill Module_OcppBackend
 						if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0) || ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging)
@@ -5120,23 +5133,29 @@ int main(void)
 						if(ShmCharger->isCcsEnable)system("pkill Module_CCS");
 						DB_Check_Record_Buf(localDb, gun_index);
 					}
-					
+
 					// LED status in Idle mode
-					if(!ShmCharger->isAuthrizing && (strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0))
+					if(!ShmCharger->isAuthrizing)
 					{
 						if(ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON)
 						{
-							if(ShmCharger->gun_info[gun_index].isSleepOn == OFF)
-								setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_CONNECTED);
-							else
-								setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP);
+							if(ShmCharger->gun_info[gun_index].rfidReq == OFF)
+							{
+								if(ShmCharger->gun_info[gun_index].isSleepOn == NO)
+									setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_CONNECTED);
+								else
+									setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP);
+							}
 						}
 						else
 						{
-							if(ShmCharger->gun_info[gun_index].isSleepOn == OFF)
-								setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_DISCONNECTED);
-							else
-								setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP);
+							if(ShmCharger->gun_info[gun_index].rfidReq == OFF)
+							{
+								if(ShmCharger->gun_info[gun_index].isSleepOn == NO)
+									setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_DISCONNECTED);
+								else
+									setLedMotion(gun_index,LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP);
+							}
 						}
 					}
 
@@ -5194,18 +5213,48 @@ int main(void)
 							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
 
 							if(ShmCharger->isCcsEnable)
+							{
 								ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_5;
+							}
 							else
-								ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+							{
+								if((6 <= ShmCharger->gun_info[gun_index].targetCurrent))
+								{
+									ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+								}
+								else if((1 <= ShmCharger->gun_info[gun_index].targetCurrent) && (ShmCharger->gun_info[gun_index].targetCurrent < 6))
+								{
+									ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = 6;
+								}
+								else
+								{
+									ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = 100;
+								}
+							}
 						}
 						else
 						{
 							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
 
 							if(ShmCharger->isCcsEnable)
+							{
 								ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_5;
+							}
 							else
-								ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+							{
+								if((6 <= ShmCharger->gun_info[gun_index].targetCurrent))
+								{
+									ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+								}
+								else if((1 <= ShmCharger->gun_info[gun_index].targetCurrent) && (ShmCharger->gun_info[gun_index].targetCurrent < 6))
+								{
+									ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = 6;
+								}
+								else
+								{
+									ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = 100;
+								}
+							}
 						}
 						ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
 
@@ -5967,7 +6016,7 @@ int main(void)
 						{
 							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
 							ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
-							sleep(3);
+							sleep(1);
 							checkStopReason(gun_index);
 							setChargerMode(gun_index, SYS_MODE_COMPLETE);
 						}
@@ -5992,7 +6041,7 @@ int main(void)
 						{
 							setLedMotion(gun_index, LED_ACTION_STOP);
 						}
-						
+
 						// Charging profile preparation
 						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) < 0))
 						{
@@ -6009,7 +6058,7 @@ int main(void)
 
 						// Checking profile id > 0 and current time is between charging profile validFrom & validTo
 						checkChargingProfileLimit(gun_index);
-						
+
 						// Determine max charging current to MCU
 						if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
 						{

+ 3 - 2
EVSE/Projects/AW-CCS/Apps/main.h

@@ -229,7 +229,7 @@ enum TIMER_IDX
 	TMR_IDX_POWERSAVING_STATE_B,
 	TMR_IDX_CHECK_TASK,
 	TMR_IDX_POWERSAVING_LED_STATUS,
-	TMR_IDX_13,
+	TMR_IDX_CHECK_POWER_CONSUMPTION,
 	TMR_IDX_14,
 	TMR_IDX_15,
 	TMR_IDX_16,
@@ -753,7 +753,8 @@ typedef struct GUN_INFO
 	uint16_t										isChargerStopByCondition:1;
 	uint16_t										isMeterOn:1;
 	uint16_t										isSleepOn:1;
-	uint16_t										:2;
+	uint16_t										isCheckPowerConsumption:1;
+	uint16_t										:1;
 }Gun_Info;
 
 struct Charger

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


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