Ver Fonte

[Improve][AW-CCS][main.c][main.h]
Action:
1. Improve: Improve the system under complete mode.
2. Improve: Sleep changed to timer counter.
3. Improve: Detected gun status.
4. Improve: If the connector unplug during the complete mode, the system should auto change the mode to idle after display receipt 15 seconds.

File:
1. main.c & main.h
Action 1
Action 2
Action 3
Action 4

FIRMWARE VERSION:B0.63.XX.XXXX.PX

8009 há 2 anos atrás
pai
commit
e9a9640731
2 ficheiros alterados com 53 adições e 16 exclusões
  1. 52 15
      EVSE/Projects/AW-CCS/Apps/main.c
  2. 1 1
      EVSE/Projects/AW-CCS/Apps/main.h

+ 52 - 15
EVSE/Projects/AW-CCS/Apps/main.c

@@ -7603,25 +7603,62 @@ int main(void)
 					if(isModeChange(gun_index))
 					{
 						setLedMotion(gun_index, LED_ACTION_STOP);
-						sleep(6);
-						setRelay(gun_index, OFF);
-						setRequest(gun_index, OFF);
-						sleep(13);
+						refreshStartTimer(&startTime[gun_index][TMR_IDX_RECEIPT_INFORMATION]);
 					}
 
-					if(((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)) ||
-					   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE) && (!ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn)) ||
-					   ocpp_get_reset_req())
+					// Check the connector status
+					if((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS) || (ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC))
 					{
-						sleep(2);
-						ShmCharger->gun_info[gun_index].rfidReq = OFF;
-						ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
-						ocpp_set_remotestop(gun_index, OFF);
-						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStop = OFF;
-						ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = NO;
+						if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A))
+						{
+							if(ShmCharger->gun_info[gun_index].isGunUnpluggedBefore != YES)
+							{
+								ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = YES;
+								DEBUG_INFO("The connector was unplugged under SYS_MODE_COMPLETE. [CHARGING_MODE_BS / CHARGING_MODE_HLC]. \n");
+							}
+						}
+					}
+					else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE)
+					{
+						if(ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn != ON)
+						{
+							if(ShmCharger->gun_info[gun_index].isGunUnpluggedBefore != YES)
+							{
+								ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = YES;
+								DEBUG_INFO("The socket e was unplugged under SYS_MODE_COMPLETE. [CHARGING_MODE_SOCKETE]. \n");
+							}
+						}
+					}
+					else
+					{}
 
-						DB_Insert_Record(localDb, gun_index);
-						setChargerMode(gun_index, SYS_MODE_IDLE);
+					// Dispay receipt information for 15 seconds
+					if((getDiffSecNow(startTime[gun_index][TMR_IDX_RECEIPT_INFORMATION]) >= 15))
+					{
+						if(((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE) && (!ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn)) ||
+						   ocpp_get_reset_req() ||
+						   (ShmCharger->gun_info[gun_index].isGunUnpluggedBefore == YES))
+						{
+							sleep(2);
+							ShmCharger->gun_info[gun_index].rfidReq = OFF;
+							ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
+							ocpp_set_remotestop(gun_index, OFF);
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStop = OFF;
+							ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = NO;
+
+							DB_Insert_Record(localDb, gun_index);
+							setChargerMode(gun_index, SYS_MODE_IDLE);
+						}
+					}
+					else
+					{
+						// After 6 seconds Relay off & PWM off (specifcation)
+						if((getDiffSecNow(startTime[gun_index][TMR_IDX_RECEIPT_INFORMATION]) >= 6))
+						{
+							setRelay(gun_index, OFF);
+							setRequest(gun_index, OFF);
+						}
 					}
 
 					break;

+ 1 - 1
EVSE/Projects/AW-CCS/Apps/main.h

@@ -240,7 +240,7 @@ enum TIMER_IDX
 	TMR_IDX_CLEAN_REMOTE_START_WAIT,
 	TMR_IDX_PTB_METER_MESSAGE,
 	TMR_IDX_PTB_METER_SEND,
-	TMR_IDX_19,
+	TMR_IDX_RECEIPT_INFORMATION,
 	TMR_IDX_GUN_DETECT,
 	TMR_IDX_CNT
 };