优化代码

This commit is contained in:
zogodo
2020-01-11 23:38:16 +08:00
parent 2db859f87c
commit cdbabf672b
4 changed files with 5 additions and 14 deletions

View File

@@ -117,17 +117,8 @@ int application_start(void)
if (sys_config->micoSystemConfig.name[0] == 1) if (sys_config->micoSystemConfig.name[0] == 1)
{ {
IPStatusTypedef para; strcpy(strMac, str_mac);
os_log("micoWlanGetIPStatus:%d", micoWlanGetIPStatus(&para, Station)); sprintf(sys_config->micoSystemConfig.name, ZTC1_NAME, str_mac+8);
strcpy(strMac, para.mac); //mac读出来全部是0??!!!
os_log("result:%s",strMac);
os_log("result:%s",para.mac);
unsigned char mac1, mac2;
mac1 = strtohex(strMac[8], strMac[9]);
mac2 = strtohex(strMac[10], strMac[11]);
os_log("strtohex:0x%02x%02x",mac1,mac2);
sprintf(sys_config->micoSystemConfig.name, ZTC1_NAME, mac1, mac2);
} }
os_log("user:%s",user_config->user); os_log("user:%s",user_config->user);

View File

@@ -9,7 +9,7 @@
#define TYPE 1 #define TYPE 1
#define TYPE_NAME "zTC1" #define TYPE_NAME "zTC1"
#define ZTC1_NAME "zTC1_%02X%02X" #define ZTC1_NAME "zTC1-%s"
#define USER_CONFIG_VERSION 2 #define USER_CONFIG_VERSION 2
#define SETTING_MQTT_STRING_LENGTH_MAX 32 //必须4字节对齐。 #define SETTING_MQTT_STRING_LENGTH_MAX 32 //必须4字节对齐。

View File

@@ -169,7 +169,7 @@ void WifiInit(void)
void ApInit() void ApInit()
{ {
char ap_name[16]; char ap_name[16];
sprintf(ap_name, ELAND_AP_SSID"-%s", str_mac+6); sprintf(ap_name, ELAND_AP_SSID, str_mac+6);
os_log("ApInit ap_name[%s]", ap_name); os_log("ApInit ap_name[%s]", ap_name);
network_InitTypeDef_st wNetConfig; network_InitTypeDef_st wNetConfig;

View File

@@ -13,7 +13,7 @@ enum
WIFI_STATE_CONNECTED, WIFI_STATE_CONNECTED,
}; };
#define ELAND_AP_SSID "TC1-AP" #define ELAND_AP_SSID "TC1-AP-%s"
#define ELAND_AP_KEY "12345678" #define ELAND_AP_KEY "12345678"
#define ELAND_AP_LOCAL_IP "192.168.0.1" #define ELAND_AP_LOCAL_IP "192.168.0.1"
#define ELAND_AP_DNS_SERVER "192.168.0.1" #define ELAND_AP_DNS_SERVER "192.168.0.1"