Procházet zdrojové kódy

esp_ble_mesh: Use standard ESP-IDF asserts

Smaller binary size, means that config options for silent assert or disable
assert will apply
Angus Gratton před 5 roky
rodič
revize
cfde7adb7f

+ 1 - 1
components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c

@@ -1017,7 +1017,7 @@ int btc_ble_mesh_client_model_init(esp_ble_mesh_model_t *model)
         return -EINVAL;
     }
 
-    __ASSERT(model && model->op, "%s, Invalid parameter", __func__);
+    __ASSERT(model && model->op, "Invalid parameter");
     esp_ble_mesh_model_op_t *op = model->op;
     while (op != NULL && op->opcode != 0) {
         op->param_cb = (esp_ble_mesh_cb_t)btc_ble_mesh_client_model_op_cb;

+ 3 - 12
components/bt/esp_ble_mesh/mesh_common/include/mesh_trace.h

@@ -9,6 +9,7 @@
 #ifndef _BLE_MESH_TRACE_H_
 #define _BLE_MESH_TRACE_H_
 
+#include <assert.h>
 #include "esp_log.h"
 #include "mesh_util.h"
 #include "esp_rom_sys.h"
@@ -72,21 +73,11 @@ extern "C" {
 #define STRINGIFY(s)    _STRINGIFY(s)
 
 #ifndef __ASSERT
-#define __ASSERT(test, fmt, ...)                        \
-    do {                                                \
-        if (!(test)) {                                  \
-            printk("ASSERTION FAIL [%s] @ %s:%d:\n\t",  \
-                   _STRINGIFY(test),                    \
-                   __FILE__,                            \
-                   __LINE__);                           \
-            printk(fmt, ##__VA_ARGS__);                 \
-            for (;;);                                   \
-        }                                               \
-    } while ((0))
+#define __ASSERT(test, str) assert(test)
 #endif
 
 #ifndef __ASSERT_NO_MSG
-#define __ASSERT_NO_MSG(x)  do { if (!(x)) BLE_MESH_PRINT_E(BLE_MESH_TRACE_TAG, "error %s %u", __FILE__, __LINE__); } while (0)
+#define __ASSERT_NO_MSG(x) assert(x)
 #endif
 
 #if !CONFIG_BLE_MESH_NO_LOG

+ 1 - 0
components/bt/esp_ble_mesh/mesh_core/adv.c

@@ -652,6 +652,7 @@ void bt_mesh_adv_init(void)
     int ret = xTaskCreatePinnedToCore(adv_thread, BLE_MESH_ADV_TASK_NAME, BLE_MESH_ADV_TASK_STACK_SIZE, NULL,
                                       BLE_MESH_ADV_TASK_PRIO, &adv_task.handle, BLE_MESH_ADV_TASK_CORE);
     __ASSERT(ret == pdTRUE, "Failed to create adv thread");
+    (void)ret;
 #endif /* CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL && CONFIG_SPIRAM_CACHE_WORKAROUND && CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY */
 }