|
@@ -458,7 +458,7 @@ bool _NeedDiagnostics = false;
|
|
|
//char* rfidPortName = "/dev/ttyS2";
|
|
|
#if ENABLE_PCBA_TEST == 0
|
|
|
char* fwVersion = "V2.05.00.0000.00";
|
|
|
-char* subVersion = "03";
|
|
|
+char* subVersion = "04";
|
|
|
#else
|
|
|
char* fwVersion = "PCBA.00.04";
|
|
|
char* subVersion = "00";
|
|
@@ -2104,72 +2104,8 @@ void GetFirmwareVersion()
|
|
|
sprintf(ShmChargerInfo->SysMisc.MainVersion, fwVersion);
|
|
|
sprintf(ShmChargerInfo->SysMisc.SubVersion, subVersion);
|
|
|
#if ENABLE_PCBA_TEST == 0
|
|
|
- byte count = 0, chademo = 0, ccs = 0, gb = 0;
|
|
|
- for(uint8_t idx=0;idx<3;idx++)
|
|
|
- {
|
|
|
- if (ShmSysConfigAndInfo->SysConfig.ModelName[7+idx] == 'J')
|
|
|
- {
|
|
|
- chademo++;
|
|
|
- count++;
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysConfig.ModelName[7+idx] == 'G')
|
|
|
- {
|
|
|
- gb++;
|
|
|
- count++;
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysConfig.ModelName[7+idx] == 'U' ||
|
|
|
- ShmSysConfigAndInfo->SysConfig.ModelName[7+idx] == 'E')
|
|
|
- {
|
|
|
- ccs++;
|
|
|
- count++;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- if (count == 1)
|
|
|
- {
|
|
|
- if (chademo > 0)
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[7] = '1';
|
|
|
- else if (ccs > 0)
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[7] = '2';
|
|
|
- else if (gb > 0)
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[7] = '3';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (chademo > 0 && ccs > 0)
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[7] = '4';
|
|
|
- else if (chademo > 0 && gb > 0)
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[7] = '5';
|
|
|
- else if (ccs > 0 && gb > 0)
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[7] = '6';
|
|
|
- }
|
|
|
-
|
|
|
- // Get network option from model name
|
|
|
- switch(ShmSysConfigAndInfo->SysConfig.ModelName[10])
|
|
|
- {
|
|
|
- case 'B':
|
|
|
- case 'U':
|
|
|
- //Blue tooth
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '3';
|
|
|
- break;
|
|
|
- case 'W':
|
|
|
- // WIFI
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '1';
|
|
|
- break;
|
|
|
- case 'T':
|
|
|
- // 3G/4G
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '2';
|
|
|
- break;
|
|
|
- case 'D':
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '5';
|
|
|
- break;
|
|
|
- default:
|
|
|
- // LAN
|
|
|
- ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '0';
|
|
|
- break;
|
|
|
- }
|
|
|
- // Get rating power from model name
|
|
|
- memcpy(&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[10], &ShmSysConfigAndInfo->SysConfig.ModelName[4], 0x03);
|
|
|
+ GetFullFirmwareVersion(fwVersion, (char *)ShmSysConfigAndInfo->SysConfig.ModelName, (char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
|
|
|
|
|
|
// Get IEC or UL
|
|
|
char _buf[3] = {0};
|
|
@@ -2459,7 +2395,7 @@ void InitialPowerCabinetSetting(void)
|
|
|
|
|
|
void Initial6ParallelSetting(void)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.ModelName[11] == '3')
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.ModelName[11] >= '3' && ShmSysConfigAndInfo->SysConfig.ModelName[11] <= '9')
|
|
|
{
|
|
|
ShmChargerInfo->Control.SysCtrl.bits.Enable6ParallelRelay = 1;
|
|
|
}
|
|
@@ -2588,6 +2524,7 @@ void SpawnNormalService(void)
|
|
|
system("/root/Module_CabinetParallel &");
|
|
|
system("/root/Module_LedIndication &");
|
|
|
system("/root/Module_Authorize &");
|
|
|
+ system("/root/Module_Firewall &");
|
|
|
}
|
|
|
|
|
|
void SpawnOcppService(void)
|
|
@@ -3218,6 +3155,17 @@ void CheckErrorOccurStatus(byte index)
|
|
|
{
|
|
|
if(strncmp((char *)chargingInfo[index]->ConnectorAlarmCode, "", 6) == EQUAL)
|
|
|
{
|
|
|
+ char *strGunError[] = {"042279", "041039", "041040", "042358", "042359"};
|
|
|
+
|
|
|
+ for(int i = 0; i < MAX_GUN_ERROR_QUANTITY; i++)
|
|
|
+ {
|
|
|
+ if((ShmChargerInfo->GunError[index].ErrFlag.ErrorValue & (1 << i)) > 0)
|
|
|
+ {
|
|
|
+ memcpy(ShmChargerInfo->GunError[index].GunAlarmCode, strGunError[i], 6);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
memcpy(chargingInfo[index]->ConnectorAlarmCode, ShmChargerInfo->GunError[index].GunAlarmCode, 6);
|
|
|
}
|
|
|
if(!chargingInfo[index]->ChargingStopFlag.bits.AlarmStop)
|
|
@@ -6075,6 +6023,7 @@ void KillTaskExceptPrimary()
|
|
|
system("killall Module_LedIndication");
|
|
|
system("killall Module_EvComm");
|
|
|
system("killall Module_InternalComm");
|
|
|
+ system("killall Module_Firewall");
|
|
|
KillPowerModuleTask();
|
|
|
system("killall Module_4g &");
|
|
|
system("killall Module_Wifi &");
|
|
@@ -6096,6 +6045,7 @@ void KillAllTask()
|
|
|
system("killall Module_EvComm");
|
|
|
system("killall Module_LcmControl");
|
|
|
system("killall Module_InternalComm");
|
|
|
+ system("killall Module_Firewall");
|
|
|
KillPowerModuleTask();
|
|
|
Kill_Ocpp_Service();
|
|
|
Kill_MaintainOcpp_Service();
|
|
@@ -7063,7 +7013,7 @@ void TriggerDispenserHardwareReboot(void)
|
|
|
if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].ConnectorQuantity > 0)
|
|
|
{
|
|
|
if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.HardwareRebootConfirm == 0 &&
|
|
|
- !Is_Dispenser_MiscCommand(i, MISC_DISP_SOFTWARE_RESET))
|
|
|
+ !Is_Dispenser_MiscCommand(i, MISC_DISP_HARDWARE_REBOOT))
|
|
|
{
|
|
|
trigger = TRUE;
|
|
|
Set_Dispenser_MiscCommand(i, MISC_DISP_HARDWARE_REBOOT);
|
|
@@ -8734,7 +8684,8 @@ void CheckDiagnosticsReq(void)
|
|
|
char _IpAddress[32];
|
|
|
char cmdBuf[256] = {0};
|
|
|
|
|
|
- if(Is_Ocpp_GetDiagnosticsReq() || ShmChargerInfo->Control.Diagnostics.DiagnosticsType != DIAGNOSTICS_TYPE_NONE)
|
|
|
+ if(Is_Ocpp_GetDiagnosticsReq() || ShmChargerInfo->Control.Diagnostics.DiagnosticsType != DIAGNOSTICS_TYPE_NONE ||
|
|
|
+ ShmSysConfigAndInfo->SysInfo.isDispenserLog)
|
|
|
{
|
|
|
// check dispenser status and set diagnostics request
|
|
|
for(int i = 0; i < MAX_DISPENSER_QUANTITY; i++)
|
|
@@ -8816,6 +8767,10 @@ void CheckDiagnosticsReq(void)
|
|
|
{
|
|
|
ShmChargerInfo->Control.Diagnostics.DiagnosticsType = DIAGNOSTICS_TYPE_NONE;
|
|
|
}
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.isDispenserLog)
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysInfo.isDispenserLog = false;
|
|
|
+ }
|
|
|
LOG_INFO("Dispenser Diagnostics Completed!");
|
|
|
}
|
|
|
}
|
|
@@ -8845,7 +8800,10 @@ void CheckOcppStatus()
|
|
|
{
|
|
|
if (chargingInfo[_index]->SystemStatus != S_IDLE &&
|
|
|
chargingInfo[_index]->SystemStatus != S_RESERVATION &&
|
|
|
- chargingInfo[_index]->SystemStatus != S_MAINTAIN)
|
|
|
+ chargingInfo[_index]->SystemStatus != S_MAINTAIN &&
|
|
|
+ chargingInfo[_index]->SystemStatus != S_FAULT &&
|
|
|
+ !(chargingInfo[_index]->SystemStatus == S_COMPLETE && ShmSysConfigAndInfo->SysInfo.ConnectorInfo[_index].Parameter.bits.PsuReleasable) &&
|
|
|
+ !(chargingInfo[_index]->SystemStatus == S_ALARM && ShmSysConfigAndInfo->SysInfo.ConnectorInfo[_index].Parameter.bits.PsuReleasable))
|
|
|
{
|
|
|
canReset = false;
|
|
|
//if (chargingInfo[_index]->SystemStatus >= S_REASSIGN && chargingInfo[_index]->SystemStatus < S_TERMINATING)
|
|
@@ -8881,7 +8839,7 @@ void CheckOcppStatus()
|
|
|
{
|
|
|
setChargerMode(i, MODE_MAINTAIN);
|
|
|
}
|
|
|
- sleep(3);
|
|
|
+ sleep(5);
|
|
|
system("reboot -f");
|
|
|
}
|
|
|
}
|
|
@@ -8900,7 +8858,7 @@ void CheckOcppStatus()
|
|
|
{
|
|
|
setChargerMode(i, MODE_MAINTAIN);
|
|
|
}
|
|
|
- sleep(3);
|
|
|
+ sleep(5);
|
|
|
Kill_Ocpp_Service();
|
|
|
KillAllTask();
|
|
|
TryCloseWatchdog();
|
|
@@ -9374,7 +9332,8 @@ int DB_Open(sqlite3 *db)
|
|
|
"`idx` INTEGER PRIMARY KEY AUTOINCREMENT, "
|
|
|
"`rebootDatetime` TEXT NOT NULL, "
|
|
|
"`model_name` TEXT, "
|
|
|
- "`serial_number` TEXT, unique(rebootDatetime) on conflict replace);";
|
|
|
+ "`serial_number` TEXT"
|
|
|
+ "`version` TEXT, unique(rebootDatetime) on conflict replace);";
|
|
|
|
|
|
char * createconsumptionSql = "CREATE TABLE IF NOT EXISTS `power_consumption` ( "
|
|
|
"`idx` INTEGER PRIMARY KEY AUTOINCREMENT, "
|
|
@@ -9968,9 +9927,11 @@ int DB_Reboot_Record(sqlite3 *db)
|
|
|
char* errMsg = NULL;
|
|
|
char insertSql[256];
|
|
|
|
|
|
- sprintf(insertSql, "insert into reboot_record(rebootDatetime, model_name, serial_number) values(CURRENT_TIMESTAMP, '%s', '%s');",
|
|
|
+ sprintf(insertSql, "insert into reboot_record(rebootDatetime, model_name, serial_number, version) values(CURRENT_TIMESTAMP, '%s', '%s', '%s_%s');",
|
|
|
(char *)ShmSysConfigAndInfo->SysConfig.ModelName,
|
|
|
- (char *)ShmSysConfigAndInfo->SysConfig.SerialNumber);
|
|
|
+ (char *)ShmSysConfigAndInfo->SysConfig.SerialNumber,
|
|
|
+ fwVersion,
|
|
|
+ subVersion);
|
|
|
|
|
|
if(sqlite3_open(DB_FILE, &db))
|
|
|
{
|
|
@@ -10138,7 +10099,7 @@ int DB_Get_Undisposed_Ocmf(sqlite3 *db, int *gunIndex, char *txId, char *ocmfKey
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-void DB_TryAddRebootRecordColumn(sqlite3 *db)
|
|
|
+void DB_TryAddRebootRecordColumn_Model(sqlite3 *db)
|
|
|
{
|
|
|
char **rs;
|
|
|
int rows, cols;
|
|
@@ -10193,6 +10154,50 @@ void DB_TryAddRebootRecordColumn(sqlite3 *db)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void DB_TryAddRebootRecordColumn_Version(sqlite3 *db)
|
|
|
+{
|
|
|
+ char **rs;
|
|
|
+ int rows, cols;
|
|
|
+ char* errMsg = NULL;
|
|
|
+ char sqlString[1024];
|
|
|
+ int result = 0;
|
|
|
+
|
|
|
+ strcpy(sqlString, "select count(*) from pragma_table_info('reboot_record') where name = 'version';");
|
|
|
+
|
|
|
+ if(sqlite3_open(DB_FILE, &db))
|
|
|
+ {
|
|
|
+ LOG_ERROR("Can't open database: %s", sqlite3_errmsg(db));
|
|
|
+ sqlite3_close(db);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sqlite3_get_table(db, sqlString, &rs, &rows, &cols, &errMsg);
|
|
|
+ if(rows > 0)
|
|
|
+ {
|
|
|
+ for(int idxRow = 1; idxRow <= rows; idxRow++)
|
|
|
+ {
|
|
|
+ result = atoi(rs[(idxRow * cols) + 0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sqlite3_free_table(rs);
|
|
|
+
|
|
|
+ if(result == 0)
|
|
|
+ {
|
|
|
+ strcpy(sqlString, "ALTER TABLE 'reboot_record' ADD COLUMN 'version' TEXT;");
|
|
|
+ if(sqlite3_exec(db, sqlString, 0, 0, &errMsg) != SQLITE_OK)
|
|
|
+ {
|
|
|
+ result = FAIL;
|
|
|
+ LOG_ERROR("reboot_record add column 'version' error message: %s", errMsg);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LOG_INFO("reboot_record ADD COLUMN 'version' successfully");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sqlite3_close(db);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void DB_TryAddChargingRecordColumn(sqlite3 *db)
|
|
|
{
|
|
|
char **rs;
|
|
@@ -10604,20 +10609,25 @@ void CheckTask()
|
|
|
if(system("pidof -s Module_ProduceUtils > /dev/null") != 0)
|
|
|
{
|
|
|
LOG_ERROR("Module_ProduceUtils not running, restart it.");
|
|
|
- system ("/root/Module_ProduceUtils &");
|
|
|
+ system("/root/Module_ProduceUtils &");
|
|
|
}
|
|
|
|
|
|
if(system("pidof -s Module_EvComm > /dev/null") != 0)
|
|
|
{
|
|
|
LOG_ERROR("Module_EvComm not running, restart it.");
|
|
|
- system ("/root/Module_EvComm &");
|
|
|
+ system("/root/Module_EvComm &");
|
|
|
}
|
|
|
|
|
|
if(system("pidof -s Module_InternalComm > /dev/null") != 0)
|
|
|
{
|
|
|
LOG_ERROR("Module_InternalComm not running, restart it.");
|
|
|
- system ("/root/Module_InternalComm &");
|
|
|
- //ShmChargerInfo->Control.SysCtrl.bits.NeedSoftReset = true;
|
|
|
+ system("/root/Module_InternalComm &");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(system("pidof -s Module_Firewall > /dev/null") != 0)
|
|
|
+ {
|
|
|
+ LOG_ERROR("Module_Firewall not running, restart it.");
|
|
|
+ system("/root/Module_Firewall &");
|
|
|
}
|
|
|
|
|
|
if(!Is_WebServer_Alive())
|
|
@@ -11142,10 +11152,22 @@ void CheckConnectorDisconnectionRecovery(unsigned char connector)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-bool ConnectorRequestToCharging(unsigned char connector)
|
|
|
+bool IsPsuResourceAvailable(unsigned char connector)
|
|
|
+{
|
|
|
+ bool _available = true;
|
|
|
+
|
|
|
+ if(ShmPsuGrouping->GroupCollection[connector].Role == _GROLE_NO_RESOURCE)
|
|
|
+ {
|
|
|
+ _available = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return _available;
|
|
|
+}
|
|
|
+
|
|
|
+int ConnectorRequestToCharging(unsigned char connector)
|
|
|
{
|
|
|
unsigned char role = 0;
|
|
|
- bool done = false;
|
|
|
+ int result = WAIT;
|
|
|
|
|
|
role = ShmPsuGrouping->GroupCollection[connector].Role;
|
|
|
|
|
@@ -11160,7 +11182,7 @@ bool ConnectorRequestToCharging(unsigned char connector)
|
|
|
break;
|
|
|
|
|
|
case _GROLE_MASTER:
|
|
|
- done = true;
|
|
|
+ result = PASS;
|
|
|
break;
|
|
|
|
|
|
case _GROLE_SLAVE:
|
|
@@ -11172,14 +11194,26 @@ bool ConnectorRequestToCharging(unsigned char connector)
|
|
|
break;
|
|
|
|
|
|
case _GROLE_REQUEST_TO_CHARGING:
|
|
|
- done = true;
|
|
|
+ result = PASS;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case _GROLE_DUMMY_MASTER:
|
|
|
+ if(!ShmPsuGrouping->GroupCollection[connector].GroupCtrl.bits.DummyMasterRequest)
|
|
|
+ {
|
|
|
+ LOG_INFO("Gun %d Wait For Dummy Master", connector + 1);
|
|
|
+ }
|
|
|
+ ShmPsuGrouping->GroupCollection[connector].GroupCtrl.bits.DummyMasterRequest = true;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case _GROLE_DUMMY_FAULT:
|
|
|
+ result = FAIL;
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- return done;
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
bool IsConnectorGroupingCompleted(unsigned char connector)
|
|
@@ -11286,18 +11320,11 @@ bool IsAvailableBackToIdle(int gun_index)
|
|
|
|
|
|
void CheckGunAvailable(void)
|
|
|
{
|
|
|
- if(!ShmChargerInfo->Control.SysCtrl.bits.PsuInit)
|
|
|
+ if(ShmPsuData->Work_Step == _WORK_CHARGING)
|
|
|
{
|
|
|
- if(ShmChargerInfo->Control.PsuCtrl.bits.SelfTestOK)
|
|
|
+ for(int i = 0; i < GENERAL_GUN_QUANTITY; i++)
|
|
|
{
|
|
|
- for(int i = 0; i < GENERAL_GUN_QUANTITY; i++)
|
|
|
- {
|
|
|
- if(ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity > 0)
|
|
|
- {
|
|
|
- ShmChargerInfo->Control.GunAvailable[i] = YES;
|
|
|
- }
|
|
|
- }
|
|
|
- ShmChargerInfo->Control.SysCtrl.bits.PsuInit = true;
|
|
|
+ ShmChargerInfo->Control.GunAvailable[i] = IsPsuResourceAvailable(i) ? YES : NO;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -11424,7 +11451,8 @@ void InitialDataBaseValue(void)
|
|
|
{
|
|
|
isDb_ready = true;
|
|
|
|
|
|
- DB_TryAddRebootRecordColumn(localDb);
|
|
|
+ DB_TryAddRebootRecordColumn_Model(localDb);
|
|
|
+ DB_TryAddRebootRecordColumn_Version(localDb);
|
|
|
DB_TryAddChargingRecordColumn(localDb);
|
|
|
|
|
|
for(int _index = 0; _index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; _index++)
|
|
@@ -11667,6 +11695,7 @@ void RestrictChargingCapability(int gunIndex, unsigned short *power, unsigned sh
|
|
|
int _limitPowerResult = 0;
|
|
|
int _limitVoltageResult = 0;
|
|
|
int _limitCurrentResult = 0;
|
|
|
+ int _IndividualLimit = NO;
|
|
|
|
|
|
_limitPowerResult = ShmPsuData->SystemAvailablePower;
|
|
|
_limitVoltageResult = MAX_OUTPUT_VOLTAGE;
|
|
@@ -11747,11 +11776,13 @@ void RestrictChargingCapability(int gunIndex, unsigned short *power, unsigned sh
|
|
|
if(chargingInfo[gunIndex]->ChargingProfilePower >= 0 && _limitPowerResult > ((int)chargingInfo[gunIndex]->ChargingProfilePower / 100))
|
|
|
{
|
|
|
_limitPowerResult = (int)chargingInfo[gunIndex]->ChargingProfilePower / 100;
|
|
|
+ _IndividualLimit = true;
|
|
|
}
|
|
|
|
|
|
if(chargingInfo[gunIndex]->ChargingProfileCurrent >= 0 && _limitCurrentResult > (int)chargingInfo[gunIndex]->ChargingProfileCurrent)
|
|
|
{
|
|
|
_limitCurrentResult = (int)chargingInfo[gunIndex]->ChargingProfileCurrent;
|
|
|
+ _IndividualLimit = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -11761,6 +11792,7 @@ void RestrictChargingCapability(int gunIndex, unsigned short *power, unsigned sh
|
|
|
if(chargingInfo[gunIndex]->LocalPowerLimitCurrent >= 0 && _limitCurrentResult > (int)(chargingInfo[gunIndex]->LocalPowerLimitCurrent * 10))
|
|
|
{
|
|
|
_limitCurrentResult = (int)(chargingInfo[gunIndex]->LocalPowerLimitCurrent * 10);
|
|
|
+ _IndividualLimit = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -11771,6 +11803,7 @@ void RestrictChargingCapability(int gunIndex, unsigned short *power, unsigned sh
|
|
|
if(limitPower != 0 && _limitPowerResult > limitPower)
|
|
|
{
|
|
|
_limitPowerResult = limitPower;
|
|
|
+ _IndividualLimit = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -11779,11 +11812,13 @@ void RestrictChargingCapability(int gunIndex, unsigned short *power, unsigned sh
|
|
|
_limitCurrentResult > ShmChargerInfo->OutputLimit.GunOtpMaxCurrent[gunIndex])
|
|
|
{
|
|
|
_limitCurrentResult = ShmChargerInfo->OutputLimit.GunOtpMaxCurrent[gunIndex];
|
|
|
+ _IndividualLimit = true;
|
|
|
}
|
|
|
|
|
|
ShmChargerInfo->OutputLimit.GunLimitPower[gunIndex] = _limitPowerResult;
|
|
|
ShmChargerInfo->OutputLimit.GunLimitVoltage[gunIndex] = _limitVoltageResult;
|
|
|
ShmChargerInfo->OutputLimit.GunLimitCurrent[gunIndex] = _limitCurrentResult;
|
|
|
+ ShmChargerInfo->OutputLimit.IndividualLimit[gunIndex] = _IndividualLimit;
|
|
|
|
|
|
if(_limitPowerResult != 0 && *power > _limitPowerResult)
|
|
|
{
|
|
@@ -11824,15 +11859,33 @@ void UpdateChargingCapability(void)
|
|
|
|
|
|
RestrictChargingCapability(i, &power, &voltage, ¤t);
|
|
|
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].CapabilityVoltage = voltage;
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].CapabilityCurrent = current;
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].CapabilityPower = power;
|
|
|
+ if((chargingInfo[i]->SystemStatus >= S_CHARGING && chargingInfo[i]->SystemStatus <= S_ALARM) ||
|
|
|
+ (chargingInfo[i]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[i]->SystemStatus <= S_CCS_PRECHARGE_ST1) ||
|
|
|
+ (chargingInfo[i]->SystemStatus == S_PREPARING_FOR_EVSE && ShmPsuGrouping->GroupCollection[i].GroupCtrl.bits.CableCheckDone))
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].CapabilityVoltage = voltage;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].CapabilityCurrent = current;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].CapabilityPower = power;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].CapabilityVoltage = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].RemoteMaxPhysicalVoltage > 0 ?
|
|
|
+ (float)ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].RemoteMaxPhysicalVoltage : (float)voltage;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].CapabilityCurrent = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].RemoteMaxPhysicalCurrent > 0 ?
|
|
|
+ (float)ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].RemoteMaxPhysicalCurrent : (float)current;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].CapabilityPower = ShmPsuData->SystemAvailablePower > 0 ?
|
|
|
+ (float)ShmPsuData->SystemAvailablePower : (float)power;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void GunErrorCollection(void)
|
|
|
{
|
|
|
bool _PsuNoResource = false;
|
|
|
+ bool _ParallelRelayWelding = false;
|
|
|
+ bool _ParallelRelayDrivingFault = false;
|
|
|
+ bool _OutputRelayWelding = false;
|
|
|
+ bool _OutputRelayDrivingFault = false;
|
|
|
|
|
|
for(int i = 0; i < MAX_GUN_QUANTITY; i++)
|
|
|
{
|
|
@@ -11847,9 +11900,30 @@ void GunErrorCollection(void)
|
|
|
_PsuNoResource = true;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(ShmChargerInfo->GunError[i].ErrFlag.bits.ParallelRelayWelding)
|
|
|
+ {
|
|
|
+ _ParallelRelayWelding = true;
|
|
|
+ }
|
|
|
+ if(ShmChargerInfo->GunError[i].ErrFlag.bits.ParallelRelayDrivingFault)
|
|
|
+ {
|
|
|
+ _ParallelRelayDrivingFault = true;
|
|
|
+ }
|
|
|
+ if(ShmChargerInfo->GunError[i].ErrFlag.bits.OutputRelayWelding)
|
|
|
+ {
|
|
|
+ _OutputRelayWelding = true;
|
|
|
+ }
|
|
|
+ if(ShmChargerInfo->GunError[i].ErrFlag.bits.OutputRelayDrivingFault)
|
|
|
+ {
|
|
|
+ _OutputRelayDrivingFault = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PsuNoResource = _PsuNoResource;
|
|
|
+ ShmStatusCodeData->FaultCode.FaultEvents.bits.ParallelRelayWelding = _ParallelRelayWelding;
|
|
|
+ ShmStatusCodeData->FaultCode.FaultEvents.bits.ParallelRelayDriving = _ParallelRelayDrivingFault;
|
|
|
+ ShmStatusCodeData->AlarmCode.AlarmEvents.bits.NormalOutputRelayWelding = _OutputRelayWelding;
|
|
|
+ ShmStatusCodeData->AlarmCode.AlarmEvents.bits.NormalOutputRelayDrivingFault = _OutputRelayDrivingFault;
|
|
|
}
|
|
|
|
|
|
void UpdateGunPresentChargingPower(int gunIndex)
|
|
@@ -12103,11 +12177,7 @@ int main(void)
|
|
|
{
|
|
|
setChargerMode(gun_index, MODE_IDLE);
|
|
|
|
|
|
- if(ShmPsuData->PsuGroup[gun_index].GroupPresentPsuQuantity > 0 ||
|
|
|
- !ShmChargerInfo->Control.PsuCtrl.bits.SelfTestOK)
|
|
|
- {
|
|
|
- ShmChargerInfo->Control.GunAvailable[gun_index] = YES;
|
|
|
- }
|
|
|
+ CheckGunAvailable();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -12684,13 +12754,13 @@ int main(void)
|
|
|
else if(isEvBoardStopChargeFlag(gun_index) == YES)
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Alarm Stop (S_AUTHORIZING) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
ChargingAlarmProcess(gun_index);
|
|
|
}
|
|
|
else if(isNormalStopChargeFlag(gun_index) == YES)
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Normal Stop (S_AUTHORIZING) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
}
|
|
@@ -12721,13 +12791,19 @@ int main(void)
|
|
|
|
|
|
time = GetTimeoutValue(_SystemStatus_Time[gun_index]) / uSEC_VAL;
|
|
|
|
|
|
- if(ConnectorRequestToCharging(gun_index))
|
|
|
+ int isRequestOK = ConnectorRequestToCharging(gun_index);
|
|
|
+
|
|
|
+ if(isRequestOK == PASS)
|
|
|
{
|
|
|
setChargerMode(gun_index, MODE_REASSIGN);
|
|
|
}
|
|
|
- else if(time >= WAIT_REASSIGN_TIME)
|
|
|
+ else if(time >= WAIT_REASSIGN_TIME || isRequestOK == FAIL)
|
|
|
{
|
|
|
- if(ShmPsuData->Work_Step != _WORK_CHARGING)
|
|
|
+ if(isRequestOK == FAIL)
|
|
|
+ {
|
|
|
+ LOG_INFO("Gun %d Request To Charging Fail", gun_index + 1);
|
|
|
+ }
|
|
|
+ else if(ShmPsuData->Work_Step != _WORK_CHARGING)
|
|
|
{
|
|
|
LOG_INFO("Gun %d Wait PSU Work Step Timeout", gun_index + 1);
|
|
|
}
|
|
@@ -12742,7 +12818,7 @@ int main(void)
|
|
|
memcpy(chargingInfo[gun_index]->ConnectorAlarmCode, "042279", 6);
|
|
|
LOG_INFO("Gun %d No Psu Resource", gun_index + 1);
|
|
|
}
|
|
|
- Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Other");
|
|
|
ChargingAlarmProcess(gun_index);
|
|
|
//setChargerMode(gun_index, MODE_IDLE);
|
|
|
}
|
|
@@ -12793,14 +12869,14 @@ int main(void)
|
|
|
{
|
|
|
// 板端或後臺要求停止
|
|
|
LOG_INFO("********** Gun %d Alarm Stop (S_PREPARNING) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
ChargingAlarmProcess(gun_index);
|
|
|
}
|
|
|
else if(isNormalStopChargeFlag(gun_index) == YES)
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Normal Stop (S_PREPARNING) %s**********", gun_index + 1,
|
|
|
chargingInfo[gun_index]->ChargingStopFlag.bits.ManualStop ? "(ManualStop)" : "");
|
|
|
- Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
else if(isResetStopChargeFlag(gun_index) == YES)
|
|
@@ -12815,7 +12891,7 @@ int main(void)
|
|
|
else if(isBackendStopFlag(gun_index))
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Backend Stop (S_PREPARNING) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "Other");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
|
|
@@ -12826,10 +12902,10 @@ int main(void)
|
|
|
|
|
|
if(strncmp((char *)chargingInfo[gun_index]->ConnectorAlarmCode, "", 6) == EQUAL)
|
|
|
{
|
|
|
- memcpy(chargingInfo[gun_index]->ConnectorAlarmCode, "012279", 6);
|
|
|
+ memcpy(chargingInfo[gun_index]->ConnectorAlarmCode, "042279", 6);
|
|
|
LOG_INFO("Gun %d No Psu Resource", gun_index + 1);
|
|
|
}
|
|
|
- Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Other");
|
|
|
ChargingAlarmProcess(gun_index);
|
|
|
}
|
|
|
}
|
|
@@ -12862,14 +12938,14 @@ int main(void)
|
|
|
{
|
|
|
// 板端或後臺要求停止
|
|
|
LOG_INFO("********** Gun %d Alarm Stop (S_PREPARING_FOR_EV) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
ChargingAlarmProcess(gun_index);
|
|
|
}
|
|
|
else if(isNormalStopChargeFlag(gun_index) == YES)
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Normal Stop (S_PREPARING_FOR_EV) %s**********", gun_index + 1,
|
|
|
chargingInfo[gun_index]->ChargingStopFlag.bits.ManualStop ? "(ManualStop)" : "");
|
|
|
- Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
else if(isResetStopChargeFlag(gun_index) == YES)
|
|
@@ -12884,7 +12960,7 @@ int main(void)
|
|
|
else if(isBackendStopFlag(gun_index))
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Backend Stop (S_PREPARING_FOR_EV) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "Other");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
|
|
@@ -12945,14 +13021,14 @@ int main(void)
|
|
|
{
|
|
|
// 板端或後臺要求停止
|
|
|
LOG_INFO("********** Gun %d Alarm Stop (S_PREPARING_FOR_EVSE) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
ChargingAlarmProcess(gun_index);
|
|
|
}
|
|
|
else if(isNormalStopChargeFlag(gun_index) == YES)
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Normal Stop (S_PREPARING_FOR_EVSE) %s**********", gun_index + 1,
|
|
|
chargingInfo[gun_index]->ChargingStopFlag.bits.ManualStop ? "(ManualStop)" : "");
|
|
|
- Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
else if(isResetStopChargeFlag(gun_index) == YES)
|
|
@@ -12973,7 +13049,7 @@ int main(void)
|
|
|
else if(isBackendStopFlag(gun_index))
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Backend Stop (S_PREPARING_FOR_EVSE) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "Other");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
|
|
@@ -13026,14 +13102,14 @@ int main(void)
|
|
|
if (isEvBoardStopChargeFlag(gun_index))
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Alarm Stop (S_CHARGING) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
ChargingAlarmProcess(gun_index);
|
|
|
}
|
|
|
else if(isNormalStopChargeFlag(gun_index) == YES)
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Normal Stop (S_CHARGING) %s**********", gun_index + 1,
|
|
|
chargingInfo[gun_index]->ChargingStopFlag.bits.ManualStop ? "(ManualStop)" : "");
|
|
|
- Set_Ocpp_StopReason(gun_index, "EVDisconnected");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
else if(isResetStopChargeFlag(gun_index) == YES)
|
|
@@ -13056,6 +13132,7 @@ int main(void)
|
|
|
IsReachConfigMaxChargingSoc(gun_index))
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Backend Condition Stop (S_CHARGING) **********", gun_index + 1);
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Other");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
else if(isSessionTargetStopFlag(gun_index) == YES)
|
|
@@ -13067,7 +13144,7 @@ int main(void)
|
|
|
else if(isBackendStopFlag(gun_index))
|
|
|
{
|
|
|
LOG_INFO("********** Gun %d Backend Stop (S_CHARGING) **********", gun_index + 1);
|
|
|
- Set_Ocpp_StopReason(gun_index, "Other");
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
ChargingTerminalProcess(gun_index);
|
|
|
}
|
|
|
}
|
|
@@ -13077,10 +13154,9 @@ int main(void)
|
|
|
{
|
|
|
if (isModeChange(gun_index))
|
|
|
{
|
|
|
- Set_Ocpp_StopReason(gun_index, "Other");
|
|
|
-
|
|
|
if (chargingInfo[gun_index]->SystemStatus == S_ALARM)
|
|
|
{
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Other");
|
|
|
LOG_INFO("================== S_ALARM (%x) ================== \n", gun_index + 1);
|
|
|
UpdateErrorCodeToOcpp(gun_index);
|
|
|
|
|
@@ -13088,6 +13164,7 @@ int main(void)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ Set_Ocpp_StopReason(gun_index, "Local");
|
|
|
LOG_INFO("================== S_TERMINATING (%x) ================== \n", gun_index + 1);
|
|
|
}
|
|
|
|