From 4a395124b6925c064efcf8d32bc67b4aa1c72621 Mon Sep 17 00:00:00 2001 From: zwsd Date: Sat, 9 Jul 2022 19:00:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=88=A4=E6=96=AD=EF=BC=8C=E6=9C=80=E5=90=8E=E5=8F=91=E7=8E=B0?= =?UTF-8?q?=E6=98=AF=E6=8E=A5=E6=94=B6=E9=83=A8=E5=88=86=E6=9C=89bug?= =?UTF-8?q?=EF=BC=8C=E5=BD=93=E5=89=8D=E6=98=AF=E6=9C=89bug=E7=9A=84?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/gatts_demo.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main/gatts_demo.c b/main/gatts_demo.c index a49c56f..5a4b909 100644 --- a/main/gatts_demo.c +++ b/main/gatts_demo.c @@ -599,6 +599,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; } + timer_set_pause_and_counter_zero(TIMER_GROUP_0, TIMER_0); ESP_LOGW(GATTS_TAG, "Processing buffer data,write data to buferr warning"); example_write_event_env(gatts_if, &b_prepare_write_env, param); break; @@ -895,7 +896,6 @@ void bluetooth_gatts_try_process_data() { cJSON *json_tmp; cJSON *ch; - uint8_t json_temp_size = 10; //接收完毕 if (bluetooth_rx_buffer_processing) { @@ -906,13 +906,22 @@ void bluetooth_gatts_try_process_data() //处理数据 json_tmp = cJSON_Parse(&bluetooth_rx_buffer[0]); + if (json_tmp == NULL) + { + ESP_LOGE("ERROR","json_tmp null"); + cJSON_Delete(json_tmp); + buffer_all_init(); + bluetooth_rx_buffer_processing = false; + return; + } ch = json_tmp->child; while (ch != NULL) { ESP_LOGI(GATTS_TAG, "%s", ch->string); - if (strcmp(ch->string,"order") == 0){ - ESP_LOGI("!!!!!!!!","##############"); + if (strcmp(ch->string, "order") == 0) + { + ESP_LOGI("!!!!!!!!", "##############"); } ch = ch->next; }