Skip to content

Commit d22de06

Browse files
2 parents b7f8ae5 + bf5a0f2 commit d22de06

30 files changed

+272
-220
lines changed

boards.txt

+33-33
Original file line numberDiff line numberDiff line change
@@ -180,37 +180,37 @@ generic.menu.FlashSize.16M15M.build.spiffs_start=0x100000
180180
generic.menu.FlashSize.16M15M.build.spiffs_end=0xFFB000
181181
generic.menu.FlashSize.16M15M.build.spiffs_blocksize=8192
182182
generic.menu.led.2=2
183-
generic.menu.led.2.build.led=-DUSERLED=2
183+
generic.menu.led.2.build.led=-DLED_BUILTIN=2
184184
generic.menu.led.0=0
185-
generic.menu.led.0.build.led=-DUSERLED=0
185+
generic.menu.led.0.build.led=-DLED_BUILTIN=0
186186
generic.menu.led.1=1
187-
generic.menu.led.1.build.led=-DUSERLED=1
187+
generic.menu.led.1.build.led=-DLED_BUILTIN=1
188188
generic.menu.led.3=3
189-
generic.menu.led.3.build.led=-DUSERLED=3
189+
generic.menu.led.3.build.led=-DLED_BUILTIN=3
190190
generic.menu.led.4=4
191-
generic.menu.led.4.build.led=-DUSERLED=4
191+
generic.menu.led.4.build.led=-DLED_BUILTIN=4
192192
generic.menu.led.5=5
193-
generic.menu.led.5.build.led=-DUSERLED=5
193+
generic.menu.led.5.build.led=-DLED_BUILTIN=5
194194
generic.menu.led.6=6
195-
generic.menu.led.6.build.led=-DUSERLED=6
195+
generic.menu.led.6.build.led=-DLED_BUILTIN=6
196196
generic.menu.led.7=7
197-
generic.menu.led.7.build.led=-DUSERLED=7
197+
generic.menu.led.7.build.led=-DLED_BUILTIN=7
198198
generic.menu.led.8=8
199-
generic.menu.led.8.build.led=-DUSERLED=8
199+
generic.menu.led.8.build.led=-DLED_BUILTIN=8
200200
generic.menu.led.9=9
201-
generic.menu.led.9.build.led=-DUSERLED=9
201+
generic.menu.led.9.build.led=-DLED_BUILTIN=9
202202
generic.menu.led.10=10
203-
generic.menu.led.10.build.led=-DUSERLED=10
203+
generic.menu.led.10.build.led=-DLED_BUILTIN=10
204204
generic.menu.led.11=11
205-
generic.menu.led.11.build.led=-DUSERLED=11
205+
generic.menu.led.11.build.led=-DLED_BUILTIN=11
206206
generic.menu.led.12=12
207-
generic.menu.led.12.build.led=-DUSERLED=12
207+
generic.menu.led.12.build.led=-DLED_BUILTIN=12
208208
generic.menu.led.13=13
209-
generic.menu.led.13.build.led=-DUSERLED=13
209+
generic.menu.led.13.build.led=-DLED_BUILTIN=13
210210
generic.menu.led.14=14
211-
generic.menu.led.14.build.led=-DUSERLED=14
211+
generic.menu.led.14.build.led=-DLED_BUILTIN=14
212212
generic.menu.led.15=15
213-
generic.menu.led.15.build.led=-DUSERLED=15
213+
generic.menu.led.15.build.led=-DLED_BUILTIN=15
214214
generic.menu.LwIPVariant.v2mss536=v2 Lower Memory
215215
generic.menu.LwIPVariant.v2mss536.build.lwip_include=lwip2/include
216216
generic.menu.LwIPVariant.v2mss536.build.lwip_lib=-llwip2
@@ -394,37 +394,37 @@ esp8285.menu.FlashSize.1M512.build.spiffs_start=0x7B000
394394
esp8285.menu.FlashSize.1M512.build.spiffs_end=0xFB000
395395
esp8285.menu.FlashSize.1M512.build.spiffs_blocksize=8192
396396
esp8285.menu.led.2=2
397-
esp8285.menu.led.2.build.led=-DUSERLED=2
397+
esp8285.menu.led.2.build.led=-DLED_BUILTIN=2
398398
esp8285.menu.led.0=0
399-
esp8285.menu.led.0.build.led=-DUSERLED=0
399+
esp8285.menu.led.0.build.led=-DLED_BUILTIN=0
400400
esp8285.menu.led.1=1
401-
esp8285.menu.led.1.build.led=-DUSERLED=1
401+
esp8285.menu.led.1.build.led=-DLED_BUILTIN=1
402402
esp8285.menu.led.3=3
403-
esp8285.menu.led.3.build.led=-DUSERLED=3
403+
esp8285.menu.led.3.build.led=-DLED_BUILTIN=3
404404
esp8285.menu.led.4=4
405-
esp8285.menu.led.4.build.led=-DUSERLED=4
405+
esp8285.menu.led.4.build.led=-DLED_BUILTIN=4
406406
esp8285.menu.led.5=5
407-
esp8285.menu.led.5.build.led=-DUSERLED=5
407+
esp8285.menu.led.5.build.led=-DLED_BUILTIN=5
408408
esp8285.menu.led.6=6
409-
esp8285.menu.led.6.build.led=-DUSERLED=6
409+
esp8285.menu.led.6.build.led=-DLED_BUILTIN=6
410410
esp8285.menu.led.7=7
411-
esp8285.menu.led.7.build.led=-DUSERLED=7
411+
esp8285.menu.led.7.build.led=-DLED_BUILTIN=7
412412
esp8285.menu.led.8=8
413-
esp8285.menu.led.8.build.led=-DUSERLED=8
413+
esp8285.menu.led.8.build.led=-DLED_BUILTIN=8
414414
esp8285.menu.led.9=9
415-
esp8285.menu.led.9.build.led=-DUSERLED=9
415+
esp8285.menu.led.9.build.led=-DLED_BUILTIN=9
416416
esp8285.menu.led.10=10
417-
esp8285.menu.led.10.build.led=-DUSERLED=10
417+
esp8285.menu.led.10.build.led=-DLED_BUILTIN=10
418418
esp8285.menu.led.11=11
419-
esp8285.menu.led.11.build.led=-DUSERLED=11
419+
esp8285.menu.led.11.build.led=-DLED_BUILTIN=11
420420
esp8285.menu.led.12=12
421-
esp8285.menu.led.12.build.led=-DUSERLED=12
421+
esp8285.menu.led.12.build.led=-DLED_BUILTIN=12
422422
esp8285.menu.led.13=13
423-
esp8285.menu.led.13.build.led=-DUSERLED=13
423+
esp8285.menu.led.13.build.led=-DLED_BUILTIN=13
424424
esp8285.menu.led.14=14
425-
esp8285.menu.led.14.build.led=-DUSERLED=14
425+
esp8285.menu.led.14.build.led=-DLED_BUILTIN=14
426426
esp8285.menu.led.15=15
427-
esp8285.menu.led.15.build.led=-DUSERLED=15
427+
esp8285.menu.led.15.build.led=-DLED_BUILTIN=15
428428
esp8285.menu.LwIPVariant.v2mss536=v2 Lower Memory
429429
esp8285.menu.LwIPVariant.v2mss536.build.lwip_include=lwip2/include
430430
esp8285.menu.LwIPVariant.v2mss536.build.lwip_lib=-llwip2
@@ -2481,7 +2481,7 @@ d1_mini_lite.menu.UploadSpeed.512000.upload.speed=512000
24812481

