Преглед изворни кода

Merge remote-tracking branch 'origin/AW-CCS'

FolusWen пре 2 година
родитељ
комит
e5445b5682
1 измењених фајлова са 35 додато и 13 уклоњено
  1. 35 13
      EVSE/Projects/AW-CCS/Apps/main.c

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

@@ -2734,7 +2734,7 @@ int SpawnTask(uint8_t gun_index)
 			system("/root/Module_Wifi &");
 		}
 
-		system("/root/Module_EventLogging &");
+		system ("/root/Module_EventLogging &");
 		system ("/root/Module_AlarmDetect &");
 		system ("/root/Module_InternalComm &");
 		system ("/root/Module_Speaker &");
@@ -5019,8 +5019,6 @@ void checkRfidAuthrize()
 				{
 					if(!isCheckdResult)
 					{
-						DEBUG_INFO("Authorize pass.\n");
-						setSpeaker(ON, SPEAKER_SHORT);
 						refreshStartTimer(&startTime[0][TMR_IDX_GUN_DETECT]);
 						ShmCharger->isGetAuthResult = TRUE;
 						isCheckdResult = TRUE;
@@ -5031,14 +5029,24 @@ void checkRfidAuthrize()
 						}
 
 						for(int gun_index = 0;gun_index<AC_QUANTITY;gun_index++)
-							ShmCharger->gun_info[gun_index].resultAuthorization = VALIDATED_RFID;
-
-						if((ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus == SYS_MODE_RESERVATION) && (strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmOCPP16Data->ReserveNow[ShmCharger->gun_selectd].IdTag) != 0))
 						{
-							for(int gun_index = 0;gun_index<AC_QUANTITY;gun_index++)
-								ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
+							if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_RESERVATION) &&
+							   (strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) != 0))
+							{
+								sleep(1);
+								ShmCharger->gun_info[gun_index].resultAuthorization = UNVALIDATED_RFID;
+								isStartByWrongReservation = YES;
 
-							isStartByWrongReservation = YES;
+								DEBUG_INFO("Not match: UserId = [%s] / Reserve IdTag = [%s] \n", ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->ReserveNow[ShmCharger->gun_selectd].IdTag);
+								DEBUG_INFO("Authorize fail.\n");
+								setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
+							}
+							else
+							{
+								ShmCharger->gun_info[gun_index].resultAuthorization = VALIDATED_RFID;
+								DEBUG_INFO("Authorize pass.\n");
+								setSpeaker(ON, SPEAKER_SHORT);
+							}
 						}
 					}
 
@@ -5057,6 +5065,8 @@ void checkRfidAuthrize()
 									setLedMotion(gun_index,LED_ACTION_IDLE);
 									ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
 								}
+
+								setSpeaker(ON, SPEAKER_SHORT);
 								ShmCharger->isAuthrizing = FALSE;
 							}
 						}
@@ -5086,14 +5096,27 @@ void checkRfidAuthrize()
 					}
 					else
 					{
-						DEBUG_INFO("Connector action detect timeout.\n");
+						if(isStartByWrongReservation != YES)
+							DEBUG_INFO("Connector action detect timeout. \n");
+						else
+							DEBUG_INFO("User Id and reservation IdTag is not match. \n");
+
 						ShmCharger->isAuthrizing = FALSE;
 						ShmCharger->isGetAuthResult = TRUE;
 
 						for(int gun_index = 0;gun_index<AC_QUANTITY;gun_index++)
 						{
-							setLedMotion(gun_index,LED_ACTION_HANDSHAKE_FAIL);
-							sleep(6);
+							if(isStartByWrongReservation != YES)
+							{
+								setLedMotion(gun_index,LED_ACTION_HANDSHAKE_FAIL);
+								sleep(6);
+							}
+							else
+							{
+								setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
+								sleep(3);
+							}
+
 							setLedMotion(gun_index,LED_ACTION_IDLE);
 							ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
 						}
@@ -5425,7 +5448,6 @@ int main(void)
 			{
 				if(ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON)
 				{
-
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent)/1000;
 
 					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower <= 1.0)