esp_ble_mesh: Use standard ESP-IDF asserts

Smaller binary size, means that config options for silent assert or disable
assert will apply
pull/6718/head
Angus Gratton 2021-02-18 11:18:32 +11:00
rodzic 0d26c89b6b
commit cfde7adb7f
3 zmienionych plików z 5 dodań i 13 usunięć

Wyświetl plik

@ -1017,7 +1017,7 @@ int btc_ble_mesh_client_model_init(esp_ble_mesh_model_t *model)
return -EINVAL; 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; esp_ble_mesh_model_op_t *op = model->op;
while (op != NULL && op->opcode != 0) { while (op != NULL && op->opcode != 0) {
op->param_cb = (esp_ble_mesh_cb_t)btc_ble_mesh_client_model_op_cb; op->param_cb = (esp_ble_mesh_cb_t)btc_ble_mesh_client_model_op_cb;

Wyświetl plik

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

Wyświetl plik

@ -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, 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); BLE_MESH_ADV_TASK_PRIO, &adv_task.handle, BLE_MESH_ADV_TASK_CORE);
__ASSERT(ret == pdTRUE, "Failed to create adv thread"); __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 */ #endif /* CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL && CONFIG_SPIRAM_CACHE_WORKAROUND && CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY */
} }