- Wed Jun 03, 2015 11:35 am
#19344
The Code:
void user_init(void)
{
volt = system_adc_read();
volt = (volt*330)/1024;
//Init uart
uart_init(BIT_RATE_74880, 0);
system_set_os_print(0);
ets_uart_printf("\r\nBooting...\r\n");
if(wifi_get_opmode() != STATION_MODE)
{
os_printf("ESP8266 is %s mode, restarting in %s mode...\r\n", WiFiMode[wifi_get_opmode()], WiFiMode[STATION_MODE]);
setup_wifi_st_mode();
}
if(wifi_get_phy_mode() != PHY_MODE_11N)
wifi_set_phy_mode(PHY_MODE_11N);
if(wifi_station_get_auto_connect() == 0)
wifi_station_set_auto_connect(1);
struct ip_info info;
IP4_ADDR(&info.ip, 10, 16, 1, 95);
IP4_ADDR(&info.gw, 10, 16, 1, 1);
IP4_ADDR(&info.netmask, 255, 255, 255, 0);
wifi_set_ip_info(STATION_IF, &info);
// Wait for Wi-Fi connection
os_timer_disarm(&WiFiLinker);
os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL);
os_timer_arm(&WiFiLinker, 10, 0);
i2c_init();
// Init
if (SHT21_Init())
os_printf("SHT21 init done.\r\n"); //os_printf
else
os_printf("SHT21 init error.\r\n"); //os_printf
}
I believe this is the SDK version: esp_iot_sdk_v1.0.1_b1_15_04_02
/Kasper