|
@@ -743,10 +743,15 @@ void StartUartTask(void const * argument)
|
|
|
HAL_GPIO_WritePin(OUT_Meter_485_DE_GPIO_Port, OUT_Meter_485_DE_Pin, GPIO_PIN_RESET);
|
|
|
HAL_GPIO_WritePin(OUT_Meter_485_RE_GPIO_Port, OUT_Meter_485_RE_Pin, GPIO_PIN_RESET);
|
|
|
#endif
|
|
|
+
|
|
|
#ifdef FUNC_RELAY_OFF_WHEN_GET_TWICE_OFF_CMD
|
|
|
u8 CsuSetRelayOffCount = 0;
|
|
|
#endif
|
|
|
|
|
|
+#ifdef FUNC_REQUEST_OFF_WHEN_GET_TWICE_OFF_CMD
|
|
|
+ u8 CsuSetRequestOffCount = 0;
|
|
|
+#endif
|
|
|
+
|
|
|
/* Infinite loop */
|
|
|
for(;;)
|
|
|
{
|
|
@@ -1017,6 +1022,14 @@ void StartUartTask(void const * argument)
|
|
|
{
|
|
|
Charger.CSUisReady = ON ;
|
|
|
|
|
|
+#ifdef DEBUG_EMPX10_COMM
|
|
|
+ if (CurRxBuf == UART_RS485_rx_buffer)
|
|
|
+ {
|
|
|
+ XP("-------------------------------------------\r\n");
|
|
|
+ HTK_ByteArray2HexStr_XP(NULL, CurRxBuf, 0, IMCP_FM_HEAD_LEN + HTK_U16(CurRxBuf[IMCP_FM_DATALEN_LSB_IDX]) + IMCP_FM_TAIL_LEN);
|
|
|
+ }
|
|
|
+#endif //DEBUG_EMPX10_COMM
|
|
|
+
|
|
|
#ifdef ENABLE_PRINT_IMCP_MSG
|
|
|
|
|
|
#ifdef FUNC_RS485_SLAVE
|
|
@@ -2209,6 +2222,9 @@ void StartUartTask(void const * argument)
|
|
|
|
|
|
if((CurRxBuf[6]&SETTING_LEGACY_REQUEST)>0)
|
|
|
{
|
|
|
+#ifdef FUNC_REQUEST_OFF_WHEN_GET_TWICE_OFF_CMD
|
|
|
+ CsuSetRequestOffCount = 0;
|
|
|
+#endif
|
|
|
Charger.am3352.isRequestOff = OFF;
|
|
|
Charger.rfid.op_bits.reqStart = ON;
|
|
|
if(!Charger.am3352.isRequestOn)
|
|
@@ -2219,6 +2235,21 @@ void StartUartTask(void const * argument)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+
|
|
|
+#ifdef FUNC_REQUEST_OFF_WHEN_GET_TWICE_OFF_CMD
|
|
|
+ if (++CsuSetRequestOffCount >= 2)
|
|
|
+ {
|
|
|
+ CsuSetRequestOffCount = 0;
|
|
|
+ Charger.am3352.isRequestOn = OFF;
|
|
|
+ Charger.am3352.RequestPinDebounceCnt = 0;
|
|
|
+ Charger.rfid.op_bits.reqStart = OFF;
|
|
|
+ if(!Charger.am3352.isRequestOff)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("#Request Pin Off.\r\n");
|
|
|
+ Charger.am3352.isRequestOff = ON;
|
|
|
+ }
|
|
|
+ }
|
|
|
+#else //FUNC_REQUEST_OFF_WHEN_GET_TWICE_OFF_CMD
|
|
|
Charger.am3352.isRequestOn = OFF;
|
|
|
Charger.am3352.RequestPinDebounceCnt = 0;
|
|
|
Charger.rfid.op_bits.reqStart = OFF;
|
|
@@ -2227,6 +2258,8 @@ void StartUartTask(void const * argument)
|
|
|
DEBUG_INFO("#Request Pin Off.\r\n");
|
|
|
Charger.am3352.isRequestOff = ON;
|
|
|
}
|
|
|
+#endif //FUNC_REQUEST_OFF_WHEN_GET_TWICE_OFF_CMD
|
|
|
+
|
|
|
}
|
|
|
|
|
|
tx_len = 8;
|
|
@@ -2613,12 +2646,18 @@ void StartUartTask(void const * argument)
|
|
|
}
|
|
|
else if (CurRxBuf == UART_RS485_rx_buffer)
|
|
|
{
|
|
|
- if (CurRxBuf[IMCP_FM_DSTADDR_IDX] != EMPX10_RS485_ADDR_BROADCAST)
|
|
|
+ if (CurRxBuf[IMCP_FM_DSTADDR_IDX] == Charger.m_EMPX10_RS485_ClientAddr)
|
|
|
{
|
|
|
Prefix_UartTX(tx, CurRxBuf);
|
|
|
HAL_UART_Transmit(pUartHandle, (uint8_t *)tx, tx_len , 0x0ffff);
|
|
|
Postfix_UartTX(tx, CurRxBuf);
|
|
|
}
|
|
|
+// else if (CurRxBuf[IMCP_FM_DSTADDR_IDX] == EMPX10_RS485_ADDR_BROADCAST)
|
|
|
+// {
|
|
|
+// Prefix_UartTX(tx, CurRxBuf);
|
|
|
+// HAL_UART_Transmit(pUartHandle, (uint8_t *)tx, tx_len , 0x0ffff);
|
|
|
+// Postfix_UartTX(tx, CurRxBuf);
|
|
|
+// }
|
|
|
}
|
|
|
#else //FUNC_EMPX10_CUSTOMIZE_RS485_CLIENT_ADDRESS
|
|
|
Prefix_UartTX(tx, CurRxBuf);
|
|
@@ -2640,6 +2679,13 @@ void StartUartTask(void const * argument)
|
|
|
|
|
|
}
|
|
|
|
|
|
+#ifdef DEBUG_EMPX10_COMM
|
|
|
+ if (CurRxBuf == UART_RS485_rx_buffer)
|
|
|
+ {
|
|
|
+ HTK_ByteArray2HexStr_XP(NULL, tx, 0, tx_len);
|
|
|
+ }
|
|
|
+#endif //DEBUG_EMPX10_COMM
|
|
|
+
|
|
|
#ifdef ENABLE_PRINT_IMCP_MSG
|
|
|
|
|
|
#ifdef FUNC_RS485_SLAVE
|
|
@@ -8566,8 +8612,7 @@ uint8_t isValidCheckSum_IAP(uint8_t *RxBuf)
|
|
|
{
|
|
|
return FAIL;
|
|
|
}
|
|
|
-
|
|
|
- if (RxBuf == UART_IAP_rx_buffer)
|
|
|
+ else if (RxBuf == UART_IAP_rx_buffer)
|
|
|
{
|
|
|
if (RxBuf[IMCP_FM_DSTADDR_IDX] != PROTOCOL_ADDR &&
|
|
|
RxBuf[IMCP_FM_DSTADDR_IDX] != PROTOCOL_ADDR_AC_MAINBOARD &&
|
|
@@ -8576,10 +8621,14 @@ uint8_t isValidCheckSum_IAP(uint8_t *RxBuf)
|
|
|
return FAIL;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (RxBuf == UART_RS485_rx_buffer)
|
|
|
+ else if (RxBuf == UART_RS485_rx_buffer)
|
|
|
{
|
|
|
- if (RxBuf[IMCP_FM_DSTADDR_IDX] != Charger.m_EMPX10_RS485_ClientAddr &&
|
|
|
+ if (RxBuf[IMCP_FM_SRCADDR_IDX] != EMPX10_RS485_ADDR_CSU)
|
|
|
+ {
|
|
|
+ return FAIL;
|
|
|
+ }
|
|
|
+ else if (
|
|
|
+ RxBuf[IMCP_FM_DSTADDR_IDX] != Charger.m_EMPX10_RS485_ClientAddr &&
|
|
|
RxBuf[IMCP_FM_DSTADDR_IDX] != EMPX10_RS485_ADDR_BROADCAST)
|
|
|
{
|
|
|
return FAIL;
|
|
@@ -9667,6 +9716,12 @@ void parseVersionInfoFromModelname(void)
|
|
|
// GB Socket
|
|
|
Charger.Ver_FW[6] = '3';
|
|
|
break;
|
|
|
+#ifdef FUNC_ADD_FW_VER_WITH_GUN_TYPE_NACS
|
|
|
+ case '9':
|
|
|
+ // NACS
|
|
|
+ Charger.Ver_FW[6] = '9';
|
|
|
+ break;
|
|
|
+#endif
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -9686,6 +9741,12 @@ void parseVersionInfoFromModelname(void)
|
|
|
// 3G/4G
|
|
|
Charger.Ver_FW[9] = '2';
|
|
|
break;
|
|
|
+#ifdef FUNC_ADD_FW_VER_WITH_NET_TYPE_WIFI_AND_4G
|
|
|
+ case 'D':
|
|
|
+ // WIFI + 4G
|
|
|
+ Charger.Ver_FW[9] = '5';
|
|
|
+ break;
|
|
|
+#endif
|
|
|
default:
|
|
|
// LAN
|
|
|
Charger.Ver_FW[9] = '0';
|
|
@@ -10176,7 +10237,8 @@ void Prefix_UartTX(uint8_t* TxBuf, uint8_t* RxBuf)
|
|
|
RS485_TX_Enable();
|
|
|
|
|
|
#ifdef FUNC_EMPX10_CUSTOMIZE_RS485_CLIENT_ADDRESS
|
|
|
- TxBuf[1] = RxBuf[2]; //Charger.m_EMPX10_RS485_ClientAddr;
|
|
|
+ //TxBuf[1] = RxBuf[2]; //Charger.m_EMPX10_RS485_ClientAddr;
|
|
|
+ TxBuf[1] = Charger.m_EMPX10_RS485_ClientAddr;
|
|
|
#else
|
|
|
TxBuf[1] = Charger.m_RS485SlaveAddr; //Update Slave Address
|
|
|
#endif
|