Improve espressif platform and native example for new SDK

This commit is contained in:
Valeriy Koval
2015-07-17 14:32:50 +03:00
parent 60e3d7450f
commit b85303c12a
2 changed files with 43 additions and 8 deletions

View File

@ -15,19 +15,54 @@
#include "smartconfig.h"
void ICACHE_FLASH_ATTR
smartconfig_done(void *data)
smartconfig_done(sc_status status, void *pdata)
{
struct station_config *sta_conf = data;
switch(status) {
case SC_STATUS_WAIT:
os_printf("SC_STATUS_WAIT\n");
break;
case SC_STATUS_FIND_CHANNEL:
os_printf("SC_STATUS_FIND_CHANNEL\n");
break;
case SC_STATUS_GETTING_SSID_PSWD:
os_printf("SC_STATUS_GETTING_SSID_PSWD\n");
sc_type *type = pdata;
if (*type == SC_TYPE_ESPTOUCH) {
os_printf("SC_TYPE:SC_TYPE_ESPTOUCH\n");
} else {
os_printf("SC_TYPE:SC_TYPE_AIRKISS\n");
}
break;
case SC_STATUS_LINK:
os_printf("SC_STATUS_LINK\n");
struct station_config *sta_conf = pdata;
wifi_station_set_config(sta_conf);
wifi_station_disconnect();
wifi_station_connect();
break;
case SC_STATUS_LINK_OVER:
os_printf("SC_STATUS_LINK_OVER\n");
if (pdata != NULL) {
uint8 phone_ip[4] = {0};
wifi_station_set_config(sta_conf);
wifi_station_disconnect();
wifi_station_connect();
os_memcpy(phone_ip, (uint8*)pdata, 4);
os_printf("Phone ip: %d.%d.%d.%d\n",phone_ip[0],phone_ip[1],phone_ip[2],phone_ip[3]);
}
smartconfig_stop();
break;
}
}
void user_rf_pre_init(void)
{
}
void user_init(void)
{
os_printf("SDK version:%s\n", system_get_sdk_version());
wifi_set_opmode(STATION_MODE);
smartconfig_start(SC_TYPE_AIRKISS, smartconfig_done);
smartconfig_start(smartconfig_done);
}

View File

@ -122,7 +122,7 @@ if "FRAMEWORK" not in env:
LDSCRIPT_PATH=join(
"$PIOPACKAGES_DIR", "sdk-esp8266", "ld", "eagle.app.v6.ld"),
LIBS=["c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "main",
"json", "upgrade", "smartconfig", "at", "ssl"]
"json", "upgrade", "smartconfig", "pwm", "at", "ssl"]
)
#