mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Merge pull request #325 from Links2004/esp8266
add 2 compiler options from last SDK, __attribute__ format to Print::printf, link to arduinoWebSockets
This commit is contained in:
commit
0c7e225bd5
@ -195,6 +195,7 @@ Libraries that don't rely on low-level access to AVR registers should work well.
|
|||||||
- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with esp8266.
|
- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with esp8266.
|
||||||
- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with esp8266.
|
- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with esp8266.
|
||||||
- [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)).
|
- [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)).
|
||||||
|
- [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets) - WebSocket Server and Client compatible with esp8266 (RFC6455)
|
||||||
|
|
||||||
#### Upload via serial port ####
|
#### Upload via serial port ####
|
||||||
Pick the correct serial port.
|
Pick the correct serial port.
|
||||||
|
@ -35,7 +35,6 @@ extern "C" {
|
|||||||
|
|
||||||
#include "stdlib_noniso.h"
|
#include "stdlib_noniso.h"
|
||||||
#include "binary.h"
|
#include "binary.h"
|
||||||
#include "pgmspace.h"
|
|
||||||
#include "esp8266_peri.h"
|
#include "esp8266_peri.h"
|
||||||
#include "twi.h"
|
#include "twi.h"
|
||||||
|
|
||||||
@ -205,6 +204,8 @@ void loop(void);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include "pgmspace.h"
|
||||||
|
|
||||||
#include "WCharacter.h"
|
#include "WCharacter.h"
|
||||||
#include "WString.h"
|
#include "WString.h"
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "user_interface.h"
|
#include "user_interface.h"
|
||||||
|
|
||||||
|
extern struct rst_info resetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
//extern "C" void ets_wdt_init(uint32_t val);
|
//extern "C" void ets_wdt_init(uint32_t val);
|
||||||
@ -279,3 +281,38 @@ uint32_t EspClass::getFlashChipSizeByChipId(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String EspClass::getResetInfo(void) {
|
||||||
|
if(resetInfo.reason != 0) {
|
||||||
|
char buff[150];
|
||||||
|
sprintf(&buff[0], "Fatal exception:%d flag:%d epc1:0x%08x epc2:0x%08x epc3:0x%08x excvaddr:0x%08x depc:0x%08x", resetInfo.exccause, resetInfo.reason, resetInfo.epc1, resetInfo.epc2, resetInfo.epc3, resetInfo.excvaddr, resetInfo.depc);
|
||||||
|
return String(buff);
|
||||||
|
}
|
||||||
|
return String("flag: 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
struct rst_info * EspClass::getResetInfoPtr(void) {
|
||||||
|
return &resetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EspClass::eraseESPconfig(void) {
|
||||||
|
bool ret = true;
|
||||||
|
size_t cfgAddr = (ESP.getFlashChipSize() - 0x4000);
|
||||||
|
size_t cfgSize = (8*1024);
|
||||||
|
|
||||||
|
noInterrupts();
|
||||||
|
while(cfgSize) {
|
||||||
|
|
||||||
|
if(spi_flash_erase_sector((cfgAddr / SPI_FLASH_SEC_SIZE)) != SPI_FLASH_RESULT_OK) {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cfgSize -= SPI_FLASH_SEC_SIZE;
|
||||||
|
cfgAddr += SPI_FLASH_SEC_SIZE;
|
||||||
|
}
|
||||||
|
interrupts();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,6 +98,11 @@ class EspClass {
|
|||||||
FlashMode_t getFlashChipMode(void);
|
FlashMode_t getFlashChipMode(void);
|
||||||
uint32_t getFlashChipSizeByChipId(void);
|
uint32_t getFlashChipSizeByChipId(void);
|
||||||
|
|
||||||
|
String getResetInfo(void);
|
||||||
|
struct rst_info * getResetInfoPtr(void);
|
||||||
|
|
||||||
|
bool eraseESPconfig(void);
|
||||||
|
|
||||||
inline uint32_t getCycleCount(void);
|
inline uint32_t getCycleCount(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class Print {
|
|||||||
return write((const uint8_t *) buffer, size);
|
return write((const uint8_t *) buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t printf(const char * format, ...);
|
size_t printf(const char * format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
size_t print(const __FlashStringHelper *);
|
size_t print(const __FlashStringHelper *);
|
||||||
size_t print(const String &);
|
size_t print(const String &);
|
||||||
size_t print(const char[]);
|
size_t print(const char[]);
|
||||||
|
@ -34,6 +34,8 @@ extern "C" {
|
|||||||
#define LOOP_TASK_PRIORITY 0
|
#define LOOP_TASK_PRIORITY 0
|
||||||
#define LOOP_QUEUE_SIZE 1
|
#define LOOP_QUEUE_SIZE 1
|
||||||
|
|
||||||
|
struct rst_info resetInfo;
|
||||||
|
|
||||||
int atexit(void (*func)()) {
|
int atexit(void (*func)()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -124,6 +126,15 @@ void user_rf_pre_init() {
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void user_init(void) {
|
void user_init(void) {
|
||||||
|
uart_div_modify(0, UART_CLK_FREQ / (74480));
|
||||||
|
|
||||||
|
system_rtc_mem_read(0, &resetInfo, sizeof(struct rst_info));
|
||||||
|
if(resetInfo.reason == WDT_RST_FLAG || resetInfo.reason == EXCEPTION_RST_FLAG) {
|
||||||
|
os_printf("Last Reset:\n - flag=%d\n - Fatal exception (%d):\n - epc1=0x%08x,epc2=0x%08x,epc3=0x%08x,excvaddr=0x%08x,depc=0x%08x\n", resetInfo.reason, resetInfo.exccause, resetInfo.epc1, resetInfo.epc2, resetInfo.epc3, resetInfo.excvaddr, resetInfo.depc);
|
||||||
|
}
|
||||||
|
struct rst_info info = { 0 };
|
||||||
|
system_rtc_mem_write(0, &info, sizeof(struct rst_info));
|
||||||
|
|
||||||
uart_div_modify(0, UART_CLK_FREQ / (115200));
|
uart_div_modify(0, UART_CLK_FREQ / (115200));
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "wiring_private.h"
|
#include "wiring_private.h"
|
||||||
#include "pins_arduino.h"
|
#include "pins_arduino.h"
|
||||||
#include "c_types.h"
|
#include "c_types.h"
|
||||||
|
#include "ets_sys.h"
|
||||||
|
|
||||||
void (*timer1_user_cb)(void);
|
void (*timer1_user_cb)(void);
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
void ICACHE_RAM_ATTR hexdump(uint8_t *mem, uint32_t len, uint8_t cols) {
|
void ICACHE_RAM_ATTR hexdump(uint8_t *mem, uint32_t len, uint8_t cols) {
|
||||||
os_printf("\n[HEXDUMP] Address: 0x%08X len: 0x%X (%d)", mem, len, len);
|
os_printf("\n[HEXDUMP] Address: 0x%08X len: 0x%X (%d)", (size_t)mem, len, len);
|
||||||
for(uint32_t i = 0; i < len; i++) {
|
for(uint32_t i = 0; i < len; i++) {
|
||||||
if(i % cols == 0) {
|
if(i % cols == 0) {
|
||||||
os_printf("\n[0x%08X] 0x%08X: ", mem, i);
|
os_printf("\n[0x%08X] 0x%08X: ", (size_t)mem, i);
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
os_printf("%02X ", *mem);
|
os_printf("%02X ", *mem);
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
pgmspace.cpp - string functions that support PROGMEM
|
pgmspace.cpp - string functions that support PROGMEM
|
||||||
Copyright (c) 2015 Michael C. Miller. All right reserved.
|
Copyright (c) 2015 Michael C. Miller. All right reserved.
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "pgmspace.h"
|
#include "pgmspace.h"
|
||||||
|
|
||||||
size_t ICACHE_FLASH_ATTR strnlen_P(const char* s, size_t size) {
|
size_t strnlen_P(const char* s, size_t size) {
|
||||||
const char* cp;
|
const char* cp;
|
||||||
for (cp = s; size != 0 && pgm_read_byte(cp) != '\0'; cp++, size--);
|
for (cp = s; size != 0 && pgm_read_byte(cp) != '\0'; cp++, size--);
|
||||||
return (size_t)(cp - s);
|
return (size_t) (cp - s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ICACHE_FLASH_ATTR memcpy_P(void* dest, const void* src, size_t count) {
|
void* memcpy_P(void* dest, const void* src, size_t count) {
|
||||||
const uint8_t* read = reinterpret_cast<const uint8_t*>(src);
|
const uint8_t* read = reinterpret_cast<const uint8_t*>(src);
|
||||||
uint8_t* write = reinterpret_cast<uint8_t*>(dest);
|
uint8_t* write = reinterpret_cast<uint8_t*>(dest);
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ void* ICACHE_FLASH_ATTR memcpy_P(void* dest, const void* src, size_t count) {
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* ICACHE_FLASH_ATTR strncpy_P(char* dest, const char* src, size_t size) {
|
char* strncpy_P(char* dest, const char* src, size_t size) {
|
||||||
const char* read = src;
|
const char* read = src;
|
||||||
char* write = dest;
|
char* write = dest;
|
||||||
char ch = '.';
|
char ch = '.';
|
||||||
@ -48,19 +48,19 @@ char* ICACHE_FLASH_ATTR strncpy_P(char* dest, const char* src, size_t size) {
|
|||||||
ch = pgm_read_byte(read++);
|
ch = pgm_read_byte(read++);
|
||||||
*write++ = ch;
|
*write++ = ch;
|
||||||
size--;
|
size--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* ICACHE_FLASH_ATTR strncat_P(char* dest, const char* src, size_t size) {
|
char* strncat_P(char* dest, const char* src, size_t size) {
|
||||||
char* write = dest;
|
char* write = dest;
|
||||||
|
|
||||||
while (*write != '\0')
|
while (*write != '\0')
|
||||||
{
|
{
|
||||||
write++;
|
write++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* read = src;
|
const char* read = src;
|
||||||
char ch = '.';
|
char ch = '.';
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ char* ICACHE_FLASH_ATTR strncat_P(char* dest, const char* src, size_t size) {
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ICACHE_FLASH_ATTR strncmp_P(const char* str1, const char* str2P, size_t size) {
|
int strncmp_P(const char* str1, const char* str2P, size_t size) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
while (size > 0)
|
while (size > 0)
|
||||||
@ -99,7 +99,7 @@ int ICACHE_FLASH_ATTR strncmp_P(const char* str1, const char* str2P, size_t size
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ICACHE_FLASH_ATTR strncasecmp_P(const char* str1, const char* str2P, size_t size) {
|
int strncasecmp_P(const char* str1, const char* str2P, size_t size) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
while (size > 0)
|
while (size > 0)
|
||||||
@ -118,7 +118,7 @@ int ICACHE_FLASH_ATTR strncasecmp_P(const char* str1, const char* str2P, size_t
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ICACHE_FLASH_ATTR printf_P(const char* formatP, ...) {
|
int printf_P(const char* formatP, ...) {
|
||||||
int ret;
|
int ret;
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
va_start(arglist, formatP);
|
va_start(arglist, formatP);
|
||||||
@ -129,13 +129,13 @@ int ICACHE_FLASH_ATTR printf_P(const char* formatP, ...) {
|
|||||||
|
|
||||||
ret = os_printf(format, arglist);
|
ret = os_printf(format, arglist);
|
||||||
|
|
||||||
delete [] format;
|
delete[] format;
|
||||||
|
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ICACHE_FLASH_ATTR snprintf_P(char* str, size_t strSize, const char* formatP, ...) {
|
int snprintf_P(char* str, size_t strSize, const char* formatP, ...) {
|
||||||
int ret;
|
int ret;
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
va_start(arglist, formatP);
|
va_start(arglist, formatP);
|
||||||
@ -146,7 +146,7 @@ int ICACHE_FLASH_ATTR snprintf_P(char* str, size_t strSize, const char* formatP,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ICACHE_FLASH_ATTR vsnprintf_P(char* str, size_t strSize, const char* formatP, va_list ap) {
|
int vsnprintf_P(char* str, size_t strSize, const char* formatP, va_list ap) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
size_t fmtLen = strlen_P(formatP);
|
size_t fmtLen = strlen_P(formatP);
|
||||||
@ -155,7 +155,7 @@ int ICACHE_FLASH_ATTR vsnprintf_P(char* str, size_t strSize, const char* formatP
|
|||||||
|
|
||||||
ret = ets_vsnprintf(str, strSize, format, ap);
|
ret = ets_vsnprintf(str, strSize, format, ap);
|
||||||
|
|
||||||
delete [] format;
|
delete[] format;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -32,26 +32,26 @@ typedef uint32_t prog_uint32_t;
|
|||||||
|
|
||||||
#define SIZE_IRRELEVANT 0x7fffffff
|
#define SIZE_IRRELEVANT 0x7fffffff
|
||||||
|
|
||||||
extern void* memcpy_P(void* dest, const void* src, size_t count);
|
void* memcpy_P(void* dest, const void* src, size_t count);
|
||||||
|
|
||||||
extern char* strncpy_P(char* dest, const char* src, size_t size);
|
char* strncpy_P(char* dest, const char* src, size_t size);
|
||||||
#define strcpy_P(dest, src) strncpy_P((dest), (src), SIZE_IRRELEVANT)
|
#define strcpy_P(dest, src) strncpy_P((dest), (src), SIZE_IRRELEVANT)
|
||||||
|
|
||||||
extern char* strncat_P(char* dest, const char* src, size_t size);
|
char* strncat_P(char* dest, const char* src, size_t size);
|
||||||
#define strcat_P(dest, src) strncat_P((dest), (src), SIZE_IRRELEVANT)
|
#define strcat_P(dest, src) strncat_P((dest), (src), SIZE_IRRELEVANT)
|
||||||
|
|
||||||
extern int strncmp_P(const char* str1, const char* str2P, size_t size);
|
int strncmp_P(const char* str1, const char* str2P, size_t size);
|
||||||
#define strcmp_P(str1, str2P) strncmp_P((str1), (str2P), SIZE_IRRELEVANT)
|
#define strcmp_P(str1, str2P) strncmp_P((str1), (str2P), SIZE_IRRELEVANT)
|
||||||
|
|
||||||
extern int strncasecmp_P(const char* str1, const char* str2P, size_t size);
|
int strncasecmp_P(const char* str1, const char* str2P, size_t size);
|
||||||
#define strcasecmp_P(str1, str2P) strncasecmp_P((str1), (str2P), SIZE_IRRELEVANT)
|
#define strcasecmp_P(str1, str2P) strncasecmp_P((str1), (str2P), SIZE_IRRELEVANT)
|
||||||
|
|
||||||
extern size_t strnlen_P(const char *s, size_t size);
|
size_t strnlen_P(const char *s, size_t size);
|
||||||
#define strlen_P(strP) strnlen_P((strP), SIZE_IRRELEVANT)
|
#define strlen_P(strP) strnlen_P((strP), SIZE_IRRELEVANT)
|
||||||
|
|
||||||
extern int printf_P(const char *formatP, ...);
|
int printf_P(const char *formatP, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
extern int snprintf_P(char *str, size_t strSize, const char *formatP, ...);
|
int snprintf_P(char *str, size_t strSize, const char *formatP, ...) __attribute__ ((format (printf, 3, 4)));
|
||||||
extern int vsnprintf_P(char *str, size_t strSize, const char *formatP, va_list ap);
|
int vsnprintf_P(char *str, size_t strSize, const char *formatP, va_list ap) __attribute__ ((format (printf, 3, 0)));
|
||||||
|
|
||||||
// flash memory must be read using 32 bit aligned addresses else a processor
|
// flash memory must be read using 32 bit aligned addresses else a processor
|
||||||
// exception will be triggered
|
// exception will be triggered
|
||||||
|
@ -203,12 +203,32 @@ uint8_t* ESP8266WiFiClass::macAddress(uint8_t* mac)
|
|||||||
return mac;
|
return mac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ESP8266WiFiClass::macAddress(void)
|
||||||
|
{
|
||||||
|
uint8_t mac[6];
|
||||||
|
char macStr[18] = {0};
|
||||||
|
wifi_get_macaddr(STATION_IF, mac);
|
||||||
|
|
||||||
|
sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
|
return String(macStr);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t* ESP8266WiFiClass::softAPmacAddress(uint8_t* mac)
|
uint8_t* ESP8266WiFiClass::softAPmacAddress(uint8_t* mac)
|
||||||
{
|
{
|
||||||
wifi_get_macaddr(SOFTAP_IF, mac);
|
wifi_get_macaddr(SOFTAP_IF, mac);
|
||||||
return mac;
|
return mac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ESP8266WiFiClass::softAPmacAddress(void)
|
||||||
|
{
|
||||||
|
uint8_t mac[6];
|
||||||
|
char macStr[18] = {0};
|
||||||
|
wifi_get_macaddr(SOFTAP_IF, mac);
|
||||||
|
|
||||||
|
sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
|
return String(macStr);
|
||||||
|
}
|
||||||
|
|
||||||
IPAddress ESP8266WiFiClass::localIP()
|
IPAddress ESP8266WiFiClass::localIP()
|
||||||
{
|
{
|
||||||
struct ip_info ip;
|
struct ip_info ip;
|
||||||
@ -251,10 +271,25 @@ uint8_t* ESP8266WiFiClass::BSSID(void)
|
|||||||
return reinterpret_cast<uint8_t*>(conf.bssid);
|
return reinterpret_cast<uint8_t*>(conf.bssid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ESP8266WiFiClass::BSSIDstr(void)
|
||||||
|
{
|
||||||
|
static struct station_config conf;
|
||||||
|
char mac[18] = {0};
|
||||||
|
wifi_station_get_config(&conf);
|
||||||
|
sprintf(mac,"%02X:%02X:%02X:%02X:%02X:%02X", conf.bssid[0], conf.bssid[1], conf.bssid[2], conf.bssid[3], conf.bssid[4], conf.bssid[5]);
|
||||||
|
return String(mac);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t ESP8266WiFiClass::channel(void) {
|
int32_t ESP8266WiFiClass::channel(void) {
|
||||||
return wifi_get_channel();
|
return wifi_get_channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t ESP8266WiFiClass::RSSI(void) {
|
||||||
|
return wifi_station_get_rssi();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
typedef STAILQ_HEAD(, bss_info) bss_info_head_t;
|
typedef STAILQ_HEAD(, bss_info) bss_info_head_t;
|
||||||
@ -353,6 +388,17 @@ uint8_t * ESP8266WiFiClass::BSSID(uint8_t i)
|
|||||||
return it->bssid;
|
return it->bssid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ESP8266WiFiClass::BSSIDstr(uint8_t i)
|
||||||
|
{
|
||||||
|
char mac[18] = {0};
|
||||||
|
struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i));
|
||||||
|
if (!it)
|
||||||
|
return String("");
|
||||||
|
|
||||||
|
sprintf(mac,"%02X:%02X:%02X:%02X:%02X:%02X", it->bssid[0], it->bssid[1], it->bssid[2], it->bssid[3], it->bssid[4], it->bssid[5]);
|
||||||
|
return String(mac);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t ESP8266WiFiClass::channel(uint8_t i)
|
int32_t ESP8266WiFiClass::channel(uint8_t i)
|
||||||
{
|
{
|
||||||
struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i));
|
struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i));
|
||||||
|
@ -103,15 +103,19 @@ public:
|
|||||||
* Get the station interface MAC address.
|
* Get the station interface MAC address.
|
||||||
*
|
*
|
||||||
* return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
|
* return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
|
||||||
|
* return: String
|
||||||
*/
|
*/
|
||||||
uint8_t* macAddress(uint8_t* mac);
|
uint8_t* macAddress(uint8_t* mac);
|
||||||
|
String macAddress(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the softAP interface MAC address.
|
* Get the softAP interface MAC address.
|
||||||
*
|
*
|
||||||
* return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
|
* return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
|
||||||
|
* return: String
|
||||||
*/
|
*/
|
||||||
uint8_t* softAPmacAddress(uint8_t* mac);
|
uint8_t* softAPmacAddress(uint8_t* mac);
|
||||||
|
String softAPmacAddress(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the station interface IP address.
|
* Get the station interface IP address.
|
||||||
@ -151,10 +155,17 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Return the current bssid / mac associated with the network if configured
|
* Return the current bssid / mac associated with the network if configured
|
||||||
*
|
*
|
||||||
* return: bssid string
|
* return: bssid uint8_t *
|
||||||
*/
|
*/
|
||||||
uint8_t * BSSID(void);
|
uint8_t * BSSID(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the current bssid / mac associated with the network if configured
|
||||||
|
*
|
||||||
|
* return: bssid string
|
||||||
|
*/
|
||||||
|
String BSSIDstr(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the current channel associated with the network
|
* Return the current channel associated with the network
|
||||||
*
|
*
|
||||||
@ -163,13 +174,12 @@ public:
|
|||||||
int32_t channel(void);
|
int32_t channel(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the current network RSSI. Note: this is just a stub, there is no way to
|
* Return the current network RSSI.
|
||||||
* get the RSSI in the Espressif SDK yet.
|
|
||||||
*
|
*
|
||||||
* return: RSSI value (currently 0)
|
* return: RSSI value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int32_t RSSI() { return 0; }
|
int32_t RSSI();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start scan WiFi networks available
|
* Start scan WiFi networks available
|
||||||
@ -209,10 +219,17 @@ public:
|
|||||||
/**
|
/**
|
||||||
* return MAC / BSSID of scanned wifi
|
* return MAC / BSSID of scanned wifi
|
||||||
* @param networkItem specify from which network item want to get the information
|
* @param networkItem specify from which network item want to get the information
|
||||||
* @return uint8_t * to MAC / BSSID of scanned wifi
|
* @return uint8_t * MAC / BSSID of scanned wifi
|
||||||
*/
|
*/
|
||||||
uint8_t * BSSID(uint8_t networkItem);
|
uint8_t * BSSID(uint8_t networkItem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return MAC / BSSID of scanned wifi
|
||||||
|
* @param networkItem specify from which network item want to get the information
|
||||||
|
* @return String MAC / BSSID of scanned wifi
|
||||||
|
*/
|
||||||
|
String BSSIDstr(uint8_t networkItem);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return channel of scanned wifi
|
* return channel of scanned wifi
|
||||||
* @param networkItem specify from which network item want to get the information
|
* @param networkItem specify from which network item want to get the information
|
||||||
|
@ -47,6 +47,10 @@ wl_status_t ESP8266WiFiMulti::run(void) {
|
|||||||
uint8 bestBSSID[6];
|
uint8 bestBSSID[6];
|
||||||
int32_t bestChannel;
|
int32_t bestChannel;
|
||||||
|
|
||||||
|
DEBUG_WIFI_MULTI("[WIFI] delete old wifi config...\n");
|
||||||
|
WiFi.disconnect();
|
||||||
|
|
||||||
|
DEBUG_WIFI_MULTI("[WIFI] start scan\n");
|
||||||
// WiFi.scanNetworks will return the number of networks found
|
// WiFi.scanNetworks will return the number of networks found
|
||||||
int8_t n = WiFi.scanNetworks();
|
int8_t n = WiFi.scanNetworks();
|
||||||
|
|
||||||
@ -93,7 +97,7 @@ wl_status_t ESP8266WiFiMulti::run(void) {
|
|||||||
DEBUG_WIFI_MULTI(" ");
|
DEBUG_WIFI_MULTI(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_WIFI_MULTI(" %d: [%d][%02X:%02X:%02X:%02X:%02X:%02X] %s (%d) %c\n", i, chan_scan, BSSID_scan[0], BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], ssid_scan, rssi_scan, (sec_scan == ENC_TYPE_NONE) ? ' ' : '*');
|
DEBUG_WIFI_MULTI(" %d: [%d][%02X:%02X:%02X:%02X:%02X:%02X] %s (%d) %c\n", i, chan_scan, BSSID_scan[0], BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], ssid_scan.c_str(), rssi_scan, (sec_scan == ENC_TYPE_NONE) ? ' ' : '*');
|
||||||
delay(0);
|
delay(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#undef max
|
#undef max
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
//#define DEBUG_WIFI_MULTI(...) os_printf( __VA_ARGS__ )
|
//#define DEBUG_WIFI_MULTI(...) Serial1.printf( __VA_ARGS__ )
|
||||||
|
|
||||||
#ifndef DEBUG_WIFI_MULTI
|
#ifndef DEBUG_WIFI_MULTI
|
||||||
#define DEBUG_WIFI_MULTI(...)
|
#define DEBUG_WIFI_MULTI(...)
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
esp_iot_sdk_v1.1.0_15_05_27_p1 Release Note
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
Here is a patch based on SDK_v1.1.0 resolved issues below:
|
||||||
|
1. SDK 1.1.0 may boot fail if SPI Flash speed is 80MHz.
|
||||||
|
2. Memory Leak in libssl when SSL connection fail.
|
||||||
|
3. Update smartconfig, please using it with the latest Espressif APP https://github.com/EspressifApp
|
||||||
|
|
||||||
|
Sorry for the inconvenience.
|
||||||
|
|
||||||
esp_iot_sdk_v1.1.0_15_05_22 Release Note
|
esp_iot_sdk_v1.1.0_15_05_22 Release Note
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
Resolved Issues(Bugs below are eligible for Bug Bounty Program):
|
Resolved Issues(Bugs below are eligible for Bug Bounty Program):
|
||||||
|
@ -118,7 +118,7 @@ void ets_isr_unmask(int intr);
|
|||||||
void ets_isr_attach(int intr, int_handler_t handler, void *arg);
|
void ets_isr_attach(int intr, int_handler_t handler, void *arg);
|
||||||
void ets_intr_lock();
|
void ets_intr_lock();
|
||||||
void ets_intr_unlock();
|
void ets_intr_unlock();
|
||||||
int ets_vsnprintf(char * s, size_t n, const char * format, va_list arg);
|
int ets_vsnprintf(char * s, size_t n, const char * format, va_list arg) __attribute__ ((format (printf, 3, 0)));
|
||||||
int ets_vprintf(const char * format, va_list arg);
|
int ets_vprintf(const char * format, va_list arg) __attribute__ ((format (printf, 1, 0)));
|
||||||
|
|
||||||
#endif /* _ETS_SYS_H */
|
#endif /* _ETS_SYS_H */
|
||||||
|
@ -30,7 +30,7 @@ enum rst_reason {
|
|||||||
DEEP_SLEEP_AWAKE_FLAG = 4
|
DEEP_SLEEP_AWAKE_FLAG = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rst_info{
|
struct rst_info {
|
||||||
uint32 reason;
|
uint32 reason;
|
||||||
uint32 exccause;
|
uint32 exccause;
|
||||||
uint32 epc1;
|
uint32 epc1;
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
1.1.0
|
1.1.0_15_05_27_p1
|
Loading…
x
Reference in New Issue
Block a user