丢弃首次连接APP发送过来的数据转发
This commit is contained in:
@@ -91,6 +91,7 @@ static void ble_server_connect_handler(ble_server_status_t status)
|
||||
if(res == DEVICE_PC_ERROR){
|
||||
}
|
||||
device_wifi_stop();
|
||||
device_inside->ble_one_connect_flag = 1;
|
||||
SYS_LOG_INF("ble Connected");
|
||||
} else if(status == BLE_SERVER_STATUS_DISCONNECTED){
|
||||
uint8_t res = pc_device_choice_inside(NULL, DATA_PORT_TYPE_BLE_VAL, DISCONNECT);
|
||||
|
||||
@@ -96,6 +96,8 @@ typedef struct
|
||||
// int (*embedded_write)(device_t *port, const void *data, uint32_t size);
|
||||
uint8_t last_color;
|
||||
|
||||
// 每次刚连接ble都会将标志位置一 ,因为连接上app后,app会发送一段字符串,这段字符串我暂时用不到需要抛弃,不然会影响异常飞控固件升级
|
||||
uint8_t ble_one_connect_flag;
|
||||
}device_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -118,6 +118,7 @@ void embedded_thread(void* arg)
|
||||
}
|
||||
void pc_thread(void* arg)
|
||||
{
|
||||
static bool app_pc_discard = true;
|
||||
while(true)
|
||||
{
|
||||
uint32_t pc_size = pc_device_get_rx_length(&sertrf.device);
|
||||
@@ -127,6 +128,12 @@ void pc_thread(void* arg)
|
||||
uint8_t data[pc_size];
|
||||
pc_device_read(&sertrf.device, data, pc_size);
|
||||
// SYS_LOG_INF("data : %s", data);
|
||||
// 由于APP连接上后,会发送一串我用不到的数据,需要丢弃掉,不然会影响我异常飞控固件升级
|
||||
if(sertrf.device.ble_one_connect_flag == 1)
|
||||
{
|
||||
sertrf.device.ble_one_connect_flag = 0;
|
||||
continue;
|
||||
}
|
||||
if(!sertrf.stmisp_device.flag)
|
||||
embedded_device_write(&sertrf.device, data, pc_size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user