Przeglądaj źródła

[Added][AW-CCS][main.h][Module_InternalComm.c]
2022-10-12 / EASON YANG
Action:
1. Added: unsigned char dip_switch.
2. Added: Read dip_switch status.

File:
1. main.h
Action 1

2. Module_InternalComm.c
Action 2

FIRMWARE VERSION: B0.63.XX.XXXX.PX

8009 2 lat temu
rodzic
commit
5fafe97301

+ 8 - 5
EVSE/Projects/AW-CCS/Apps/Module_InternalComm.c

@@ -36,6 +36,7 @@
 
 #define FAIL_SPEC_COMM		100
 #define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define GET_BIT(x, pos)     ((x & ( 1 << pos)) >> pos)
 #define PASS				1
 #define FAIL				0
 #define ON					1
@@ -777,6 +778,7 @@ unsigned char Query_AC_MCU_Status(unsigned char fd, unsigned char targetAddr, Ac
 			Ret_Buf->pp_state = rx[17];
 			Ret_Buf->rating_current = rx[18];
 			Ret_Buf->rotatory_switch = (rx[19] & 0x0F);
+			Ret_Buf->dip_switch = GET_BIT(rx[19], 4);
 			Ret_Buf->socket_e.isSocketEMode = (rx[20] & 0x01);
 			Ret_Buf->socket_e.isSocketEPinOn = ((rx[20]>>1) & 0x01);
 
@@ -2185,6 +2187,8 @@ int main(void)
 					DEBUG_INFO("MCU-%d get Pilot Duty : %.2f\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
 					DEBUG_INFO("MCU-%d get Pilot Voltage Positive : %.2f\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive);
 					DEBUG_INFO("MCU-%d get Pilot Voltage Negative : %.2f\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive);
+					DEBUG_INFO("MCU-%d get Locker State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.locker_state);
+					DEBUG_INFO("MCU-%d get Relay State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.relay_state);
 
 					if(ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON)
 					{
@@ -2194,15 +2198,14 @@ int main(void)
 							DEBUG_INFO("Relay mode : CHARGING_MODE_BS / CHARGING_MODE_HLC. \n");
 					}
 
-					DEBUG_INFO("MCU-%d get Relay State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.relay_state);
+					DEBUG_INFO("MCU-%d get Shutter State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state);
+					DEBUG_INFO("MCU-%d get Meter State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.meter_state);
+					DEBUG_INFO("MCU-%d get PP State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.pp_state);
 					DEBUG_INFO("MCU-%d get Rating Current : %.2f\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.rating_current);
 					DEBUG_INFO("MCU-%d get Rotary switch : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch);
+					DEBUG_INFO("MCU-%d get Dip Switch : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.dip_switch);
 					DEBUG_INFO("MCU-%d get is on Socket-E mode : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEMode);
 					DEBUG_INFO("MCU-%d get Socket-E detect pin : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn);
-					DEBUG_INFO("MCU-%d get Locker State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.locker_state);
-					DEBUG_INFO("MCU-%d get Shutter State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state);
-					DEBUG_INFO("MCU-%d get Meter State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.meter_state);
-					DEBUG_INFO("MCU-%d get PP State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.pp_state);
 
 					previousCharger.gun_info[gun_index].primaryMcuState.cp_state = ShmCharger->gun_info[gun_index].primaryMcuState.cp_state;
 					previousCharger.gun_info[gun_index].primaryMcuState.current_limit = ShmCharger->gun_info[gun_index].primaryMcuState.current_limit;

+ 1 - 0
EVSE/Projects/AW-CCS/Apps/main.h

@@ -421,6 +421,7 @@ typedef struct AC_PRIMARY_MCU
 	unsigned char pp_state;
 	unsigned char rating_current;
 	unsigned char rotatory_switch;
+	unsigned char dip_switch;
 	Relay	relayState;
 	Socket_E socket_e;
 }Ac_Primary_Mcu;