更新 WLAN 模块,使用 TCP 协议以匹配服务端变动

This commit is contained in:
lxbpxylps@126.com 2021-10-06 19:29:41 +08:00
parent 2fe8e3a952
commit 0b3b6af977
4 changed files with 14 additions and 25 deletions

View File

@ -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
{

View File

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

View File

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

View File

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