24822482
##############################################################
24832483
d1.name=WeMos D1 R1
2484-
d1.build.board=ESP8266_WEMOS_D1MINI
2484+
d1.build.board=ESP8266_WEMOS_D1R1
24852485
d1.build.variant=d1
24862486
d1.upload.tool=esptool
24872487
d1.upload.maximum_data_size=81920

cores/esp8266/Arduino.h

+17-3
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@ extern "C" {
8585
#define EXTERNAL 0
8686

8787
//timer dividers
88-
#define TIM_DIV1 0 //80MHz (80 ticks/us - 104857.588 us max)
89-
#define TIM_DIV16 1 //5MHz (5 ticks/us - 1677721.4 us max)
90-
#define TIM_DIV265 3 //312.5Khz (1 tick = 3.2us - 26843542.4 us max)
88+
enum TIM_DIV_ENUM {
89+
TIM_DIV1 = 0, //80MHz (80 ticks/us - 104857.588 us max)
90+
TIM_DIV16 = 1, //5MHz (5 ticks/us - 1677721.4 us max)
91+
TIM_DIV256 = 3 //312.5Khz (1 tick = 3.2us - 26843542.4 us max)
92+
};
93+
94+
9195
//timer int_types
9296
#define TIM_EDGE 0
9397
#define TIM_LEVEL 1
@@ -236,7 +240,17 @@ void optimistic_yield(uint32_t interval_us);
236240
} // extern "C"
237241
#endif
238242

243+
244+
//for compatibility, below 4 lines to be removed in release 3.0.0
239245
#ifdef __cplusplus
246+
extern "C"
247+
#endif
248+
const int TIM_DIV265 __attribute__((deprecated, weak)) = TIM_DIV256;
249+
250+
251+
252+
#ifdef __cplusplus
253+
240254
#include <algorithm>
241255
#include "pgmspace.h"
242256

