Skip to content

Commit

Permalink
Merge branch 'bugfix/remove_-Wno-formate_in_ble_mesh_examples' into '…
Browse files Browse the repository at this point in the history
…master'

ble_mesh: example: Remove -Wno-format compile option for BLE Mesh examples

See merge request espressif/esp-idf!21523
  • Loading branch information
Isl2017 committed Dec 15, 2022
2 parents 34e5a80 + 2fd57ba commit 7283a40
Show file tree
Hide file tree
Showing 44 changed files with 169 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ set(COMPONENT_ADD_INCLUDEDIRS ". include")
set(COMPONENT_REQUIRES bt nvs_flash example_nvs)

register_component()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Copyright (C) 2018-2020 Alibaba Group Holding Limited
/*
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2020 Alibaba Group Holding Limited
*
* SPDX-License-Identifier: Apache-2.0
*
* SPDX-FileContributor: 2020-2022 Espressif Systems (Shanghai) CO LTD
*/

#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#include "esp_log.h"
#include "esp_random.h"
Expand Down Expand Up @@ -247,7 +249,7 @@ static void genie_model_retry_timer_cb(void *args)
/* start new timer */
if (!genie_dlist_is_empty(p_head)) {
util_timer_start(&g_vnd_msg_timer, nearest);
ESP_LOGD(TAG, "restart retry timer, timeout: %d", nearest);
ESP_LOGD(TAG, "restart retry timer, timeout: %" PRIu32, nearest);
} else {
util_timer_stop(&g_vnd_msg_timer);
ESP_LOGD(TAG, "list empty, stop timer");
Expand Down Expand Up @@ -631,5 +633,5 @@ void genie_model_dispatch(uint32_t opcode, esp_ble_mesh_model_t *model,
return;
}
}
ESP_LOGW(TAG, "not find callback function for opcode: 0x%02x", opcode);
ESP_LOGW(TAG, "not find callback function for opcode: 0x%02" PRIu32, opcode);
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
// Copyright (C) 2018-2020 Alibaba Group Holding Limited
// Adaptations to ESP-IDF Copyright (c) 2020 Espressif Systems (Shanghai) Co. Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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.
/*
* SPDX-FileCopyrightText: 2018-2020 Alibaba Group Holding Limited
*
* SPDX-License-Identifier: Apache-2.0
*
* SPDX-FileContributor: 2020-2022 Espressif Systems (Shanghai) CO LTD
*/

#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>

#include "genie_mesh.h"
#include "genie_event.h"
Expand Down Expand Up @@ -333,7 +327,7 @@ static void genie_timer_update(void *args)
k_work_submit(&g_genie_timer.work);

if (g_genie_timer.unix_time % 60 == 0) {
ESP_LOGI(TAG, "genie_timer_update %d", g_genie_timer.unix_time);
ESP_LOGI(TAG, "genie_timer_update %" PRIu32, g_genie_timer.unix_time);
}
}

Expand Down Expand Up @@ -534,7 +528,7 @@ int genie_timer_start(uint8_t index, uint32_t unix_time, genie_timer_attr_data_t
return -GENIE_TIMER_ERR_PARAM;
}

