瀏覽代碼

[Improve][AW-Regular / AW-ChargeLab / AW-CCS / Noodoe][main]

2021.08.23 / Folus Wen

Actions:
1. Polling timer prevent date time back to early value.

Files:
1. As follow commit history

Image version: V0.69.XX.XXXX.XX (AW-Regular / AW-ChargeLab)
               V0.53.XX.XXXX.NX (Noodoe)
               D0.55.XX.XXXX.XX (AW-CCS)
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 3 年之前
父節點
當前提交
e74f3b71cb

+ 3 - 3
EVSE/Projects/AW-CCS/Apps/main.c

@@ -4543,7 +4543,7 @@ int main(void)
 		//==============================================
 		// Period check for 10 seconds
 		//==============================================
-		if(DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) > 10000)
+		if((DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) > 10000) || (DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) < 0))
 		{
 			//==============================================
 			// Check task processing
@@ -5507,7 +5507,7 @@ int main(void)
 						ocpp_set_starttransaction_conf(gun_index, OFF);
 
 						// Charging profile preparation
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) < 0))
 						{
 							if(!ocpp_get_profile_conf(gun_index))
 							{
@@ -5698,7 +5698,7 @@ int main(void)
 						}
 
 						// Debug information
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) < 0))
 						{
 							DEBUG_INFO("==============================================================\n");
 							DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d \n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);

+ 62 - 5
EVSE/Projects/AW-ChargeLab/Apps/main.c

@@ -929,6 +929,27 @@ uint8_t ocpp_compare_reserve_id_with_remote_user(uint8_t gun_index)
 	return result;
 }
 
+uint8_t ocpp_isAuthorizeRemoteStart()
+{
+	uint8_t result = NO;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeRemoteTxRequests].ItemData, "TRUE"))
+		{
+			result = YES;
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_AuthorizeRemoteStart].variableAttribute[0].value, "TRUE"))
+		{
+			result = YES;
+		}
+	}
+
+	return result;
+}
 
 //======================================================
 // Check interface status
@@ -3578,7 +3599,7 @@ int main(void)
 		//==============================================
 		// Period check for 10 seconds
 		//==============================================
-		if(DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) > 10000)
+		if((DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) > 10000) || (DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) < 0))
 		{
 			//==============================================
 			// Check task processing
@@ -3948,6 +3969,11 @@ int main(void)
 									break;
 							}
 						}
+						else if(ocpp_isAuthorizeRemoteStart() && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND))
+						{
+							DEBUG_INFO("Remote start request authorize.\n");
+							ocpp_set_auth_req(ON, "ISO14443");
+						}
 					}
 					
 					if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH)
@@ -3995,6 +4021,37 @@ int main(void)
 								}
 								break;
 							case START_METHOD_BACKEND:
+								if(ocpp_isAuthorizeRemoteStart())
+								{
+									if(ocpp_get_auth_conf())
+									{
+										if(ocpp_get_auth_result(gun_index))
+										{
+											memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+
+											DEBUG_INFO("Authorize pass.\n");
+											setSpeaker(ON,SPEAKER_SHORT);
+											setLedMotion(gun_index,LED_ACTION_RFID_PASS);
+											sleep(3);
+											setChargerMode(gun_index, SYS_MODE_PREPARING);
+										}
+										else
+										{
+											DEBUG_INFO("Authorize fail.\n");
+											setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
+											setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
+											sleep(3);
+											setChargerMode(gun_index, SYS_MODE_IDLE);
+										}
+										ocpp_set_auth_conf(OFF);
+									}
+								}
+								else
+								{
+									setSpeaker(ON,SPEAKER_SHORT);
+									setChargerMode(gun_index, SYS_MODE_PREPARING);
+								}
+								break;
 							case START_METHOD_BLE:
 							case START_METHOD_FREE:
 							default:
@@ -4233,7 +4290,7 @@ int main(void)
 						ocpp_set_starttransaction_conf(gun_index, OFF);
 
 						// Charging profile preparation
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) < 0))
 						{
 							if(!ocpp_get_profile_conf(gun_index))
 							{
@@ -4293,7 +4350,7 @@ int main(void)
 						}
 
 						// Debug information
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) < 0))
 						{
 							DEBUG_INFO("=============================================================\n");
 							DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
@@ -4565,7 +4622,7 @@ int main(void)
 						}
 
 						// Charging profile preparation
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) < 0))
 						{
 							if(!ocpp_get_profile_conf(gun_index))
 							{
@@ -4586,7 +4643,7 @@ int main(void)
 						}
 
 						// Debug information
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) < 0))
 						{
 							DEBUG_INFO("=============================================================\n");
 							DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);

+ 5 - 5
EVSE/Projects/AW-Regular/Apps/main.c

@@ -3599,7 +3599,7 @@ int main(void)
 		//==============================================
 		// Period check for 10 seconds
 		//==============================================
-		if(DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) > 10000)
+		if((DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) > 10000) || (DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) < 0))
 		{
 			//==============================================
 			// Check task processing
@@ -4290,7 +4290,7 @@ int main(void)
 						ocpp_set_starttransaction_conf(gun_index, OFF);
 
 						// Charging profile preparation
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) < 0))
 						{
 							if(!ocpp_get_profile_conf(gun_index))
 							{
@@ -4350,7 +4350,7 @@ int main(void)
 						}
 
 						// Debug information
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) < 0))
 						{
 							DEBUG_INFO("=============================================================\n");
 							DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
@@ -4622,7 +4622,7 @@ int main(void)
 						}
 
 						// Charging profile preparation
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) < 0))
 						{
 							if(!ocpp_get_profile_conf(gun_index))
 							{
@@ -4643,7 +4643,7 @@ int main(void)
 						}
 
 						// Debug information
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) < 0))
 						{
 							DEBUG_INFO("=============================================================\n");
 							DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);

+ 6 - 6
EVSE/Projects/Noodoe/Apps/main.c

@@ -2066,7 +2066,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, "V0.52.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "V0.53.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -3376,7 +3376,7 @@ int main(void)
 		//==============================================
 		// Period check for 10 seconds
 		//==============================================
-		if(DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) > 10000)
+		if((DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) > 10000) || (DiffTimebWithNow(startTime[0][TMR_IDX_CHECK_TASK]) < 0))
 		{
 			//==============================================
 			// Check task processing
@@ -4069,7 +4069,7 @@ int main(void)
 						ocpp_set_starttransaction_conf(gun_index, OFF);
 
 						// Charging profile preparation
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) < 0))
 						{
 							if(!ocpp_get_profile_conf(gun_index))
 							{
@@ -4129,7 +4129,7 @@ int main(void)
 						}
 
 						// Debug information
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) < 0))
 						{
 							DEBUG_INFO("=============================================================\n");
 							DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
@@ -4419,7 +4419,7 @@ int main(void)
 						}
 
 						// Charging profile preparation
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) < 0))
 						{
 							if(!ocpp_get_profile_conf(gun_index))
 							{
@@ -4440,7 +4440,7 @@ int main(void)
 						}
 
 						// Debug information
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+						if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT) || (DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) < 0))
 						{
 							DEBUG_INFO("=============================================================\n");
 							DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);