doc/esp8266wifi/readme.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ The same sketch without ``Serial.setDebugOutput(true)`` will print out only the
302302
Enable Debugging in IDE
303303
~~~~~~~~~~~~~~~~~~~~~~~
304304

305-
Arduino IDE provides convenient method to `enable debugging <https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst>`__ for specific libraries.
305+
Arduino IDE provides convenient method to `enable debugging <../Troubleshooting/debugging.rst>`__ for specific libraries.
306306

307307
What's Inside?
308308
--------------

doc/faq/a02-my-esp-crashes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ is wrong, it restarts itself to tell you about it.
8383
There are two typical scenarios that trigger ESP restarts:
8484

8585
- **Exception** - when code is performing `illegal
86-
operation <https://github.com/esp8266/Arduino/blob/master/doc/exception_causes.rst>`__,
86+
operation <../exception_causes.rst>`__,
8787
like trying to write to non-existent memory location.
8888
- **Watchdog** - if code is `locked
8989
up <https://en.wikipedia.org/wiki/Watchdog_timer>`__ staying too long
@@ -104,7 +104,7 @@ Typical restart because of exception looks like follows:
104104
Exception cause decoding
105105

106106
Start with looking up exception code in the `Exception Causes
107-
(EXCCAUSE) <https://github.com/esp8266/Arduino/blob/master/doc/exception_causes.rst>`__
107+
(EXCCAUSE) <../exception_causes.rst>`__
108108
table to understand what kind of issue it is. If you have no clues what
109109
it's about and where it happens, then use `Arduino ESP8266/ESP32
110110
Exception Stack Trace

doc/faq/a04-board-generic-is-unknown.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ follows:
5454
Error compiling for board Generic ESP8266 Module.
5555

5656
Below is an example messages for
57-
`WeMos <https://github.com/esp8266/Arduino/blob/master/doc/boards.rst#wemos-d1>`__:
57+
`WeMos <../boards.rst#wemos-d1-r2-mini>`__:
5858

5959
::
6060

6161
Board d1_mini (platform esp8266, package esp8266) is unknown
6262
Error compiling for board WeMos D1 R2 & mini.
6363

64-
... and another one for `Adafruit
65-
HUZZAH <https://github.com/esp8266/Arduino/blob/master/doc/boards.rst#adafruit-huzzah-esp8266-esp-12>`__:
64+
... and another one for `Adafruit Feather
65+
HUZZAH <../boards.rst#adafruit-feather-huzzah-esp8266>`__:
6666

6767
::
6868

doc/faq/readme.rst

+28
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,31 @@ This error may pop up after switching between
8888
`stable <https://github.com/esp8266/Arduino#stable-version->`__ esp8266
8989
/ Arduino package installations, or after upgrading the package version
9090
:doc:`Read more <a04-board-generic-is-unknown>`.
91+
92+
93+
How to clear TCP PCBs in time-wait state ?
94+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95+
96+
This is needed with lwIP-v1.4, less needed with lwIP-v2 but timeout is still
97+
too high.
98+
99+
Time-wait PCB state helps TCP not confusing two consecutive connections with the
100+
same (s-ip,s-port,d-ip,d-port) when the first is already closed but still
101+
having duplicate packets lost in internet arriving later during the second.
102+
Artificially clearing them is a workaround to help saving precious heap.
103+
104+
The following lines are compatible with both lwIP versions:
105+
106+
.. code:: cpp
107+
108+
// no need for #include
109+
struct tcp_pcb;
110+
extern struct tcp_pcb* tcp_tw_pcbs;
111+
extern "C" void tcp_abort (struct tcp_pcb* pcb);
112+
113+
void tcpCleanup (void) {
114+
while (tcp_tw_pcbs)
115+
tcp_abort(tcp_tw_pcbs);
116+
}
117+
118+
Ref. `#1923 <https://github.com/esp8266/Arduino/issues/1923>`__

doc/reference.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ current speed. For example
149149
| ``Serial`` and ``Serial1`` objects are both instances of the
150150
``HardwareSerial`` class.
151151
| I've done this also for official ESP8266 `Software
152-
Serial <https://github.com/esp8266/Arduino/blob/master/doc/libraries.rst#softwareserial>`__
152+
Serial <libraries.rst#softwareserial>`__
153153
library, see this `pull
154154
request <https://github.com/plerup/espsoftwareserial/pull/22>`__.
155155
| Note that this implementation is **only for ESP8266 based boards**,

0 commit comments

Comments
 (0)