Statistics: Posted by webself — Fri Sep 25, 2015 2:50 pm
Statistics: Posted by blubb — Mon Aug 24, 2015 5:51 pm
Statistics: Posted by ESP_Faye — Mon Aug 24, 2015 5:29 pm
Statistics: Posted by blubb — Tue Aug 18, 2015 7:19 pm
Code:
void ICACHE_FLASH_ATTR
user_esp_platform_check_ip(void)
{
struct ip_info ipconfig;
//disarm timer first
os_timer_disarm(&test_timer);
//get ip info of ESP8266 station
wifi_get_ip_info(STATION_IF, &ipconfig);
if (wifi_station_get_connect_status() == STATION_GOT_IP && ipconfig.ip.addr != 0) {
os_printf("got ip !!! \r\n");
wifi_station_set_hostname("esp8266");
espconn_nbns_init();
} else {
if ((wifi_station_get_connect_status() == STATION_WRONG_PASSWORD ||
wifi_station_get_connect_status() == STATION_NO_AP_FOUND ||
wifi_station_get_connect_status() == STATION_CONNECT_FAIL)) {
os_printf("connect fail !!! \r\n");
} else {
//re-arm timer to check ip
os_timer_setfn(&test_timer, (os_timer_func_t *)user_esp_platform_check_ip, NULL);
os_timer_arm(&test_timer, 100, 0);
}
}
}
void ICACHE_FLASH_ATTR
user_set_station_config(void)
{
// Wifi configuration
char ssid[32] = SSID;
char password[64] = PASSWORD;
struct station_config stationConf;
//need not mac address
stationConf.bssid_set = 0;
//Set ap settings
os_memcpy(&stationConf.ssid, ssid, 32);
os_memcpy(&stationConf.password, password, 64);
wifi_station_set_config(&stationConf);
//set a timer to check whether got ip from router succeed or not.
os_timer_disarm(&test_timer);
os_timer_setfn(&test_timer, (os_timer_func_t *)user_esp_platform_check_ip, NULL);
os_timer_arm(&test_timer, 100, 0);
}
void user_init(void)
{
os_printf("SDK version:%s\n", system_get_sdk_version());
//Set station mode
wifi_set_opmode(STATION_MODE);
// ESP8266 connect to router.
user_set_station_config();
}
Statistics: Posted by ESP_Faye — Tue Aug 18, 2015 9:58 am
Statistics: Posted by blubb — Sun Aug 16, 2015 10:00 pm
Statistics: Posted by blubb — Fri Aug 14, 2015 6:17 pm
Code:
void espconn_nbns_init(void)
Code:
wifi_station_set_hostname("esp8266");
espconn_nbns_init();
Statistics: Posted by ESP_Faye — Fri Aug 14, 2015 4:18 pm
Statistics: Posted by ESP_Faye — Thu Aug 13, 2015 10:40 am
Statistics: Posted by blubb — Sun Jul 19, 2015 10:58 pm
Statistics: Posted by ESP_Faye — Wed Jul 08, 2015 11:20 am
Statistics: Posted by ESP_Faye — Wed Jul 01, 2015 9:59 am
Statistics: Posted by ESP_Faye — Mon Jun 29, 2015 5:24 pm
Statistics: Posted by blubb — Mon Jun 22, 2015 5:41 am
Statistics: Posted by Blackfarmer — Sun Jun 14, 2015 3:56 am
Statistics: Posted by joostn — Tue Jun 09, 2015 6:54 pm
Statistics: Posted by ESP_Faye — Tue Jun 09, 2015 2:01 pm
Statistics: Posted by Blackfarmer — Sun May 31, 2015 7:20 pm