Browse Source

2022-07-21 / Wendell

Actions
1. merge master, add Webservice function
2. modify check psu task logic
3. modify subVersion to 04

Files
1. As follow commit history

Image version : V2.03.XX.XXXX.XX
Wendell 2 years ago
parent
commit
90a33b509c

+ 5 - 4
EVSE/Projects/DO360/Apps/InfyGroup_PsuCommObj.c

@@ -177,7 +177,7 @@ void ReceiveDataFromCanBus()
             PwrFrameMsg = (PwrFrame *)&frame.can_id;
             address = PwrFrameMsg->InfyBits.SourceAddress;
 
-            if(PwrFrameMsg->InfyBits.DestinationAddress != NEXTON_ADD)
+            if(PwrFrameMsg->InfyBits.DestinationAddress == INFY_ADD_CSU)
             {
                 switch (PwrFrameMsg->InfyBits.CmdValue)
                 {
@@ -325,7 +325,7 @@ void ReceiveDataFromCanBus()
                         break;
                 }
             }
-            else
+            if(PwrFrameMsg->InfyBits.DestinationAddress == NEXTON_ADD)
             {
                 switch(PwrFrameMsg->NextonBits.CmdValue)
                 {
@@ -492,7 +492,7 @@ void SetLed(byte address, byte device, byte value)
     SendCmdToPsu(PwrFrameMsg.PwrMessage, data, sizeof(data));
 }
 
-bool InitialCommunication()
+pid_t InitialCommunication()
 {
     CanFd = InitCanBus();
 
@@ -506,9 +506,10 @@ bool InitialCommunication()
     if(recFork == 0)
     {
         ReceiveDataFromCanBus();
+        return 0;
     }
 
-    return true;
+    return recFork;
 }
 
 //================================================

+ 1 - 1
EVSE/Projects/DO360/Apps/InfyGroup_PsuCommObj.h

@@ -166,7 +166,7 @@ typedef enum
 }SetMiscInfoCommand;
 
 /*Initialization*/
-bool InitialCommunication();
+pid_t InitialCommunication();
 
 /*Set Cmd*/
 void SwitchPower(byte group, byte value);

+ 38 - 14
EVSE/Projects/DO360/Apps/Module_PsuComm.c

@@ -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)

BIN
EVSE/Projects/DO360/Apps/libInfyGroup_PsuCommObj.a


+ 1 - 1
EVSE/Projects/DO360/Apps/main.c

@@ -429,7 +429,7 @@ bool isModelNameMatch = true;
 //char* rfidPortName = "/dev/ttyS2";
 #if ENABLE_PCBA_TEST == 0
 char* fwVersion = "V2.03.00.0000.00";
-char* subVersion = "03";
+char* subVersion = "04";
 #else
 char* fwVersion = "PCBA.00.04";
 char* subVersion = "00";

BIN
EVSE/Projects/DO360/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/DO360/Images/ramdisk.gz


BIN
EVSE/rootfs/root/Module_Payment_Bazel8


BIN
EVSE/rootfs/root/Module_Payment_Enegate


BIN
EVSE/rootfs/root/Module_PowerSharing