|
@@ -56,10 +56,10 @@ void setSpeaker(unsigned char isOn, unsigned char speaker_mode);
|
|
|
//==========================
|
|
|
#define MODULE_EWT 0
|
|
|
|
|
|
-int rfidFd = -1;
|
|
|
-char* rfidPortName = "/dev/ttyS2";
|
|
|
-RFID rfid;
|
|
|
-char *valid_Internet[2] = {"8.8.8.8", "180.76.76.76"};
|
|
|
+int rfidFd = -1;
|
|
|
+char* rfidPortName = "/dev/ttyS2";
|
|
|
+RFID rfid;
|
|
|
+char *valid_Internet[2] = {"8.8.8.8", "180.76.76.76"};
|
|
|
|
|
|
//==========================
|
|
|
// Declare share memory
|
|
@@ -896,7 +896,7 @@ void get_firmware_version(unsigned char gun_index)
|
|
|
}
|
|
|
|
|
|
// Get CSU root file system version
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.01.40.0007.PH");
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.02.40.0007.PH");
|
|
|
|
|
|
// Get MCU firmware version
|
|
|
strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
|
|
@@ -908,7 +908,6 @@ void get_firmware_version(unsigned char gun_index)
|
|
|
DEBUG_INFO("CSU MCU-%2d firmware version: %s\r\n", gun_index, ShmCharger->gun_info[gun_index].ver.Version_FW);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//===============================================
|
|
|
// Upgrade firmware
|
|
|
//===============================================
|
|
@@ -1472,9 +1471,6 @@ int main(void)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- /*
|
|
|
- * TODO: Soft reset need to restart evse process
|
|
|
- */
|
|
|
system("/usr/bin/run_evse_restart.sh");
|
|
|
}
|
|
|
}
|
|
@@ -1532,12 +1528,35 @@ int main(void)
|
|
|
ShmOCPP16Data->CsMsg.bits[gun_index].ReserveNowConf = ON;
|
|
|
}
|
|
|
|
|
|
+ // Change availability check
|
|
|
+ if(ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq)
|
|
|
+ {
|
|
|
+ if(strcmp((char*)ShmOCPP16Data->ChangeAvailability[gun_index].Type, "Operative") == 0)
|
|
|
+ {
|
|
|
+ if(isMode(gun_index, SYS_MODE_MAINTAIN))
|
|
|
+ {
|
|
|
+ setChargerMode(gun_index, SYS_MODE_IDLE);
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = OFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(isMode(gun_index, SYS_MODE_IDLE))
|
|
|
+ {
|
|
|
+ setChargerMode(gun_index, SYS_MODE_MAINTAIN);
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = OFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// Connector process
|
|
|
switch(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus)
|
|
|
{
|
|
|
case SYS_MODE_BOOTING:
|
|
|
if(isModeChange(gun_index))
|
|
|
{
|
|
|
+ setLedMotion(gun_index,LED_ACTION_INIT);
|
|
|
+
|
|
|
//CSU Initialization & task spawn
|
|
|
if((Initialization() != PASS) ||
|
|
|
(SpawnTask() != PASS) )
|
|
@@ -1568,12 +1587,11 @@ int main(void)
|
|
|
setChargerMode(gun_index, SYS_MODE_IDLE);
|
|
|
}
|
|
|
|
|
|
- setLedMotion(gun_index,LED_ACTION_INIT);
|
|
|
-
|
|
|
break;
|
|
|
case SYS_MODE_IDLE:
|
|
|
if(isModeChange(gun_index))
|
|
|
{
|
|
|
+ setLedMotion(gun_index,LED_ACTION_IDLE);
|
|
|
setRelay(gun_index,OFF);
|
|
|
ShmCharger->rfidReq = OFF;
|
|
|
ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStart = OFF;
|
|
@@ -1673,12 +1691,11 @@ int main(void)
|
|
|
else
|
|
|
{}
|
|
|
|
|
|
- setLedMotion(gun_index,LED_ACTION_IDLE);
|
|
|
-
|
|
|
break;
|
|
|
case SYS_MODE_AUTHORIZING:
|
|
|
if(isModeChange(gun_index))
|
|
|
{
|
|
|
+ setLedMotion(gun_index,LED_ACTION_AUTHED);
|
|
|
ftime(&startTime[gun_index][TMR_IDX_AUTH]);
|
|
|
|
|
|
if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID)
|
|
@@ -1718,8 +1735,6 @@ int main(void)
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- setLedMotion(gun_index,LED_ACTION_AUTHED);
|
|
|
}
|
|
|
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH)
|
|
@@ -1769,21 +1784,12 @@ int main(void)
|
|
|
case SYS_MODE_PREPARING:
|
|
|
if(isModeChange(gun_index))
|
|
|
{
|
|
|
- /*
|
|
|
- * TODO:
|
|
|
- * 1. Request MCU start charging
|
|
|
- * 2. Enable handshaking watch dog in 180 seconds
|
|
|
- */
|
|
|
ftime(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
|
|
|
- setRelay(gun_index,ON);
|
|
|
+ setRelay(gun_index, ON);
|
|
|
}
|
|
|
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > TIMEOUT_SPEC_HANDSHAKING)
|
|
|
{
|
|
|
- /*
|
|
|
- * TODO:
|
|
|
- * 1. HANDSHAKING timeout process
|
|
|
- */
|
|
|
setLedMotion(gun_index, LED_ACTION_HANDSHAKE_FAIL);
|
|
|
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > TIMEOUT_SPEC_HANDSHAKING_LED)
|
|
@@ -1968,7 +1974,6 @@ int main(void)
|
|
|
/*
|
|
|
* TODO:
|
|
|
* 1. Record charging history.
|
|
|
- * 2. OCPP send stop transaction request & reason.
|
|
|
*/
|
|
|
if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == ON)
|
|
|
{
|
|
@@ -2138,11 +2143,6 @@ int main(void)
|
|
|
case SYS_MODE_RESERVATION:
|
|
|
if(isModeChange(gun_index))
|
|
|
{
|
|
|
- /*
|
|
|
- * TODO:
|
|
|
- * 1. LED control depend on relay status
|
|
|
- * 2. check reservation is overtime?
|
|
|
- */
|
|
|
setLedMotion(gun_index,LED_ACTION_MAINTAIN);
|
|
|
}
|
|
|
|
|
@@ -2171,7 +2171,6 @@ int main(void)
|
|
|
/*
|
|
|
* TODO:
|
|
|
* 1. LED control depend on relay status
|
|
|
- * 2. Check booking start is on time?
|
|
|
*/
|
|
|
}
|
|
|
|