mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Merge branch 'master' into master
This commit is contained in:
commit
6ff023c833
@ -269,10 +269,13 @@ long map(long, long, long, long, long);
|
|||||||
|
|
||||||
void setTZ(const char* tz);
|
void setTZ(const char* tz);
|
||||||
|
|
||||||
void configTime(int timezone, int daylightOffset_sec, const char* server1,
|
// configure time using POSIX TZ string
|
||||||
|
// server pointers *must remain valid* for the duration of the program
|
||||||
|
void configTime(const char* tz, const char* server1,
|
||||||
const char* server2 = nullptr, const char* server3 = nullptr);
|
const char* server2 = nullptr, const char* server3 = nullptr);
|
||||||
|
|
||||||
void configTime(const char* tz, const char* server1,
|
// configures with approximated TZ value. part of the old api, prefer configTime with TZ variable
|
||||||
|
void configTime(int timezone, int daylightOffset_sec, const char* server1,
|
||||||
const char* server2 = nullptr, const char* server3 = nullptr);
|
const char* server2 = nullptr, const char* server3 = nullptr);
|
||||||
|
|
||||||
// esp32 api compatibility
|
// esp32 api compatibility
|
||||||
@ -290,6 +293,12 @@ bool getLocalTime(struct tm * info, uint32_t ms = 5000);
|
|||||||
#include "WCharacter.h"
|
#include "WCharacter.h"
|
||||||
#include "WString.h"
|
#include "WString.h"
|
||||||
|
|
||||||
|
// configTime wrappers for temporary server{1,2,3} strings
|
||||||
|
void configTime(int timezone, int daylightOffset_sec, String server1,
|
||||||
|
String server2 = String(), String server3 = String());
|
||||||
|
void configTime(const char* tz, String server1,
|
||||||
|
String server2 = String(), String server3 = String());
|
||||||
|
|
||||||
#include "HardwareSerial.h"
|
#include "HardwareSerial.h"
|
||||||
#include "Esp.h"
|
#include "Esp.h"
|
||||||
#include "Updater.h"
|
#include "Updater.h"
|
||||||
|
@ -20,18 +20,19 @@
|
|||||||
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 <eagle_soc.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* precache()
|
/* precache()
|
||||||
* pre-loads flash data into the flash cache
|
* pre-loads flash data into the flash cache
|
||||||
* if f==0, preloads instructions starting at the address we were called from.
|
* if f==0, preloads instructions starting at the address we were called from.
|
||||||
* otherwise preloads flash at the given address.
|
* otherwise preloads flash at the given address.
|
||||||
* All preloads are word aligned.
|
* All preloads are word aligned.
|
||||||
*/
|
*/
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void precache(void *f, uint32_t bytes) {
|
void precache(void *f, uint32_t bytes) {
|
||||||
// Size of a cache page in bytes. We only need to read one word per
|
// Size of a cache page in bytes. We only need to read one word per
|
||||||
// page (ie 1 word in 8) for this to work.
|
// page (ie 1 word in 8) for this to work.
|
||||||
@ -46,6 +47,20 @@ void precache(void *f, uint32_t bytes) {
|
|||||||
(void)x;
|
(void)x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** based on efuse data, we could determine what type of chip this is
|
||||||
|
* - https://github.com/espressif/esptool/blob/f04d34bcab29ace798d2d3800ba87020cccbbfdd/esptool.py#L1060-L1070
|
||||||
|
* - https://github.com/espressif/ESP8266_RTOS_SDK/blob/3c055779e9793e5f082afff63a011d6615e73639/components/esp8266/include/esp8266/efuse_register.h#L20-L21
|
||||||
|
*/
|
||||||
|
bool esp_is_8285() {
|
||||||
|
const uint32_t data[] {
|
||||||
|
READ_PERI_REG(0x3ff00050), // aka MAC0
|
||||||
|
READ_PERI_REG(0x3ff00058), // aka CHIPID
|
||||||
|
};
|
||||||
|
|
||||||
|
return ((data[0] & (1 << 4)) > 0)
|
||||||
|
|| ((data[1] & (1 << 16)) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -122,10 +122,21 @@ inline int esp_get_cpu_freq_mhz()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Call this function in your setup() to cause the phase locked version of the generator to
|
// Call this function in your setup() to cause the phase locked version of the generator to
|
||||||
// be linked in automatically. Otherwise, the default PWM locked version will be used.
|
// be linked in automatically. Otherwise, the default PWM locked version will be used.
|
||||||
void enablePhaseLockedWaveform(void);
|
void enablePhaseLockedWaveform(void);
|
||||||
|
|
||||||
|
// Determine when the sketch runs on ESP8285
|
||||||
|
#if !defined(CORE_MOCK)
|
||||||
|
bool __attribute__((const, nothrow)) esp_is_8285();
|
||||||
|
#else
|
||||||
|
inline bool esp_is_8285()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -208,6 +208,19 @@ void configTime(int timezone_sec, int daylightOffset_sec, const char* server1, c
|
|||||||
sntp_init();
|
sntp_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void configTime(int timezone_sec, int daylightOffset_sec, String server1, String server2, String server3)
|
||||||
|
{
|
||||||
|
static String servers[3];
|
||||||
|
servers[0] = std::move(server1);
|
||||||
|
servers[1] = std::move(server2);
|
||||||
|
servers[2] = std::move(server3);
|
||||||
|
|
||||||
|
configTime(timezone_sec, daylightOffset_sec,
|
||||||
|
servers[0].length() ? servers[0].c_str() : nullptr,
|
||||||
|
servers[1].length() ? servers[1].c_str() : nullptr,
|
||||||
|
servers[2].length() ? servers[2].c_str() : nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void setTZ(const char* tz){
|
void setTZ(const char* tz){
|
||||||
|
|
||||||
char tzram[strlen_P(tz) + 1];
|
char tzram[strlen_P(tz) + 1];
|
||||||
@ -228,6 +241,19 @@ void configTime(const char* tz, const char* server1, const char* server2, const
|
|||||||
sntp_init();
|
sntp_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void configTime(const char* tz, String server1, String server2, String server3)
|
||||||
|
{
|
||||||
|
static String servers[3];
|
||||||
|
servers[0] = std::move(server1);
|
||||||
|
servers[1] = std::move(server2);
|
||||||
|
servers[2] = std::move(server3);
|
||||||
|
|
||||||
|
configTime(tz,
|
||||||
|
servers[0].length() ? servers[0].c_str() : nullptr,
|
||||||
|
servers[1].length() ? servers[1].c_str() : nullptr,
|
||||||
|
servers[2].length() ? servers[2].c_str() : nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
static BoolCB _settimeofday_cb;
|
static BoolCB _settimeofday_cb;
|
||||||
|
|
||||||
void settimeofday_cb (const TrivialCB& cb)
|
void settimeofday_cb (const TrivialCB& cb)
|
||||||
|
@ -69,20 +69,8 @@ enum wl_enc_type { /* Values map to 802.11 encryption suites... */
|
|||||||
ENC_TYPE_AUTO = 8
|
ENC_TYPE_AUTO = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(LWIP_INTERNAL) && !defined(__LWIP_TCP_H__) && !defined(LWIP_HDR_TCPBASE_H)
|
#include <lwip/init.h>
|
||||||
enum wl_tcp_state {
|
#include <lwip/tcpbase.h>
|
||||||
CLOSED = 0,
|
using wl_tcp_state = tcp_state;
|
||||||
LISTEN = 1,
|
|
||||||
SYN_SENT = 2,
|
|
||||||
SYN_RCVD = 3,
|
|
||||||
ESTABLISHED = 4,
|
|
||||||
FIN_WAIT_1 = 5,
|
|
||||||
FIN_WAIT_2 = 6,
|
|
||||||
CLOSE_WAIT = 7,
|
|
||||||
CLOSING = 8,
|
|
||||||
LAST_ACK = 9,
|
|
||||||
TIME_WAIT = 10
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* WL_DEFINITIONS_H_ */
|
#endif /* WL_DEFINITIONS_H_ */
|
||||||
|
@ -55,6 +55,10 @@ This change is harmless with standard sketches: Calls to ``WiFi.mode()`` do
|
|||||||
enable radio as usual. It also smooths current spikes at boot and decreases
|
enable radio as usual. It also smooths current spikes at boot and decreases
|
||||||
DHCP stress.
|
DHCP stress.
|
||||||
|
|
||||||
|
Known side-effects:
|
||||||
|
|
||||||
|
- ``WiFi.mode()`` must be called before changing mac addresses with ``wifi_set_macaddr({SOFTAP,STATION}_IF, ...)``.
|
||||||
|
|
||||||
Legacy behavior can be restored by calling ``enableWiFiAtBootTime()`` from
|
Legacy behavior can be restored by calling ``enableWiFiAtBootTime()`` from
|
||||||
anywhere in the code (it is a weak void function intended to play with the
|
anywhere in the code (it is a weak void function intended to play with the
|
||||||
linker).
|
linker).
|
||||||
|
@ -18,12 +18,15 @@ signature line must be alone on a single line. The block comment ending
|
|||||||
compiler command-line options just as you would have for the GCC @file
|
compiler command-line options just as you would have for the GCC @file
|
||||||
command option.
|
command option.
|
||||||
|
|
||||||
Actions taken in processing comment block to create ``build.opt`` \* for
|
Actions taken in processing comment block to create ``build.opt``
|
||||||
each line, white space is trimmed \* blank lines are skipped \* lines
|
|
||||||
starting with ``*``, ``//``, or ``#`` are skipped \* the remaining
|
- for each line, white space is trimmed
|
||||||
results are written to build tree\ ``/core/build.opt`` \* multiple
|
- blank lines are skipped
|
||||||
``/*@create-file:build.opt@`` ``*/`` comment blocks are not allowed \*
|
- lines starting with ``*``, ``//``, or ``#`` are skipped
|
||||||
``build.opt`` is finished with a ``-include ...`` command, which
|
- the remaining results are written to build tree\ ``/core/build.opt``
|
||||||
|
- multiple ``/*@create-file:build.opt@`` ``*/`` comment blocks are not
|
||||||
|
allowed
|
||||||
|
- ``build.opt`` is finished with a ``-include ...`` command, which
|
||||||
references the global .h its contents were extracted from.
|
references the global .h its contents were extracted from.
|
||||||
|
|
||||||
Example Sketch: ``LowWatermark.ino``
|
Example Sketch: ``LowWatermark.ino``
|
||||||
@ -108,8 +111,10 @@ multiple Sketches are open, they can no longer reliably share one cached
|
|||||||
of ``core.a`` cached. Other sketches will use this cached version for
|
of ``core.a`` cached. Other sketches will use this cached version for
|
||||||
their builds.
|
their builds.
|
||||||
|
|
||||||
There are two solutions to this issue: 1. Turn off the “Aggressively
|
There are two solutions to this issue:
|
||||||
Cache Compiled core” feature, by setting ``compiler.cache_core=false``.
|
|
||||||
|
1. Turn off the “Aggressively Cache Compiled core” feature, by setting
|
||||||
|
``compiler.cache_core=false``.
|
||||||
2. Rely on the not ideal fail-safe, aggressive cache workaround built
|
2. Rely on the not ideal fail-safe, aggressive cache workaround built
|
||||||
into the script.
|
into the script.
|
||||||
|
|
||||||
@ -145,11 +150,16 @@ When you switch between Sketch windows, core will be recompiled and the
|
|||||||
cache updated. The workaround logic is reset when Arduino IDE is
|
cache updated. The workaround logic is reset when Arduino IDE is
|
||||||
completely shutdown and restarted.
|
completely shutdown and restarted.
|
||||||
|
|
||||||
The workaround is not perfect. These issues may be of concern: 1. Dirty
|
The workaround is not perfect. These issues may be of concern:
|
||||||
temp space. Arduino build cache files left over from a previous run or
|
|
||||||
boot. 2. Arduino command-line options: \* override default
|
1. Dirty temp space. Arduino build cache files left over from a previous
|
||||||
preferences.txt file. \* override a preference, specifically
|
run or boot.
|
||||||
``compiler.cache_core``. 3. Multiple versions of the Arduino IDE running
|
2. Arduino command-line options:
|
||||||
|
|
||||||
|
- override default preferences.txt file.
|
||||||
|
- override a preference, specifically ``compiler.cache_core``.
|
||||||
|
|
||||||
|
3. Multiple versions of the Arduino IDE running
|
||||||
|
|
||||||
**Dirty temp space**
|
**Dirty temp space**
|
||||||
|
|
||||||
|
@ -265,8 +265,6 @@ void ArduinoOTAClass::_runUpdate() {
|
|||||||
delay(100);
|
delay(100);
|
||||||
|
|
||||||
Update.setMD5(_md5.c_str());
|
Update.setMD5(_md5.c_str());
|
||||||
WiFiUDP::stopAll();
|
|
||||||
WiFiClient::stopAll();
|
|
||||||
|
|
||||||
if (_start_callback) {
|
if (_start_callback) {
|
||||||
_start_callback();
|
_start_callback();
|
||||||
|
@ -89,7 +89,6 @@ void ESP8266HTTPUpdateServerTemplate<ServerType>::setup(ESP8266WebServerTemplate
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WiFiUDP::stopAll();
|
|
||||||
if (_serial_output)
|
if (_serial_output)
|
||||||
Serial.printf("Update: %s\n", upload.filename.c_str());
|
Serial.printf("Update: %s\n", upload.filename.c_str());
|
||||||
if (upload.name == "filesystem") {
|
if (upload.name == "filesystem") {
|
||||||
|
@ -224,7 +224,6 @@ void ESP8266WiFiGenericClass::_eventCallback(void* arg)
|
|||||||
|
|
||||||
if(event->event == EVENT_STAMODE_DISCONNECTED) {
|
if(event->event == EVENT_STAMODE_DISCONNECTED) {
|
||||||
DEBUG_WIFI("STA disconnect: %d\n", event->event_info.disconnected.reason);
|
DEBUG_WIFI("STA disconnect: %d\n", event->event_info.disconnected.reason);
|
||||||
WiFiClient::stopAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->event == EVENT_STAMODE_AUTHMODE_CHANGE) {
|
if (event->event == EVENT_STAMODE_AUTHMODE_CHANGE) {
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LWIP_INTERNAL
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include "wl_definitions.h"
|
#include "wl_definitions.h"
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LWIP_INTERNAL
|
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define LWIP_INTERNAL
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "osapi.h"
|
#include "osapi.h"
|
||||||
#include "ets_sys.h"
|
#include "ets_sys.h"
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LWIP_INTERNAL
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "osapi.h"
|
#include "osapi.h"
|
||||||
#include "ets_sys.h"
|
#include "ets_sys.h"
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LWIP_INTERNAL
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
Binary file not shown.
@ -30,7 +30,10 @@
|
|||||||
#define NUM_DIGITAL_PINS 17
|
#define NUM_DIGITAL_PINS 17
|
||||||
#define NUM_ANALOG_INPUTS 1
|
#define NUM_ANALOG_INPUTS 1
|
||||||
|
|
||||||
#define isFlashInterfacePin(p) ((p) >= 6 && (p) <= 11)
|
#define isFlashInterfacePin(p)\
|
||||||
|
(esp_is_8285()\
|
||||||
|
? ((p) == 6 || (p) == 7 || (p) == 8 || (p) == 11)\
|
||||||
|
: ((p) >= 6 && (p) <= 11))
|
||||||
|
|
||||||
#define analogInputToDigitalPin(p) ((p > 0) ? NOT_A_PIN : 0)
|
#define analogInputToDigitalPin(p) ((p > 0) ? NOT_A_PIN : 0)
|
||||||
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)? (p) : NOT_AN_INTERRUPT)
|
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)? (p) : NOT_AN_INTERRUPT)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user