ESP_LOGI(TAG, "timer start index %d expect unix_time %d attr_type %d",
ESP_LOGI(TAG, "timer start index %d expect unix_time %" PRIu32 " attr_type %d",
index, unix_time, attr_data->type);

if (!g_genie_timer.init) {
Expand Down Expand Up @@ -634,7 +628,7 @@ int genie_timer_periodic_start(uint8_t index, uint16_t periodic_time, uint8_t sc

vendor_timer->unixtime_match = convert_utc_to_unix(&utc) + periodic_time - g_timing_data.timezone * HOUR;

ESP_LOGI(TAG, "periodic timer unixtime_match %d", vendor_timer->unixtime_match);
ESP_LOGI(TAG, "periodic timer unixtime_match %" PRIu32, vendor_timer->unixtime_match);

VT_LOCK;
genie_slist_append(&g_genie_timer.timer_list_active, &vendor_timer->next);
Expand Down Expand Up @@ -704,7 +698,7 @@ int genie_timer_remove(uint8_t index)
void genie_timer_local_time_show(void)
{
ENTER_FUNC();
ESP_LOGI(TAG, "unix_time revert %d", convert_utc_to_unix(&local_time));
ESP_LOGI(TAG, "unix_time revert %" PRIu32, convert_utc_to_unix(&local_time));
ESP_LOGI(TAG, "%4d/%2d/%2d %2d:%2d:%d weekday %2d %04d",
local_time.year, local_time.month + 1, local_time.day,
local_time.hour, local_time.minutes, local_time.seconds,
Expand Down Expand Up @@ -780,12 +774,12 @@ int genie_timer_local_time_update(uint32_t unix_time)

local_time = convert_unix_to_utc(unix_time + g_timing_data.timezone * HOUR);

ESP_LOGI(TAG, "unix_time %d", unix_time);
ESP_LOGI(TAG, "unix_time %" PRIu32, unix_time);
ESP_LOGI(TAG, "localtime update %4d/%2d/%2d %2d:%2d:%d weekday %2d",
local_time.year, local_time.month + 1, local_time.day,
local_time.hour, local_time.minutes, local_time.seconds,
local_time.weekday);
ESP_LOGI(TAG, "unix_time revert %d", convert_utc_to_unix(&local_time));
ESP_LOGI(TAG, "unix_time revert %" PRIu32, convert_utc_to_unix(&local_time));

return 0;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
// Copyright (C) 2018-2020 Alibaba Group Holding Limited
// Adaptations to ESP-IDF Copyright (c) 2020 Espressif Systems (Shanghai) Co. Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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.
/*
* SPDX-FileCopyrightText: 2018-2020 Alibaba Group Holding Limited
*
* SPDX-License-Identifier: Apache-2.0
*
* SPDX-FileContributor: 2020-2022 Espressif Systems (Shanghai) CO LTD
*/

#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#include "esp_log.h"

Expand Down Expand Up @@ -63,7 +57,7 @@ void util_timer_start(util_timer_t *timer, uint32_t timeout)
return;
}

ESP_LOGD(TAG, "timer: %p, timeout: %u", timer, timeout);
ESP_LOGD(TAG, "timer: %p, timeout: %" PRIu32, timer, timeout);

util_timer_stop(timer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ set(COMPONENT_SRCS "board.c"
set(COMPONENT_ADD_INCLUDEDIRS ". include")

register_component()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <string.h>
#include <errno.h>
#include <math.h>
#include <inttypes.h>

#include "esp_log.h"
#include "esp_mac.h"
Expand Down Expand Up @@ -857,7 +858,7 @@ static void prov_complete(uint16_t net_idx, uint16_t addr, uint8_t flags, uint32
{
ENTER_FUNC();
ESP_LOGI(TAG, "net_idx: 0x%04x, addr: 0x%04x", net_idx, addr);
ESP_LOGI(TAG, "flags: 0x%02x, iv_index: 0x%08x", flags, iv_index);
ESP_LOGI(TAG, "flags: 0x%02x, iv_index: 0x%08" PRIx32, flags, iv_index);
}

static void example_ble_mesh_provisioning_cb(esp_ble_mesh_prov_cb_event_t event,
Expand Down Expand Up @@ -1021,7 +1022,7 @@ static void example_ble_mesh_config_server_cb(esp_ble_mesh_cfg_server_cb_event_t
static void example_ble_mesh_generic_server_cb(esp_ble_mesh_generic_server_cb_event_t event,
esp_ble_mesh_generic_server_cb_param_t *param)
{
ESP_LOGD(TAG, "event 0x%02x, opcode 0x%04x, src 0x%04x, dst 0x%04x",
ESP_LOGD(TAG, "event 0x%02x, opcode 0x%04" PRIx32 ", src 0x%04x, dst 0x%04x",
event, param->ctx.recv_op, param->ctx.addr, param->ctx.recv_dst);

switch (event) {
Expand Down Expand Up @@ -1090,7 +1091,7 @@ static void example_ble_mesh_lighting_server_cb(esp_ble_mesh_lighting_server_cb_
#endif
esp_ble_mesh_server_state_value_t state = {0};

ESP_LOGD(TAG, "event 0x%02x, opcode 0x%04x, src 0x%04x, dst 0x%04x",
ESP_LOGD(TAG, "event 0x%02x, opcode 0x%04" PRIx32 ", src 0x%04x, dst 0x%04x",
event, param->ctx.recv_op, param->ctx.addr, param->ctx.recv_dst);

switch (event) {
Expand Down Expand Up @@ -1208,15 +1209,15 @@ static void example_ble_mesh_custom_model_cb(esp_ble_mesh_model_cb_event_t event
switch (event) {
case ESP_BLE_MESH_MODEL_OPERATION_EVT:
ESP_LOGD(TAG, "ESP_BLE_MESH_MODEL_OPERATION_EVT");
ESP_LOGD(TAG, "opcode: 0x%06x", param->model_operation.opcode);
ESP_LOGD(TAG, "opcode: 0x%06" PRIx32, param->model_operation.opcode);
genie_model_dispatch(param->model_operation.opcode, param->model_operation.model,
param->model_operation.ctx, param->model_operation.msg, param->model_operation.length);
break;
case ESP_BLE_MESH_MODEL_SEND_COMP_EVT:
ESP_LOGD(TAG, "ESP_BLE_MESH_MODEL_SEND_COMP_EVT");
ESP_LOGD(TAG, "opcode: 0x%06x", param->model_send_comp.opcode);
ESP_LOGD(TAG, "opcode: 0x%06" PRIx32, param->model_send_comp.opcode);
if (param->model_send_comp.err_code) {
ESP_LOGE(TAG, "Failed to send message: 0x%06x, err: %d", param->model_send_comp.opcode, param->model_send_comp.err_code);
ESP_LOGE(TAG, "Failed to send message: 0x%06" PRIx32 ", err: %d", param->model_send_comp.opcode, param->model_send_comp.err_code);
break;
}
break;
Expand Down
5 changes: 3 additions & 2 deletions examples/bluetooth/esp_ble_mesh/aligenie_demo/main/board.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* AliGenie - Example
*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/

#include <stdio.h>
#include <inttypes.h>

#include "driver/gpio.h"
#include "esp_log.h"
Expand Down Expand Up @@ -215,7 +216,7 @@ uint8_t *mac_str2hex(const char *mac_str, uint8_t *mac_hex)
{
uint32_t mac_data[6] = {0};

sscanf(mac_str, "%02x%02x%02x%02x%02x%02x",
sscanf(mac_str, "%02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02" PRIx32,
mac_data, mac_data + 1, mac_data + 2, mac_data + 3, mac_data + 4, mac_data + 5);

for (int i = 0; i < 6; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "."
REQUIRES console nvs_flash bt
REQUIRED_IDF_TARGETS esp32)

target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/*
* ESP BLE Mesh Example
*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/

#include <inttypes.h>

#include "ble_unit.h"
#include "sync.h"
#define TAG "BLE_UINT"
Expand Down Expand Up @@ -102,7 +104,7 @@ static void ble_gap_util_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_pa
&& (memcmp(default_adv_data, param->scan_rst.ble_adv, sizeof(default_adv_data)) == 0)) {
scan_count.adv_count += 1;
if (scan_count.adv_count % 10 == 0) {
ESP_LOGI(TAG, "adv count:%d scan_res count %d\n", scan_count.adv_count, scan_count.scan_res_count);
ESP_LOGI(TAG, "adv count:%" PRIu32 " scan_res count %" PRIu32, scan_count.adv_count, scan_count.scan_res_count);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/

#include <inttypes.h>

#include "run_tc.h"
#include "test_env.h"
#include "wifi_unit.h"
Expand Down Expand Up @@ -48,7 +50,7 @@ static void wifi_tc_sta_throughput_timeout(void *arg)
uint32_t speed = report[1] * 8 / (now - last_timestamp);
accumulate_speed += speed;
statistic_count += 1;
printf("speed: %d kbps average speed: %lld kbps\n", speed, accumulate_speed / statistic_count );
printf("speed: %" PRIu32 " kbps average speed: %lld kbps\n", speed, accumulate_speed / statistic_count );
report[1] = 0;
report[0] = now;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ set(srcs "ble_mesh_adapter.c"

idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <inttypes.h>

#include "esp_ble_mesh_networking_api.h"
#include "ble_mesh_adapter.h"

Expand Down Expand Up @@ -120,7 +122,7 @@ void ble_mesh_deinit_node_prestore_params(void)
void ble_mesh_node_statistics_get(void)
{
xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY);
ESP_LOGI(TAG, "Statistics:%d\n", ble_mesh_node_statistics.package_num);
ESP_LOGI(TAG, "Statistics:%" PRIu32, ble_mesh_node_statistics.package_num);
xSemaphoreGive(ble_mesh_node_sema);
}

Expand Down Expand Up @@ -229,7 +231,7 @@ void ble_mesh_test_performance_client_model_get(void)
rtt = (int)(sum_time / succeed_packet_count);
}

ESP_LOGI(TAG, "VendorModel:Statistics,%d,%d\n", failed_packet_num, rtt);
ESP_LOGI(TAG, "VendorModel:Statistics,%" PRIu32 ",%" PRIu32, failed_packet_num, rtt);
}

void ble_mesh_test_performance_client_model_get_received_percent(void)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#include "esp_log.h"
#include "esp_vfs_dev.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/*
* Console example - various system commands
*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>

#include "esp_log.h"
#include "esp_console.h"
Expand Down Expand Up @@ -57,7 +58,7 @@ static void register_restart(void)

static int free_mem(int argc, char **argv)
{
printf("freeheap:%d\n", esp_get_free_heap_size());
printf("freeheap:%" PRIu32 "\n", esp_get_free_heap_size());
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <inttypes.h>

#include "esp_timer.h"
#include "ble_mesh_adapter.h"

Expand Down Expand Up @@ -36,7 +38,7 @@ void ble_mesh_generic_onoff_client_model_cb(esp_ble_mesh_generic_client_cb_event
{
uint32_t opcode = param->params->opcode;

ESP_LOGD(TAG, "enter %s: event is %d, error code is %d, opcode is 0x%x\n",
ESP_LOGD(TAG, "enter %s: event is %d, error code is %d, opcode is 0x%" PRIx32,
__func__, event, param->error_code, opcode);

switch (event) {
Expand Down
Loading

0 comments on commit 7283a40

Please sign in to comment.