Parcourir la source

[Improve][AW-Regular][Module_InternalComm.c][main.h]
2022-03-03 / Eason Yang
Action
1. Improve: Module_InternalComm task. Disable unneccessary protocol.
2. Rename: set_circuit -> rotate_switch_fault.

File
1.Module_InternalComm.c
Action 1

2.main.h
Action 2

FIRMWARE VERSION: V0.70.XX.XXXX.PX

8009 il y a 3 ans
Parent
commit
6c3778bd31

+ 45 - 27
EVSE/Projects/AW-Regular/Apps/Module_InternalComm.c

@@ -822,7 +822,7 @@ unsigned char Query_AC_MCU_Alarm(unsigned char fd, unsigned char targetAddr, Ac_
 
 			//rx[8] 3~7bits reserved
 			Ret_Buf->bits.circuit_short = (((rx[8]>>0)&0x01)?1:0);
-			Ret_Buf->bits.set_circuit = (((rx[8]>>1)&0x01)?1:0);
+			Ret_Buf->bits.rotate_switch_fault = (((rx[8]>>1)&0x01)?1:0);
 			Ret_Buf->bits.relay_drive_fault = (((rx[8]>>2)&0x01)?1:0);
 
 			//rx[9] 0~7bits reserved
@@ -1978,7 +1978,7 @@ int main(void)
 					else
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<16);
 
-					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit == 0x01)
+					if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.rotate_switch_fault == 0x01)
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<17;
 					else
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<17);
@@ -2003,9 +2003,31 @@ int main(void)
 					}
 				}
 
+				//===============================
+				// Case 5 : Query present output current
+				//===============================
+				if(Query_Present_OutputCurrent(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].outputCurrent) == PASS)
+				{
+#ifndef SIMULATION
+					ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
+#else
+					ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus==SYS_MODE_CHARGING?(((rand()%10)+((ShmCharger->gun_info[gun_index].targetCurrent*10)-5))/10.0):0) ;
+#endif
+					failCount[gun_index] = 0;
+				}
+				else
+				{
+					DEBUG_WARN("MCU-%d get output current fail...%d\n", gun_index, failCount[gun_index]);
+					if(failCount[gun_index]<1000)
+					{
+						failCount[gun_index]++;
+					}
+				}
+
 				//===============================
 				// Case 5 : Query primary MCU BLE config
 				//===============================
+				/*
 				if(Query_Ble_Config(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleConfigData))
 				{
 					ShmSysConfigAndInfo->SysConfig.Bluetooth.isLogin = ShmCharger->gun_info[gun_index].bleConfigData.isLogin;
@@ -2022,10 +2044,12 @@ int main(void)
 						failCount[gun_index]++;
 					}
 				}
+				*/
 
 				//===============================
 				// Case 6 : Query primary MCU ble login id
 				//===============================
+				/*
 				if(Query_Ble_Central_ID(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleLoginCentralId))
 				{
 					memcpy(ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID, ShmCharger->gun_info[gun_index].bleLoginCentralId.id, sizeof ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID);
@@ -2040,6 +2064,7 @@ int main(void)
 						failCount[gun_index]++;
 					}
 				}
+				*/
 
 				//===============================
 				// Case 7 : Config primary MCU reset request
@@ -2171,14 +2196,23 @@ int main(void)
 						DEBUG_INFO("MCU-%d get locker_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault);
 						DEBUG_INFO("MCU-%d get power_drop : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop);
 						DEBUG_INFO("MCU-%d get circuit_short : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.circuit_short);
-						DEBUG_INFO("MCU-%d get set_circuit : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit);
+						DEBUG_INFO("MCU-%d get rotate_switch_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.rotate_switch_fault);
 						DEBUG_INFO("MCU-%d get relay_drive_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
 						DEBUG_INFO("MCU-%d get InputAlarmCode : %x\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
 					}
 
+					//===============================
+					// Query present output current
+					//===============================
+					DEBUG_INFO("==================================================\n");
+					DEBUG_INFO("========= High priority polling : Case 5 =========\n");
+					DEBUG_INFO("==================================================\n");
+					DEBUG_INFO("MCU-%d get output current : %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
+
 					//===============================
 					// Query primary MCU BLE config
 					//===============================
+					/*
 					if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin == ON)
 					{
 						DEBUG_INFO("**************************************************\n");
@@ -2188,10 +2222,12 @@ int main(void)
 						DEBUG_INFO("MCU-%d get isRequestStartCharger : %d\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart);
 						DEBUG_INFO("MCU-%d get isRequestStopCharger : %d\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop);
 					}
+					*/
 
 					//===============================
 					// Query primary MCU ble login id
 					//===============================
+					/*
 					if(strcmp((char *)&ShmCharger->gun_info[gun_index].bleLoginCentralId.id,"") != 0)
 					{
 						DEBUG_INFO("**************************************************\n");
@@ -2199,12 +2235,13 @@ int main(void)
 						DEBUG_INFO("**************************************************\n");
 						DEBUG_INFO("MCU-%d get ble central id : %s\n", gun_index, ShmCharger->gun_info[gun_index].bleLoginCentralId.id);
 					}
+					*/
 
 					//===============================
 					// Config primary MCU duty
 					//===============================
 					DEBUG_INFO("==================================================\n");
-					DEBUG_INFO("========== High priority polling : Case 9 ========\n");
+					DEBUG_INFO("========== High priority polling : Case 8 ========\n");
 					DEBUG_INFO("==================================================\n");
 					DEBUG_INFO("MCU-%d set cp pwn duty : %d\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
 
@@ -2246,25 +2283,9 @@ int main(void)
 						break;
 					case 3:
 						//===============================
-						// Query present output current
+						// Reserve
 						//===============================
-						if(Query_Present_OutputCurrent(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].outputCurrent) == PASS)
-						{
-#ifndef SIMULATION
-							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
-#else
-							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus==SYS_MODE_CHARGING?(((rand()%10)+((ShmCharger->gun_info[gun_index].targetCurrent*10)-5))/10.0):0) ;
-#endif
-							failCount[gun_index] = 0;
-						}
-						else
-						{
-							DEBUG_WARN("MCU-%d get output current fail...%d\n", gun_index, failCount[gun_index]);
-							if(failCount[gun_index]<1000)
-							{
-								failCount[gun_index]++;
-							}
-						}
+
 						break;
 					case 5:
 						//===============================
@@ -2558,10 +2579,7 @@ int main(void)
 					}
 					else if(stepIndex == 3)
 					{
-						DEBUG_INFO("==================================================\n");
-						DEBUG_INFO("======== Normal priority polling : Case 3 ========\n");
-						DEBUG_INFO("==================================================\n");
-						DEBUG_INFO("MCU-%d get output current : %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
+						// Reserved 
 					}
 					else if(stepIndex == 5)
 					{
@@ -2579,7 +2597,7 @@ int main(void)
 					}
 					else if(stepIndex == 9)
 					{
-
+						// Reserved 
 					}
 					else if(stepIndex == 11)
 					{

+ 1 - 1
EVSE/Projects/AW-Regular/Apps/main.h

@@ -272,7 +272,7 @@ typedef struct AC_PRIMARY_MCU_ALARM
 			unsigned long locker_fault:1;
 			unsigned long power_drop:1;
 			unsigned long circuit_short:1;
-			unsigned long set_circuit:1;
+			unsigned long rotate_switch_fault:1;
 			unsigned long relay_drive_fault:1;
 			unsigned long comm_timeout:1;
 		}bits;