|
@@ -101,12 +101,12 @@ byte getAvailableCapOffset = 5;
|
|
|
byte deratingKeepCount = 0;
|
|
|
byte psuCmdSeq = _PSU_CMD_CAP;
|
|
|
|
|
|
-byte startModuleFlag = false;
|
|
|
bool psuReceiveRecovery = false;
|
|
|
bool isCommStart = false;
|
|
|
int lostCnt = 0;
|
|
|
bool _isTriggerShutdown = false;
|
|
|
bool _isShutdownCompleted = false;
|
|
|
+pid_t _RxPsuPid = 0;
|
|
|
|
|
|
unsigned short evseOutVol[CONNECTOR_QUANTITY] = {0, 0, 0, 0};
|
|
|
unsigned short evseOutCur[CONNECTOR_QUANTITY] = {0, 0, 0, 0};
|
|
@@ -1159,6 +1159,25 @@ void Await()
|
|
|
usleep(CMD_DELAY_TIME);
|
|
|
}
|
|
|
|
|
|
+bool Is_PsuRxComm_Alive(void)
|
|
|
+{
|
|
|
+ if(_RxPsuPid > 0)
|
|
|
+ {
|
|
|
+ if(kill(_RxPsuPid, 0) == 0)
|
|
|
+ {
|
|
|
+ // Process exists.
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+void Run_PsuRxCommProcess(void)
|
|
|
+{
|
|
|
+ _RxPsuPid = InitialCommunication();
|
|
|
+ LOG_INFO("Create PsuRx PID = %d", _RxPsuPid);
|
|
|
+}
|
|
|
+
|
|
|
void PsuReceiveRecoveryCheck(void)
|
|
|
{
|
|
|
char *ptrSave, *ptrToken;
|
|
@@ -1172,10 +1191,12 @@ void PsuReceiveRecoveryCheck(void)
|
|
|
|
|
|
if(fd < 0)
|
|
|
{
|
|
|
+ close(fd);
|
|
|
return;
|
|
|
}
|
|
|
if(read(fd, psuTaskPidString, 64) < 0)
|
|
|
{
|
|
|
+ close(fd);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -1196,7 +1217,8 @@ void PsuReceiveRecoveryCheck(void)
|
|
|
if(psuTaskCount == 1)
|
|
|
{
|
|
|
LOG_INFO("************ PSU Receive Task Need Recovery ************\n");
|
|
|
- InitialCommunication();
|
|
|
+
|
|
|
+ Run_PsuRxCommProcess();
|
|
|
|
|
|
psuReceiveRecovery = true;
|
|
|
}
|
|
@@ -3805,7 +3827,7 @@ bool IsExtendPrechargeReady(unsigned char master)
|
|
|
|
|
|
if(ShmPsuGrouping->GroupCollection[slave].Role != _GROLE_PREPARE_ATTACH_ON ||
|
|
|
ShmPsuData->PsuGroup[slave].GroupPresentOutputVoltage > (ShmPsuData->PsuGroup[master].GroupPresentOutputVoltage + PRECHARGE_RANGE_VOLTAGE) ||
|
|
|
- ShmPsuData->PsuGroup[slave].GroupPresentOutputVoltage < (ShmPsuData->PsuGroup[master].GroupPresentOutputVoltage - PRECHARGE_OFFSET_VOLTAGE- PRECHARGE_RANGE_VOLTAGE))
|
|
|
+ ShmPsuData->PsuGroup[slave].GroupPresentOutputVoltage < (ShmPsuData->PsuGroup[master].GroupPresentOutputVoltage - PRECHARGE_OFFSET_VOLTAGE - PRECHARGE_RANGE_VOLTAGE))
|
|
|
{
|
|
|
ready = false;
|
|
|
}
|
|
@@ -5188,7 +5210,7 @@ int main(void)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- LOG_INFO("InitShareMemory OK");
|
|
|
+ LOG_INFO("Psu Task PID = %d", getpid());
|
|
|
|
|
|
signal(SIGCHLD, SIG_IGN);
|
|
|
|
|
@@ -5213,7 +5235,7 @@ int main(void)
|
|
|
sleep(2);
|
|
|
InitialGunLimitSequence();
|
|
|
_gunCount = GENERAL_GUN_QUANTITY;
|
|
|
- _maxGroupCount = GENERAL_GUN_QUANTITY;
|
|
|
+ _maxGroupCount = MAX_GROUP_QUANTITY;
|
|
|
_PrePsuWorkStep = _INIT_PSU_STATUS;
|
|
|
ShmPsuData->Work_Step = INITIAL_START;
|
|
|
isInitialComp = NO;
|
|
@@ -5226,10 +5248,11 @@ int main(void)
|
|
|
// initial object
|
|
|
Initialization();
|
|
|
InitialPsuData();
|
|
|
- libInitialize = InitialCommunication();
|
|
|
+ //libInitialize = InitialCommunication();
|
|
|
+ Run_PsuRxCommProcess();
|
|
|
|
|
|
//main loop
|
|
|
- while (libInitialize)
|
|
|
+ while (1)
|
|
|
{
|
|
|
PsuCommLostCheck();
|
|
|
IsShutdownCompleted();
|
|
@@ -5309,7 +5332,11 @@ int main(void)
|
|
|
|
|
|
if((GetTimeoutValue(_PsuReceiveRecoveryCheck_time) / uSEC_VAL) >= PSU_TASK_CHECK_TIME)
|
|
|
{
|
|
|
- PsuReceiveRecoveryCheck();
|
|
|
+ //PsuReceiveRecoveryCheck();
|
|
|
+ if(!Is_PsuRxComm_Alive())
|
|
|
+ {
|
|
|
+ Run_PsuRxCommProcess();
|
|
|
+ }
|
|
|
GetClockTime(&_PsuReceiveRecoveryCheck_time);
|
|
|
}
|
|
|
|
|
@@ -5410,15 +5437,15 @@ int main(void)
|
|
|
|
|
|
if(ShmPsuPosition->PsuLocationInit)
|
|
|
{
|
|
|
-#if 1
|
|
|
for(int i = 0; i < _maxGroupCount; i++)
|
|
|
{
|
|
|
+#if 1
|
|
|
if(ShmPsuPosition->GroupLocationInfo[i].GroupPsuQuantity > 0)
|
|
|
{
|
|
|
ShowGroupMember(i);
|
|
|
}
|
|
|
- }
|
|
|
#endif
|
|
|
+ }
|
|
|
|
|
|
//ShmPsuData->Work_Step = Get_PSU_VERSION;
|
|
|
ShmPsuData->Work_Step = PSU_COUNT_CONFIRM;
|
|
@@ -5623,11 +5650,8 @@ int main(void)
|
|
|
int time = GetTimeoutValue(_cmdSubPriority_time) / 1000;
|
|
|
|
|
|
// 低 Priority 的指令
|
|
|
- if (time > 1000)
|
|
|
+ if (time >= 1000)
|
|
|
{
|
|
|
- //PreCheckSmartChargingStep();
|
|
|
- startModuleFlag = true;
|
|
|
-
|
|
|
for(byte group = 0; group < GENERAL_GUN_QUANTITY; group++)
|
|
|
{
|
|
|
if(ShmPsuData->PsuGroup[group].GroupPresentPsuQuantity > 0)
|