gengyuchao 6 ani în urmă
părinte
comite
ef07a315bb

+ 3 - 2
examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/main/example_ble_client_throughput.c

@@ -516,7 +516,7 @@ static void throughput_client_task(void *param)
                                                             ESP_GATT_WRITE_TYPE_NO_RSP,
                                                             ESP_GATT_AUTH_REQ_NONE);
                         }
-                    } else { //you can delete the else for the fast speed
+                    } else { //Add the vTaskDelay to prevent this task from consuming the CPU all the time, causing low-priority tasks to not be executed at all.
                         vTaskDelay( 10 / portTICK_PERIOD_MS );
                     }
                 }
@@ -586,7 +586,8 @@ void app_main()
     if (local_mtu_ret){
         ESP_LOGE(GATTC_TAG, "set local  MTU failed, error code = %x", local_mtu_ret);
     }
-
+    // The task is only created on the CPU core that Bluetooth is working on, 
+    // preventing the sending task from using the un-updated Bluetooth state on another CPU.
     xTaskCreatePinnedToCore(&throughput_client_task, "throughput_client_task", 4096, NULL, 10, NULL, BLUETOOTH_TASK_PINNED_TO_CORE);
 
 #if (CONFIG_GATTC_WRITE_THROUGHPUT)

+ 3 - 2
examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/main/example_ble_server_throughput.c

@@ -631,7 +631,7 @@ void throughput_server_task(void *param)
                                                     gl_profile_tab[PROFILE_A_APP_ID].char_handle,
                                                     sizeof(indicate_data), indicate_data, false);
                     }
-                } else { //you can delete the else for the fast speed
+                } else { //Add the vTaskDelay to prevent this task from consuming the CPU all the time, causing low-priority tasks to not be executed at all.
                     vTaskDelay( 10 / portTICK_PERIOD_MS );
                 }
             }
@@ -711,7 +711,8 @@ void app_main()
     if (local_mtu_ret){
         ESP_LOGE(GATTS_TAG, "set local  MTU failed, error code = %x", local_mtu_ret);
     }
-
+    // The task is only created on the CPU core that Bluetooth is working on, 
+    // preventing the sending task from using the un-updated Bluetooth state on another CPU.
     xTaskCreatePinnedToCore(&throughput_server_task, "throughput_server_task", 4096, NULL, 15, NULL, BLUETOOTH_TASK_PINNED_TO_CORE);
 #if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT)
     gatts_semaphore = xSemaphoreCreateBinary();