1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

1278 Commits

Author SHA1 Message Date
Max Prokhorov
d62fb9ffeb MDNS: fix legacy unicast responses (#6613)
* mdns: use ID from parameter struct when constructing response message

* print id for legacy requests
2019-10-07 14:25:51 +02:00
David J. Fiddes
d7abafea2f Remove duplication and incompatible declarations in sntp.h (#6610)
This removes definitions relating to the built-in SNTP client that
are LwIP v1 specific. Instead of duplicating these pull in the
LwIP header that correspond to the required functions depending on
the version of the stack being used.

Without this fix calls to sntp_getserver() work but return invalid
data and can lead to stack exhaustion.

Update the NTP-TZ-DST example to use the Arduino sntp.h header
rather than duplicate the conditional checks to use the LwIP header.

Tests:
 - Build against a simple SNTP API demonstratin app and all
   LwIP configurations. Verify that the app runs for an extended
   period and that the expected results are obtained.
2019-10-06 15:25:34 -07:00
david gauchard
c55f49bd61
use a scheduled function for settimeofday_cb (#6600)
* use a scheduled function for settimeofday_cb

* per review

* use a generic and clear name for trivial functional variable type name used for callbacks
2019-10-06 22:50:57 +02:00
Develo
a00a4744d0
Update EEPROM.cpp (#6599)
use InterruptLock class for scoped interrupts instead of blindly disabling/enabling interrupts, which doesn't support nesting nor restore previous state.

Add forgotten include

Remove locks, simplify code

Fix typo

Drop needless include
2019-10-05 22:21:41 -03:00
c0degeek
d4897cd216 Added Chip ID into HTTP header (#3877) 2019-10-05 11:28:33 -07:00
Kristian Sloth Lauszus
5d20137339 Set SPI_HAS_TRANSACTION to 1 (#6591)
See #2639
2019-10-04 17:25:54 -07:00
Dirk Mueller
3890e1af1e Put longer string literals into PROGMEM (#6588)
* Put longer string literals into PROGMEM

* Use Flash Strings for Debug output

This is hopefully very infrequently used, so it shouldn't
be in main memory.
2019-10-03 23:17:36 -03:00
Dirk O. Kaar
899893294c Align to latest EspSoftwareSerial release (#6584)
* Align to latest EspSoftwareSerial release - nothing ESP8266 specific, but drifting versions otherwise makes life hard for users.

* ghostl array compatibility: aggregate initialization, no implicit cast to T*.
2019-10-02 10:26:47 -07:00
Dirk Mueller
1d26b28225 Remove duplicated sha1 implementation (Fixes #6568) (#6569)
* Remove duplicated sha1 implementation (Fixes #6568)

The Hash library had its own copy of a loop-unrolled sha1 implementation
adding a large code footprint for no good reason, as there are several
sha1 implementations already in tree (one in NONOS-SDK as well as one
in bearssl). Switching to the bearssl one is straightforward and removes
about 3kb of code size overhead.

Also cleanup some obvious inefficiencies (copy by value, string
summing, no reservation causing repeated reallocations) in the
implementation.

* Remove overload variants for sha1(...) that accept nonconst data

The data is always remaining unmodified, so non-const overloads
are confusing and redundant. Also optimize the hexify variant
a bit more.
2019-09-30 20:58:09 -07:00
Dirk Mueller
2a83adb0fd Fix setURL() handling of path-only parameters (#6570)
The function accidentally compared the current location instead
of the passed in (new) location, which didn't match intended
logic and the code comment.
2019-09-30 20:23:25 -07:00
david gauchard
ffe5476fc4 time: import IANA timezone definitions, expose SNTP API (#6373)
* time: import IANA timezone definitions
- `configTime("timezone", "ntp servers...")` added
- timezone definitions by country/cities (TZ.h)
- script to update timezone definitions
- updated example

* fix former configTime non-matching signature

* +include

* example: add scheduled function in callback

* crlf fix

* +missing license for napt

* SNTP: expose configuration helpers

* update submodule

* update precompiled libraries

* optional: change SNTP startup delay

* makes SNTP_UPDATE_DELAY a weak function
update example
fix for lwip1.4

* on the proper use of polledTimeout api... thanks @mcspr :]

* improve update script (per review)

* update lwIP submodule

* update submodule

* hide harmless shell message

* update the release process by asking first to update TZ.h
[ci skip]

* minor update in release documentation

* update in release documentation

* update in release documentation

* clarify release documentation

* fix release documentation - sorry for the noise :(

* fixes per review

* example style

* useless variable in example

* update lwip2 submodule reference, to include espressif missing declaration fixes
2019-09-29 00:25:01 -03:00
Dirk O. Kaar
4f2cc1ccfc Latest (5.3.1) EspSoftwareSerial tries to give better guidance about matching working versions. (#6561) 2019-09-27 17:10:44 -07:00
Earle F. Philhower, III
2b9fcdb568 Add EEPROM debug printouts, error check to example (#6556)
* Add EEPROM debug printouts, error check to example

Add debug printouts when EEPROM calls fail, even if the API doesn't
allow returning a success/failure code.

Adds error checking to the example to make it explicit that when you
call EEPROM::commit(), you need to look at the result code in your code.

Fixes #6551 , or would fix it if there was error checking in the MCVE.

* Clarify example error message
2019-09-26 14:48:04 -03:00
Earle F. Philhower, III
69f3e81fb9
Restore EEPROM address to prior released location (#6537)
When the FS_END was adjusted to end on a full block (i.e. rounded down)
to avoid filesystem issues, but _FS_end was changed.  The EEPROM library
used _FS_end to implicitly calculate the start of the EEPROM data, so
this means after the _FS_end fix, EEPROM data written with prior
releases would "disappear."

Avoid the issue by explicitly calculating the EEPROM start location in
the linker, using the same formula as prior release.

Fixes #6531
2019-09-20 08:24:10 -07:00
Carlos Alberto Nunes
3733ece7e8 Allow Filesystem update via ESP8266HTTPUpdateServer (#3732)
* Allow SPIFFS update via ESP8266HTTPUpdateServer

This adds capability to update the SPIFFS image via
the same mechansism as firmware in the 
ESP8266HTTPUpdateServer.

It does not provide any dependency or linkage between
firmware and spiffs image updating; they are each taken
on their own, each followed by a reboot.

(I wrote this before seeing the other PR for similar
functionality; I like this a bit better, becaue it uses
the available SPIFFS size, and does not hide magic numbers
(U_SPIFFS) in the html...)

(It also cleans up a stray \n from commit ace0622)

* A simple filter

* Review https://github.com/esp8266/Arduino/pull/3234#pullrequestreview-37773153

* Including suggestions for mobile first #3961

* SPIFFS rennamed to FS

* including comments from @earlephihower

* button renaming

* missing #include for LittleFS

* generic names as suggested by @d-a-v
2019-09-20 09:44:48 +02:00
johnm545
5d609fd294 Fix WiFiClientSecure::available() blocking on dropped connections (#6449)
* Fix WiFiClientSecure::available blocking

Added a check of WiFiClient::availableForWrite to prevent blocking writes when the _run_until blocking flag is false

* change availForWrite from int to size_t

* add timeout to _run_until loop

fixes #6464

* use polledTimeout with _timeout millis
2019-09-17 01:03:34 -03:00
Dirk O. Kaar
efb8aaa5fb EspSoftwareSerial 5.3.0 version update (#6526) 2019-09-16 15:49:19 +02:00
david gauchard
2d1acfa9a4
add or improve some debug messages (#6508) 2019-09-12 16:08:52 +02:00
david gauchard
5ca0bde200 MDNS: fix random crash on startup (#6261)
* mDNS debug option + AP address is used by default when STA is also present

* mDNS: store network interface, checking it is up

* igmp: force on selected interface (avoid crash *sometimes*)

* fix for all lwip2 ipv4 ipv6 & lwip1

* mdns: IPAddress is not needed to reference associated interface

* mdns: debug: fix print warnings

* emulation: add ets_strncpy

* emulation: truly emulate AddrList (remove fake one)
2019-09-04 20:10:47 -07:00
david gauchard
273f4000f0
Experimental: add new WiFi (pseudo) modes: WIFI_SHUTDOWN & WIFI_RESUME (#6356)
* add new WiFimodes: WIFI_SHUTDOWN & WIFI_RESUME with example
* restore WiFi.onWiFiModeChange()
2019-09-05 03:01:01 +02:00
Dirk O. Kaar
db460388cd SoftwareSerial: Bring submodule in line with upstream release 5.2.9 (#6486) 2019-09-05 01:59:12 +02:00
david gauchard
291b321e62
ClientContext: restore use of two different pending booleans for connect and write #6483 2019-09-04 01:22:56 +02:00
david gauchard
85f1ea7c78
exceptions: optionally enforce c++ standards (#6333)
* exceptions: 3 choices: legacy, std::new never returns 0, or exceptions enabled
* arduino_new (doc, example, array)
2019-08-29 00:21:10 +02:00
Earle F. Philhower, III
0a031ce957
Move all scripts and documentation to Python3 (#6378)
* Move all scripts and documentation to Python3

Python 2 EOL is Jan 1, 2020.  Migrate scripts to run under Python 3.

Under Windows, we're already running Python 3.7, by dumb luck.  The
oddness is that the Windows standalone executable for Python 3 is called
"python" whereas under UNIX-like OSes it's called "python3" with
"python" always referring to the Python 2 executable.  The ZIP needs to
be updated to include a Python3.exe (copy of Python.exe) so that we can
use the same command lines under Linux and Windows, and to preserve my
sanity.

Fixes #6376

* Add new Windows ZIP with python3.exe file

* Sort options in boards.txt generation for repeatability

The order of the board opts dict changes depending on the Python version
and machine, so sort the options before printing them to get a stable
ordering.

* Re-add Python2 compatibility tweaks

Most scripts can run as Python 2 or Python 3 with minimal changes, so
re-add (and fix, as necessary) compatibility tweaks to the scripts.
2019-08-28 12:42:48 -07:00
Iscle
1800bb5abe BasicHttpsClient: Updated demo certificate fingerprint (#6462)
The previous certificate had already expired, I swapped it with the current one.
2019-08-28 11:48:34 -07:00
Dirk O. Kaar
e201f614e8 Fix reverse dependency core Updater -> library ESP8266WiFi (#6398)
* Per @earlephilhower suggestion

* Hints from @earlephilhower

* Namespace BearSSL in core "feels" wrong - using catch-all esp8266 instead.

* After review remarks by @earlephilhower
2019-08-28 11:07:04 -07:00
david gauchard
06f1865628
new network feature: NAPT (widely known as NAT) (#6360)
* lwIP: napt patches (enabled with lwip2 w/o IPv6 w/ features)
2019-08-28 17:51:14 +02:00
david gauchard
45dbc65dba
standardizes processing of _delaying in lwIP callbacks (remove assert) (#6460) 2019-08-28 15:24:57 +02:00
david gauchard
0937b076c8
ClientContext: break timeout delays also on error while writing or connecting (#6454)
This PR stops the 1ms-delay loop also when a tcp error occurs (previously this was done only when tcp had just connected or a write/send had succeeded).
The tcp error can be any, in this case with pubsubclient it is "connection refused" after the mqtt server disappeared and pubsubclient tries to reconnect.
2019-08-27 15:26:27 +02:00
Jeroen88
60d519e235 Bugfix/esp8266 http client (#6176) 2019-08-26 16:12:50 +02:00
thangktran
6dd8474014 libraries: wrong value for setFrequency() (#6409)
Thanks to fix suggestion from @UlliBien.

Fixes: https://github.com/esp8266/Arduino/issues/6380
2019-08-17 12:27:45 -07:00
Zakary Kamal Ismail
0dbb04e881 Add HTTP_HEAD to HTTPMethod and parse it (#6413)
* Add HTTP_HEAD to HTTPMethod

* Parse the HTTP_HEAD variant of HTTPMethod from a method string

* Add HTTP_HEAD to the ESP8266WebServer constants

* Skip sending the content of the response if the HTTP method is HEAD method

* Convert the HTTP status code 418  to string
This status code is an easter egg from the IETF and is described in 
[RFC2324](https://tools.ietf.org/html/rfc2324#section-2.3.2)
2019-08-17 11:58:40 -07:00
Ilya
8f45a0fb91 Set method _connectSSL as protected (#6424) 2019-08-16 13:23:05 +02:00
Earle F. Philhower, III
adfc28d7d8
Fix basic SSL server definitions (#6402)
A typo was present in several ifdefs which would allow a server to negotiate
an EC connection even when in basic SSL mode.  When this happened, a crash
would occur (since there were no EC or advanced AES modes installed).

Fix the typo, fixes #6397
2019-08-08 21:54:59 -07:00
teo1978
a8873c2364 fix documented parameter (#6392) 2019-08-07 14:16:07 +02:00
david gauchard
88f0410c4b
ensure consistency for gdb hooks signatures (#6391) 2019-08-07 11:18:45 +02:00
thangktran
f78ab66f89 libraries: fixed no "OK" ACK for Signed Update (#6351) 2019-08-01 14:00:49 +02:00
Earle F. Philhower, III
d2fde8dee0
Fix trivial extra "\n" on web update success (#6350)
Fixes #3290
2019-07-26 16:34:22 -07:00
Earle F. Philhower, III
824a83347d
Update LittleFS/SdFat to current project head (#6345)
* Update LittleFS to current project head

Several bugfixes noted in the LittleFS added:

https://github.com/ARMmbed/littlefs/commits/master

* Also update SdFat to latest upstream head

Also adds a delay(0) every 5000 fat clusters examined to avoid WDT
errors on highly fragmented FAT filesystems.
2019-07-25 13:50:58 -07:00
Earle F. Philhower, III
aa0bc3372f Add plain char* signatures WebServer::sendContent (#6341)
Fixes #2567

Allow the web server to send plain C strings instead of requring they be
encapsulated inside a String class object.  Saves memory vs. having to
convert C strings to Strings (i.e. duplication of data), overloads on
the efficient sendContent_P(char*) methods.
2019-07-25 13:39:57 +02:00
david gauchard
5cb82c1610
webserver: restore legacy request handler (#6321) 2019-07-20 08:29:02 +02:00
Dirk O. Kaar
d9684351c2 Make delay() as overridable as yield() already is, and add overridable loop_end() (#6306)
* Make delay() overridable "weak"

* Add pluggable loop_end()

* Release tag 5.2.3 for SoftwareSerial
2019-07-18 14:40:58 -07:00
Earle F. Philhower, III
52f8c62b81
Fix GCC 9.1 warnings (except Ticker.h, gdbstub) (#6298)
Cleans up all warnings seen w/GCC 9.1 to allow it to track the main
branch more easily until 3.x.

Does not include Ticker.h "fix" of pragmas around a function cast we're
doing that GCC9 doesn't like, that will be addressed separately and
maybe only in the 3.0 branch.

Does not include GDB hook fix, either, because the pragmas required
to disable the GCC9.1 warnings don't exist in 4.8 at all.
2019-07-14 21:22:49 -07:00
Earle F. Philhower, III
c18b402c31
Add a dump of received FP and CERT when in debug mode (#6300)
* Add a dump of received FP and CERT when in debug mode

To simplify BearSSL debugging, print the received FP (when it doesn't
match the expected) and the binary certificate (always), when in debug
mode.

* Add documentation section on FP mismatch in rare instances.
2019-07-14 14:09:44 -07:00
Earle F. Philhower, III
8c37601614 Fix Ticker callback casting. (#6282)
Fixes errors seen in #6281 and adds a slight test case to the examples
to ensure no compiler errors.
2019-07-10 23:15:10 -04:00
Earle F. Philhower, III
7c6701512f
Clean up remaining non-LeaMDNS diffs from gcc4.8 to gcc7.2 (#6279)
With this change plus the leamdns change, the core will compile
unmodified on GCC 4.8 and GCC 7.2, making keeping the two in sync for
3.0 much easier.
2019-07-10 13:52:38 -07:00
Dirk O. Kaar
48ace77b48 Refactored to avoid compiler warning (#6278)
Fixes commit 2d9253e46c41ef6949759ec028a356917d289831.
2019-07-10 10:47:01 -07:00
david gauchard
1b3ac4f5e9
Switch default FW to "2.2.2-dev(38a443e)" (menu:2.2.1+100) (#6272)
* enable by default latest 2.2.x firmware, including fixed espnow
* LittleFS: avoid crash when FS size is 0
* flash size defaults: 1M for generic board, not empty FS for all
2019-07-09 20:18:55 +02:00
nouser2013
adf2b14a6a Add support for newer mobile OS changes. (#5529)
* Add support for newer mobile OS changes.

Took me quite a while to figure this out, but according to this issue (https://github.com/espressif/arduino-esp32/issues/1037), in order to get a captive notification to show or the popup to open, the DNS server must resolve to a public IP. It will not work with a pivate one (e.g. 192.168.4.1).

On Android, a notification ("Register with Network") is displayed in top left notification bar.
On IOS, the login popup is displayed.

* Add support for newer mobile OS changes.

Took me quite a while to figure this out, but according to this issue (espressif/arduino-esp32#1037), in order to get a captive notification to show or the popup to open, the DNS server must resolve to a public IP. It will not work with a pivate one (e.g. 192.168.4.1).

On Android, a notification ("Register with Network") is displayed in top left notification bar.
On IOS, the login popup is displayed.
2019-07-08 16:12:28 +02:00
Earle F. Philhower, III
d2a487dfd9 Clean up code to build under GCC7, fix pgm_read_unaligned (#6270)
Apply most compatible changes needed to get the core compiling under GCC
7.2 to the main gcc 4.8 tree to ease porting for 3.0.0.

Update pgmspace.h with corrected and optimized unaligned pgm_read
macros.  Now pgm_read_dword in the unaligned case gives proper results
even if optimization is enabled and is also written in assembly and only
1 instruction longer than the pgm_read_byte macro (which also has been
optimized to reduce 1 instruction).  These changes should marginally
shrink code and speed up flash reads accordingly.

The toolchain should/will be rebuilt at a later time with this
optimization to ensure it's used in the libc.a/etc. files.
2019-07-08 10:17:48 +02:00