|
|
@@ -10,12 +10,17 @@
|
|
|
#include "string.h"
|
|
|
|
|
|
#include "hal_spi.h"
|
|
|
-
|
|
|
+#define WECHAT_DEBUG 1
|
|
|
#define BLE_CONFIG_BUF_LEN 32
|
|
|
|
|
|
static uint16_t g_s_tlen = 0;
|
|
|
static uint16_t g_s_clen = 0;
|
|
|
static uint8_t g_s_ble_config[BLE_CONFIG_BUF_LEN];
|
|
|
+#if WECHAT_DEBUG
|
|
|
+
|
|
|
+static uint8_t test_cmd[] = {0x00, 0x00, 0x06, 0xf1, 0x05, 0x12, 0x03, 0x22, 0xf1, 0x8a};
|
|
|
+uint8_t test_tx_buffer[] = {0x52, 0x01, 0x00, 0x00, 0x00, 0x06, 0x12, 0x08, 0xf1, 0x06, 0x62, 0xf1, 0x8a, 0x22, 0x22, 0x22};
|
|
|
+#endif //WECHAT_DEBUG
|
|
|
|
|
|
static spi_send_callback_fp g_s_spi_send_callback = NULL;
|
|
|
|
|
|
@@ -62,7 +67,19 @@ void MOD_SpiDataProcess(uint8_t* data, uint8_t data_len)
|
|
|
if(data[4] == TRANSFER_GET_CAN_CMD)
|
|
|
{
|
|
|
DLOG_I("send_can_data_cmd");
|
|
|
+#if WECHAT_DEBUG
|
|
|
+ if(!memcmp(&data[7], test_cmd, sizeof(test_cmd)))
|
|
|
+ {
|
|
|
+ DLOG_I("wechat test cmd");
|
|
|
+ MOD_SpiDataSend(BLE_CMD_TRANSFER, test_tx_buffer, sizeof(test_tx_buffer));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MOD_CanTransferData(&data[5], pack_len-3-1);
|
|
|
+ }
|
|
|
+#else
|
|
|
MOD_CanTransferData(&data[5], pack_len-3-1);
|
|
|
+#endif //WECHAT_DEBUG
|
|
|
}
|
|
|
}
|
|
|
else if(pack_cmd == BLE_CMD_CONNECT)
|