1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

3259 Commits

Author SHA1 Message Date
Anders
d20177ae35 - Add new ESP-NOW mesh backend.
- Add HelloEspnow.ino example to demonstrate the ESP-NOW mesh backend features.

- Deprecate the ESP8266WiFiMesh class in favour of the new ESP-NOW and TCP/IP backends.

- Update the TCP/IP mesh backend to use the new lwIP version preprocessor flag and remove obsolete preprocessor flags.
2019-07-10 02:29:01 +02: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
Earle F. Philhower, III
828857d0e0 Make SPIFFS be an integer number of blocks (#5989)
* Make SPIFFS be an integer number of blocks

boards.txt.py simply calculated the end and start using flash sizes, but
in cases where an 8K page was used (>512KB SPIFFS), this could leave a
4K half-block left at the end of SPIFFS.

mkspiffs and the SPIFFS code uses integer division to calculate the
maximum block number, so it worked fine in practice and the code simply
ignored the extra, fractional block.

Now actually take block size into account when calculating the end of
SPIFFS, ensuring no fractional blocks are passed in.  Does not result in
data loss on pre-existing SPIFFS filesystems.

* Fix the 1m512 case and clean up code

Ensure that no SPIFFS_block in the LD files is modified from the
original to endure correct backwards compatibility

* Factor out common if, clean code

* Make boards.py vars "fs_xx" instead of "spiffs_xx"
2019-07-09 10:24:25 +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
Earle F. Philhower, III
76cda9bdbc
Update axtls libs with fix for #6260 (#6262)
Fixes #6260.  AXTLS' x509 decode had a uncaught byte access to PROGMEM.
2019-07-06 07:59:25 -07:00
david gauchard
3f0f2143f8
fix bug in storing UDP remote address (#6263) 2019-07-06 12:30:40 +02:00
Earle F. Philhower, III
6bd4b1c4f7
Clean up trivial gcc -wextra warnings (#6254)
After verifying that they really were spurious, clean up the warnings
that gcc -wextra reports, except for LeaMDNS.

Upgrade GCC to gcc-7 for host builds
2019-07-05 22:31:50 -07:00
mayankgour13
8b1af68e3f Infinite loop while passing File(FS.h) resolved (#5038)
Stream.available() never reaches to -1 which makes it an infinite loop. When File (FS.h) goes empty it reaches to 0 not -1.
2019-07-05 09:02:01 -04:00
M Hightower
ad2b51e36f Do not call yield() from timedRead() or timedPeek() when _timeout is set to 0. (#6242) 2019-07-05 13:36:46 +02:00
Alexander Emelianov
4bfa2ae889 TCP connect and send delay fix (#6213)
* TCP connect and send delay fix
Implement early exit as connection established or data already sent.
(Previous implementation was exiting only on timeout expired)
2019-07-05 12:11:40 +02:00
david gauchard
403001e37c nonos-sdk: update to latest version 2.2.x branch, commitlog added in tree (#6257) 2019-07-04 22:06:14 -04:00
Earle F. Philhower, III
a0634a71a9
Fix mixup with boolean/bitwise or for BSSL probing (#6252)
Fix an error identified by -wextra where the size of the SSL extension
section in the probeMFLN call only.
2019-07-04 09:14:50 -07:00
dav1901
16312949c9 Add timeout to STA::waitForConnectResult (#5371) 2019-07-04 14:08:02 +02:00
aesapronov
e81bb6f57c HTTPClient: Added possibility of sending POST with empty payload (#4275)
* Added possibility of sending POST with empty payload
Specification does not prohibit the sending of an empty POST requests. In this case "Content-Length: 0" should be set. See thread here: http://lists.w3.org/Archives/Public/ietf-http-wg/2010JulSep/0276.html
2019-07-04 13:00:54 +02:00
Chris van Marle
6272b49406 Updater signature validation - format incompatible w/RFC8017 (#6250)
* Add hash OID to signature verification (#6201)

* Add legacy signing option

* Describe and use the legacy option of signing.py
2019-07-04 12:17:30 +02:00
Earle F. Philhower, III
7036297920 Convert ESP8266WebServer* into templatized model (#5982)
* Convert ESP8266WebServer* into templatized model

Supercedes #4912

Refactor the three versions of ESP8266WebServer and *WebServerSecure to a
single templated class. Use "using" to enable old, non-templated names to b
used (so no user changes required to compile or run).

Fixes #4908 and clean up the code base a lot.

Basic tests run (the ones in the example code).

No code changes are required in userland except for setting the SSL
certificates which now use a cleaner "getServer()" accessor and lets the
app use the native BearSSL calls on the WiFiClientSecure object.

@devyte should be proud, it removes virtuals and even has template specialization...

* Fix HTTPUpdate templates and examples

* Fix HTTPUpdateServer library build

Need to remove dot-a linkage since there are no .cpp files in the
directory anymore due to templates.

* Provide backward-compat names for updt template

Allow existing code to use the same well known names for
HTTPUpdateSecure.

* Remove ClientType from all templates, auto-infer

Remove the ClientType template parameter from all objects.  Simplifies
the code and makes it more foolproof.

Add a "using" in each server to define the type of connection returned
by all servers, which is then used in the above templates automatically.

* Can safely include FS.h now that SD/SPIFFS unified

* Move the templates/objects to their own namespaces

* Fix merge issues with untemplated methods

* Address review comments

* Fix mock test, remove warnings inside test dir

Make the simple mock test CI job pass and clean up
any spurious warnings in the test directory.

There still are warnings in the libraries and core, but they
should be addressed in a separate PR.
2019-07-04 10:58:22 +02:00
Dirk O. Kaar
93a52f923b Bugfix: attach interrupt (#6049) (#6048)
* Properly check for "functional" ISRs and expose C-style attachInterruptArg

* Use RAII idiom

(cherry picked from commit 15c0b5b356aad0c3032b96ed6db0ec70cbf719d3)

# Conflicts:
#	cores/esp8266/core_esp8266_wiring_digital.cpp

* Indentation

* Easier reviewability

* Refactored after review input.

* Finish up insights from review comments.
2019-07-03 23:13:48 -04:00
david gauchard
3f35506684 using std::nothrow instead of malloc (#6251) 2019-07-03 21:59:54 -04:00
david gauchard
6272e897ca
mock: addrList fix (#6248)
* improve mock tcp write
* mock addrlist
* add a single mock build in travis
2019-07-03 09:49:03 +02:00
david gauchard
5a47cab77d
add documentation to scheduled functions (#6234)
* add documentation to scheduled functions
2019-06-27 12:09:27 +02:00
david gauchard
f9009b8a5e
mDNS: restriction to a single interface (#6224)
Default interface is STA (or AP if available and STA is unavailable).
An interface can also be specified in ::begin() by its IP address.
MDNS will not cross interfaces (there is currently no notion of "bridged interfaces")

Multiple instances should be working, this is not tested in this commit.
2019-06-27 09:30:12 +02:00
david gauchard
5306976db1
udp remote pbuf helper: honor fragmented packets (#6222)
fix for #5960 didn't take fragmented packets into account
fixes #6218
2019-06-26 21:35:43 +02:00
Earle F. Philhower, III
961b558a91 Fix device test environment variables (#6229)
* Fix device test environment variables

Device tests were not connecting properly to WiFi because the
environment variables were not set when WiFi.connect was called.
This would result in tests sometimes working *if* the prior sketch run
on the ESP saved WiFi connection information and auto-connect was
enabled.  But, in most cases, the tests would simply never connect to
any WiFi and fail.

getenv() works only after BS_RUN is called (because BS_RUN handles the
actual parsing of environment variables sent from the host).

Add a "pretest" function to all tests which is called by the host test
controller only after all environment variables are set.  Move all
WiFi/etc. operations that were in each separate test's setup() into it.

So the order of operations for tests now is:
ESP:  setup()
      -> Set serial baud
      -> Call BS_RUN()
HOST: Send environment
      Send "do pretest"
ESP:  pretest()
      -> Set Wifi using env. ariables, etc. return "true" on success
HOST: Send "run test 1"
ESP:  Run 1st test, return result
HOST: Send "run test 2"
ESP:  Run 2nd test, return result
<and so forth>

If nothing is needed to be set up, just return true from the pretest
function.

All tests now run and at least connect to WiFi.  There still seem to be
some actual test errors, but not because of the WiFi/environment
variables anymore.

* Remove unneeded debug prints

* Silence esptool.py output when not in V=1 mode

Esptool-ck.exe had an option to be silent, but esptool.py doesn't so the
output is very chatty and makes looking a the run logs hard (60 lines
of esptool.py output, 3 lines of actual test reports).

Redirect esptool.py STDOUT to /dev/null unless V=1 to clear this up.

* Speed up builds massively by removing old JSON

arduino-builder checks the build.options.json file and then goes off and
pegs my CPU at 100% for over a minute on each test compile checking if
files have been modified.

Simply deleting any pre-existing options.json file causes this step to
be skipped and a quick, clean recompile is done in siginificantly less
time.

* Enable compile warnings, fix any that show up

Enable all GCC warnings when building the tests and fix any that came up
(mostly signed/unsigned, unused, and deprecated ones).

* Fix UMM_MALLOC printf crash, umm_test

Printf can now handle PROGMEM addresses, so simplify and correct the
debug printouts in umm_info and elsewhere.
2019-06-26 17:54:36 +02:00
Dirk O. Kaar
7d8782acfc EspSoftwareSerial public release 5.2.2 (source code collision with DHT lib resolved) (#6227) 2019-06-26 07:44:35 -07:00
david gauchard
b94ea923b0
scheduled function: replacing new by malloc needs to initialize complex members (#6233)
* scheduled function: replacing new by malloc needs to initialize complex members

Functional was not initialized because of malloc() instead of new.
First assignment calls destructor on initial value which was not constructed (->frozen,wdt).
2019-06-26 15:18:07 +02:00
Dirk O. Kaar
909a9c4f4c Expand gitignore to cover files created by Visual Micro (#6231)
* Expand gitignore to cover files created by Visual Micro's Arduino IDE for Visual Studio

* Also ignore VS project files
2019-06-26 13:57:26 +02:00
Earle F. Philhower, III
793f92e3e7
Update mklittlefs to match library (#6230)
Fixes #6220

MklittleFS had different configuration options which affected small
files and could result in crashes or corruption on upload.

Update mklittlefs tool to one that matches the config of the current
library.

You will need to re-run tools/get.py to get the new tool version if you
are running from Git.
2019-06-25 15:13:16 -07:00
david gauchard
7c184f4268 filter weird characters from esp output to python (#6226)
(this is an issue probably since we switched from esptool.exe to esptool.py)
2019-06-25 12:45:33 -07:00
david gauchard
80e976d1f0 recurrent scheduled functions: fix comment (#6228)
per https://github.com/esp8266/Arduino/pull/6182#issuecomment-505413580
2019-06-25 11:18:19 -07:00
david gauchard
05be1a09e6
remove scheduled functions complexity overhead, change recurrent api (#6214)
* remove scheduled functions complexity overhead, change recurrent functions api
2019-06-25 12:53:47 +02:00
Dirk O. Kaar
f5a882d03d Put InterruptLock (from interrupts.h) into namespace esp8266 to fix now and future (#6225)
collisions with 3rd party Arduino libraries (currently Adafruit DHT has this issue)
2019-06-25 11:14:45 +02:00
Dirk O. Kaar
2e3e1d5e98 EspSoftwareSerial release 5.2.1 (#6219)
* Track breaking API chance in EspSoftwareSerial.

* Revert "Track breaking API chance in EspSoftwareSerial."

This reverts commit 78aa3e84321935dcc3cfb7ebe8c293ccb0c06a79.

* Track breaking API chance in EspSoftwareSerial.

* Bug fix in EspSoftwareSerial

* EspSoftwareSerial: improved memory fences

* Refactoring upstream

* EspSoftwareSerial fixed a high-bitrate error source, probably caused by end-bit detection

without checking for same-level timestamps from the IRQ

* EspSoftwareSerial examples updates

* Fix to stop bit detection in EspSoftwareSerial

* Latest bit timings fix in EspSoftwareSerial.

* EspSoftwareSerial examples

* EspSoftwareSerial latest throughput results in comments of loopback.ino

* Lastest EspSoftwareSerial, dependent on a few as yet unmerged PRs, tho

* Submodule EspSoftwareSerial release 5.2.0 with workaround for as yet missing attachInterruptArg in Arduino.h

* EspSoftwareSerial release 5.2.0, includes workaround for missing attachInterruptArg in ESP8266 Arduino

* EspSoftwareSerial: CI failed on examples - defines for Wemos board GPIOs.
2019-06-24 14:32:59 +02:00
Dirk O. Kaar
653f58e209 interrupts.h in tests/host/common is empty (#6217)
* Per suggestion in https://github.com/esp8266/Arduino/pull/6217#issuecomment-504421729
2019-06-22 16:43:19 +02:00
Dirk O. Kaar
d93c7e06d7 Unrelated includes, but necessary Arduino.h missing (#6215) 2019-06-21 11:15:53 +02:00
david gauchard
fc77f2e89c
littlefs: fixes for mock/emulation, use in FSBrowser example (#6211)
* littlefs: fixes for mock/emulation, use in FSBrowser example
* emulation: makefile: integrate arch size into object file names
2019-06-20 23:34:27 +02:00
Ruandv
a78fb72302 Updated Example to use ArduinoJson6 (#6203)
* Updated Example to use ArduinoJson6

* Updated save method to Serialize and not Deserialize

* Updated References to ArduinoJson 6.11.0

* Style Fix

* another line missed

* Added the file extension to the new version
2019-06-20 15:24:33 -04:00
david gauchard
621a341234
emulation: add fake cont_yield (#6210)
* emulation: add fake cont_yield
(temporarily disable littleFS mock due to missing file)

* fix makefile
2019-06-19 19:01:20 +02:00
Kyle Lobo
ec7bdfa284 Fix editing, typos and grammatical errors (#6207)
1. The current version is ~at~ on the Arduino website
2. Start Arduino and open _the_ Preferences window
3. Enter ```https://arduino.esp8266.com/stable/package_esp8266com_index.json``` into _the_ *Additional Board Manager URLs* field
4. The current version is ~at~ on the Arduino website
5. [PlatformIO](https://platformio.org?utm_source=github&utm_medium=arduino-esp8266) is an open source ecosystem for IoT
development with _a_ ~cross platform~ cross-platform build system, library manager and full support
6. [ESP8266 Community Forum](https://www.esp8266.com/u/arduinoanswers) is a ~well established~ well-established community
7. or just want to discuss how to approach a problem, (removed extra space after 'problem')
8. when encountering an issue ~which~ that happens at run time
9. attach _the_ serial output
10. Check out the list of issues ~which~ that are easy to fix
11. It is distributed under _the_ MIT license.
12. It is distributed under _the_ MIT license.
2019-06-17 16:40:46 -07:00
david gauchard
59db907647
lwip2: (re)fix setting static ip address (#6194) 2019-06-17 23:57:31 +02:00
Earle F. Philhower, III
9f03bbb8c3
Add an EC keyed certificat to BearSSL Server example (#6202)
Needed for future automated performance test suite use, to allow
selecting between EC and RSA signed keys for the server's cert.
2019-06-14 14:58:29 -07:00
Earle F. Philhower, III
0920daf251
Add some more CI tests for String::replace (#6193) 2019-06-10 12:51:43 -07:00
Earle F. Philhower, III
fe01433f78
Obey the BASIC_SSL request for TLS servers (#6187)
When in basic SSL mode, don't include ciphers for EC for the server by
replacinf the BearSSL "support everything" init call with our own
version which obeys the requested BASIC_SSL.

Saves ~46KB on TLS servers, about the same as basic SSL saves for
clients.
2019-06-07 19:40:33 -07:00
Earle F. Philhower, III
777986c9ae
Undo #6162 because of bad performance in some EC situations (#6188)
Undo the BearSSL RODATA->PROGMEM changes because there are some bad
performance regressions in EC server operations which can result in
timeouts and WDTs.

Keep the shrunked bearssl.a library as that is orthogonal to the PROGMEM
changes.
2019-06-07 16:05:59 -07:00
Earle F. Philhower, III
6bfb1bae40
Move all SSL constants into PROGMEM, free 1.2KB (#6162)
Rewrite all the integer math operations with const input parameters to
use PROGMEM properly (pgm_read_xx or memcpy_P), and move all the EC
order and generators and SHA OIDs to PROGMEM.

This frees around 1.2KB of heap for any SSL applications.

Also delete unneeded objects from the bearssl.a library to shrink the
GIT repo size.
2019-06-06 13:05:22 -07:00
Earle F. Philhower, III
6722d1d44b
Add mklittlefs tool to gitignore (#6186) 2019-06-06 09:29:32 -07:00
Earle F. Philhower, III
78a1a66e6d
Make SSO support \0s, use memmove, add test (#6155)
Supercedes #6027

Make SSO more generic by keeping track of its length explicitly,
allowing for embedded \0s to exist in the String (just like the non-SSO
ones).

Use memmove/memcpy_P when we know the length of a string to save CPU
time.

Add tests to inject \0s in a String to ensure it is still working as
designed.
2019-06-05 08:11:53 -07:00
Dirk O. Kaar
79101213a5 Use placement new for ETSTimer - no heap fragmentation (#6164)
* Use placement new for ETSTimer - no heap fragmentation, new/delete semantics unchanged.

* Make change completely invisible to derived classes at compile-time.

* Fix "sizeof() incomplete type ETSTimer" error.

* C++ reinterpret_cast<> instead of C-style cast.

void* instead of uint32_t - fixes x86_64 server compiles.

* Simplify casts.

* Revert to complete placement new treatment of ETSTimer member.

* Cleanup includes

* Fix omitted casts

* Change per review https://github.com/esp8266/Arduino/pull/6164#pullrequestreview-243583458

* wtf - local compile didn't catch this sloppy mistake

* Resolves review https://github.com/esp8266/Arduino/pull/6164#discussion_r290388119

* Reviewer stated that floating point operations are inlined, software operations -

reduce number of code spots to one.
2019-06-05 00:14:14 -04:00
Earle F. Philhower, III
8859b818d8
Make CertStore natively use File interface (#6131)
__This is a breaking change, but the header and example did warn
everyone that this API was in flux due to the incompatible SD and SPIFFS
File implementations.__

BearSSL CertStores now simply need a filesystem and the names of the
data (generated on-chip) and archive (uploaded by user) files on it.
No more need to roll your own virtual CertStoreFile class.

Update the library, examples, and device test.
2019-05-30 12:53:03 -07:00
Earle F. Philhower, III
44bda41cf6
Add FS::info64 call for filesystems > 4GB (#6154)
Fixes #6082

Add an info64() call which returns used and total sizes as 64 bit
quantities.  A default wrapper that just copies the 32-bit values is
included for LittleFS/SPIFFS which can't hit those capacities.
2019-05-30 10:51:55 -07:00