1
0
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:
david gauchard 2022-06-26 17:53:26 +02:00 committed by GitHub
commit 6ff023c833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 103 additions and 50 deletions

View File

@ -269,10 +269,13 @@ long map(long, long, long, long, long);
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);
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);
// esp32 api compatibility
@ -290,6 +293,12 @@ bool getLocalTime(struct tm * info, uint32_t ms = 5000);
#include "WCharacter.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 "Esp.h"
#include "Updater.h"

View File

@ -20,18 +20,19 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <eagle_soc.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* precache()
* pre-loads flash data into the flash cache
* if f==0, preloads instructions starting at the address we were called from.
* otherwise preloads flash at the given address.
* All preloads are word aligned.
*/
#ifdef __cplusplus
extern "C" {
#endif
void precache(void *f, uint32_t bytes) {
// 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.
@ -46,6 +47,20 @@ void precache(void *f, uint32_t bytes) {
(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
}
#endif

View File

@ -122,10 +122,21 @@ inline int esp_get_cpu_freq_mhz()
}
#endif
// 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.
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
}
#endif

View File

@ -208,6 +208,19 @@ void configTime(int timezone_sec, int daylightOffset_sec, const char* server1, c
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){
char tzram[strlen_P(tz) + 1];
@ -228,6 +241,19 @@ void configTime(const char* tz, const char* server1, const char* server2, const
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;
void settimeofday_cb (const TrivialCB& cb)

View File

@ -69,20 +69,8 @@ enum wl_enc_type { /* Values map to 802.11 encryption suites... */
ENC_TYPE_AUTO = 8
};
#if !defined(LWIP_INTERNAL) && !defined(__LWIP_TCP_H__) && !defined(LWIP_HDR_TCPBASE_H)
enum wl_tcp_state {
CLOSED = 0,
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
#include <lwip/init.h>
#include <lwip/tcpbase.h>
using wl_tcp_state = tcp_state;
#endif /* WL_DEFINITIONS_H_ */

View File

@ -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
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
anywhere in the code (it is a weak void function intended to play with the
linker).

View File

@ -18,13 +18,16 @@ 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
command option.
Actions taken in processing comment block to create ``build.opt`` \* for
each line, white space is trimmed \* blank lines are skipped \* lines
starting with ``*``, ``//``, or ``#`` are skipped \* 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.
Actions taken in processing comment block to create ``build.opt``
- for each line, white space is trimmed
- blank lines are skipped
- lines starting with ``*``, ``//``, or ``#`` are skipped
- 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.
Example Sketch: ``LowWatermark.ino``
@ -108,10 +111,12 @@ multiple Sketches are open, they can no longer reliably share one cached
of ``core.a`` cached. Other sketches will use this cached version for
their builds.
There are two solutions to this issue: 1. Turn off the “Aggressively
Cache Compiled core” feature, by setting ``compiler.cache_core=false``.
There are two solutions to this issue:
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
into the script.
into the script.
Using “compiler.cache_core=false”
---------------------------------
@ -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
completely shutdown and restarted.
The workaround is not perfect. These issues may be of concern: 1. Dirty
temp space. Arduino build cache files left over from a previous run or
boot. 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
The workaround is not perfect. These issues may be of concern:
1. Dirty temp space. Arduino build cache files left over from a previous
run or boot.
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**

View File

@ -265,8 +265,6 @@ void ArduinoOTAClass::_runUpdate() {
delay(100);
Update.setMD5(_md5.c_str());
WiFiUDP::stopAll();
WiFiClient::stopAll();
if (_start_callback) {
_start_callback();

View File

@ -89,7 +89,6 @@ void ESP8266HTTPUpdateServerTemplate<ServerType>::setup(ESP8266WebServerTemplate
return;
}
WiFiUDP::stopAll();
if (_serial_output)
Serial.printf("Update: %s\n", upload.filename.c_str());
if (upload.name == "filesystem") {

View File

@ -224,7 +224,6 @@ void ESP8266WiFiGenericClass::_eventCallback(void* arg)
if(event->event == EVENT_STAMODE_DISCONNECTED) {
DEBUG_WIFI("STA disconnect: %d\n", event->event_info.disconnected.reason);
WiFiClient::stopAll();
}
if (event->event == EVENT_STAMODE_AUTHMODE_CHANGE) {

View File

@ -20,8 +20,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define LWIP_INTERNAL
extern "C"
{
#include "wl_definitions.h"

View File

@ -20,8 +20,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define LWIP_INTERNAL
#include <list>
#include <errno.h>
#include <algorithm>

View File

@ -21,8 +21,6 @@
*/
#define LWIP_INTERNAL
extern "C" {
#include "osapi.h"
#include "ets_sys.h"

View File

@ -19,8 +19,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define LWIP_INTERNAL
extern "C" {
#include "osapi.h"
#include "ets_sys.h"

View File

@ -20,7 +20,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define LWIP_INTERNAL
#include <functional>
extern "C"

Binary file not shown.

View File

@ -30,7 +30,10 @@
#define NUM_DIGITAL_PINS 17
#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 digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)? (p) : NOT_AN_INTERRUPT)