From fb3242938754036322387ea4fa71233c3fa1a132 Mon Sep 17 00:00:00 2001 From: Hrishikesh Dhayagude Date: Fri, 11 Oct 2019 12:14:05 +0530 Subject: [PATCH] ESP BLE Mesh: Minor fix - Print the address and the on/off value appropriately The new value should be printed in the set function and not the previous one. --- .../ble_mesh_client_model/main/ble_mesh_demo_main.c | 8 ++++---- .../esp_ble_mesh/ble_mesh_node/main/ble_mesh_demo_main.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/main/ble_mesh_demo_main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/main/ble_mesh_demo_main.c index 3dde33207..f7466992d 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/main/ble_mesh_demo_main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/main/ble_mesh_demo_main.c @@ -150,12 +150,12 @@ static void gen_onoff_set_unack_handler(esp_ble_mesh_model_t *model, uint8_t prev_onoff; esp_err_t err; - ESP_LOGI(TAG, "%s, addr 0x%02x onoff 0x%02x", __func__, model->element->element_addr, led->current); - prev_onoff = led->previous; led->current = data[0]; remote_onoff = led->current; + ESP_LOGI(TAG, "%s, addr 0x%04x onoff 0x%02x", __func__, model->element->element_addr, led->current); + board_led_operation(led->pin, led->current); /* If Generic OnOff state is changed, and the publish address of Generic OnOff Server @@ -181,12 +181,12 @@ static void gen_onoff_set_handler(esp_ble_mesh_model_t *model, uint8_t prev_onoff, send_data; esp_err_t err; - ESP_LOGI(TAG, "%s, addr 0x%02x onoff 0x%02x", __func__, model->element->element_addr, led->current); - prev_onoff = led->previous; led->current = data[0]; remote_onoff = led->current; + ESP_LOGI(TAG, "%s, addr 0x%04x onoff 0x%02x", __func__, model->element->element_addr, led->current); + board_led_operation(led->pin, led->current); send_data = led->current; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/main/ble_mesh_demo_main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/main/ble_mesh_demo_main.c index 0e0aeaf84..1d8fb2cd5 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/main/ble_mesh_demo_main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/main/ble_mesh_demo_main.c @@ -146,11 +146,11 @@ static void gen_onoff_set_unack_handler(esp_ble_mesh_model_t *model, uint8_t prev_onoff; esp_err_t err; - ESP_LOGI(TAG, "%s, addr 0x%02x onoff 0x%02x", __func__, model->element->element_addr, led->current); - prev_onoff = led->previous; led->current = data[0]; + ESP_LOGI(TAG, "%s, addr 0x%04x onoff 0x%02x", __func__, model->element->element_addr, led->current); + board_led_operation(led->pin, led->current); /* If Generic OnOff state is changed, and the publish address of Generic OnOff Server @@ -175,11 +175,11 @@ static void gen_onoff_set_handler(esp_ble_mesh_model_t *model, uint8_t prev_onoff, send_data; esp_err_t err; - ESP_LOGI(TAG, "%s, addr 0x%02x onoff 0x%02x", __func__, model->element->element_addr, led->current); - prev_onoff = led->previous; led->current = data[0]; + ESP_LOGI(TAG, "%s, addr 0x%04x onoff 0x%02x", __func__, model->element->element_addr, led->current); + board_led_operation(led->pin, led->current); send_data = led->current;