1. sync codes from non-os version 1.1.1:

1). update smartconfig to v2.2;
 2). add some new APIs;
 3). fix bugs in net80211 and wpa;
2. update smart_config demo;
3. fix a bug in app demo;

***internal version 0f73a14a***
This commit is contained in:
Espressif Systems
2015-06-08 17:29:38 +08:00
parent 7824323c0b
commit f33be1ab40
14 changed files with 63 additions and 24 deletions

View File

@ -75,6 +75,7 @@ void task2(void *pvParameters)
free(recv_buf);
if (recbytes <= 0) {
close(sta_socket);
printf("C > read data fail!\n");
}
}
@ -159,8 +160,8 @@ user_init(void)
{
struct station_config *config = (struct station_config *)zalloc(sizeof(struct station_config));
sprintf(config->ssid, "CVR100W_T");
sprintf(config->password, "justfortest");
sprintf(config->ssid, "ZTE_5560");
sprintf(config->password, "espressif");
/* need to sure that you are in station mode first,
* otherwise it will be failed. */

View File

@ -22,32 +22,54 @@
#define server_ip "192.168.101.142"
#define server_port 9669
sc_type SC_Type = 0;
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:
printf("SC_STATUS_WAIT\n");
break;
case SC_STATUS_FIND_CHANNEL:
printf("SC_STATUS_FIND_CHANNEL\n");
break;
case SC_STATUS_GETTING_SSID_PSWD:
printf("SC_STATUS_GETTING_SSID_PSWD\n");
break;
case SC_STATUS_LINK:
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:
printf("SC_STATUS_LINK_OVER\n");
if (SC_Type == SC_TYPE_ESPTOUCH) {
uint8 phone_ip[4] = {0};
memcpy(phone_ip, (uint8*)pdata, 4);
printf("Phone ip: %d.%d.%d.%d\n",phone_ip[0],phone_ip[1],phone_ip[2],phone_ip[3]);
}
smartconfig_stop();
break;
}
}
void ICACHE_FLASH_ATTR
smartconfig_task(void *pvParameters)
{
smartconfig_start(SC_TYPE_ESPTOUCH, smartconfig_done);//SC_TYPE_AIRKISS
SC_Type = SC_TYPE_ESPTOUCH;
smartconfig_start(SC_Type, smartconfig_done);//SC_TYPE_AIRKISS
vTaskDelete(NULL);
}
void ICACHE_FLASH_ATTR
sc_smartconfig_check(void)
{
if(SC_STATUS_LINK_OVER == smartconfig_get_status()) {
smartconfig_stop();
}
}
/******************************************************************************
* FunctionName : user_init
* Description : entry of user application, init user function here

View File

@ -9,10 +9,12 @@
#include "c_types.h"
enum rst_reason {
DEFAULT_RST = 0,
WDT_RST = 1,
EXCEPTION_RST = 2,
SOFT_RST = 3
DEFAULT_RST_FLAG = 0,
WDT_RST_FLAG,
EXCEPTION_RST_FLAG,
SOFT_WDT_RST_FLAG,
SOFT_RESTART_FLAG,
DEEP_SLEEP_AWAKE_FLAG
};
struct rst_info{
@ -55,4 +57,19 @@ void system_uart_de_swap(void);
uint16 system_adc_read(void);
uint16 system_get_vdd33(void);
enum flash_size_map {
FLASH_SIZE_4M_MAP_256_256 = 0,
FLASH_SIZE_2M,
FLASH_SIZE_8M_MAP_512_512,
FLASH_SIZE_16M_MAP_512_512,
FLASH_SIZE_32M_MAP_512_512,
FLASH_SIZE_16M_MAP_1024_1024,
FLASH_SIZE_32M_MAP_1024_1024
};
enum flash_size_map system_get_flash_size_map(void);
bool system_param_save_with_protect(uint16 start_sec, void *param, uint16 len);
bool system_param_load(uint16 start_sec, uint16 offset, void *param, uint16 len);
#endif

View File

@ -6,13 +6,10 @@
#ifndef __SMARTCONFIG_H__
#define __SMARTCONFIG_H__
typedef void (*sc_callback_t)(void *data);
typedef enum {
SC_STATUS_WAIT = 0,
SC_STATUS_FIND_CHANNEL,
SC_STATUS_GETTING_SSID_PSWD,
SC_STATUS_GOT_SSID_PSWD,
SC_STATUS_LINK,
SC_STATUS_LINK_OVER,
} sc_status;
@ -22,9 +19,11 @@ typedef enum {
SC_TYPE_AIRKISS,
} sc_type;
sc_status smartconfig_get_status(void);
typedef void (*sc_callback_t)(sc_status status, void *pdata);
const char *smartconfig_get_version(void);
bool smartconfig_start(sc_type type, sc_callback_t cb, ...);
bool smartconfig_stop(void);
bool esptouch_set_timeout(uint8 time_s);//15s~255s, offset:45s
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.