mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
Merge remote-tracking branch 'esp8266/master'
This commit is contained in:
@ -897,6 +897,43 @@ void ESP8266WiFiClass::_smartConfigCallback(uint32_t st, void* result)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* set Sleep mode
|
||||
* @param type sleep_type_t
|
||||
* @return bool
|
||||
*/
|
||||
bool ESP8266WiFiClass::setSleepMode(WiFiSleepType_t type) {
|
||||
return wifi_set_sleep_type((sleep_type_t)type);
|
||||
}
|
||||
|
||||
/**
|
||||
* get Sleep mode
|
||||
* @return sleep_type_t
|
||||
*/
|
||||
WiFiSleepType_t ESP8266WiFiClass::getSleepMode() {
|
||||
return (WiFiSleepType_t)wifi_get_sleep_type();
|
||||
}
|
||||
|
||||
/**
|
||||
* set phy Mode
|
||||
* @param mode phy_mode_t
|
||||
* @return bool
|
||||
*/
|
||||
bool ESP8266WiFiClass::setPhyMode(WiFiPhyMode_t mode) {
|
||||
return wifi_set_phy_mode((phy_mode_t)mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* get phy Mode
|
||||
* @return phy_mode_t
|
||||
*/
|
||||
WiFiPhyMode_t ESP8266WiFiClass::getPhyMode() {
|
||||
return (WiFiPhyMode_t)wifi_get_phy_mode();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
void ESP8266WiFiClass::_eventCallback(void* arg)
|
||||
|
@ -36,8 +36,21 @@ extern "C" {
|
||||
#define WIFI_SCAN_RUNNING (-1)
|
||||
#define WIFI_SCAN_FAILED (-2)
|
||||
|
||||
|
||||
// Note:
|
||||
// this enums need to be in sync with the SDK!
|
||||
|
||||
enum WiFiMode { WIFI_OFF = 0, WIFI_STA = 1, WIFI_AP = 2, WIFI_AP_STA = 3 };
|
||||
|
||||
typedef enum {
|
||||
WIFI_PHY_MODE_11B = 1, WIFI_PHY_MODE_11G = 2, WIFI_PHY_MODE_11N = 3
|
||||
} WiFiPhyMode_t;
|
||||
|
||||
typedef enum {
|
||||
WIFI_NONE_SLEEP = 0, WIFI_LIGHT_SLEEP = 2, WIFI_MODEM_SLEEP = 3
|
||||
} WiFiSleepType_t;
|
||||
|
||||
|
||||
class ESP8266WiFiClass
|
||||
{
|
||||
public:
|
||||
@ -375,6 +388,32 @@ public:
|
||||
friend class WiFiClient;
|
||||
friend class WiFiServer;
|
||||
|
||||
/**
|
||||
* set Sleep mode
|
||||
* @param type WiFiPhyMode_t
|
||||
* @return bool
|
||||
*/
|
||||
bool setSleepMode(WiFiSleepType_t type);
|
||||
|
||||
/**
|
||||
* get Sleep mode
|
||||
* @return sleep_type_t
|
||||
*/
|
||||
WiFiSleepType_t getSleepMode();
|
||||
|
||||
/**
|
||||
* set phy Mode
|
||||
* @param mode phy_mode_t
|
||||
* @return bool
|
||||
*/
|
||||
bool setPhyMode(WiFiPhyMode_t mode);
|
||||
|
||||
/**
|
||||
* get phy Mode
|
||||
* @return phy_mode_t
|
||||
*/
|
||||
WiFiPhyMode_t getPhyMode();
|
||||
|
||||
protected:
|
||||
void _mode(WiFiMode);
|
||||
static void _scanDone(void* result, int status);
|
||||
|
@ -493,8 +493,9 @@ extern "C" void* ax_port_malloc(size_t size, const char* file, int line) {
|
||||
DEBUG_TLS_MEM_PRINT("%s:%d malloc %d failed, left %d\r\n", file, line, size, ESP.getFreeHeap());
|
||||
panic();
|
||||
}
|
||||
if (size >= 1024)
|
||||
if (size >= 1024) {
|
||||
DEBUG_TLS_MEM_PRINT("%s:%d malloc %d, left %d\r\n", file, line, size, ESP.getFreeHeap());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -510,8 +511,9 @@ extern "C" void* ax_port_realloc(void* ptr, size_t size, const char* file, int l
|
||||
DEBUG_TLS_MEM_PRINT("%s:%d realloc %d failed, left %d\r\n", file, line, size, ESP.getFreeHeap());
|
||||
panic();
|
||||
}
|
||||
if (size >= 1024)
|
||||
if (size >= 1024) {
|
||||
DEBUG_TLS_MEM_PRINT("%s:%d realloc %d, left %d\r\n", file, line, size, ESP.getFreeHeap());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -519,6 +521,7 @@ extern "C" void ax_port_free(void* ptr) {
|
||||
free(ptr);
|
||||
uint32_t *p = (uint32_t*) ptr;
|
||||
size_t size = p[-3];
|
||||
if (size >= 1024)
|
||||
if (size >= 1024) {
|
||||
DEBUG_TLS_MEM_PRINT("free %d, left %d\r\n", p[-3], ESP.getFreeHeap());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user