[Fix] Fix building error when `PKG_USING_CJSON` is not defined

[Mod] Modify wifi_usage help message
This commit is contained in:
MurphyZhao 2017-11-09 17:15:52 +08:00 committed by Bernard Xiong
parent 99e5e90c40
commit e466357c7f
2 changed files with 14 additions and 4 deletions

View File

@ -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 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;
}

View File

@ -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);