clean up warnings

For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.
Only remaining warning is in FreeRTOS queue.c, and it may be a useful one.
This commit is contained in:
Ivan Grokhotkov 2016-09-23 14:46:39 +08:00
parent 28be72dbc7
commit 5e6b2e9c45
3 changed files with 41 additions and 47 deletions

View File

@ -27,22 +27,22 @@
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "tcpip_adapter.h" #include "tcpip_adapter.h"
#include "esp_log.h"
#define ESP32_WORKAROUND 1 #define ESP32_WORKAROUND 1
#if CONFIG_WIFI_ENABLED #if CONFIG_WIFI_ENABLED
static const char* TAG = "event";
static bool event_init_flag = false; static bool event_init_flag = false;
static xQueueHandle g_event_handler = NULL; static xQueueHandle g_event_handler = NULL;
static system_event_cb_t g_event_handler_cb; static system_event_cb_t g_event_handler_cb;
static void *g_event_ctx; static void *g_event_ctx;
#define WIFI_DEBUG(...)
#define WIFI_API_CALL_CHECK(info, api_call, ret) \ #define WIFI_API_CALL_CHECK(info, api_call, ret) \
do{\ do{\
esp_err_t __err = (api_call);\ esp_err_t __err = (api_call);\
if ((ret) != __err) {\ if ((ret) != __err) {\
WIFI_DEBUG("%s %d %s ret=%d\n", __FUNCTION__, __LINE__, (info), __err);\ ESP_LOGE(TAG, "%s %d %s ret=%d", __FUNCTION__, __LINE__, (info), __err);\
return __err;\ return __err;\
}\ }\
} while(0) } while(0)
@ -71,7 +71,7 @@ static system_event_handle_t g_system_event_handle_table[] = {
{SYSTEM_EVENT_STA_CONNECTED, system_event_sta_connected_handle_default}, {SYSTEM_EVENT_STA_CONNECTED, system_event_sta_connected_handle_default},
{SYSTEM_EVENT_STA_DISCONNECTED, system_event_sta_disconnected_handle_default}, {SYSTEM_EVENT_STA_DISCONNECTED, system_event_sta_disconnected_handle_default},
{SYSTEM_EVENT_STA_AUTHMODE_CHANGE, NULL}, {SYSTEM_EVENT_STA_AUTHMODE_CHANGE, NULL},
{SYSTEM_EVENT_STA_GOT_IP, system_event_sta_got_ip_default}, {SYSTEM_EVENT_STA_GOT_IP, system_event_sta_got_ip_default},
{SYSTEM_EVENT_AP_START, system_event_ap_start_handle_default}, {SYSTEM_EVENT_AP_START, system_event_ap_start_handle_default},
{SYSTEM_EVENT_AP_STOP, system_event_ap_stop_handle_default}, {SYSTEM_EVENT_AP_STOP, system_event_ap_stop_handle_default},
{SYSTEM_EVENT_AP_STACONNECTED, NULL}, {SYSTEM_EVENT_AP_STACONNECTED, NULL},
@ -85,7 +85,7 @@ static esp_err_t system_event_sta_got_ip_default(system_event_t *event)
extern esp_err_t esp_wifi_set_sta_ip(void); extern esp_err_t esp_wifi_set_sta_ip(void);
WIFI_API_CALL_CHECK("esp_wifi_set_sta_ip", esp_wifi_set_sta_ip(), ESP_OK); WIFI_API_CALL_CHECK("esp_wifi_set_sta_ip", esp_wifi_set_sta_ip(), ESP_OK);
printf("ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR "\n", ESP_LOGI(TAG, "ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR,
IP2STR(&event->event_info.got_ip.ip_info.ip), IP2STR(&event->event_info.got_ip.ip_info.ip),
IP2STR(&event->event_info.got_ip.ip_info.netmask), IP2STR(&event->event_info.got_ip.ip_info.netmask),
IP2STR(&event->event_info.got_ip.ip_info.gw)); IP2STR(&event->event_info.got_ip.ip_info.gw));
@ -161,7 +161,7 @@ esp_err_t system_event_sta_connected_handle_default(system_event_t *event)
esp_event_send(&evt); esp_event_send(&evt);
} else { } else {
WIFI_DEBUG("invalid static ip\n"); ESP_LOGE(TAG, "invalid static ip");
} }
} }
@ -187,92 +187,86 @@ static esp_err_t esp_wifi_post_event_to_user(system_event_t *event)
static esp_err_t esp_system_event_debug(system_event_t *event) static esp_err_t esp_system_event_debug(system_event_t *event)
{ {
if (event == NULL) { if (event == NULL) {
printf("Error: event is null!\n"); ESP_LOGE(TAG, "event is null!");
return ESP_FAIL; return ESP_FAIL;
} }
WIFI_DEBUG("received event: ");
switch (event->event_id) { switch (event->event_id) {
case SYSTEM_EVENT_WIFI_READY: { case SYSTEM_EVENT_WIFI_READY: {
WIFI_DEBUG("SYSTEM_EVENT_WIFI_READY\n"); ESP_LOGD(TAG, "SYSTEM_EVENT_WIFI_READY");
break; break;
} }
case SYSTEM_EVENT_SCAN_DONE: { case SYSTEM_EVENT_SCAN_DONE: {
system_event_sta_scan_done_t *scan_done; system_event_sta_scan_done_t *scan_done = &event->event_info.scan_done;
scan_done = &event->event_info.scan_done; ESP_LOGD(TAG, "SYSTEM_EVENT_SCAN_DONE, status:%d, number:%d", scan_done->status, scan_done->number);
WIFI_DEBUG("SYSTEM_EVENT_SCAN_DONE\nstatus:%d, number:%d\n", scan_done->status, scan_done->number);
break; break;
} }
case SYSTEM_EVENT_STA_START: { case SYSTEM_EVENT_STA_START: {
WIFI_DEBUG("SYSTEM_EVENT_STA_START\n"); ESP_LOGD(TAG, "SYSTEM_EVENT_STA_START");
break; break;
} }
case SYSTEM_EVENT_STA_STOP: { case SYSTEM_EVENT_STA_STOP: {
WIFI_DEBUG("SYSTEM_EVENT_STA_STOP\n"); ESP_LOGD(TAG, "SYSTEM_EVENT_STA_STOP");
break; break;
} }
case SYSTEM_EVENT_STA_CONNECTED: { case SYSTEM_EVENT_STA_CONNECTED: {
system_event_sta_connected_t *connected; system_event_sta_connected_t *connected = &event->event_info.connected;
connected = &event->event_info.connected; ESP_LOGD(TAG, "SYSTEM_EVENT_STA_CONNECTED, ssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, channel:%d, authmode:%d", \
WIFI_DEBUG("SYSTEM_EVENT_STA_CONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, channel:%d, authmode:%d\n", \
connected->ssid, connected->ssid_len, connected->bssid[0], connected->bssid[0], connected->bssid[1], \ connected->ssid, connected->ssid_len, connected->bssid[0], connected->bssid[0], connected->bssid[1], \
connected->bssid[3], connected->bssid[4], connected->bssid[5], connected->channel, connected->authmode); connected->bssid[3], connected->bssid[4], connected->bssid[5], connected->channel, connected->authmode);
break; break;
} }
case SYSTEM_EVENT_STA_DISCONNECTED: { case SYSTEM_EVENT_STA_DISCONNECTED: {
system_event_sta_disconnected_t *disconnected; system_event_sta_disconnected_t *disconnected = &event->event_info.disconnected;
disconnected = &event->event_info.disconnected; ESP_LOGD(TAG, "SYSTEM_EVENT_STA_DISCONNECTED, ssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, reason:%d", \
WIFI_DEBUG("SYSTEM_EVENT_STA_DISCONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, reason:%d\n", \
disconnected->ssid, disconnected->ssid_len, disconnected->bssid[0], disconnected->bssid[0], disconnected->bssid[1], \ disconnected->ssid, disconnected->ssid_len, disconnected->bssid[0], disconnected->bssid[0], disconnected->bssid[1], \
disconnected->bssid[3], disconnected->bssid[4], disconnected->bssid[5], disconnected->reason); disconnected->bssid[3], disconnected->bssid[4], disconnected->bssid[5], disconnected->reason);
break; break;
} }
case SYSTEM_EVENT_STA_AUTHMODE_CHANGE: { case SYSTEM_EVENT_STA_AUTHMODE_CHANGE: {
system_event_sta_authmode_change_t *auth_change; system_event_sta_authmode_change_t *auth_change = &event->event_info.auth_change;
auth_change = &event->event_info.auth_change; ESP_LOGD(TAG, "SYSTEM_EVENT_STA_AUTHMODE_CHNAGE, old_mode:%d, new_mode:%d", auth_change->old_mode, auth_change->new_mode);
WIFI_DEBUG("SYSTEM_EVENT_STA_AUTHMODE_CHNAGE\nold_mode:%d, new_mode:%d\n", auth_change->old_mode, auth_change->new_mode);
break; break;
} }
case SYSTEM_EVENT_STA_GOT_IP: { case SYSTEM_EVENT_STA_GOT_IP: {
system_event_sta_got_ip_t *got_ip; system_event_sta_got_ip_t *got_ip = &event->event_info.got_ip;
got_ip = &event->event_info.got_ip; ESP_LOGD(TAG, "SYSTEM_EVENT_STA_GOTIP, ip:" IPSTR ", mask:" IPSTR ", gw:" IPSTR,
WIFI_DEBUG("SYSTEM_EVENT_STA_GOTIP\n"); IP2STR(&got_ip->ip_info.ip),
IP2STR(&got_ip->ip_info.netmask),
IP2STR(&got_ip->ip_info.gw));
break; break;
} }
case SYSTEM_EVENT_AP_START: { case SYSTEM_EVENT_AP_START: {
WIFI_DEBUG("SYSTEM_EVENT_AP_START\n"); ESP_LOGD(TAG, "SYSTEM_EVENT_AP_START");
break; break;
} }
case SYSTEM_EVENT_AP_STOP: { case SYSTEM_EVENT_AP_STOP: {
WIFI_DEBUG("SYSTEM_EVENT_AP_STOP\n"); ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STOP");
break; break;
} }
case SYSTEM_EVENT_AP_STACONNECTED: { case SYSTEM_EVENT_AP_STACONNECTED: {
system_event_ap_staconnected_t *staconnected; system_event_ap_staconnected_t *staconnected = &event->event_info.sta_connected;
staconnected = &event->event_info.sta_connected; ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STACONNECTED, mac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d", \
WIFI_DEBUG("SYSTEM_EVENT_AP_STACONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \
staconnected->mac[0], staconnected->mac[0], staconnected->mac[1], \ staconnected->mac[0], staconnected->mac[0], staconnected->mac[1], \
staconnected->mac[3], staconnected->mac[4], staconnected->mac[5], staconnected->aid); staconnected->mac[3], staconnected->mac[4], staconnected->mac[5], staconnected->aid);
break; break;
} }
case SYSTEM_EVENT_AP_STADISCONNECTED: { case SYSTEM_EVENT_AP_STADISCONNECTED: {
system_event_ap_stadisconnected_t *stadisconnected; system_event_ap_stadisconnected_t *stadisconnected = &event->event_info.sta_disconnected;
stadisconnected = &event->event_info.sta_disconnected; ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STADISCONNECTED, mac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d", \
WIFI_DEBUG("SYSTEM_EVENT_AP_STADISCONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \
stadisconnected->mac[0], stadisconnected->mac[0], stadisconnected->mac[1], \ stadisconnected->mac[0], stadisconnected->mac[0], stadisconnected->mac[1], \
stadisconnected->mac[3], stadisconnected->mac[4], stadisconnected->mac[5], stadisconnected->aid); stadisconnected->mac[3], stadisconnected->mac[4], stadisconnected->mac[5], stadisconnected->aid);
break; break;
} }
case SYSTEM_EVENT_AP_PROBEREQRECVED: { case SYSTEM_EVENT_AP_PROBEREQRECVED: {
system_event_ap_probe_req_rx_t *ap_probereqrecved; system_event_ap_probe_req_rx_t *ap_probereqrecved = &event->event_info.ap_probereqrecved;
ap_probereqrecved = &event->event_info.ap_probereqrecved; ESP_LOGD(TAG, "SYSTEM_EVENT_AP_PROBEREQRECVED, rssi:%d, mac:%02x:%02x:%02x:%02x:%02x:%02x", \
WIFI_DEBUG("SYSTEM_EVENT_AP_PROBEREQRECVED\nrssi:%d, mac:%02x:%02x:%02x:%02x:%02x:%02x\n", \
ap_probereqrecved->rssi, ap_probereqrecved->mac[0], ap_probereqrecved->mac[0], ap_probereqrecved->mac[1], \ ap_probereqrecved->rssi, ap_probereqrecved->mac[0], ap_probereqrecved->mac[0], ap_probereqrecved->mac[1], \
ap_probereqrecved->mac[3], ap_probereqrecved->mac[4], ap_probereqrecved->mac[5]); ap_probereqrecved->mac[3], ap_probereqrecved->mac[4], ap_probereqrecved->mac[5]);
break; break;
} }
default: { default: {
printf("Error: no such kind of event!\n"); ESP_LOGW(TAG, "no such kind of event!");
break; break;
} }
} }
@ -283,19 +277,19 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
static esp_err_t esp_system_event_handler(system_event_t *event) static esp_err_t esp_system_event_handler(system_event_t *event)
{ {
if (event == NULL) { if (event == NULL) {
printf("Error: event is null!\n"); ESP_LOGE(TAG, "Error: event is null!");
return ESP_FAIL; return ESP_FAIL;
} }
esp_system_event_debug(event); esp_system_event_debug(event);
if ((event->event_id < SYSTEM_EVENT_MAX) && (event->event_id == g_system_event_handle_table[event->event_id].event_id)) { if ((event->event_id < SYSTEM_EVENT_MAX) && (event->event_id == g_system_event_handle_table[event->event_id].event_id)) {
if (g_system_event_handle_table[event->event_id].event_handle) { if (g_system_event_handle_table[event->event_id].event_handle) {
WIFI_DEBUG("enter default callback\n"); ESP_LOGV(TAG, "enter default callback");
g_system_event_handle_table[event->event_id].event_handle(event); g_system_event_handle_table[event->event_id].event_handle(event);
WIFI_DEBUG("exit default callback\n"); ESP_LOGV(TAG, "exit default callback");
} }
} else { } else {
printf("mismatch or invalid event, id=%d\n", event->event_id); ESP_LOGE(TAG, "mismatch or invalid event, id=%d", event->event_id);
} }
return esp_wifi_post_event_to_user(event); return esp_wifi_post_event_to_user(event);
@ -310,7 +304,7 @@ static void esp_system_event_task(void *pvParameters)
if (xQueueReceive(g_event_handler, &evt, portMAX_DELAY) == pdPASS) { if (xQueueReceive(g_event_handler, &evt, portMAX_DELAY) == pdPASS) {
ret = esp_system_event_handler(&evt); ret = esp_system_event_handler(&evt);
if (ret == ESP_FAIL) { if (ret == ESP_FAIL) {
printf("esp wifi post event to user fail!\n"); ESP_LOGE(TAG, "post event to user fail!");
} }
} }
} }
@ -334,9 +328,9 @@ esp_err_t esp_event_send(system_event_t *event)
if (pdPASS != ret) { if (pdPASS != ret) {
if (event) { if (event) {
printf("e=%d f\n", event->event_id); ESP_LOGE(TAG, "e=%d f", event->event_id);
} else { } else {
printf("e null\n"); ESP_LOGE(TAG, "e null");
} }
return ESP_FAIL; return ESP_FAIL;
} }

View File

@ -10,6 +10,6 @@ COMPONENT_ADD_INCLUDEDIRS := port/include include/expat
COMPONENT_SRCDIRS := library port COMPONENT_SRCDIRS := library port
CFLAGS += -Wno-error=address -Waddress -DHAVE_EXPAT_CONFIG_H CFLAGS += -Wno-unused-function -DHAVE_EXPAT_CONFIG_H
include $(IDF_PATH)/make/component_common.mk include $(IDF_PATH)/make/component_common.mk

View File

@ -6,6 +6,6 @@ COMPONENT_ADD_INCLUDEDIRS := include/lwip include/lwip/port include/lwip/posix
COMPONENT_SRCDIRS := api apps/sntp apps core/ipv4 core/ipv6 core netif port/freertos port/netif port COMPONENT_SRCDIRS := api apps/sntp apps core/ipv4 core/ipv6 core netif port/freertos port/netif port
CFLAGS += -Wno-error=address -Waddress CFLAGS += -Wno-address -Wno-unused-variable -Wno-unused-but-set-variable
include $(IDF_PATH)/make/component_common.mk include $(IDF_PATH)/make/component_common.mk