diff --git a/TC1/main.c b/TC1/main.c index bab21c9..144c739 100644 --- a/TC1/main.c +++ b/TC1/main.c @@ -15,6 +15,7 @@ char rtc_init = 0; //sntp校时成功标志位 uint32_t total_time = 0; char strMac[16] = { 0 }; +char str_mac[16] = { 0 }; uint32_t power = 0; system_config_t* sys_config; @@ -71,10 +72,6 @@ int application_start(void) int i; os_log("Start %s",VERSION); - uint8_t mac[32]; - mico_wlan_get_mac_address(mac); - os_log("mac[%s]", mac); - //char main_num=0; OSStatus err = kNoErr; @@ -86,6 +83,12 @@ int application_start(void) err = mico_system_init(sys_config); require_noerr(err, exit); + uint8_t mac[8]; + mico_wlan_get_mac_address(mac); + sprintf(str_mac, "%02X%02X%02X%02X%02X%02X", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + os_log("mico_system_init str_mac[%s]", str_mac); + bool open_ap = false; MicoGpioInitialize((mico_gpio_t)Button, INPUT_PULL_UP); if (!MicoGpioInputGet(Button)) diff --git a/TC1/main.h b/TC1/main.h index b4bac70..7a091d2 100644 --- a/TC1/main.h +++ b/TC1/main.h @@ -66,6 +66,7 @@ typedef struct extern char rtc_init; extern uint32_t total_time; extern char strMac[16]; +extern char str_mac[16]; extern uint32_t power; extern system_config_t* sys_config; extern user_config_t* user_config; diff --git a/TC1/user_wifi.c b/TC1/user_wifi.c index 08a09ee..a7dd04b 100644 --- a/TC1/user_wifi.c +++ b/TC1/user_wifi.c @@ -164,19 +164,18 @@ void WifiInit(void) //sntp_init(); //启动定时器开始进行wifi连接 if (!mico_rtos_is_timer_running(&wifi_led_timer)) mico_rtos_start_timer(&wifi_led_timer); - - IPStatusTypedef para; - micoWlanGetIPStatus(¶, Station); - strcpy(strMac, para.mac); - } void ApInit() { + char ap_name[16]; + sprintf(ap_name, ELAND_AP_SSID"-%s", str_mac+6); + os_log("ap_name[%s]", ap_name); + os_log("Soft_ap_Server"); network_InitTypeDef_st wNetConfig; memset(&wNetConfig, 0x0, sizeof(network_InitTypeDef_st)); - strcpy((char *)wNetConfig.wifi_ssid, ELAND_AP_SSID); + strcpy((char *)wNetConfig.wifi_ssid, ap_name); strcpy((char *)wNetConfig.wifi_key, ELAND_AP_KEY); wNetConfig.wifi_mode = Soft_AP; wNetConfig.dhcpMode = DHCP_Server;