Browse Source

2020-05-27 /Edward Lien

Actions:
1.Change Charging mode name to BC mode & HL mode.
2.setRelay use DC Config_Relay_Output() function control.
3.merge from master.

Files:
1. As follow commit history

Image version: D0.06.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
Edward Lien 4 years ago
parent
commit
bffcc715c1

+ 1 - 48
EVSE/Projects/AW-CCS/Apps/Module_InternalComm.c

@@ -1323,53 +1323,6 @@ unsigned char Config_AC_MCU_LEGACY_REQUEST(unsigned char fd, unsigned char targe
 	return result;
 }
 
-unsigned char Config_AC_MCU_RELAY(unsigned char fd, unsigned char targetAddr, Legacy_Request *Set_Buf)
-{
-	unsigned char result = FAIL;
-	unsigned char tx[9];
-	unsigned char rx[512];
-	unsigned char chksum = 0x00;
-
-	tx[0] = 0xaa;
-	tx[1] = 0x00;
-	tx[2] = targetAddr;
-	tx[3] = CMD_CONFIG_MCU_MODE;
-	tx[4] = 0x02;
-	tx[5] = 0x00;
-	tx[6] = Set_Buf->isLegacyRequest;
-	tx[7] = 0x00;
-
-	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
-		chksum ^= tx[6+idx];
-	tx[8] = chksum;
-
-	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
-
-	if(len > 6)
-	{
-		if (len < 6+(rx[4] | rx[5]<<8))
-			return result;
-
-		chksum = 0x00;
-		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
-		{
-			chksum ^= rx[6+idx];
-		}
-
-		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
-		   (rx[2] == tx[1]) &&
-		   (rx[1] == tx[2]) &&
-		   (rx[3] == tx[3]) &&
-		   (rx[6] == 0x01))
-		{
-			result = PASS;
-
-		}
-	}
-
-	return result;
-}
-
 unsigned char Config_AC_MCU_RESET_REQUEST(unsigned char fd, unsigned char targetAddr, Mcu_Reset_Request *Set_Buf)
 {
 	unsigned char result = FAIL;
@@ -1854,7 +1807,7 @@ int main(void)
 				//===============================
 				// Case 2-X : Config primary Relay
 				//===============================
-				if(Config_AC_MCU_RELAY(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1),&ShmCharger->gun_info[gun_index].legacyRequest))
+				if(Config_Relay_Output(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1),&ShmCharger->gun_info[gun_index].primaryMcuState.relayState))
 				{
 					failCount[gun_index] = 0;
 				}

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

@@ -1182,7 +1182,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.05.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.06.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -1592,6 +1592,9 @@ void setRelay(unsigned char gun_index,unsigned char isOn)
 		if(ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn == OFF)
 		{
 			ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = ON;
+			ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][0] = 0x01;
+			ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][1] = 0x01;
+			ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0x01;
 			DEBUG_INFO("Gun-%d Output relay sts: ON \r\n",gun_index);
 		}
 	}
@@ -1600,6 +1603,9 @@ void setRelay(unsigned char gun_index,unsigned char isOn)
 		if(ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn == ON)
 		{
 			ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = OFF;
+			ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][0] = 0;
+			ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][1] = 0;
+			ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0;
 			DEBUG_INFO("Gun-%d Output relay sts: OFF \r\n",gun_index);
 		}
 	}
@@ -2317,7 +2323,7 @@ int main(void)
 						}
 						
 						ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_DUTY_5;
-						ShmCharger->gun_info[gun_index].chargingMode = CHARGING_MODE_CP;
+						ShmCharger->gun_info[gun_index].chargingMode = CHARGING_MODE_BC;
 					}
 
 					if(((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B)) ||
@@ -2531,7 +2537,7 @@ int main(void)
 								ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_CP_STAT_E;
 								ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;						
 								ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_CP_STATE_E;
-								ShmCharger->gun_info[gun_index].chargingMode = CHARGING_MODE_CP;
+								ShmCharger->gun_info[gun_index].chargingMode = CHARGING_MODE_BC;
 								DEBUG_INFO("CCS 2 secs handshake timeout.\r\n");
 							}							
 							break;	
@@ -2573,9 +2579,7 @@ int main(void)
 								//refresh 180 secs timeout
 								ftime(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
 								ShmCharger->gun_info[gun_index].ccsHandshakeState = HANDSHAKE_NORMAL_CP;
-								DEBUG_INFO("Refresh handshake 180 secs timeout.\r\n");
-								
-								setRelay(gun_index,ON);
+								DEBUG_INFO("Refresh handshake 180 secs timeout.\r\n");								
 							}						
 							break;	
 						case HANDSHAKE_NORMAL_CP:
@@ -2627,6 +2631,8 @@ int main(void)
 								memcpy((char*)ShmOCPP16Data->StartTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StartTransaction[gun_index].IdTag));
 								
 								ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq = ON;
+								
+								setRelay(gun_index,ON);
 
 								setChargerMode(gun_index, SYS_MODE_CHARGING);
 							}						
@@ -2648,7 +2654,7 @@ int main(void)
 					}
 					switch(ShmCharger->gun_info[gun_index].chargingMode)
 					{
-						case CHARGING_MODE_CP:
+						case CHARGING_MODE_BC:
 							if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
 							   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop == ON) ||
 							   (ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq == ON)||
@@ -2856,8 +2862,8 @@ int main(void)
 								}
 							}						
 							break;
-						case CHARGING_MODE_CCS:
-							ShmCharger->gun_info[gun_index].chargingMode = CHARGING_MODE_CCS;
+						case CHARGING_MODE_HL:
+							
 							break;
 						default:
 							break;
@@ -2882,7 +2888,7 @@ int main(void)
 					}
 					switch(ShmCharger->gun_info[gun_index].chargingMode)
 					{
-						case CHARGING_MODE_CP:
+						case CHARGING_MODE_BC:
 								// If RFID SN different with start user, it need to authorize ID
 								if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
 								{
@@ -3041,7 +3047,7 @@ int main(void)
 									}
 								}
 								break;
-						case CHARGING_MODE_CCS:
+						case CHARGING_MODE_HL:
 								break;
 						default:
 								break;
@@ -3055,7 +3061,7 @@ int main(void)
 					
 					switch(ShmCharger->gun_info[gun_index].chargingMode)
 					{
-						case CHARGING_MODE_CP:
+						case CHARGING_MODE_BC:
 								if(ShmOCPP16Data->MsMsg.bits.ResetReq)
 								{
 									if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard")==0)
@@ -3098,7 +3104,7 @@ int main(void)
 								DB_Insert_Record(localDb, gun_index);
 								setChargerMode(gun_index, SYS_MODE_IDLE);
 								break;
-						case CHARGING_MODE_CCS:
+						case CHARGING_MODE_HL:
 								break;
 						default:
 								break;

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

@@ -132,8 +132,8 @@
 #define HANDSHAKE_NORMAL_CP				5
 #define HANDSHAKE_NORMAL_CCS			6
 
-#define	CHARGING_MODE_CP				0
-#define	CHARGING_MODE_CCS				1
+#define	CHARGING_MODE_BC				0
+#define	CHARGING_MODE_HL				1
 
 
 #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
@@ -263,6 +263,7 @@ typedef struct AC_PRIMARY_MCU
 	unsigned char pp_state;
 	unsigned char rating_current;
 	unsigned char rotatory_switch;
+	Relay	relayState;
 }Ac_Primary_Mcu;
 
 typedef struct AC_PRIMARY_MCU_ALARM

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


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


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


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


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


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


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


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