mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Improve espressif platform and native example for new SDK
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
@ -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"]
|
||||
)
|
||||
|
||||
#
|
||||
|
Reference in New Issue
Block a user