diff --git a/User/APP_Setting/APP_Setting.c b/User/APP_Setting/APP_Setting.c index 852b783..bc7535a 100644 --- a/User/APP_Setting/APP_Setting.c +++ b/User/APP_Setting/APP_Setting.c @@ -1,5 +1,7 @@ //系统设置应用 +#include "string.h" + #include "sys.h" #include "systick.h" @@ -68,17 +70,20 @@ void APP_Setting_Launcher(void) if (WLAN_CheckNet()) { - uint8_t temp_ip_str[20]; - uint8_t temp_ipaddr_str[40]; + uint8_t temp_ipaddr_str[60]; - Delay_ms(50); - if (WLAN_GetIP(temp_ip_str) != 1) - strcpy(temp_ip_str, "查询失败"); - Delay_ms(50); - if (WLAN_GetIPAddr(temp_ipaddr_str) != 1) + Delay_ms(2000); + if (WLAN_GetIPAddr(temp_ipaddr_str)) + { + char *ret = strrchr(temp_ipaddr_str, '&'); + *ret = '\n'; + } + else + { strcpy(temp_ipaddr_str, "查询失败"); + } - sprintf(temp_str, "网络已连接\n\nIP地址:%s\nIP归属地:%s", temp_ip_str, temp_ipaddr_str); + sprintf(temp_str, "网络已连接\n\nIP地址及归属地:\n%s", temp_ipaddr_str); } else { diff --git a/User/APP_Weather/APP_Weather.c b/User/APP_Weather/APP_Weather.c index a6a3ed0..f99ae22 100644 --- a/User/APP_Weather/APP_Weather.c +++ b/User/APP_Weather/APP_Weather.c @@ -42,7 +42,7 @@ uint8_t APP_Weather_Sync(void); */ void APP_Weather_Launcher(void) { - APP_Weather_SetCity("汉中"); + APP_Weather_SetCity("杭州"); GE_Draw_ClrAll(WHITE); diff --git a/User/WLAN/WLAN.c b/User/WLAN/WLAN.c index 7221c37..89557c0 100644 --- a/User/WLAN/WLAN.c +++ b/User/WLAN/WLAN.c @@ -26,27 +26,12 @@ uint8_t WLAN_CheckNet(void) return 0; } -uint8_t WLAN_GetIP(uint8_t *ip_str) -{ - HC25_ClearReceive; - HC25_SendBuff("ip", 3); - - ip_str[0] = '\0'; - - if (HC25_ReceiveBuffUntil(ip_str, '\n', 1000) && strcmp(ip_str, "OK") == 0) - if (HC25_ReceiveBuffUntil(ip_str, '\n', 1000)) - return 1; - - return 0; -} - uint8_t WLAN_GetIPAddr(uint8_t *ipaddr_str) { HC25_ClearReceive; HC25_SendBuff("ipaddr", 7); ipaddr_str[0] = '\0'; - if (HC25_ReceiveBuffUntil(ipaddr_str, '\n', 1000) && strcmp(ipaddr_str, "OK") == 0) if (HC25_ReceiveBuffUntil(ipaddr_str, '\n', 1000)) return 1; diff --git a/User/WLAN/WLAN.h b/User/WLAN/WLAN.h index 731ad3e..b073866 100644 --- a/User/WLAN/WLAN.h +++ b/User/WLAN/WLAN.h @@ -8,7 +8,6 @@ #include "Clock.h" uint8_t WLAN_CheckNet(void); -uint8_t WLAN_GetIP(uint8_t *ip_str); uint8_t WLAN_GetIPAddr(uint8_t *ipaddr_str); uint8_t WLAN_GetNetClockTime(uint8_t *clock_time_str); uint8_t WLAN_GetWeather(uint8_t *weather_str, uint8_t *city_str);