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

1210 Commits

Author SHA1 Message Date
aerlon
24a1d22730 Make softAP documentation state the correct min value (0) for the max_connection argument. (#5165) 2018-10-01 14:27:16 -03:00
daud
678c7beab5 fix typo (#5189) 2018-09-30 14:28:13 -03:00
Earle F. Philhower, III
270788bedb
Really free stack after last BearSSL obj destroyed (#5185)
The BearSSL second stack, once allocated, was never deallocated.  The
reference count of the stack pointer never hit 0 due to the initial
creation counting as one.  Now, check to see if there is only one use_count
and if so then delete the stack.
2018-09-29 18:12:03 -07:00
per1234
4e3af9795b Add missing keywords.txt files to bundled libraries (#5183) 2018-09-29 10:48:23 -07:00
Earle F. Philhower, III
6314093fe5
Add SSL Session capability to speed reconnections (#5160)
SSL Sessions enable most of the SSL handshake to be skipped when both
client and server agree to use them.  Add a BearSSLSession class and
an optional setting to the SSL client to enable this.

Note that SSL sessions are unrelated to HTTP sessions.  They are
ephemeral and only relate to the SSL parameters, not anything at
the HTTP protocol level.
2018-09-28 12:03:20 -07:00
Earle F. Philhower, III
8e11836378
Move BearSSL _cipher* init to _clear() for consistency (#5178)
The cipher list count/pointer was cleared separately in the three
constructors available.  Move this reset to _clear() to reduce code
duplication and keep the semantics.
2018-09-28 09:18:07 -07:00
Earle F. Philhower, III
5137d4da11
Update to BearSSL 0.6+ release, add AES_CCM modes (#5164)
Pull in latest BearSSL head (0.6 + minor additions) release and add AES_CCM
modes to the encryption options. Enable the aes_ccm initialization in client/server

The EC mul20 and square20 code was identical in two different files,
but because these copies were static, we ended up with an extra 6k of
duplicated code. Updated BearSSL to make them shared, saving 6KB.
2018-09-27 20:30:19 -07:00
david gauchard
5a5af55d3a
ClientContext: restore TCP PuSH flasg when needed (#5176)
fix #5173
2018-09-27 17:22:21 +02:00
david gauchard
775eb9b343
fix: tcp_output() should always be called after tcp_write(), does not break nagle (+ doc) (#5172) 2018-09-26 23:56:01 +02:00
Earle F. Philhower, III
7c91eee26d
Clear cipher list on server creation, fix crash (#5171)
The cipher list values were not initialized to NULL appropriately for the
BearSSL::WiFiClientSecure() constructor called by the Server object.
This caused a crash as a random value was free'd when conecting to the
SSL server object.
2018-09-26 11:13:57 -07:00
Earle F. Philhower, III
d0171574d8
Fix TCP race condition, remove fixed delay in CC (#5167)
ClientContext::_wait_for_sent() could dereference a TCP's _pcb after
the connection was dropped by the OS, resulting in a crash.

Move the connection dropped check to catch this case, and replace
a fixed millisecond delay() with a yield and timeout value to minimize
wasted time when transmission completes.
2018-09-26 08:47:10 -07:00
david gauchard
83a8076db8 ClientContext (tcp) updates (#5089)
* +sync, get/set default nodelay, sync

* default nodelay=1

* update flush()

* fix return value

* ClientContext: put things together

* ClientContext: fix debugging messages

* WiFiClient: move static members out of the class, add comments

* remove circular dependency

* parameter and return value for Client::flush&stop, flush timeout raised to 300ms

* tcp flush: restart timer on ack receive

* OTA protocol needs setNoDelay(true)

* fix Ethernet with Client changes

* 1 line unredable -> 5 lines readable code

* doc

* Update client-class.rst

* Added details for getters
2018-09-25 10:47:27 -03:00
aerlon
88bd26bd74 WiFi Mesh Update 2.1 (#5157)
* - Add assert in HelloMesh.ino for invalid transmission status.
- Make uint64ToString and stringToUint64 methods into stand-alone type conversion functions.
- Add getters and setters for requestHandler and responseHandler.
- Polish HelloMesh.ino code by adding networkIndex as networkFilter loop variable and switching networkFilter definition position.
- Add initial WiFi.disconnect() in HelloMesh.ino setup() function to ensure smooth WiFi operation.
- Add latestTransmissionSuccessful() convenience method.
- Change default WiFi mode to WIFI_STA and improve handling of WiFi mode (fixes issue #5071).
- Add checks to methods that change AP properties to avoid unnecessary AP restarts.
- Add getter for ESP8266WiFiMesh SSID and getters and setters for ESP8266WiFiMesh settings related to hidden SSID usage, max station connections allowed per AP and WiFi timeouts.
- Make waitForClientTransmission method use more accurate timekeeping.
- Improve type usage.
- Improve comments.
- Update README.md, keywords.txt and library.properties.

* Make getter and setter order consistent throughout code.

* - Fix active AP getting turned off when calling begin().
- Fix crash bug due to WiFiServer duplication when using the ESP8266WiFiMesh copy constructor with the AP controller as argument, under certain circumstances.

* - Move non performance-sensitive Strings to flash memory to save RAM.

- Add comments explaining F(), FPSTR() and PROGMEM.

- Fix README.md formatting.

* Remove the uint64ToString and stringToUint64 methods from the ESP8266WiFiMesh class since they are now stand-alone functions in the TypeConversionFunctions files.

* Change the minimum valid argument value of the setMaxAPStations method to 0, since this value is also supported by the ESP8266.

* Fix compiler warning.
2018-09-24 16:11:09 -03:00
david gauchard
d8a7a34caf automatically WiFiClient::flush before ::stop (#5135) 2018-09-22 00:23:36 -03:00
Earle F. Philhower, III
0a04ebf76d Add full debug builds for all tests (#5146)
* Add full debug builds for all tests

In order to ensure the -DEBUG builds don't fail with checked-in code, add
two jobs which build even/odd with full debug flags to Travis.

Fixes #5143

* Add in dump of platform.txt to verify build options

* Fix BASH comparison of strings

* Fix debug-mode compile error in ESP8266AVRISP

* Add -Wextra to CI (matches IDE "All" warnings)
2018-09-21 13:14:13 -03:00
Earle F. Philhower, III
cc284bb533 Allow cipher specification for BearSSL (#5151)
* Allow cipher specification for BearSSL

BearSSL has many more ciphers than axTLS, but they are more compute intensive
and slower.  Add an option to use only the same, limited security, axTLS ciphers
as well as allow users to specify any suite of ciphers they want using standard
BearSSL formats.

Fixes #5110

* Rename methods to avoid axtls references.

* Allow std::vector to set a list of allowed ciphers

For C++ afficionados, allow std::vectors to be passed in to the setCipher()
routine.

The BearSSL object will now keep a copy of any set ciphers and free on object
destruction.  These custom lists should normally only be 1-4 entries long, so it
is not expected to be a memory hog having this extra copy.
2018-09-21 11:47:20 -03:00
Earle F. Philhower, III
1a44f79a9e
Update api.github.com certificate signature (#5145)
Fixes #5144
2018-09-18 08:28:16 -07:00
Earle F. Philhower, III
cd43337f4f Fix connection options and update github pubkey (#5120)
As part of the "clear connection configuration for reused objects"
patch, a ::stop would reset the self-signed, trust anchors, etc.
WiFiClient, unfortunately, calls ::stop as part of the connection
process, so all of these settings were lost.

Now only clear the connection settings on ::stop if we've already
been connected.

Also update the github public key which changed yet again.

Fixes #5086
2018-09-16 23:24:42 -03:00
Earle F. Philhower, III
991d738176 Move SSLContext to its own header (#5121)
Simple refactor to make WiFiClientSecureAxTLS use an external header to
define its SSLContext, just as it does for several other classes.

Fixes #3648
2018-09-16 22:25:39 -03:00
sadykowich
5902103669 Create library.properties (#5129)
This file need to using this library in Eclipes CDT Arduino.
Without this file the library manager doesn't listing this library.
2018-09-13 18:28:54 -03:00
sadykowich
1f25997c16 Create library.properties (#5128)
This file need to using this library in Eclipes CDT Arduino.
Without this file the library manager doesn't listing this library.
2018-09-13 17:44:56 -03:00
sadykowich
bd613beb5c Create library.properties (#5127)
This file need to using this library in Eclipes CDT Arduino.
Without this file the library manager doesn't listing this library.
2018-09-13 16:56:33 -03:00
sadykowich
91519309d0 Add files via upload (#5119)
add missing ESP8266mDNS/library.properties
(needed for eclipse)
2018-09-11 15:36:14 +02:00
david gauchard
ce28a76a24 metric for heap fragmentation (#5090)
* +Esp.getHeapUnfragness()

* only in debug mode

* default value

* always enable, 64->32, light 32 integer square root, comments

* fix when debugging is disabled

* give credits

* cosmetics

* fragmentation metric updates (doc, better api, added getMaxFreeBlockSize())

* api reworked, +example

* fixe types, fix names

* coding style fix

* use astyle for example
2018-09-10 01:50:01 -03:00
yoursunny
bbaea5a358 ESP8266HTTPClient: allow getString() more than once (#5091)
fixes #4951
2018-09-09 00:34:20 -03:00
Develo
4fdff072e8
read all lines from slow servers (#5113)
Replaces #1829
2018-09-07 15:07:59 -03:00
aerlon
1d841953ab Soft-AP documentation update (#5088)
* Add information about the max_connection constructor argument.

* Correct information about max soft-AP connections.

* Add information about what happens when max_connection is reached.

* Correct terminology

* - Correct the valid range of max_connection to 1 - 8.
- Include reference.
2018-08-29 11:17:44 -04:00
yoursunny
0da54d88a9 Hash: make actual SHA1 result and comment consistent (#5057)
fixes #3437
2018-08-25 23:24:23 -04:00
Philip Dorr
18f643c7e2 Fix min and max for Servo library (#5064)
Use the optionally defined min/max values instead of the hard-coded limits
for pulse widths.
2018-08-20 09:01:07 -07:00
david gauchard
85e68093e9
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system (#5018)
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system 

* enable dot_a_linkage on internal libraries
* add device tests
* boards generator: deprecate --noextra4k/--allowWPS and fix documentation
2018-08-20 14:35:52 +02:00
Earle F. Philhower, III
56b98fd4df Move all PROGMEM to their own section (#5048)
According to the GCC man page, __section__ attributes should only be used
for global variables.  However, the PROGMEM and ICACHE_RODATA macros use
this variable decorator even for local variables.  Most of the time it works,
but when a static or inlined function tries to use a PROGMEM/PSTR/etc.
variable the compiler can throw an error like:
  error: XXX causes a section type conflict with YYY

Change the PROGMEM macro to emit a section name that is unique (a combo
of the file, line, and counter variables to ensure uniqueness).  The
standard linker script will place them properly in .IROM without
any changes.

Fixes #5036 and others.
2018-08-15 11:46:13 -03:00
hreintke
adde93bcaa Implementation of Functional and Scheduled option in Ticker lib (#5030)
* Implementation of Functional and Scheduled option in Ticker lib

* Update example formatting

* More example updates

* More updates to example

* More updates to example
2018-08-14 16:00:20 -03:00
Jiří Engelthaler
f77645465c CaptivePortalAdvanced: Change debug print to println 2018-08-04 15:01:54 +03:00
Jeroen88
e4d9c279ef Function added to detect baudrate (#4978)
* Function added to detect baudrate

* Added uart_start_detect_baudrate, detectBaudrate() wrappers for HardwareSerial and an example usage SerialDetectBaudrate.ino

* Some layout changes to pass Travis tests

* Some more nitty-gritty layout changes to pass Travis tests

* Some even more nitty-gritty layout changes to pass Travis tests

* renamed one function to testBaudrate() and updated doc/reference.rst

* Minor updates to doc/reference.rst

* New lines added
2018-08-01 15:33:25 -04:00
aerlon
7d5997dad1 Update of mesh network library. (#4718)
* Make mesh network actually usable. Make mesh network use static IP during initial connection to speed up connection time. Add separate handlers for requests and responses. Add network password. Provide more detailed code example. Add optional verbose mode. Improve comments. Add readme file.

* Fix compiler warnings. Fix code style of HelloMesh.ino to avoid upsetting Travis.

* Remove stray spaces.

* Make mesh network WiFi password settable via the ESP8266WiFiMesh constructor. Make use of static IP optional by moving static IP initialization code to setStaticIP method. Increase scanning interval from one to two seconds in the HelloMesh.ino example to increase chances of successful connections. Update comments. Update README.rst.

* Increase specificity in the conditions of the waitForClientTransmission method (renamed from waitForClient) to avoid issues related to #4626 , #4728 and #4754 in the future.

* Improve most parts of the library to achieve better performance and greatly increase flexibility.

Changes:
* Make WiFi-connection related variables static to allow for the use of multiple ESP8266WiFiMesh instances on a single node (useful e.g. when communicating with several different mesh networks).
* Make it possible to choose AP port, which is helpful when using multiple ESP8266WiFiMesh AP:s on a single node.
* Add user-customizable network filter.
* Make activation of own AP optional for each mesh node.
* Add ways to change mesh network name and node id for existing ESP8266WiFiMesh instances.
* Add verboseModePrint method to clean up the code.
* Add reactivation of static IP after successful data transfers to speed up re-connection attempts.
* Add empty_IP constant which can be used to check if static IP is disabled for a ESP8266WiFiMesh instance.
* Remove the WiFiClient _client class variable in ESP8266WiFiMesh since there is no need to save _client in the class instance.
* Add transmission status as a return value from attemptTransmission.
* Pass calling ESP8266WiFiMesh instance pointer to callback functions to allow for greater range of actions in callbacks.
* Make transmission message a class variable to allow it to be stored in the class and accessed from callbacks.
* Add getters for mesh name and node id to ESP8266WiFiMesh.
* Add getter and setter for networkFilter to ESP8266WiFiMesh.
* Increase range of available node_id:s by changing the type to String and adding functions to convert between String and uint64_t using a customizable radix between 2 and 36.
* Make it possible to connect to several nodes during each attemptTransmission call.
* Add static connection_queue and latest_transmission_outcomes vectors to the ESP8266WiFiMesh class, a NetworkInfo class and a TransmissionResult class to aid in bookkeeping when connecting to several AP:s during one attemptTransmission call.
* Make wifi_channel and BSSID optional when connecting to an AP (though excluding them will slow down the connection process).
* Add optional scan and static ip optimizations available in Arduino core for ESP8266 version 2.4.2.
* Add functions to check lwIP version in order to enable WiFi optimizations only available with lwIP2.
* Add concluding_disconnect, initial_disconnect and no_scan options to the attemptTransmission method.
* Update documentation.

* Improve README.rst formatting.

* Further improve README.rst.

* Even further improve README.rst.

* Make source code comments Doxygen compatible. Improve README file and change its file format to .md.

* Add temporary compatibility layer to ensure backwards compatibility with the old mesh network library API until the next major core release (2.5.0).

* Polish documentation slightly.

* Add scan_all_wifi_channels option to attemptTransmission method.

* - Add getter and setter for the WiFi channel of a ESP8266WiFiMesh instance.
- Separate methods for changing mesh name and node id from AP control methods.
- Add methods getAPController and isAPController to better handle situations when multiple ESP8266WiFiMesh instances take turns to be in control of the AP.
- Create separate UtilityMethods.cpp file for utility methods.
- Improve code efficiency and robustness, e.g. by passing arguments by reference instead of by value for non-POD types and employing typedefs.
- Update README.md.

* Make the code more stylish.

* Update README.md with the new ESP8266WiFiMesh constructor documentation.

* Make attemptScan method in CompatibilityLayer use reference as argument.

* Make it possible to use const String as argument to attemptScan.

* - Make code use camelCase instead of snake_case.
- Improve documentation.

* Rename Uint64ToString to uint64ToString and StringToUint64 to stringToUint64, since they are methods.
2018-07-31 22:46:20 -04:00
Laercio Mendonça
75a6a3f073 Include SetUUID for SSDP (#4981)
* Include SetUUID for SSDP

Inclusion of the SetUUID Method for Custom UUID

* Ajusts PR

* Include IconList Object on XML
2018-07-30 01:52:16 -04:00
david gauchard
3cc12b1e08 arduino API's SPI::transfer(void*, size) (optimized) (#4925)
* SPI::transfer(void*, size) (optimized)

* spi: transfer(): fix checking size

* spi: transferBytes_: 32bits miso transfer

* spi: transferBytes_: fix declaration

* spi: transferBytes: add comments, reduce diff
2018-07-27 10:44:02 -04:00
Earle F. Philhower, III
53091882b8
Fix minor BearSSL API issues (#4901)
Fixes #4882 and updates GitHub certificate fingerprint to the current one
in BearSSL_Validation example.

When setting a authentication mode or stopping, clear all others out in case
the object is being re-used.

Add in a yield during the SSL handshake to allow a graceful timeout and not
a WDT error when the remote server hiccups.  Thanks to @Jeroen88 for
finding and testing this.
2018-07-16 09:35:00 -07:00
Earle F. Philhower, III
89d2f42153
Note that CERTS.IDX file is generated on-chip (#4902)
Several users have been worried that they need to generate the IDX file,
but don't know how.  The CertStore code actually writes this file on object
creation, and the user never needs to explicitly generate or upload it.

Add a comment to the example explicitly noting this.
2018-07-08 21:54:40 -07:00
Earle F. Philhower, III
945535ae78
Make ar compatible with GNU and BSD in example (#4907)
Change the "ar" options in the example CertStore.AR archive generator to
make them compatible with both Linux and MacOS.
2018-07-08 21:12:32 -07:00
david gauchard
e486887f18
optionally allow WPS (#4889) 2018-07-06 16:45:25 +02:00
A C SREEDHAR REDDY
e0b6242e04 clear mdns.queryservice()'s previous result when called (#4894)
cleared the linkedlist.
* issue #4893
2018-07-05 23:17:53 -04:00
klucsik
b126a9c526 https fingerprint clue (#4863)
Adding a clue on the https part that yo will definitely need the fingerprint. 
(My first commit)
2018-07-03 00:40:50 -04:00
Earle F. Philhower, III
794630e068
Remove dependency on SD/SPIFFS from CertStore (#4760)
Due to popular demand, remove the hardcoded dependency on SPIFFS
or SD from the CertStore by factoring out the file interface into
a new class (CertStoreFile) that the user will need to implement
as a thin wrapper around either a SPIFFS.file or a SD.file

Combine the downloaded certificates into a UNIX "ar" archive
and parse that on-the-fly to allow easy inspection and creation
of the Cert Store database.

Examples updated with a new certificate downloader that creates
the certs.ar archive and with a single sample that can be built
for either SPIFFS or SD with a #define.  Users can copy the
implementation of the CertStoreFile they need to their own code
as it is self-contained.

Also move the CertStore to the BearSSL namespace and remove the
suffix and separate SPIFFS/SD sources.

Remove the "deep+" change from the CI build as well (no special
options needed on any PIO or makefile build).

We'll revisit the filesystem wrapper for 2.5.0, hopefully having a
unified template for both filesystem usage at a global level.  For
current users, be aware the interface may change (simplify!) in
release 2.5.0.

Fixes #4740
2018-06-12 19:06:26 -07:00
Earle F. Philhower, III
c0cfe875c2
Make BearSSL::write() blocking, match axTLS (#4804)
When a message is sent by the app that is larger than the SSL buffer,
it will take multiple TLS fragments to transfer.  Writes will loop
through and not return until either all data is transferred or there
is an error.
2018-06-12 13:18:00 -07:00
Earle F. Philhower, III
ebda795f34
Support multiple tone(), analogWrite(), and Servo (#4640)
Remove and rewrite all the parts of the core/libraries using TIMER1
and consolidate into a single, shared waveform generation interrupt
structure.  Tone, analogWrite(), Servo all now just call into this
shared resource to perform their tasks so are all compatible
and can be used simultaneously.

This setup enables multiple tones, analogWrites, servos, and stepper
motors to be controlled with reasonable accuracy.  It uses both TIMER1
and the internal ESP cycle counter to handle timing of waveform edges.
TIMER1 is used in non-reload mode and only edges cause interrupts.  The
interrupt is started and stopped as required, minimizing overhead when
these features are not being used.

A generic "startWaveform(pin, high-US, low-US, runtime-US)" and
"stopWaveform(pin)" allow for further types of interfaces.  Minimum
high or low period is ~1 us.

Add a tone(float) method, useful when working with lower frequencies.

Fixes #4321.  Fixes 4349.
2018-06-07 18:38:58 -07:00
Mike Morrison
ea4720b03e fix issue with compressed pointer (issue 4648) (#4752) 2018-06-07 12:31:49 -04:00
Balázs Kelemen
8cda9655e3 Allow to update credentials after setup performed. (#4789) 2018-06-07 13:13:45 +02:00
david gauchard
1a9403df1b
lwip2 fix and update (#4729)
* interactive example: update with option for using DHCP again after using static IP
* lwip2: avoid crash when IP address is set to 0(any) by dhcp not getting its lease renewal in due time
* lwip2: automatically remove oldest PCBs in time-wait state, limit their number
  thanks to @me-no-dev 07f4d4c241 (diff-f8258e71e25fb9985ca3799e3d8b88ecR399)
* faq: update about tcpCleanup()
* lwip2: add a macro HAS_PHY_CAPTURE=1 indicating capture facility is available
2018-05-25 17:24:00 +02:00
Earle F. Philhower, III
529baabef8
Return data in internal SSL buffers after close (#4756)
When the TCP socket is closed there may be some data left in the
BearSSL internal buffers which can be read by the application.

The BearSSL pump, however, would always return no data available
in the case the socket was disconnected before checking if the
SSL was in a state where the app could possibly read.

Fix by returning if the state is available, even if the connection
is gone.  Eventually no more data will become available to read
and the original -1 will be returned.

This should match the existing axTLS ::connected() behavior.
2018-05-23 08:24:34 -07:00