1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Merge branch 'Links2004-esp8266' into esp8266

* Links2004-esp8266:
  allow user to run code in user_rf_pre_init. add void to "C" functions.
  add debug out to ESP8266WiFiMulti::APlistAdd
  update SDK to esp_iot_sdk_v1.2.0_15_07_13_p4
  add softAPdisconnect function ```int softAPdisconnect(bool wifioff = false);``` external mode calls now change the use flags see #529
  function dumps moved to esp8266-wiki
  filter addresses out of function list
  patch the SDK to latest version (3 patches)
  rename example of ILI9341 (before the IDE dont display it)
  send postmortem infos to Serial1 to.
  add lib dump
  add basic WPS function
  allow setting the host name of AP interface
  update ld add *(.sdk.version)
  update SDK to v1.2.0_15_07_03
  upate phy with values from SDK 1.1.2 (esp_init_data_default.bin)
  Pulldown only possible for in 16. ( see #478 ) rename define to INPUT_PULLDOWN_16 to make it clear
  disable DEBUG_HTTP_UPDATE
This commit is contained in:
Ivan Grokhotkov 2015-07-28 18:08:08 +03:00
commit 6c90b34130
13 changed files with 155 additions and 19 deletions

2
.gitignore vendored
View File

@ -75,3 +75,5 @@ nbproject
build/macosx/esptool-*-osx.zip
build/macosx/dist/osx-xtensa-lx106-elf.tgz
/docs/lib_dump/full
/docs/lib_dump

View File

@ -68,7 +68,7 @@ enum ADCMode {
ADC_VDD = 255
};
#define ADC_MODE(mode) extern "C" int __get_adc_mode() { return (int) (mode); }
#define ADC_MODE(mode) extern "C" int __get_adc_mode(void) { return (int) (mode); }
typedef enum {
FM_QIO = 0x00,

View File

@ -247,18 +247,26 @@ void user_rf_pre_init() {
rtc_reg[30] = 0;
system_set_os_print(0);
__run_user_rf_pre_init();
}
extern int __get_rf_mode() __attribute__((weak));
extern int __get_rf_mode()
extern int __get_rf_mode(void) __attribute__((weak));
extern int __get_rf_mode(void)
{
return 0; // default mode
}
extern int __get_adc_mode() __attribute__((weak));
extern int __get_adc_mode()
extern int __get_adc_mode(void) __attribute__((weak));
extern int __get_adc_mode(void)
{
return 33; // default ADC mode
}
extern void __run_user_rf_pre_init(void) __attribute__((weak));
extern void __run_user_rf_pre_init(void)
{
return; // default do noting
}

View File

@ -30,7 +30,10 @@
extern void __real_system_restart_local();
extern cont_t g_cont;
static void uart_write_char_d(char c);
static void uart0_write_char_d(char c);
static void uart1_write_char_d(char c);
static void print_stack(uint32_t start, uint32_t end);
static void print_pcs(uint32_t start, uint32_t end);
@ -46,7 +49,7 @@ void __wrap_system_restart_local() {
return;
}
ets_install_putc1(&uart0_write_char_d);
ets_install_putc1(&uart_write_char_d);
if (rst_info.reason == REASON_EXCEPTION_RST) {
ets_printf("\nException (%d):\nepc1=0x%08x epc2=0x%08x epc3=0x%08x excvaddr=0x%08x depc=0x%08x\n",
@ -120,6 +123,11 @@ static void print_pcs(uint32_t start, uint32_t end) {
ets_printf("<<<pc<<<\n");
}
void uart_write_char_d(char c) {
uart0_write_char_d(c);
uart1_write_char_d(c);
}
void uart0_write_char_d(char c) {
while (((USS(0) >> USTXC) & 0xff) >= 0x7e) { }
@ -128,3 +136,12 @@ void uart0_write_char_d(char c) {
}
USF(0) = c;
}
void uart1_write_char_d(char c) {
while (((USS(1) >> USTXC) & 0xff) >= 0x7e) { }
if (c == '\n') {
USF(1) = '\r';
}
USF(1) = c;
}

View File

@ -55,6 +55,30 @@ void ESP8266WiFiClass::mode(WiFiMode m)
if(wifi_get_opmode() == (uint8)m) {
return;
}
if((m & WIFI_AP)) {
_useApMode = true;
} else {
_useApMode = false;
}
if((m & WIFI_STA)) {
_useClientMode = true;
} else {
_useClientMode = false;
}
ETS_UART_INTR_DISABLE();
wifi_set_opmode(m);
ETS_UART_INTR_ENABLE();
}
void ESP8266WiFiClass::_mode(WiFiMode m)
{
if(wifi_get_opmode() == (uint8)m) {
return;
}
ETS_UART_INTR_DISABLE();
wifi_set_opmode(m);
ETS_UART_INTR_ENABLE();
@ -69,10 +93,10 @@ int ESP8266WiFiClass::begin(const char* ssid, const char *passphrase, int32_t ch
if(_useApMode) {
// turn on AP+STA mode
mode(WIFI_AP_STA);
_mode(WIFI_AP_STA);
} else {
// turn on STA mode
mode(WIFI_STA);
_mode(WIFI_STA);
}
if(!ssid || *ssid == 0x00 || strlen(ssid) > 31) {
@ -156,6 +180,31 @@ void ESP8266WiFiClass::config(IPAddress local_ip, IPAddress gateway, IPAddress s
_useStaticIp = true;
}
int ESP8266WiFiClass::softAPdisconnect(bool wifioff)
{
struct softap_config conf;
*conf.ssid = 0;
*conf.password = 0;
ETS_UART_INTR_DISABLE();
wifi_softap_set_config(&conf);
wifi_station_disconnect();
ETS_UART_INTR_ENABLE();
if(wifioff) {
_useApMode = false;
if( _useClientMode) {
// turn on AP
_mode(WIFI_STA);
} else {
// turn wifi off
_mode(WIFI_OFF);
}
}
return 0;
}
int ESP8266WiFiClass::disconnect(bool wifioff)
{
struct station_config conf;
@ -171,10 +220,10 @@ int ESP8266WiFiClass::disconnect(bool wifioff)
if(_useApMode) {
// turn on AP
mode(WIFI_AP);
_mode(WIFI_AP);
} else {
// turn wifi off
mode(WIFI_OFF);
_mode(WIFI_OFF);
}
}
@ -192,10 +241,10 @@ void ESP8266WiFiClass::softAP(const char* ssid, const char* passphrase, int chan
_useApMode = true;
if(_useClientMode) {
// turn on AP+STA mode
mode(WIFI_AP_STA);
_mode(WIFI_AP_STA);
} else {
// turn on STA mode
mode(WIFI_AP);
_mode(WIFI_AP);
}
if(!ssid || *ssid == 0x00 || strlen(ssid) > 31) {
@ -417,10 +466,10 @@ int8_t ESP8266WiFiClass::scanNetworks(bool async)
if(_useApMode) {
// turn on AP+STA mode
mode(WIFI_AP_STA);
_mode(WIFI_AP_STA);
} else {
// turn on STA mode
mode(WIFI_STA);
_mode(WIFI_STA);
}
int status = wifi_station_get_connect_status();
@ -645,10 +694,10 @@ bool ESP8266WiFiClass::beginWPSConfig(void) {
if(_useApMode) {
// turn on AP+STA mode
mode(WIFI_AP_STA);
_mode(WIFI_AP_STA);
} else {
// turn on STA mode
mode(WIFI_STA);
_mode(WIFI_STA);
}
disconnect();
@ -693,10 +742,10 @@ void ESP8266WiFiClass::beginSmartConfig()
if(_useApMode) {
// turn on AP+STA mode
mode(WIFI_AP_STA);
_mode(WIFI_AP_STA);
} else {
// turn on STA mode
mode(WIFI_STA);
_mode(WIFI_STA);
}
_smartConfigStarted = true;

View File

@ -104,6 +104,13 @@ public:
*/
void softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
/*
* Disconnect from the network (close AP)
*
* return: one value of wl_status_t enum
*/
int softAPdisconnect(bool wifioff = false);
/*
* Disconnect from the network
*
@ -348,6 +355,7 @@ public:
friend class WiFiServer;
protected:
void _mode(WiFiMode);
static void _scanDone(void* result, int status);
void * _getScanInfoByIndex(int i);
static void _smartConfigCallback(uint32_t status, void* result);

View File

@ -166,29 +166,34 @@ bool ESP8266WiFiMulti::APlistAdd(const char* ssid, const char *passphrase) {
if(!ssid || *ssid == 0x00 || strlen(ssid) > 31) {
// fail SSID to long or missing!
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] no ssid or ssid to long\n");
return false;
}
if(passphrase && strlen(passphrase) > 63) {
// fail passphrase to long!
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] passphrase to long\n");
return false;
}
newAP.ssid = strdup(ssid);
if(!newAP.ssid) {
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] fail newAP.ssid == 0\n");
return false;
}
if(passphrase && *passphrase != 0x00) {
newAP.passphrase = strdup(passphrase);
if(!newAP.passphrase) {
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] fail newAP.passphrase == 0\n");
free(newAP.ssid);
return false;
}
}
APlist.push_back(newAP);
DEBUG_WIFI_MULTI("[WIFI][APlistAdd] add SSID: %s\n", newAP.ssid);
return true;
}

View File

@ -1,3 +1,50 @@
esp_iot_sdk_v1.2.0_15_07_13_p4 Release Note
-------------------------------------------
Here is a patch of memory optimization based on SDK_v1.2.0
1. It saved about 8KBytes memory.
2. It revised problem that change mode may cause memory leak.
3. Update SmartConfig to version 2.4.3
Please replace the lib in \esp_iot_sdk_v1.2.0\lib
Thanks for your interest in Espressif Systems and ESP8266 !
esp_iot_sdk_v1.2.0_15_07_09_p3 Release Note
-------------------------------------------
Here is a patch based on SDK_v1.2.0 solved problem that if APs SSID is hiddenESPTOUCH may get wrong BSSID of AP and cause connection fail.
Please replace the lib in \esp_iot_sdk_v1.2.0\lib
Sorry for the inconvenience.
esp_iot_sdk_v1.2.0_15_07_09_p2 Release Note
-------------------------------------------
Updated libssl again. To support SHA-256 and SHA-512.
Thanks for your interest in Espressif Systems and ESP8266 !
esp_iot_sdk_v1.2.0_15_07_08_p1 Release Note
-------------------------------------------
Here is a patch based on SDK_v1.2.0 solved problem that abnormal SSL disconnection may cause reset.
Please replace the lib in \esp_iot_sdk_v1.2.0\lib
Sorry for the inconvenience.
esp_iot_sdk_v1.2.0_15_07_03 Release Note
-------------------------------------------
Resolved IssuesBugs below are eligible for Bug Bounty Program):

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
1.2.0_15_07_03
1.2.0_15_07_13_p4