Browse Source

更改变量名,处理数据时写入警告提示

master
zwsd 3 years ago
parent
commit
92a3e85c89
  1. 19
      main/gatts_demo.c

19
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_all_init();
//
bluetooth_rx_buffer_processing = false;
}
}
Loading…
Cancel
Save