|
@@ -29,9 +29,9 @@
|
|
|
#define TMR_IDX_9 9
|
|
|
|
|
|
#define TIMEOUT_SPEC_HANDSHAKING 180000
|
|
|
-#define TIMEOUT_SPEC_AUTH 10000
|
|
|
+#define TIMEOUT_SPEC_AUTH 15000
|
|
|
#define TIMEOUT_SPEC_HANDSHAKING_LED 185000
|
|
|
-#define TIMEOUT_SPEC_LOGPPRINTOUT 20000
|
|
|
+#define TIMEOUT_SPEC_LOGPPRINTOUT 30000
|
|
|
|
|
|
#define MtdBlockSize 0x600000
|
|
|
|
|
@@ -1075,7 +1075,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.17.60.6007.B0");
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.18.60.XXXX.B0");
|
|
|
|
|
|
// Get AC connector type from model name
|
|
|
for(uint8_t idx=0;idx<3;idx++)
|
|
@@ -2004,13 +2004,13 @@ int main(void)
|
|
|
//==========================================
|
|
|
if(ShmOCPP16Data->MsMsg.bits.ResetReq)
|
|
|
{
|
|
|
- if((!isMode(0, SYS_MODE_CHARGING) && !isMode(0, SYS_MODE_TERMINATING) && !isMode(0, SYS_MODE_COMPLETE)) &&
|
|
|
- (AC_QUANTITY>1?(!isMode(1, SYS_MODE_CHARGING) && !isMode(1, SYS_MODE_TERMINATING) && !isMode(1, SYS_MODE_COMPLETE)):true))
|
|
|
+ if((!isMode(0, SYS_MODE_CHARGING) && !isMode(0, SYS_MODE_TERMINATING) && !isMode(0, SYS_MODE_COMPLETE)) &&
|
|
|
+ (AC_QUANTITY>1?(!isMode(1, SYS_MODE_CHARGING) && !isMode(1, SYS_MODE_TERMINATING) && !isMode(0, SYS_MODE_COMPLETE)):true))
|
|
|
{
|
|
|
ShmOCPP16Data->MsMsg.bits.ResetReq = OFF;
|
|
|
sprintf((char*)ShmOCPP16Data->Reset.ResponseStatus, "Accepted");
|
|
|
ShmOCPP16Data->MsMsg.bits.ResetConf = ON;
|
|
|
-
|
|
|
+
|
|
|
if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard") == 0)
|
|
|
{
|
|
|
system("sync");
|
|
@@ -2022,7 +2022,6 @@ int main(void)
|
|
|
else
|
|
|
{
|
|
|
close(wtdFd);
|
|
|
- sleep(5);
|
|
|
system("/usr/bin/run_evse_restart.sh");
|
|
|
}
|
|
|
}
|
|
@@ -2127,10 +2126,10 @@ int main(void)
|
|
|
if(ShmOCPP16Data->CsMsg.bits[gun_index].UnlockConnectorReq == ON)
|
|
|
{
|
|
|
ShmOCPP16Data->CsMsg.bits[gun_index].UnlockConnectorReq = OFF;
|
|
|
-
|
|
|
- sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "Unlocked");
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "NotSupported");
|
|
|
ShmOCPP16Data->CsMsg.bits[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].UnlockConnectorConf = ON;
|
|
|
-
|
|
|
+
|
|
|
ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = ON;
|
|
|
}
|
|
|
|
|
@@ -2474,17 +2473,7 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
ftime(&startChargingTime[gun_index]);
|
|
|
ftime(&startTime[gun_index][TMR_IDX_LOGPPRINTOUT]);
|
|
|
- }
|
|
|
-
|
|
|
- // Charging profile preparation
|
|
|
- if(!ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf)
|
|
|
- {
|
|
|
- ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq = ON;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf = OFF;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
|
|
|
(ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop == ON) ||
|
|
@@ -2624,6 +2613,16 @@ int main(void)
|
|
|
// Debug information
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
|
|
|
{
|
|
|
+ // Charging profile preparation
|
|
|
+ if(!ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq = ON;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf = OFF;
|
|
|
+ }
|
|
|
+
|
|
|
DEBUG_INFO("=======================================================================\r\n");
|
|
|
DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d \r\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
|
|
|
DEBUG_INFO("ShmCharger->gun_info[%d].primaryMcuCp_Pwn_Duty.max_current: %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
|
|
@@ -2788,7 +2787,8 @@ int main(void)
|
|
|
if((ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
|
|
|
(ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
|
|
|
!ShmOCPP16Data->OcppConnStatus ) &&
|
|
|
- (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod != START_METHOD_BLE))
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod != START_METHOD_BLE) ||
|
|
|
+ (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
|
|
|
{
|
|
|
if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
|
|
|
(ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
|
|
@@ -2885,7 +2885,7 @@ int main(void)
|
|
|
}
|
|
|
else if(ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON)
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP16Data->StopTransaction[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].StopReason, "UnlockCommand");
|
|
|
+ sprintf((char*)ShmOCPP16Data->StopTransaction[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].StopReason, "UnlockCommand");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2908,6 +2908,7 @@ int main(void)
|
|
|
|
|
|
break;
|
|
|
case SYS_MODE_ALARM:
|
|
|
+
|
|
|
if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus == SYS_MODE_CHARGING) ||
|
|
|
(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus == SYS_MODE_TERMINATING))
|
|
|
{
|
|
@@ -2917,7 +2918,7 @@ int main(void)
|
|
|
{
|
|
|
setRelay(gun_index, OFF);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode == 0))
|
|
|
{
|
|
|
if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus == SYS_MODE_CHARGING) ||
|
|
@@ -3068,6 +3069,81 @@ int main(void)
|
|
|
ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq = OFF;
|
|
|
ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationConf = ON;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Check is there RFID or back end request start
|
|
|
+ if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
|
|
|
+ (ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq == ON))
|
|
|
+ {
|
|
|
+ if((ShmCharger->gun_info[gun_index].rfidReq == ON))
|
|
|
+ {
|
|
|
+ memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
|
|
|
+ {
|
|
|
+ // Big endian
|
|
|
+ switch(rfid.snType)
|
|
|
+ {
|
|
|
+ case RFID_SN_TYPE_6BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_7BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_10BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_4BYTE:
|
|
|
+ default:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Little endian
|
|
|
+ switch(rfid.snType)
|
|
|
+ {
|
|
|
+ case RFID_SN_TYPE_6BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_7BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_10BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_4BYTE:
|
|
|
+ default:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) == 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Start Method in reservation : RFID...\r\n");
|
|
|
+ DEBUG_INFO("Start request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
|
|
|
+ DEBUG_INFO("Reservation User Id : %s\r\n", ShmOCPP16Data->ReserveNow[gun_index].IdTag);
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_RFID;
|
|
|
+ setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
|
|
|
+ }
|
|
|
+
|
|
|
+ ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq)
|
|
|
+ {
|
|
|
+ if(strcmp((char*)ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) == 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Start Method in reservation: BACKEND...\r\n");
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BACKEND;
|
|
|
+ memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, ARRAY_SIZE(ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag));
|
|
|
+ setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
|
|
|
+ }
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq = OFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
case SYS_MODE_BOOKING:
|