Browse Source

[Improve][AW-CCS][main.c]
2022-08-25 / EASON YANG
Action:
1. Improve: checkHandshakeCountdown() function. Refresh handskake timer.

File:
1. main.c
Action 1

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

8009 2 years ago
parent
commit
d51b7e48df
1 changed files with 8 additions and 1 deletions
  1. 8 1
      EVSE/Projects/AW-CCS/Apps/main.c

+ 8 - 1
EVSE/Projects/AW-CCS/Apps/main.c

@@ -5000,7 +5000,10 @@ void checkHandshakeCountdown(uint8_t gun_index)
 			break;
 		case SYS_MODE_PREPARING:
 
-			ShmCharger->timeoutSpec.Handshake_Timeout = ((ocpp_get_connection_timeout()) - getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]));
+			if(ShmCharger->gun_info[ShmCharger->gun_selectd].isHandshakeTimerRefresh == YES)
+				refreshStartTimer(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
+			else
+				ShmCharger->timeoutSpec.Handshake_Timeout = ((ocpp_get_connection_timeout()) - getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]));
 
 			break;
 		case SYS_MODE_RESERVATION:
@@ -5191,6 +5194,7 @@ void checkRfidAuthrize()
 						}
 					}
 
+					// Check handshake timeout
 					for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
 						checkHandshakeCountdown(gun_index);
 
@@ -5908,6 +5912,7 @@ int main(void)
 						previousData[gun_index].current_limit = 0;
 					}
 
+					// Check handshake timeout
 					checkHandshakeCountdown(gun_index);
 
 					// LED status in Idle mode
@@ -6646,7 +6651,9 @@ int main(void)
 						ShmCharger->gun_info[gun_index].rfidReq = OFF;
 					}
 
+					// Check handshake timeout
 					checkHandshakeCountdown(gun_index);
+
 					if(getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > ShmCharger->timeoutSpec.Present_Timeout_Spec)
 					{
 						setLedMotion(gun_index, LED_ACTION_HANDSHAKE_FAIL);