Remove warnings if no debug enabled (#3334)

This commit is contained in:
Luc 2019-10-08 15:35:42 +08:00 committed by Me No Dev
parent a35035f827
commit 79e4339582

View File

@ -76,6 +76,7 @@ typedef struct {
uint8_t data[]; uint8_t data[];
} spp_packet_t; } spp_packet_t;
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)
static char *bda2str(esp_bd_addr_t bda, char *str, size_t size) static char *bda2str(esp_bd_addr_t bda, char *str, size_t size)
{ {
if (bda == NULL || str == NULL || size < 18) { if (bda == NULL || str == NULL || size < 18) {
@ -87,6 +88,7 @@ static char *bda2str(esp_bd_addr_t bda, char *str, size_t size)
p[0], p[1], p[2], p[3], p[4], p[5]); p[0], p[1], p[2], p[3], p[4], p[5]);
return str; return str;
} }
#endif
static bool get_name_from_eir(uint8_t *eir, char *bdname, uint8_t *bdname_len) static bool get_name_from_eir(uint8_t *eir, char *bdname, uint8_t *bdname_len)
{ {
@ -325,8 +327,10 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
switch(event){ switch(event){
case ESP_BT_GAP_DISC_RES_EVT: case ESP_BT_GAP_DISC_RES_EVT:
log_i("ESP_BT_GAP_DISC_RES_EVT"); log_i("ESP_BT_GAP_DISC_RES_EVT");
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)
char bda_str[18]; char bda_str[18];
log_i("Scanned device: %s", bda2str(param->disc_res.bda, bda_str, 18)); log_i("Scanned device: %s", bda2str(param->disc_res.bda, bda_str, 18));
#endif
for (int i = 0; i < param->disc_res.num_prop; i++) { for (int i = 0; i < param->disc_res.num_prop; i++) {
uint8_t peer_bdname_len; uint8_t peer_bdname_len;
char peer_bdname[ESP_BT_GAP_MAX_BDNAME_LEN + 1]; char peer_bdname[ESP_BT_GAP_MAX_BDNAME_LEN + 1];