diff --git a/main/gatts_demo.c b/main/gatts_demo.c index 9e5b982..3051ebc 100644 --- a/main/gatts_demo.c +++ b/main/gatts_demo.c @@ -559,7 +559,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i #define profile_b_buffer_size 100 char bluetooth_rx_buffer[profile_b_buffer_size] = {0}; uint8_t bluetooth_rx_buffer_len = 0; -bool bluetooth_rx_off = false; +bool bluetooth_rx_buffer_processing = false; bool flag = true; uint32_t total = 0; @@ -614,7 +614,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i } case ESP_GATTS_WRITE_EVT: { - if (bluetooth_rx_off == false) + if (bluetooth_rx_buffer_processing == false) { timer_set_pause_and_counter_zero(TIMER_GROUP_0, TIMER_0); timer_start(TIMER_GROUP_0, TIMER_0); @@ -633,7 +633,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i example_write_event_env(gatts_if, &b_prepare_write_env, param); break; } - + ESP_LOGW(GATTS_TAG, "Processing buffer data,write data to buferr warning"); example_write_event_env(gatts_if, &b_prepare_write_env, param); break; } @@ -765,7 +765,7 @@ static bool IRAM_ATTR timer_group_isr_callback(void *args) // printf("esp_bt_controller_init"); // ESP_LOGI("timer","------------------"); - bluetooth_rx_off = true; + bluetooth_rx_buffer_processing = true; return pdFALSE; } @@ -892,19 +892,22 @@ void app_main(void) void bluetooth_gatts_try_process_data() { //接收完毕 - if (bluetooth_rx_off) + if (bluetooth_rx_buffer_processing) { //关闭定时器 timer_set_pause_and_counter_zero(TIMER_GROUP_0, TIMER_0); //打印输出 ESP_LOGI(GATTS_TAG, "%s", &bluetooth_rx_buffer[0]); - //验证数据 //处理数据 + while (1) + { + /* code */ + } - //接收标志位设为未接收 - bluetooth_rx_off = false; - //buffer置0 + // buffer置0 buffer_all_init(); + //未在处理数据 + bluetooth_rx_buffer_processing = false; } } \ No newline at end of file