From e466357c7fd6e7c5aa92e1c2467fc99187236f87 Mon Sep 17 00:00:00 2001 From: MurphyZhao Date: Thu, 9 Nov 2017 17:15:52 +0800 Subject: [PATCH] [Fix] Fix building error when `PKG_USING_CJSON` is not defined [Mod] Modify wifi_usage help message --- components/drivers/wlan/wlan_cmd.c | 15 ++++++++++++--- components/drivers/wlan/wlan_cmd.h | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/components/drivers/wlan/wlan_cmd.c b/components/drivers/wlan/wlan_cmd.c index 273061fada..e5c4381dc8 100644 --- a/components/drivers/wlan/wlan_cmd.c +++ b/components/drivers/wlan/wlan_cmd.c @@ -245,7 +245,9 @@ int wifi_save_cfg(const char* filename) int wifi_save_setting(void) { + #ifdef PKG_USING_CJSON wifi_save_cfg(WIFI_SETTING_FN); + #endif return 0; } @@ -304,8 +306,10 @@ int wifi_default(void) int result = 0; struct rt_wlan_device *wlan; + #ifdef PKG_USING_CJSON /* read default setting for wifi */ wifi_read_cfg(WIFI_SETTING_FN); + #endif if (network_mode == WIFI_STATION) { @@ -352,13 +356,16 @@ int wifi_default(void) static void wifi_usage(void) { - rt_kprintf("wifi wlan_dev - do the default wifi action\n"); + rt_kprintf("wifi help - Help information\n"); + rt_kprintf("wifi cfg SSID PASSWORD - Setting your router AP ssid and pwd\n"); + rt_kprintf("wifi - Do the default wifi action\n"); + rt_kprintf("wifi wlan_dev scan\n"); rt_kprintf("wifi wlan_dev join SSID PASSWORD\n"); - rt_kprintf("wifi wlan_dev ap SSID [PASSWORD]\n"); - rt_kprintf("wifi cfg SSID PASSWORD\n"); + rt_kprintf("wifi wlan_dev ap SSID [PASSWORD]\n"); rt_kprintf("wifi wlan_dev up\n"); rt_kprintf("wifi wlan_dev down\n"); rt_kprintf("wifi wlan_dev rssi\n"); + rt_kprintf("wifi wlan_dev status\n"); } int wifi(int argc, char** argv) @@ -388,7 +395,9 @@ int wifi(int argc, char** argv) network_mode = WIFI_STATION; + #ifdef PKG_USING_CJSON wifi_save_cfg(WIFI_SETTING_FN); + #endif return 0; } diff --git a/components/drivers/wlan/wlan_cmd.h b/components/drivers/wlan/wlan_cmd.h index 90bcc0b938..5e8b13ce7c 100644 --- a/components/drivers/wlan/wlan_cmd.h +++ b/components/drivers/wlan/wlan_cmd.h @@ -13,9 +13,10 @@ int wifi_softap_setup_netif(struct netif *netif); int wifi_set_setting(const char* ssid, const char* pwd); +#ifdef PKG_USING_CJSON int wifi_read_cfg(const char* filename); int wifi_save_cfg(const char* filename); - +#endif /* save wifi setting with default storage file */ int wifi_save_setting(void);