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

91 Commits

Author SHA1 Message Date
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
Dirk O. Kaar
e1c8bf8df2 Update EspSoftwareSerial to release 5.0.0. (#5965)
* Update EspSoftwareSerial to release 5.0.0.

(Includes half-duplex patch for SerialStress.ino)

* Updated EspSoftwareSerial to allow Platformio builds that lack defaults for RX/TX defines.
2019-04-09 16:14:02 -04:00
david gauchard
9a2ed274f3 polledTimeout: add option to use CPU count instead of millis() (#5870)
* polledTimeout: add option to use CPU count instead of millis()

* use more "using" alias

* more c++/clear code, using typename (thanks @devyte)

* rename class name to include unit, introduce timeMax() and check it with assert()

* remove useless defines

* improve api readability, add micro-second unit

* update example

* mock: emulate getCycleCount, add/fix polledTimeout CI test

* + nano-seconds, assert -> message, comments, host test

* allow 0 for timeout (enables immediate timeout, fix division by 0)

* typo, set member instead of local variable

* unify error message

* slight change on checkExpired() allows "never expired"
also removed printed message, add YieldAndDelay, simplify calculations

* remove traces of debug.h/cpp in this PR

* include missing <limits> header

* back to original expired test, introduce boolean _neverExpires, fix reset(), getTimeout() is invalid

* fix expiredOneShot with _timeout==0 check

* reenable getTimeout()

* expose checkExpired with unit conversion

* fix timing comments, move critical code to iram

* add member ::neverExpires and use it where relevant

* improve clarity

* remove exposed checkExpired(), adapt LEAmDNS with equivalent

* add API ::resetToNeverExpires(), use it in LEAmDNS

* remove offending constness from ::flagged() LEAmDNS (due do API fix in PolledTimeout)

* simplify "Fast" base classes

* minor variable rename

* Fix examples

* compliance with good c++ manners

* minor changes for consistency

* add missing const

* expired() and bool() moved to iram

* constexpr compensation computing

* add/update comments

* move neverExpires and alwaysExpired
2019-04-05 10:50:53 -03:00
Earle F. Philhower, III
b1da9eda46
SD Filesystem compatible with 8266 File, using latest SdFat (#5525)
* Add a FAT filesystem for SD cards to Arduino FS

Arduino forked a copy of SD lib several years ago, put their own wrapper
around it, and it's been languishing in our ESP8266 libraries ever since
as SD. It doesn't support long file names, has class names which
conflict with the ESP8266 internal names, and hasn't been updated in
ages.

The original author of the SD library has continued work in the
meantime, and produced a very feature rich implementation of SdFat. It
unfortunately also conflicts with the class names we use in ESP8266
Arduino and has a different API than the internal SPIFFS or proposed
LittleFS filesystem objects.

This PR puts a wrapper around the latest and greatest SdFat library,
by forking it and wrapping its classes in a private namespace "sdfat,"
and making as thin a wrapper as possible around it to conform to
the ESP8266 FS, File, and Dir classes.

This PR also removes the Arduino SD.h class library and rewrites it
using the new SDFS filesystem to make everything in the ESP8266
Arduino core compatible with each other.

By doing so it lets us use a single interface for anything needing a
file instead of multiple ones (see SDWebServer and how a different
object is needed vs. one serving from SPIFFS even though the logic is
all the same). Same for BearSSL's CertStores and probably a few others
I've missed, cleaning up our code base significantly.

Like LittleFS, silently create directories when a file is created with
a subdirectory specifier ("/path/to/file.txt") if they do not yet exist.

Adds a blacklist of sketches to skip in the CI process (because SdFat
has many examples which do not build properly on the ESP8266).

Now that LittleFS and SDFS have directory support, the FS needs to be
able to communicate whether a name is one or the other.  Add a simple
bool FS::isDirectory() and bool FS::isFile() method.  SPIFFS doesn't
have directories, so if it's valid it's a file and reported as such.

Add ::mkdir/::rmdir to the FS class to allow users to make and destroy
subdirectories.  SPIFFS directory operations will, of course, fail
and return false.

Emulate a 16MB SD card and allow test runner to exercise it by using
a custom SdFat HOST_MOCK-enabled object.

Throw out the original Arduino SD.h class and rewrite from scratch using
only the ESP8266 native SDFS calls.  This makes "SD" based applications
compatible with normal ESP8266 "File" and "FS" and "SPIFFS" operations.

The only major visible change for users is that long filenames now are
fully supported and work without any code changes.  If there are static
arrays of 11 bytes for old 8.3 names in code, they will need to be
adjusted.

While it is recommended to use the more powerful SDFS class to access SD
cards, this SD.h wrapper allows for use of existing Arduino libraries
which are built to only with with that SD class.

Additional helper functions added to ESP8266 native Filesystem:: classes
to help support this portability.

The rewrite is good enough to run the original SDWebServer and SD
example code without any changes.

* Add a FSConfig and SDFSConfig param to FS.begin()

Allows for configuration values to be passed into a filesystem via the
begin method.  By default, a FS will receive a nullptr and should so
whatever is appropriate.

The base FSConfig class has one parameter, _autoFormat, set by the
default constructor to true.

For SPIFFS, you can now disable auto formatting on mount failure by
passing in a FSConfig(false) object.

For SDFS a SDFSConfig parameter can be passed into config specifying the
chip select and SPI configuration.  If nothing is passed in, the begin
will fail since there are no safe default values here.

* Add FS::setConfig to set FS-specific options

Add a new call, FS::setConfig(const {SDFS,SPIFFS}Config *cfg), which
takes a FS-specific configuration object and copies any special settings
on a per-FS basis.  The call is only valid on unmounted filesystems, and
checks the type of object passed in matches the FS being configured.

Updates the docs and tests to utilize this new configuration method.

* Add ::truncate to File interface

Fixes #3846

* Use polledTimeout for formatting yields, cleanup

Use the new polledTimeout class to ensure a yield every 5ms while
formatting.

Add in default case handling and some debug messages when invalid inputs
specified.

* Make setConfig take const& ref, cleaner code

setConfig now can take a parameter defined directly in the call by using
a const &ref to it, leading to one less line of code to write and
cleaner reading of the code.

Also clean up SDFS implementation pointer definition.
2019-03-06 02:14:44 +00:00
david gauchard
dc03293d82
(re)introduce timeout in HardwareSerial::readBytes(buffer, size) (#5558)
(re)introduce timeout in HardwareSerial::readBytes(buffer, size), add HardwareSerial::read(buffer, size) + visual test
2019-01-08 04:01:21 +01:00
david gauchard
4c8d8f1e8a uart: BW improvements (#4620)
* uart fixes and BW improvements

* uart: read_char straightly use hw buffer

* +attributes for functions called by ISR

* uart: BW improvements
read_char straightly use hw buffer (+ ~10%bw)
read by block (+ ~190%bw) (instead of generic Stream::readBytes)
attributes for functions called by ISR
remove overrun message
remove some ISR flags which were not honoured

* fix merge

* fix buffer overflow

* serial stress test sketch

* astyle

* serial stress example: interactive keyboard, stop reading, overrun

* serial device test: bandwidth & overrun

* update + HardwareSerial::hasError()

* interactive overrun in example

* astyle

* Test using @plerup's SoftwareSerial as submodule (tag 3.4.1)

* update upstream ref (fix warning)

* host mock uart/read(buf,size)

* reset style changes in submodules before style diff

* update build_boards_manager_package.sh for submodules

* trigger CI (removing space)

* cannot reproduce locally the CI issue, setting bash -x option to get live trace

* remove previously added (in this PR) 'set -e' in package builder (passes local tests, not real CI)
script-comment new recipe.hooks.core.prebuild.3 (along with already commented .1 and .2)
moved CI package test to be first on the test list
remove 'set -x', wish me luck
2018-12-10 10:35:11 -03:00
david gauchard
50cbdc0b92 update AddrList and examples (#5422) 2018-12-03 15:15:50 -03:00
Develo
e5d50a6e4b
Split AddrList into object-iterator-container components (#5410)
* Split AddrList into object-iterator-container components

* Update AddrList.h

Remove gist code
2018-12-02 23:46:39 -03:00
david gauchard
92373a9837 Deprecate axTLS, update examples (#5366)
* update examples

* fix serial<->tcp example, use STASSID instead of SSID (name collision)

* fix HTTPSRequest.ino

* update AxTLS HTTPS examples, update AxTLS API to deprecated

* fixes

* fixes + fix astyle (no preproc directives) + restyling script

* fix HTTPClient library

* fixes

* common.sh: do not reload arduino when already present (for locally CI testing)

* common.sh: do not reload ArduinoJson when already present (for locally CI testing)

* fix

* fix

* fix deprecated example

* fix WiFiHTTPSServer.ino

* reduce footprint

* wipfix

* fix led builtin

* fix example

* finished updating APSSID on all examples

* style

* restyle examples

* helper to run CI test locally

* local CI runner more verbose

* +const

* deprecation deprecation

* deprecation

* Update NTPClient.ino

const char[] => const char *

* Update interactive.ino

const char[] => const char *
2018-11-29 20:49:27 -08:00
david gauchard
c6777149a8
constexpr helpers to identify core version (#5269) 2018-11-29 17:10:33 +01:00
david gauchard
5c4db3acf4
IPv6 on esp8266-nonos-sdk and arduino (#5136) 2018-11-27 23:07:47 +01:00
Develo
a501d3ca3b
PolledTimeout Class for wrapping millis() loops (WIP) (#5198)
* PolledTimeout Class for wrapping millis() loops

* Add yield policies, improve reset, add host tests

* Fix copyright, comments

* adjust host tests for better time precision

* add fuzzyness to timing tests for CI jitter

* add blink example with polledTimeout

* improve namespace and type naming, add copyright, comments

* fix astyle
2018-11-26 10:57:49 -03: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
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
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
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
david gauchard
76a14b1f63
lwip2: fix static address management (#4677)
+ interactive example (for debugging)
2018-05-02 01:20:55 +02: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
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
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
Earle F. Philhower, III
f9ac524b13
Add -Werror to acceptance builds for C and CPP (#4369)
Use platform.local.txt to add -Werror to GCC for the build of all
code.  Any warnings on a submitted patch will cause an error.

Several examples and libraries had warnings/errors (missing returns
on functions, types, etc.).  Clean those up with this commit as well.
2018-02-17 18:47:10 -08:00
Develo
83f6d83db0
Fix RTCmem example buffer access past end (#4288) 2018-02-06 20:54:03 -03:00
david gauchard
9913e52107 handle tv.tv_usec in settimeofday() (#4001)
optional settimeofday()'s callback
fix #1679
2017-12-24 17:48:25 -03:00
david gauchard
cbfbc1ad63 lwip2 fixes and time/ntp management
core: +settimeofday()
core: +coredecls.h +sntp-lwip2.c
core: fix clock_gettime() with micros64()
core: honor DST in configTime()
core: internal clock is automatically started
examples: +esp8266/NTP-TZ-DST.ino
lwip2: sntp client removed
lwip2: fix crashing with WiFi.softAPConfig(ip,ip,ip)
fix #3852
2017-11-21 10:50:48 +08:00
wosk
e9dea9af99 Update keywords.txt for coloring syntax (#2892)
Add ESP keywords and update ESP8266Wifi library
2017-02-06 13:25:27 +03:00
Jose M Viloria
0291a6e32a Update Blink.ino
Typo
2017-01-05 11:50:43 -06:00
Ivan Grokhotkov
9db0393b65 Update RTC memory example 2016-06-02 14:34:28 +08:00
Macro Yau
2a4081b079 Added support for RTC user memory in ESP-specific APIs. (#1836) 2016-06-01 11:13:33 +08:00
Max Vilimpoc
7c8d9b2d8d Add TestEspApi example, exercising the non-RTOS C API. 2016-02-27 12:59:08 +01:00
Alex
573a0fb47f Add LED_BUILTIN definition (#1556)
keep arduino incompatible BUILTIN_LED (+22 squashed commits)
[e124f9c] keep arduino incompatible BUILTIN_LED
[18dab66] keep arduino incompatible BUILTIN_LED
[0095de6] keep arduino incompatible BUILTIN_LED
[cca2714] keep arduino incompatible BUILTIN_LED
[ff62bfb] keep arduino incompatible BUILTIN_LED
[fd6f7c0] keep arduino incompatible BUILTIN_LED
[220b02a] keep arduino incompatible BUILTIN_LED
[b871b1b] keep arduino incompatible BUILTIN_LED
[1d97cac] keep arduino incompatible BUILTIN_LED
[ebc2667] changed BUILTIN_LED to LED_BUILTIN
[7008a27] changed BUILTIN_LED to LED_BUILTIN
[cf3f6da] changed BUILTIN_LED to LED_BUILTIN
[5e11c43] changed BUILTIN_LED to LED_BUILTIN
[8645bd5] changed BUILTIN_LED to LED_BUILTIN
[faae742] changed BUILTIN_LED to LED_BUILTIN
[df2659b] changed BUILTIN_LED to LED_BUILTIN
[1eb74d5] changed BUILTIN_LED to LED_BUILTIN
[fb9e977] changed BUILTIN_LED to LED_BUILTIN
[b735737] changed BUILTIN_LED to LED_BUILTIN
[d0557dd] changed BUILTIN_LED to LED_BUILTIN
[a25e4aa] changed BUILTIN_LED to LED_BUILTIN
[7865ace] changed BUILTIN_LED to LED_BUILTIN
2016-02-04 17:44:17 +03:00
Ivan Grokhotkov
74aec438ae Fix "invalid library found" errors with Arduino 1.6.6 (#965)
As per suggestion from @marvinroger
2015-11-16 00:39:54 +03:00
Markus Sattler
33c9d03356 add CheckFlashConfig.ino example 2015-10-09 14:29:21 +02:00
Ivan Grokhotkov
34be16c8da Add example for storing JSON config file in SPIFFS 2015-08-10 15:15:06 +03:00
probonopd
fab4b86147 Rename to CallSDKFunctions and correct spelling 2015-07-20 13:04:55 +02:00
probonopd
ca1bbf2e9a Example sketch to demonstrate how to use native ESP8266 SDK functionality 2015-07-20 12:43:29 +02:00
probonopd
496fee1a15 Use BUILTIN_LED 2015-06-26 20:31:56 +03:00
probonopd
2969b0b7a3 Use BUILTIN_LED 2015-06-26 20:31:51 +03:00
probonopd
3e87bb3ce2 No need to disable the watchdog 2015-06-26 20:31:45 +03:00
probonopd
7553b67dd7 ESP8266 BlinkWithoutDelay 2015-06-26 20:31:39 +03:00
probonopd
0e29e7e048 ESP8266 Blink example for the blue LED on the ESP-01 module 2015-06-26 20:31:32 +03:00