|
@@ -53,9 +53,12 @@
|
|
|
#define UPGRADE_AC 0x05
|
|
|
#define UPGRADE_LED 0x06
|
|
|
#define SYSTEM_MIN_VOL 150
|
|
|
+#define MIN_OUTPUT_CUR 0
|
|
|
+#define AC_OUTPUT_VOL 220
|
|
|
|
|
|
#define NO_DEFINE 255
|
|
|
#define DEFAULT_AC_INDEX 2
|
|
|
+#define PSU_MIN_CUR 100
|
|
|
|
|
|
#define DB_FILE "/Storage/ChargeLog/localCgargingRecord.db"
|
|
|
|
|
@@ -1101,6 +1104,9 @@ void InitialShareMemoryInfo()
|
|
|
sprintf((char *)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId, " ");
|
|
|
sprintf((char *)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd, " ");
|
|
|
|
|
|
+ ShmSysConfigAndInfo->SysConfig.TotalConnectorCount = 0;
|
|
|
+ ShmSysConfigAndInfo->SysConfig.AcConnectorCount = 0;
|
|
|
+
|
|
|
ShmSysConfigAndInfo->SysInfo.FactoryConfiguration = 0;
|
|
|
ShmSysConfigAndInfo->SysInfo.InputVoltageR = 0;
|
|
|
ShmSysConfigAndInfo->SysInfo.InputVoltageS = 0;
|
|
@@ -1194,7 +1200,7 @@ void InitialShareMemoryInfo()
|
|
|
else if (strcmp(EvsePower, "36") == EQUAL)
|
|
|
buf_pow = 360;
|
|
|
|
|
|
- ShmSysConfigAndInfo->SysConfig.RatingCurrent = (buf_pow / 30) * 100;
|
|
|
+ ShmSysConfigAndInfo->SysConfig.RatingCurrent = (buf_pow / 30) * PSU_MIN_CUR;
|
|
|
|
|
|
if(ShmSysConfigAndInfo->SysConfig.MaxChargingPower == 0 ||
|
|
|
ShmSysConfigAndInfo->SysConfig.MaxChargingPower > buf_pow)
|
|
@@ -1250,6 +1256,7 @@ int Initialization()
|
|
|
if (ac_chargingInfo[count]->Type == _Type_AC)
|
|
|
{
|
|
|
ac_chargingInfo[count]->SelfTest_Comp = NO;
|
|
|
+ strcpy((char *)ShmOCPP16Data->StatusNotification[count + ShmSysConfigAndInfo->SysConfig.TotalConnectorCount].ErrorCode, "NoError");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1720,23 +1727,23 @@ bool isEvStopCharging_ccs(byte gunIndex)
|
|
|
void DisplayChargingInfo()
|
|
|
{
|
|
|
PRINTF_FUNC("*********** DisplayChargingInfo *********** \n");
|
|
|
- if (ShmSysConfigAndInfo->SysConfig.AcConnectorCount > 0 &&
|
|
|
- ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc == NO_DEFINE &&
|
|
|
- ac_chargingInfo[0]->SystemStatus >= S_PREPARNING && ac_chargingInfo[0]->SystemStatus <= S_COMPLETE)
|
|
|
- {
|
|
|
- ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc = DEFAULT_AC_INDEX;
|
|
|
- }
|
|
|
- else
|
|
|
+ for (byte i = 0; i < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; i++)
|
|
|
{
|
|
|
- for (byte i = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount - 1; i >= 0; i--)
|
|
|
- {
|
|
|
- if (chargingInfo[i]->SystemStatus != S_IDLE)
|
|
|
+ if (chargingInfo[i]->SystemStatus != S_IDLE &&
|
|
|
+ chargingInfo[i]->SystemStatus != S_RESERVATION)
|
|
|
{
|
|
|
ChangeGunSelectByIndex(i);
|
|
|
- break;
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (ShmSysConfigAndInfo->SysConfig.AcConnectorCount > 0 &&
|
|
|
+ ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc == NO_DEFINE &&
|
|
|
+ ac_chargingInfo[0]->SystemStatus >= S_PREPARNING && ac_chargingInfo[0]->SystemStatus <= S_COMPLETE)
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc = DEFAULT_AC_INDEX;
|
|
|
}
|
|
|
+
|
|
|
usleep(50000);
|
|
|
ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
|
|
|
}
|
|
@@ -2209,6 +2216,46 @@ void ChkPrimaryStatus()
|
|
|
{
|
|
|
leftBtnPush = true;
|
|
|
PRINTF_FUNC("left btn down............................... \n");
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc != NO_DEFINE)
|
|
|
+ {
|
|
|
+ switch(ac_chargingInfo[0]->SystemStatus)
|
|
|
+ {
|
|
|
+ case S_IDLE:
|
|
|
+ {
|
|
|
+ if(isDetectPlugin())
|
|
|
+ {
|
|
|
+ _DetectPlugInTimeout();
|
|
|
+ StopSystemTimeoutDet();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case S_REASSIGN_CHECK:
|
|
|
+ case S_REASSIGN:
|
|
|
+ case S_PREPARNING:
|
|
|
+ case S_PREPARING_FOR_EV:
|
|
|
+ case S_PREPARING_FOR_EVSE:
|
|
|
+ case S_CCS_PRECHARGE_ST0:
|
|
|
+ case S_CCS_PRECHARGE_ST1:
|
|
|
+ {
|
|
|
+ // 取消充電
|
|
|
+ AcChargingTerminalProcess();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case S_CHARGING:
|
|
|
+ {
|
|
|
+ if (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE)
|
|
|
+ {
|
|
|
+ // 停止充電
|
|
|
+ AcChargingTerminalProcess();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case S_COMPLETE:
|
|
|
+ {}
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
switch(chargingInfo[ShmSysConfigAndInfo->SysInfo.CurGunSelected]->SystemStatus)
|
|
|
{
|
|
|
case S_IDLE:
|
|
@@ -2229,6 +2276,9 @@ void ChkPrimaryStatus()
|
|
|
case S_CCS_PRECHARGE_ST1:
|
|
|
{
|
|
|
// 取消充電
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc != NO_DEFINE)
|
|
|
+ AcChargingTerminalProcess();
|
|
|
+ else
|
|
|
ChargingTerminalProcess(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
|
|
|
}
|
|
|
break;
|
|
@@ -2815,9 +2865,9 @@ bool AddGunInfoByConnector(byte typeValue, byte slots)
|
|
|
ac_chargingInfo[_acgunIndex] = &ShmSysConfigAndInfo->SysInfo.AcChargingData[_ac_Index];
|
|
|
|
|
|
// AC 固定 index
|
|
|
- ac_chargingInfo[_acgunIndex]->Index = 1;
|
|
|
+ ac_chargingInfo[_acgunIndex]->Index = 0;
|
|
|
ac_chargingInfo[_acgunIndex]->ReservationId = -1;
|
|
|
- ac_chargingInfo[_acgunIndex]->SystemStatus = S_BOOTING;
|
|
|
+ ac_chargingInfo[_acgunIndex]->SystemStatus = S_IDLE;
|
|
|
ac_chargingInfo[_acgunIndex]->Type = _Type_AC;
|
|
|
ac_chargingInfo[_acgunIndex]->IsAvailable = YES;
|
|
|
_ac_Index++;
|
|
@@ -2917,6 +2967,9 @@ bool CheckConnectorTypeStatus()
|
|
|
slots++;
|
|
|
}
|
|
|
|
|
|
+ // AC index 接在 DC 後面
|
|
|
+ ac_chargingInfo[0]->Index += _gunIndex;
|
|
|
+
|
|
|
ShmSysConfigAndInfo->SysConfig.TotalConnectorCount = _gunIndex;
|
|
|
ShmSysConfigAndInfo->SysConfig.AcConnectorCount = _acgunIndex;
|
|
|
PRINTF_FUNC("DC _gunCount = %d, AC _gunCount = %d \n",
|
|
@@ -3762,14 +3815,39 @@ bool OcppRemoteStop(byte gunIndex)
|
|
|
|
|
|
void OcppRemoteStartChk()
|
|
|
{
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.OrderCharging != 255)
|
|
|
+ PRINTF_FUNC("OrderCharging = %d \n", ShmSysConfigAndInfo->SysInfo.OrderCharging);
|
|
|
+
|
|
|
if (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == _OFFLINE_POLICY_NO_CHARGING)
|
|
|
{}
|
|
|
else if(!isDetectPlugin())
|
|
|
{
|
|
|
+ // 如果有 AC 槍,則固定是第 2 把槍,所以索引固定為 1
|
|
|
+ byte acDirIndex = ShmSysConfigAndInfo->SysConfig.AcConnectorCount;
|
|
|
+
|
|
|
+ for (byte ac_index = 0; ac_index < ShmSysConfigAndInfo->SysConfig.AcConnectorCount; ac_index++)
|
|
|
+ {
|
|
|
+ if ((ac_chargingInfo[ac_index]->SystemStatus == S_IDLE || ac_chargingInfo[ac_index]->SystemStatus == S_RESERVATION)&&
|
|
|
+ ShmOCPP16Data->CsMsg.bits[acDirIndex].RemoteStartTransactionReq == YES)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->CsMsg.bits[acDirIndex].RemoteStartTransactionReq = NO;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.OrderCharging = DEFAULT_AC_INDEX;
|
|
|
+ ShmOCPP16Data->CsMsg.bits[ShmSysConfigAndInfo->SysConfig.TotalConnectorCount + ac_index].RemoteStartTransactionReq = NO;
|
|
|
+ DetectPluginStart();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ byte threeGunIndex = 0;
|
|
|
+
|
|
|
for (byte gun_index = 0; gun_index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gun_index++)
|
|
|
{
|
|
|
+ // 如果有 AC 槍,且 DC 槍也有兩把
|
|
|
+ if (acDirIndex == 1 && gun_index == 1)
|
|
|
+ threeGunIndex = 1;
|
|
|
+
|
|
|
if ((chargingInfo[gun_index]->SystemStatus == S_IDLE || chargingInfo[gun_index]->SystemStatus == S_RESERVATION)&&
|
|
|
- ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq == YES)
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index + threeGunIndex].RemoteStartTransactionReq == YES)
|
|
|
{
|
|
|
ShmSysConfigAndInfo->SysInfo.OrderCharging = gun_index;
|
|
|
ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq = NO;
|
|
@@ -4594,41 +4672,7 @@ int main(void)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
|
|
|
ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_IDLE;
|
|
|
-
|
|
|
- if ((ShmSysConfigAndInfo->SysConfig.TotalConnectorCount + ShmSysConfigAndInfo->SysConfig.AcConnectorCount) > 1 &&
|
|
|
- ShmSysConfigAndInfo->SysInfo.PageIndex != _LCM_AUTHORIZING &&
|
|
|
- ShmSysConfigAndInfo->SysInfo.PageIndex != _LCM_AUTHORIZ_FAIL &&
|
|
|
- ShmSysConfigAndInfo->SysInfo.PageIndex != _LCM_AUTHORIZ_COMP &&
|
|
|
- ShmSysConfigAndInfo->SysInfo.PageIndex != _LCM_WAIT_FOR_PLUG)
|
|
|
- {
|
|
|
- bool isReturnTimeout = false;
|
|
|
- for (byte count = 0; count < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; count++)
|
|
|
- {
|
|
|
- if (count != ShmSysConfigAndInfo->SysInfo.CurGunSelected ||
|
|
|
- (ShmSysConfigAndInfo->SysConfig.AcConnectorCount > 0 &&
|
|
|
- ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc == DEFAULT_AC_INDEX))
|
|
|
- {
|
|
|
- if ((chargingInfo[count]->SystemStatus >= S_REASSIGN_CHECK && chargingInfo[count]->SystemStatus <= S_COMPLETE) ||
|
|
|
- (chargingInfo[count]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[count]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
- {
|
|
|
- isReturnTimeout = true;
|
|
|
- StartSystemTimeoutDet(Timeout_ReturnToChargingGunDet);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!isReturnTimeout && ShmSysConfigAndInfo->SysConfig.AcConnectorCount > 0 &&
|
|
|
- ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc == NO_DEFINE &&
|
|
|
- ac_chargingInfo[0]->SystemStatus >= S_PREPARNING && ac_chargingInfo[0]->SystemStatus <= S_COMPLETE)
|
|
|
- {
|
|
|
- isReturnTimeout = true;
|
|
|
- StartSystemTimeoutDet(Timeout_ReturnToChargingGunDet);
|
|
|
}
|
|
|
-
|
|
|
- if (!isReturnTimeout)
|
|
|
- StopSystemTimeoutDet();
|
|
|
- }
|
|
|
- }
|
|
|
} // Idle 正常程序終點
|
|
|
}
|
|
|
|