|
@@ -1876,7 +1876,7 @@ int DB_variableClear(sqlite3 *db)
|
|
|
DEBUG_INFO("Drop table failed.\n");
|
|
|
result = FAIL;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
DEBUG_INFO("Drop table succeed.\n");
|
|
|
}
|
|
|
|
|
@@ -3248,7 +3248,7 @@ void setChargerMode(unsigned char gun_index, unsigned char mode)
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus = ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus;
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus = mode;
|
|
|
|
|
|
- DEBUG_INFO("Gun-%02d mode switch from %s to %s\n", gun_index, getSystemModeName(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus), getSystemModeName(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus));
|
|
|
+ DEBUG_INFO("Gun-[%d] mode switch from %s to %s\n", gun_index, getSystemModeName(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus), getSystemModeName(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus));
|
|
|
}
|
|
|
|
|
|
unsigned char isMode(unsigned char gun_index, unsigned char mode)
|
|
@@ -3911,7 +3911,7 @@ void setRequest(unsigned char gun_index,unsigned char isOn)
|
|
|
if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == OFF)
|
|
|
{
|
|
|
ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest = ON;
|
|
|
- DEBUG_INFO("Gun-%d permission request: ON \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] permission request: ON \n",gun_index);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -3919,7 +3919,7 @@ void setRequest(unsigned char gun_index,unsigned char isOn)
|
|
|
if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == ON)
|
|
|
{
|
|
|
ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest = OFF;
|
|
|
- DEBUG_INFO("Gun-%d permission request: OFF \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] permission request: OFF \n",gun_index);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3951,22 +3951,22 @@ void setRelay(unsigned char gun_index,unsigned char isOn)
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0x01;
|
|
|
|
|
|
if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
|
|
|
- DEBUG_INFO("Gun-%d Output relay status: ON. [CHARGING_MODE_BS] \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] Output relay status: ON. [CHARGING_MODE_BS] \n",gun_index);
|
|
|
else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
|
|
|
- DEBUG_INFO("Gun-%d Output relay status: ON. [CHARGING_MODE_HLC] \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] Output relay status: ON. [CHARGING_MODE_HLC] \n",gun_index);
|
|
|
|
|
|
break;
|
|
|
case CHARGING_MODE_SOCKETE:
|
|
|
ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = ON;
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][3] = 0x01;
|
|
|
- DEBUG_INFO("Gun-%d Output relay status: ON. [CHARGING_MODE_SOCKETE] \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] Output relay status: ON. [CHARGING_MODE_SOCKETE] \n",gun_index);
|
|
|
break;
|
|
|
default:
|
|
|
ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = ON;
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][0] = 0x01;
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][1] = 0x01;
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0x01;
|
|
|
- DEBUG_INFO("Gun-%d Output relay status: ON. [DEFFAULT] \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] Output relay status: ON. [DEFFAULT] \n",gun_index);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -3985,22 +3985,22 @@ void setRelay(unsigned char gun_index,unsigned char isOn)
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0;
|
|
|
|
|
|
if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
|
|
|
- DEBUG_INFO("Gun-%d Output relay status: OFF. [CHARGING_MODE_BS] \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] Output relay status: OFF. [CHARGING_MODE_BS] \n",gun_index);
|
|
|
else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
|
|
|
- DEBUG_INFO("Gun-%d Output relay status: OFF. [CHARGING_MODE_HLC] \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] Output relay status: OFF. [CHARGING_MODE_HLC] \n",gun_index);
|
|
|
|
|
|
break;
|
|
|
case CHARGING_MODE_SOCKETE:
|
|
|
ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = OFF;
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][3] = 0;
|
|
|
- DEBUG_INFO("Gun-%d Output relay status: OFF. [CHARGING_MODE_SOCKETE] \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] Output relay status: OFF. [CHARGING_MODE_SOCKETE] \n",gun_index);
|
|
|
break;
|
|
|
default:
|
|
|
ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = OFF;
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][0] = 0;
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][1] = 0;
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0;
|
|
|
- DEBUG_INFO("Gun-%d Output relay status: OFF. [DEFFAULT] \n",gun_index);
|
|
|
+ DEBUG_INFO("Gun-[%d] Output relay status: OFF. [DEFFAULT] \n",gun_index);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -4996,7 +4996,7 @@ void checkChargingProfileLimit(uint8_t gun_index, uint8_t system_mode)
|
|
|
if(previousData[gun_index].primaryMcuCp_Pwn_Duty != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
|
|
|
{
|
|
|
DEBUG_INFO("==================================================\n");
|
|
|
- DEBUG_INFO("gun-%02d primaryMcuCp_Pwn_Duty: %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
|
|
|
+ DEBUG_INFO("gun-[%d] primaryMcuCp_Pwn_Duty: %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
|
|
|
DEBUG_INFO("==================================================\n");
|
|
|
previousData[gun_index].primaryMcuCp_Pwn_Duty = ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current;
|
|
|
}
|
|
@@ -5004,7 +5004,7 @@ void checkChargingProfileLimit(uint8_t gun_index, uint8_t system_mode)
|
|
|
if(ShmCharger->gun_info[gun_index].targetCurrent != previousData[gun_index].targetCurrent)
|
|
|
{
|
|
|
DEBUG_INFO("==================================================\n");
|
|
|
- DEBUG_INFO("gun-%02d targetCurrent: %d\n", gun_index, ShmCharger->gun_info[gun_index].targetCurrent);
|
|
|
+ DEBUG_INFO("gun-[%d] targetCurrent: %d\n", gun_index, ShmCharger->gun_info[gun_index].targetCurrent);
|
|
|
DEBUG_INFO("MaxChargingCurrent: %d \n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
|
|
|
DEBUG_INFO("==================================================\n");
|
|
|
previousData[gun_index].targetCurrent = ShmCharger->gun_info[gun_index].targetCurrent;
|
|
@@ -5013,7 +5013,7 @@ void checkChargingProfileLimit(uint8_t gun_index, uint8_t system_mode)
|
|
|
if(ShmCharger->gun_info[gun_index].primaryMcuState.current_limit != previousData[gun_index].current_limit)
|
|
|
{
|
|
|
DEBUG_INFO("==================================================\n");
|
|
|
- DEBUG_INFO("gun-%02d mcu current_limit: %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
|
|
|
+ DEBUG_INFO("gun-[%d] mcu current_limit: %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
|
|
|
DEBUG_INFO("==================================================\n");
|
|
|
previousData[gun_index].current_limit = ShmCharger->gun_info[gun_index].primaryMcuState.current_limit;
|
|
|
}
|
|
@@ -5736,6 +5736,70 @@ void checkMissingPtbMeterMessage(uint8_t gun_index)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void checkConnectorStatus(uint8_t gun_index)
|
|
|
+{
|
|
|
+ if((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS) || (ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC))
|
|
|
+ {
|
|
|
+ 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;
|
|
|
+
|
|
|
+ switch(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus)
|
|
|
+ {
|
|
|
+ case SYS_MODE_CHARGING:
|
|
|
+ DEBUG_INFO("Gun-[%d] is unplugged under: [CHARGING].\n", gun_index);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case SYS_MODE_TERMINATING:
|
|
|
+ DEBUG_INFO("Gun-[%d] is unplugged under: [TERMINATING].\n", gun_index);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case SYS_MODE_COMPLETE:
|
|
|
+ DEBUG_INFO("Gun-[%d] is unplugged under: [COMPLETE].\n", gun_index);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case SYS_MODE_ALARM:
|
|
|
+ DEBUG_INFO("Gun-[%d] is unplugged under: [COMPLETE].\n", gun_index);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+
|
|
|
+ switch(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus)
|
|
|
+ {
|
|
|
+ case SYS_MODE_CHARGING:
|
|
|
+ DEBUG_INFO("Socket_e-[%d] is unplugged under: [CHARGING].\n", gun_index);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case SYS_MODE_TERMINATING:
|
|
|
+ DEBUG_INFO("Socket_e-[%d] is unplugged under: [TERMINATING].\n", gun_index);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case SYS_MODE_COMPLETE:
|
|
|
+ DEBUG_INFO("Socket_e-[%d] is unplugged under: [COMPLETE].\n", gun_index);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case SYS_MODE_ALARM:
|
|
|
+ DEBUG_INFO("Socket_e-[%d] is unplugged under: [COMPLETE].\n", gun_index);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {}
|
|
|
+}
|
|
|
+
|
|
|
//======================================================
|
|
|
// Main process
|
|
|
//======================================================
|
|
@@ -7161,30 +7225,7 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
// If unplug the connector during a session, the system must stop charging and stop session.
|
|
|
- if((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS) || (ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC))
|
|
|
- {
|
|
|
- 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 CHARGING. [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 CHARGING. [CHARGING_MODE_SOCKETE]. \n");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {}
|
|
|
+ checkConnectorStatus(gun_index);
|
|
|
|
|
|
if((ShmCharger->gun_info[gun_index].isGunUnpluggedBefore == YES) ||
|
|
|
(ShmCharger->gun_info[gun_index].rfidReq == ON) ||
|
|
@@ -7436,30 +7477,7 @@ int main(void)
|
|
|
//}
|
|
|
|
|
|
// If unplug the connector during a session, the system must stop charging and stop session.
|
|
|
- if((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS) || (ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC))
|
|
|
- {
|
|
|
- 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 TERMINATING. [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 TERMINATING. [CHARGING_MODE_SOCKETE]. \n");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {}
|
|
|
+ checkConnectorStatus(gun_index);
|
|
|
|
|
|
// End authorize pass
|
|
|
if(((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index)) ||
|
|
@@ -7607,30 +7625,7 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
// Check the connector status
|
|
|
- if((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS) || (ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC))
|
|
|
- {
|
|
|
- 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
|
|
|
- {}
|
|
|
+ checkConnectorStatus(gun_index);
|
|
|
|
|
|
// Dispay receipt information for 15 seconds
|
|
|
if((getDiffSecNow(startTime[gun_index][TMR_IDX_RECEIPT_INFORMATION]) >= 15))
|
|
@@ -7666,32 +7661,8 @@ int main(void)
|
|
|
setLedMotion(gun_index,LED_ACTION_ALARM);
|
|
|
setRelay(gun_index, OFF);
|
|
|
|
|
|
- if((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS) || (ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC))
|
|
|
- {
|
|
|
- if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A))
|
|
|
- {
|
|
|
- setRequest(gun_index,OFF);
|
|
|
- if(ShmCharger->gun_info[gun_index].isGunUnpluggedBefore != YES)
|
|
|
- {
|
|
|
- ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = YES;
|
|
|
- DEBUG_INFO("The connector was unplugged under ALARM. [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)
|
|
|
- {
|
|
|
- setRequest(gun_index,OFF);
|
|
|
- if(ShmCharger->gun_info[gun_index].isGunUnpluggedBefore != YES)
|
|
|
- {
|
|
|
- ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = YES;
|
|
|
- DEBUG_INFO("The socket e was unplugged under ALARM. [CHARGING_MODE_SOCKETE]. \n");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {}
|
|
|
+ // Check the connector status
|
|
|
+ checkConnectorStatus(gun_index);
|
|
|
|
|
|
/*
|
|
|
* TODO:
|