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

1035 Commits

Author SHA1 Message Date
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
Earle F. Philhower, III
9b5f3c2882
Report connected when any bytes are available (#4754)
The SSL pipeline is multi-stage, and the TCP connection can go down
even though there is still data waiting to be decrypted or in the
decryption buffer.

Explicitly check that there if there can be any data made available
to the app, and if so report that we are still connected().  When
there is no data and there is no TCP connection, report disconnected.
2018-05-22 11:04:32 -07:00
Earle F. Philhower, III
e3c970210f
Add BearSSL client and server, support true bidir, lower memory, modern SSL (#4273)
BearSSL (https://www.bearssl.org) is a TLS(SSL) library written by
Thomas Pornin that is optimized for lower-memory embedded systems
like the ESP8266. It supports a wide variety of modern ciphers and
is unique in that it doesn't perform any memory allocations during
operation (which is the unfortunate bane of the current axTLS).

BearSSL is also absolutely focused on security and by default performs
all its security checks on x.509 certificates during the connection
phase (but if you want to be insecure and dangerous, that's possible
too).

While it does support unidirectional SSL buffers, like axTLS,
as implemented the ESP8266 wrappers only support bidirectional
buffers. These bidirectional buffers avoid deadlocks in protocols
which don't have well separated receive and transmit periods.

This patch adds several classes which allow connecting to TLS servers
using this library in almost the same way as axTLS:
BearSSL::WiFiClientSecure - WiFiClient that supports TLS
BearSSL::WiFiServerSecure - WiFiServer supporting TLS and client certs

It also introduces objects for PEM/DER encoded keys and certificates:
BearSSLX509List - x.509 Certificate (list) for general use
BearSSLPrivateKey - RSA or EC private key
BearSSLPublicKey - RSA or EC public key (i.e. from a public website)

Finally, it adds a Certificate Authority store object which lets
BearSSL access a set of trusted CA certificates on SPIFFS to allow it
to verify the identity of any remote site on the Internet, without
requiring RAM except for the single matching certificate.
CertStoreSPIFFSBearSSL - Certificate store utility

Client certificates are supported for the BearSSL::WiFiClientSecure, and
what's more the BearSSL::WiFiServerSecure can also *require* remote clients
to have a trusted certificate signed by a specific CA (or yourself with
self-signing CAs).

Maximum Fragment Length Negotiation probing and usage are supported, but
be aware that most sites on the Internet don't support it yet.  When
available, you can reduce the memory footprint of the SSL client or server
dramatically (i.e. down to 2-8KB vs. the ~22KB required for a full 16K
receive fragment and 512b send fragment).  You can also manually set a
smaller fragment size and guarantee at your protocol level all data will
fit within it.

Examples are included to show the usage of these new features.

axTLS has been moved to its own namespace, "axtls".  A default "using"
clause allows existing apps to run using axTLS without any changes.

The BearSSL::WiFi{client,server}Secure implements the axTLS
client/server API which lets many end user applications take advantage
of BearSSL with few or no changes.

The BearSSL static library used presently is stored at
https://github.com/earlephilhower/bearssl-esp8266 and can be built
using the standard ESP8266 toolchain.
2018-05-14 20:46:47 -07:00
Marian Craciunescu
bd87970aae add http client configurable timeout usefull when download is slow on server side (#4705)
* add http client configurable timeout usefull when download is slow from server side

* member init outside constructor body.

* removed this.
2018-05-04 11:18:15 -03:00
david gauchard
76a14b1f63
lwip2: fix static address management (#4677)
+ interactive example (for debugging)
2018-05-02 01:20:55 +02:00
Dan Worth
7820fb73a5 Added channel, ssid scan (#4636)
* Added channel, ssid scan

Overloaded scanNetworks so scan can occur on a single channel and/or for a particular ssid.

* Added parameters to scanNetworks

channel number and ssid have been added as optional parameters to the orginal scanNetworks()
2018-04-13 15:55:45 -03:00
david gauchard
b08d282673 fix connection reset by peer case (#4626)
* fix connection reset by peer case where pcb is set to null in ClientContext::_error but not reported to WiFiClient

* ClientContext: rename functions *_sent to *_acked (:sent to :ack in debug)

* use nullptr instead of 0
2018-04-11 22:25:04 -03:00
Earle F. Philhower, III
8ae553d99e
I2s input API and examples (#4539)
Enables I2S stereo input via DMA using new API calls:

. i2s_rxtx_begin(bool rx, rool tx);
. i2s_read_sample(uint32_t *l, uint32_t *r);

Original API calls will only enable TX, so this is backwards compatible.

Add simple I2S input example code using Arduino serial plotter.

Add UDP transmit of I2S microphone data to a PC (remote microphone).

Clean up and reorganize code to share RX and TX logic as much as
possible.  Fix a potential WDT error while in blocking sample read
and write.
2018-04-02 07:37:21 -07:00
Iman Ahmadvand
241531aa4c Adding softAP SSID & PSK query API (#4138)
* softAP SSID & PSK query API added.
Signatures:
String ESP8266WiFiAP::softAPSSID() const;
String ESP8266WiFiAP::softAPPSK() const;

* Fix for proper C-style string copy

* add API to validate input ip as string
Signatures:
static bool IPAddress::isValid(const String& arg);
static bool IPAddress::isValid(const char* arg, size_t len);

* fix indentation

* fix ip string validation to use built-in implementation.
signatures:
static bool isValid(const String& arg);
static bool isValid(const char* arg);
2018-03-28 09:27:20 -03:00
david gauchard
559cb35025 spi: use const for output buffers (#4552) 2018-03-23 13:39:20 -03:00
Ivan Grokhotkov
95b1348a71 WiFiClient: clean up ClientContext before connecting (#4516)
Fixes https://github.com/esp8266/Arduino/issues/4497
2018-03-23 12:19:45 -03:00
Earle F. Philhower, III
42f824b2e4 Fix WebServerSecure streamFile() (#4545)
* Fix WebServerSecure streamFile()

ESP8266WebServerSecure's streamFile was using the base class' method
which did not use SSL encrypt before transmitting, leading to failure.

Add a new template method and required support for
WiFiClientSecure::write(Stream&) (using a local temp buffer since the
SSL libs do not grok Arduino Streams at all).

Fixes #4544

* Match ClientContext buffer and yield() behavior

ClientContext sends out 256 bytes at a time and gives a yield after
each chunk to ensure the WDT doesn't fire.  Mimic that behavior in
WiFiClientSecure::write(Stream&).
2018-03-22 00:53:37 -03:00
Harald
3267443348 Fix random crashing of ClientContext::write(Stream) and write_P(PGM_P buf, size_t size) (#2504) (#4530)
* Fix random crashing of ClientContext::write(Stream) and write_P(PGM_P buf, size_t size) (#2504)

* - Allow partial buffer release

* - Refined comments
2018-03-22 00:01:22 -03:00
Juraj Andrássy
891113678c SPISlave.end() added (#4248)
* Change argument to Esp.deepSleep from uint32 to uint64 to match SDK, add deepSleepMax based on the cali_proc function per SDK

* SPISlave.end() added

* Nameoftherose patch for Issue #2435 (#4256)

* WiFiTelnetToSerial Example - Minor Issues #2435

* WiFiTelnetToSerial Example - Minor Issues #2435

Patch to rectify issue #2435

* Check that pins needed by Wire are defined at compile-time (#4261)
2018-03-18 01:53:54 -03:00
fabianoms
4e2e1f268c AddServiceTxt returning bool (issue #1962) (#4507) 2018-03-17 20:16:26 -03:00
Jonatan Olofsson
461c922586 Compressed dns (#3769)
* Add UdpContext seek and tell

* Add support for DNS compressed messages

* mDNS compressed pointer: Validate offset before jumping
2018-03-16 09:46:35 -03:00
Shawn A
836c7da8cc adds getautoreconnect() (#4359) 2018-03-16 01:15:30 -03:00
per1234
5c0a57ff6d Specify units in CheckFlashConfig example sketch (#4490) 2018-03-12 11:54:21 -03:00
Earle F. Philhower, III
afcbcd5cc9
Add support for hardware Sigma Delta generator
Provides a simple interface to attach/detach pins to the sigma-delta generator, and get/set the 2 parameters prescaler & target.  Working example that fades the onboard LED is provided.  Code and sample by @stefaandesmet2003.
2018-03-10 12:07:04 -08:00
Ivan Grokhotkov
170911a689 gdbstub, postmortem: clean up
- Move GDB stub hooks into a separate file, provide header for it
- Use syscall instruction raise user mode exception
- Remove unused code in postmortem.c

fixup

fixup
2018-03-09 12:47:22 +08:00
Shawn A
0643d6e7ab Bugfix/persistentchecks (#3798)
* persistent check fixes

fixes assumtions that persistent matches current configs, and prevents changes when such conditions exist

* oops

* fix code compliance block scoping
2018-03-08 23:55:09 -03:00
Ivan Grokhotkov
61cd8d8385 examples: format all .ino files
This formats all the example source files using Arduino style rules.
2018-03-08 14:32:06 +08:00
per1234
7999f5c29c Use correct separator in keywords.txt
The Arduino IDE currently requires the use of a tab separator between the name and identifier. Without this tab the keyword is not highlighted.

Reference:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywords
2018-03-05 15:51:14 +08:00
david gauchard
a2e7c7d016 (bool)WiFiClient needs to return ::connected() since ClientContext is not destroyed on ::stop() (#4422) 2018-03-02 20:27:08 -03:00
Ivan Grokhotkov
1349bafd83 [WIP] ESP8266WiFi: initialize new fields, remove old workaround (#4413)
* ESP8266WiFi: initialise new STA configuration fields

* ESP8266WiFi: remove workaround for wifi_station_ap_number
2018-02-28 17:21:32 -03:00
Ivan Grokhotkov
ee5a1e2804 WiFiClient: don’t destroy ClientContext on ::stop
Reported in https://github.com/esp8266/Arduino/issues/4078.

WiFiClient::stopAll, called from a WiFi disconnected event handler,
could be called while WiFiClient::connect was in progress. This issue
was initially fixed in #4194, by testing `this` pointer for being
non-null in ClientContext::connect.

This change delegates deletion of ClientContext to WiFiClient
destructor. WiFiClient::stop only calls ClientContext::stop, which
closes/aborts the connection.
2018-02-20 03:33:55 +03:00