fix ble mesh send problem

This commit is contained in:
luchangjie 2020-10-30 12:04:15 +08:00 committed by Yuan Hong Hui
parent 67743ac444
commit 0c193626e0
9 changed files with 215 additions and 80 deletions

View File

@ -2,5 +2,7 @@
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/bluetooth/esp_ble_mesh/common_components/example_init)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(ble_mesh_console)

View File

@ -7,4 +7,6 @@ PROJECT_NAME := ble_mesh_console
COMPONENT_ADD_INCLUDEDIRS := components/include
EXTRA_COMPONENT_DIRS := $(IDF_PATH)/examples/bluetooth/esp_ble_mesh/common_components/example_init
include $(IDF_PATH)/make/project.mk

View File

@ -104,7 +104,7 @@ void ble_mesh_set_node_prestore_params(uint16_t netkey_index, uint16_t unicast_a
void ble_mesh_node_statistics_get(void)
{
xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY);
ESP_LOGI(TAG, "statistics:%d,%d\n", ble_mesh_node_statistics.statistics, ble_mesh_node_statistics.package_num);
ESP_LOGI(TAG, "Statistics:%d\n", ble_mesh_node_statistics.package_num);
xSemaphoreGive(ble_mesh_node_sema);
}
@ -114,6 +114,7 @@ int ble_mesh_node_statistics_accumulate(uint8_t *data, uint32_t value, uint16_t
uint16_t sequence_num = (data[0] << 8) | data[1];
xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY);
for (i = 0; i < ble_mesh_node_statistics.total_package_num; i++) {
if (ble_mesh_node_statistics.package_index[i] == sequence_num) {
xSemaphoreGive(ble_mesh_node_sema);
@ -136,6 +137,7 @@ int ble_mesh_node_statistics_accumulate(uint8_t *data, uint32_t value, uint16_t
}
}
xSemaphoreGive(ble_mesh_node_sema);
return 0;
}
@ -190,24 +192,26 @@ void ble_mesh_create_send_data(char *data, uint16_t byte_num, uint16_t sequence_
void ble_mesh_test_performance_client_model_get(void)
{
uint32_t i, j;
uint32_t i;
uint32_t succeed_packet_count;
uint32_t sum_time = 0;
uint32_t failed_packet_num = 0;
uint32_t rtt = 0;
for (i = 0, j = 0; i < test_perf_statistics.test_num; i++) {
for (i = 0, succeed_packet_count = 0; i < test_perf_statistics.test_num; i++) {
if (test_perf_statistics.time[i] != 0) {
sum_time += test_perf_statistics.time[i];
j += 1;
succeed_packet_count += 1;
} else {
continue;
}
if (j == test_perf_statistics.test_num - 1) {
break;
failed_packet_num += 1;
}
}
ESP_LOGI(TAG, "VendorModel:Statistics,%d,%d\n",
test_perf_statistics.statistics, (sum_time / (j + 1)));
if(succeed_packet_count != 0){
rtt = (int)(sum_time / succeed_packet_count);
}
ESP_LOGI(TAG, "VendorModel:Statistics,%d,%d\n", failed_packet_num, rtt);
}
void ble_mesh_test_performance_client_model_get_received_percent(void)
@ -250,6 +254,9 @@ void ble_mesh_test_performance_client_model_get_received_percent(void)
// for script match
ESP_LOGI(TAG, "VendorModel:Statistics");
for (j = 0; j < time_level_num; j++) {
ESP_LOGI("", "%d:%d", statistics_time_percent[j].time_level, statistics_time_percent[j].time_num);
}
free(statistics_time_percent);
}
@ -264,18 +271,12 @@ int ble_mesh_test_performance_client_model_accumulate_time(uint16_t time, uint8_
uint16_t sequence_num = 0;
uint16_t node_received_ttl = 0;
// receive failed
if (length != test_perf_statistics.test_length) {
return 1;
}
if (data != NULL) {
sequence_num = (data[0] << 8) | data[1];
if (data[2] == VENDOR_MODEL_PERF_OPERATION_TYPE_SET) {
node_received_ttl = data[3];
}
}
for (i = 0; i < test_perf_statistics.test_num; i++) {
if (test_perf_statistics.package_index[i] == sequence_num) {
return 1;
@ -286,7 +287,7 @@ int ble_mesh_test_performance_client_model_accumulate_time(uint16_t time, uint8_
if (test_perf_statistics.package_index[i] == 0) {
test_perf_statistics.package_index[i] = sequence_num;
if (data[2] == VENDOR_MODEL_PERF_OPERATION_TYPE_SET) {
if (node_received_ttl == test_perf_statistics.ttl && ack_ttl == test_perf_statistics.ttl) {
if (node_received_ttl == test_perf_statistics.ttl) {
test_perf_statistics.time[i] = time;
} else {
test_perf_statistics.time[i] = 0;

View File

@ -22,12 +22,10 @@
#include "esp_vfs_fat.h"
#include "esp_bt.h"
#include "esp_bt_main.h"
#include "esp_console.h"
#include "ble_mesh_console_decl.h"
#include "ble_mesh_example_init.h"
#define TAG "ble_mesh_test"
@ -50,34 +48,6 @@ static void initialize_filesystem(void)
}
#endif // CONFIG_STORE_HISTORY
esp_err_t bluetooth_init(void)
{
esp_err_t ret;
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
ret = esp_bt_controller_init(&bt_cfg);
if (ret) {
return ret;
}
ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);
if (ret) {
return ret;
}
ret = esp_bluedroid_init();
if (ret) {
return ret;
}
ret = esp_bluedroid_enable();
if (ret) {
return ret;
}
esp_log_level_set("*", ESP_LOG_ERROR);
esp_log_level_set("ble_mesh_console", ESP_LOG_INFO);
return ret;
}
void app_main(void)
{
esp_err_t res;
@ -90,6 +60,9 @@ void app_main(void)
printf("esp32_bluetooth_init failed (ret %d)", res);
}
esp_log_level_set("*", ESP_LOG_INFO);
esp_log_level_set("ble_mesh_console", ESP_LOG_INFO);
esp_console_repl_t *repl = NULL;
esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();

View File

@ -62,7 +62,7 @@ static void register_restart(void)
static int free_mem(int argc, char **argv)
{
printf("%d\n", esp_get_free_heap_size());
printf("freeheap:%d\n", esp_get_free_heap_size());
return 0;
}

View File

@ -70,18 +70,18 @@ void ble_mesh_test_performance_client_model_throughput(void *params)
ctx.model = profile_context->model;
ctx.send_rel = 0;
test_perf_statistics.test_length = profile_context->length;
// create send data
data = malloc(profile_context->length);
if (data == NULL) {
ESP_LOGE(TAG, " %s, %d, malloc fail\n", __func__, __LINE__);
}
TRANSACTION_INIT(&trans, TRANS_TYPE_MESH_PERF, TRANS_MESH_SEND_MESSAGE,
TRANS_MESH_SEND_MESSAGE_EVT, SEND_MESSAGE_TIMEOUT, &start_time, NULL);
for (i = 1; i <= profile_context->test_num; i++) {
ble_mesh_create_send_data((char *)data, profile_context->length, i, profile_context->opcode);
start_time = esp_timer_get_time();
TRANSACTION_INIT(&trans, TRANS_TYPE_MESH_PERF, TRANS_MESH_SEND_MESSAGE,
TRANS_MESH_SEND_MESSAGE_EVT, SEND_MESSAGE_TIMEOUT, &start_time, NULL);
//tx: data profile_context->length
esp_ble_mesh_client_model_send_msg(profile_context->model, &ctx, profile_context->opcode,
profile_context->length, data, 8000, profile_context->need_ack, profile_context->device_role);
ble_mesh_test_performance_client_model_accumulate_statistics(profile_context->length);
@ -156,7 +156,6 @@ int ble_mesh_test_performance_client_model_performance(int argc, char **argv)
}
if (strcmp(test_perf_client_model_statistics.action_type->sval[0], "init") == 0) {
init_transactions();
result = ble_mesh_test_performance_client_model_init(test_perf_client_model_statistics.node_num->ival[0],
test_perf_client_model_statistics.test_size->ival[0], test_perf_client_model_statistics.ttl->ival[0]);
if (result == 0) {

View File

@ -15,8 +15,6 @@
#include "esp_bt.h"
#include "soc/soc.h"
#include "esp_bt_device.h"
#include "test.h"
#include "esp_ble_mesh_networking_api.h"
#include "esp_ble_mesh_defs.h"
@ -25,8 +23,8 @@
#include "esp_ble_mesh_generic_model_api.h"
#include "ble_mesh_console_lib.h"
#include "ble_mesh_adapter.h"
#include "transaction.h"
#include "esp_bt_defs.h"
#include "provisioner_prov.h"
@ -56,6 +54,12 @@ typedef struct {
} ble_mesh_comp_t;
static ble_mesh_comp_t component;
typedef struct {
struct arg_int *action;
struct arg_end *end;
} ble_mesh_deinit_t;
static ble_mesh_deinit_t deinit;
typedef struct {
struct arg_int *bearer;
struct arg_int *enable;
@ -290,8 +294,8 @@ void ble_mesh_prov_cb(esp_ble_mesh_prov_cb_event_t event, esp_ble_mesh_prov_cb_p
#if (CONFIG_BLE_MESH_PROVISIONER)
case ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT:
ESP_LOGD(TAG, "Provisioner recv unprovisioned device beacon:");
ESP_LOG_BUFFER_HEX("Device UUID %s", param->provisioner_recv_unprov_adv_pkt.dev_uuid, 16);
ESP_LOG_BUFFER_HEX("Address %s", param->provisioner_recv_unprov_adv_pkt.addr, 6);
ESP_LOG_BUFFER_HEX("Device UUID", param->provisioner_recv_unprov_adv_pkt.dev_uuid, 16);
ESP_LOG_BUFFER_HEX("Address", param->provisioner_recv_unprov_adv_pkt.addr, 6);
ESP_LOGD(TAG, "Address type 0x%x, oob_info 0x%04x, adv_type 0x%x, bearer 0x%x",
param->provisioner_recv_unprov_adv_pkt.addr_type, param->provisioner_recv_unprov_adv_pkt.oob_info,
param->provisioner_recv_unprov_adv_pkt.adv_type, param->provisioner_recv_unprov_adv_pkt.bearer);
@ -347,13 +351,24 @@ void ble_mesh_model_cb(esp_ble_mesh_model_cb_event_t event, esp_ble_mesh_model_c
{
uint16_t result;
uint8_t data[4];
esp_err_t outcome = ESP_OK;
uint8_t status;
uint64_t *start_time = NULL;
transaction_t *trans = NULL;
ESP_LOGD(TAG, "enter %s, event=%x\n", __func__, event);
do {
trans = transaction_get(TRANS_TYPE_MESH_PERF, TRANS_MESH_SEND_MESSAGE, trans);
if (trans) {
start_time = (uint64_t *)trans->input;
break;
}
}while(trans);
switch (event) {
case ESP_BLE_MESH_MODEL_OPERATION_EVT:
if (param->model_operation.model != NULL && param->model_operation.model->op != NULL) {
if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET) {
if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET) {
ESP_LOGI(TAG, "VendorModel:SetAck,Success,%d", param->model_operation.ctx->recv_ttl);
data[0] = param->model_operation.msg[0];
data[1] = param->model_operation.msg[1];
@ -367,9 +382,36 @@ void ble_mesh_model_cb(esp_ble_mesh_model_cb_event_t event, esp_ble_mesh_model_c
} else if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET_UNACK) {
ESP_LOGI(TAG, "VendorModel:SetUnAck,Success,%d,%d", param->model_operation.ctx->recv_ttl, param->model_operation.length);
result = ble_mesh_node_statistics_accumulate(param->model_operation.msg, param->model_operation.length, VENDOR_MODEL_PERF_OPERATION_TYPE_SET_UNACK);
if (result == 0) {
esp_ble_mesh_server_model_send_msg(param->model_operation.model, param->model_operation.ctx,
ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS, param->model_operation.length, param->model_operation.msg);
}
else if (param->model_operation.opcode == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET) {
ESP_LOGI(TAG, "Node:GetStatus,OK");
ble_mesh_node_get_state(status);
outcome = esp_ble_mesh_server_model_send_msg(param->model_operation.model, param->model_operation.ctx, ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS,
sizeof(status), &status);
if (outcome != ESP_OK) {
ESP_LOGE(TAG, "Node:SendMsg,Fal");
}
} else if (param->model_operation.opcode == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET) {
ble_mesh_node_set_state(param->model_operation.msg[0]);
ESP_LOGI(TAG, "Node:SetAck,OK,%d,%d", param->model_operation.msg[0], param->model_operation.ctx->recv_ttl);
outcome = esp_ble_mesh_server_model_send_msg(param->model_operation.model, param->model_operation.ctx, ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS,
sizeof(status), param->model_operation.msg);
if (outcome != ESP_OK) {
ESP_LOGE(TAG, "Node:SendMsg,Fal");
}
} else if (param->model_operation.opcode == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK) {
ble_mesh_node_set_state(param->model_operation.msg[0]);
ESP_LOGI(TAG, "Node:SetUnAck,OK,%d,%d", param->model_operation.msg[0], param->model_operation.ctx->recv_ttl);
} else if (param->model_operation.opcode == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS) {
ESP_LOGI(TAG, "Node:Status,Success,%d", param->model_operation.length);
} else if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET) {
ESP_LOGI(TAG, "VendorModel:SetAck,OK,%d", param->model_operation.ctx->recv_ttl);
} else if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS) {
if (trans) {
uint64_t current_time = esp_timer_get_time();
outcome = ble_mesh_test_performance_client_model_accumulate_time(((uint32_t)(current_time - *start_time) / 1000), param->model_operation.msg,
param->model_operation.ctx->recv_ttl, param->model_operation.length);
transaction_set_events(trans, TRANS_MESH_SEND_MESSAGE_EVT);
}
}
}
@ -384,11 +426,23 @@ void ble_mesh_model_cb(esp_ble_mesh_model_cb_event_t event, esp_ble_mesh_model_c
case ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT:
ESP_LOGI(TAG, "PublishSend,OK,0x%x,%d,", param->model_publish_comp.model->model_id, param->model_publish_comp.model->pub->msg->len);
break;
case ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT:
ESP_LOGI(TAG, "Node:PublishReceive,OK,0x%04X,%d,%d", param->client_recv_publish_msg.opcode, param->client_recv_publish_msg.length, param->client_recv_publish_msg.msg[1]);
if (trans) {
uint64_t current_time = esp_timer_get_time();
outcome = ble_mesh_test_performance_client_model_accumulate_time(((uint32_t)(current_time - *start_time) / 2000), param->client_recv_publish_msg.msg,
param->client_recv_publish_msg.ctx->recv_ttl, param->client_recv_publish_msg.length);
transaction_set_events(trans, TRANS_MESH_SEND_MESSAGE_EVT);
}
break;
case ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT:
ESP_LOGI(TAG, "PublishUpdate,OK");
break;
case ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT:
ESP_LOGI(TAG, "Node:TimeOut");
ESP_LOGI(TAG, "Node:TimeOut, 0x%04X", param->client_send_timeout.opcode);
if (trans) {
transaction_set_events(trans, TRANS_MESH_SEND_MESSAGE_EVT);
}
break;
case ESP_BLE_MESH_MODEL_EVT_MAX:
ESP_LOGI(TAG, "Node:MaxEvt");
@ -429,6 +483,19 @@ int ble_mesh_power_set(int argc, char **argv)
return result;
}
static int get_dev_uuid(uint8_t uuid[16])
{
uint8_t addr[6] = {0};
extern int get_bd_addr(uint8_t addr[6]);
if (get_bd_addr(addr)) {
return -1;
}
memcpy(uuid, addr, BD_ADDR_LEN);
return 0;
}
static int ble_mesh_load_oob(int argc, char **argv)
{
uint8_t *static_val;
@ -444,7 +511,9 @@ static int ble_mesh_load_oob(int argc, char **argv)
//parsing prov
#if CONFIG_BLE_MESH_NODE
prov.uuid = dev_uuid;
memcpy(dev_uuid, esp_bt_dev_get_address(), BD_ADDR_LEN);
if (get_dev_uuid(dev_uuid)) {
return 1;
}
if (oob.static_val->count != 0) {
static_val = malloc(oob.static_val_len->ival[0] + 1);
if (static_val == NULL) {
@ -500,7 +569,7 @@ int ble_mesh_init(int argc, char **argv)
if (device_uuid == NULL) {
ESP_LOGE(TAG, "ble mesh malloc failed, %d\n", __LINE__);
}
err = get_value_string((char *)component.dev_uuid->sval[0], (char *) device_uuid);
err = get_value_string((char *)component.dev_uuid->sval[0], (char *)device_uuid);
if (err == ESP_OK) {
memcpy(dev_uuid, device_uuid, ESP_BLE_MESH_OCTET16_LEN);
} else {
@ -508,7 +577,9 @@ int ble_mesh_init(int argc, char **argv)
memcpy(dev_uuid, device_uuid, BD_ADDR_LEN);
}
} else {
memcpy(dev_uuid, esp_bt_dev_get_address(), 6);
if (get_dev_uuid(dev_uuid)) {
return 1;
}
}
err = esp_ble_mesh_init(&prov, local_component);
@ -550,6 +621,35 @@ int ble_mesh_node_enable_bearer(int argc, char **argv)
return err;
}
int ble_mesh_deinit(int argc, char **argv)
{
int err;
esp_ble_mesh_deinit_param_t param = {};
ESP_LOGD(TAG, "enter %s \n", __func__);
int nerrors = arg_parse(argc, argv, (void **) &deinit);
if (nerrors != 0) {
arg_print_errors(stderr, deinit.end, argv[0]);
return 1;
}
if (deinit.action->count != 0) {
param.erase_flash = deinit.action->ival[0];
err = esp_ble_mesh_deinit(&param);
if (err == ESP_OK) {
ESP_LOGI(TAG, "Bm:DeInit,OK,%d,\n", deinit.action->ival[0]);
}
else{
ESP_LOGI(TAG, "Bm:DeInit,Fail\n");
}
}
else {
return 1;
}
ESP_LOGD(TAG, "exit %s\n", __func__);
return err;
}
int ble_mesh_provisioner_enable_bearer(int argc, char **argv)
{
esp_err_t err = 0;
@ -672,9 +772,15 @@ int ble_mesh_provision_address(int argc, char **argv)
str_2_mac((uint8_t *)provisioner_addr.device_addr->sval[0], del_dev.addr);
arg_int_to_value(provisioner_addr.addr_type, device_addr.addr_type, "address type");
arg_int_to_value(provisioner_addr.addr_type, del_dev.addr_type, "address type");
} else if (provisioner_addr.device_uuid->count != 0) {
get_value_string((char *)provisioner_addr.device_uuid->sval[0], (char *)device_addr.uuid);
get_value_string((char *)provisioner_addr.device_uuid->sval[0], (char *)del_dev.uuid);
}
if (provisioner_addr.device_uuid->count != 0) {
uint8_t tmp_uuid[16] = {0};
err = get_value_string((char *)provisioner_addr.device_uuid->sval[0], (char *)tmp_uuid);
if (err != ESP_OK) {
str_2_mac((uint8_t *)provisioner_addr.device_uuid->sval[0], tmp_uuid);
}
memcpy(device_addr.uuid, tmp_uuid, 16);
memcpy(del_dev.uuid, tmp_uuid, 16);
del_dev.flag = BIT(1);
}
@ -858,7 +964,19 @@ void ble_mesh_register_cmd(void)
.func = &ble_mesh_init,
.argtable = &component,
};
ESP_ERROR_CHECK( esp_console_cmd_register(&model_cmd) );
ESP_ERROR_CHECK( esp_console_cmd_register(&model_cmd));
deinit.action = arg_int0("o", NULL, "<action>", "deinit action");
deinit.end = arg_end(1);
const esp_console_cmd_t deinit_cmd = {
.command = "bmdeinit",
.help = "ble mesh: provisioner/node deinit",
.hint = NULL,
.func = &ble_mesh_deinit,
.argtable = &deinit,
};
ESP_ERROR_CHECK( esp_console_cmd_register(&deinit_cmd));
provisioner_addr.add_del = arg_str1("z", NULL, "<add/delete>", "action type");
provisioner_addr.device_addr = arg_str0("d", NULL, "<address>", "device address");
@ -896,7 +1014,7 @@ void ble_mesh_register_cmd(void)
.func = &ble_mesh_load_oob,
.argtable = &oob,
};
ESP_ERROR_CHECK( esp_console_cmd_register(&oob_cmd) );
ESP_ERROR_CHECK( esp_console_cmd_register(&oob_cmd));
bearer.bearer = arg_int0("b", NULL, "<bearer>", "supported bearer");
bearer.enable = arg_int0("e", NULL, "<enable/disable>", "bearers node supported");
@ -1027,4 +1145,6 @@ void ble_mesh_register_cmd(void)
.argtable = &node_network_info,
};
ESP_ERROR_CHECK(esp_console_cmd_register(&node_network_info_cmd));
init_transactions();
}

View File

@ -11,10 +11,18 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "string.h"
#include "esp_bt_device.h"
#include "esp_console.h"
#ifdef CONFIG_BT_BLUEDROID_ENABLED
#include "esp_bt_device.h"
#endif
#ifdef CONFIG_BT_NIMBLE_ENABLED
#include "host/ble_hs.h"
#endif
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
@ -25,9 +33,45 @@ void register_bluetooth(void)
register_ble_address();
}
int get_bd_addr(uint8_t addr[6])
{
if (addr) {
#ifdef CONFIG_BT_BLUEDROID_ENABLED
memcpy(addr, esp_bt_dev_get_address(), 6);
return 0;
#endif
#ifdef CONFIG_BT_NIMBLE_ENABLED
uint8_t own_addr_type = 0;
uint8_t mac[6] = {0};
int rc = 0;
rc = ble_hs_id_infer_auto(0, &own_addr_type);
if (rc != 0) {
printf("error determining address type; rc=%d\n", rc);
return rc;
}
ble_hs_id_copy_addr(own_addr_type, mac, NULL);
uint8_t *src = addr;
uint8_t *dst = mac + 5;
for (uint8_t length = 6; length > 0; length--) {
*src++ = *dst--;
}
return 0;
#endif
}
return -1;
}
int bt_mac(int argc, char** argv)
{
const uint8_t *mac = esp_bt_dev_get_address();
uint8_t mac[6] = {0};
get_bd_addr(mac);
printf("+BTMAC:"MACSTR"\n", MAC2STR(mac));
return 0;
}

View File

@ -5,14 +5,10 @@
#include "freertos/event_groups.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "esp_timer.h"
#include "esp_log.h"
#include "esp_err.h"
#include "transaction.h"
#define TAG "TRANS"
static transaction_t transactions[MAX_TRANSACTION_COUNT];
@ -178,7 +174,6 @@ esp_err_t transaction_run(transaction_t *trans)
if (trans) {
start_time = utils_get_system_ts();
// wait for wait events
while (1) {
//TODO: we didn't handle ts overflow
@ -246,7 +241,6 @@ transaction_t *transaction_get(uint8_t type, uint32_t sub_type, transaction_t *s
}
}
xSemaphoreGiveRecursive(trans_mutex);
ESP_LOGV(TAG, "transaction get: %x, %x, %x, %x", type, sub_type, (uint32_t) start, (uint32_t) trans);
return trans;
}