Browse Source

2022-02-16 / Alston Lin
Actions
1. Add Psu major error to check when to restart
2. Modify the infy-power library

Files
1. As follow commit history

root 3 years ago
parent
commit
01c27d2f38

+ 24 - 26
EVSE/Modularization/Infypwr_PsuCommObj.c

@@ -326,7 +326,6 @@ void ReceiveDataFromCanBus()
 
                         short temp = frame.data[4];
                         int status = (frame.data[5] << 16) + (frame.data[6] << 8) + frame.data[7];
-
                         return_status(group, SN, temp, status);
                         //PRINTF_LIB_FUNC("group = %d, address = %d, temp = %d \n", group, address, temp);
                     }
@@ -355,9 +354,8 @@ void ReceiveDataFromCanBus()
 
                         // 回傳輸出能力 : 最大電壓、最小電壓、最大電流、額定功率
                         //address = frame.can_id & 0x000000FF;
-                        if(!GetRealIndexByGroup(&address))
-                            break;
-
+//                        if(!GetRealIndexByGroup(&address))
+//                            break;
                         short maxVol = ((frame.data[0] << 8) + frame.data[1]) * 10;
                         short minVol = ((frame.data[2] << 8) + frame.data[3]) * 10;
                         short maxCur = (frame.data[4] << 8) + frame.data[5];
@@ -401,9 +399,9 @@ void ReceiveDataFromCanBus()
                             break;
 
                         // 回傳降載後的電流
-                        //address = frame.can_id & 0x000000FF;
-                        if(!GetRealIndexByGroup(&address))
-                            break;
+                        address = frame.can_id & 0x000000FF;
+//                        if(!GetRealIndexByGroup(&address))
+//                            break;
 
                         unsigned short vextVol = ((frame.data[0] << 8) + frame.data[1]);
                         unsigned short iAvailCur = ((frame.data[2] << 8) + frame.data[3]);
@@ -418,13 +416,13 @@ void ReceiveDataFromCanBus()
                         if (!colFinished)
                             break;
 
-                        //address = frame.can_id & 0x000000FF;
+                        address = frame.can_id & 0x000000FF;
                         float ReturnValue;
                         byte value[4];
                         byte type;
 
-                        if(!GetRealIndexByGroup(&address))
-                            break;
+//                        if(!GetRealIndexByGroup(&address))
+//                            break;
 
                         memcpy(value, frame.data + 4, sizeof(value));
                         ReturnValue = IEEE_754_to_float(value);
@@ -455,9 +453,9 @@ void ReceiveDataFromCanBus()
                             break;
 
                         // 回傳版號 : 無系統回覆功能
-                        //address = frame.can_id & 0x000000FF;
-                        if(!GetRealIndexByGroup(&address))
-                            break;
+                        address = frame.can_id & 0x000000FF;
+//                        if(!GetRealIndexByGroup(&address))
+//                            break;
 
                         short dcSwVer = ((frame.data[0] << 8) + frame.data[1]);
                         short pfcSwVer = ((frame.data[2] << 8) + frame.data[3]);
@@ -480,9 +478,9 @@ void ReceiveDataFromCanBus()
                             break;
 
                         // 回傳三向輸入電壓
-                        //address = frame.can_id & 0x000000FF;
-                        if(!GetRealIndexByGroup(&address))
-                            break;
+                        address = frame.can_id & 0x000000FF;
+//                        if(!GetRealIndexByGroup(&address))
+//                            break;
 
                         short abVol = ((frame.data[0] << 8) + frame.data[1]) / 10;
                         short bcVol = ((frame.data[2] << 8) + frame.data[3]) / 10;
@@ -502,8 +500,8 @@ void ReceiveDataFromCanBus()
 						memcpy(vol, frame.data, 4);
 						memcpy(cur, frame.data + 4, 4);
 
-						if (!GetRealIndexByGroup(&address))
-							break;
+//						if (!GetRealIndexByGroup(&address))
+//							break;
 
 						float _Vol = IEEE_754_to_float(vol);
 						float _Cur = IEEE_754_to_float(cur);
@@ -527,8 +525,8 @@ void ReceiveDataFromCanBus()
                         /*Test mode used*/
                         // 回傳輸出值與入風口溫度
                         address = frame.can_id & 0x000000FF;
-                        if(!GetRealIndexByGroup(&address))
-                            break;
+//                        if(!GetRealIndexByGroup(&address))
+//                            break;
 
                         short outputVol = ((frame.data[0] << 8) + frame.data[1]);
                         short outputCur = ((frame.data[2] << 8) + frame.data[3]);
@@ -546,9 +544,9 @@ void ReceiveDataFromCanBus()
 
                         /*Test mode used*/
                         // 回傳輸出值與入風口溫度
-                        //address = frame.can_id & 0x000000FF;
-                        if(!GetRealIndexByGroup(&address))
-                            break;
+                        address = frame.can_id & 0x000000FF;
+//                        if(!GetRealIndexByGroup(&address))
+//                            break;
 
                         byte isErr =  (frame.data[0] >> 0) & 0x01;
                         byte status = (frame.data[0] >> 1) & 0x01;
@@ -568,9 +566,9 @@ void ReceiveDataFromCanBus()
 
                         /*Test mode used*/
                         // 回傳輸出值與入風口溫度
-                        //address = frame.can_id & 0x000000FF;
-                        if(!GetRealIndexByGroup(&address))
-                            break;
+                        address = frame.can_id & 0x000000FF;
+//                        if(!GetRealIndexByGroup(&address))
+//                            break;
 
                         short vR = ((frame.data[0] << 8) + frame.data[1]);
                         short vS = ((frame.data[2] << 8) + frame.data[3]);

+ 1 - 1
EVSE/Modularization/Infypwr_PsuCommObj.h

@@ -89,7 +89,7 @@ typedef union
 enum PSU_POWER_CMD
 {
 	PSU_POWER_ON = 		0,
-	PSU_POWER_OFF = 	1,
+	PSU_POWER_OFF = 			1,
 };
 
 enum PSU_SLEEP_MODE_CMD

+ 1 - 0
EVSE/Projects/define.h

@@ -2283,6 +2283,7 @@ struct PsuData
 	unsigned char           GroupCount;
 	unsigned char           Work_Step;
 	struct PsuModuleVer     PsuVersion[MAX_PSU_QUANTITY];
+	unsigned char 			PsuStopChargeFlag;
 };
 
 /************************************************************************************/