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

1704 Commits

Author SHA1 Message Date
david gauchard
6ff023c833
Merge branch 'master' into master 2022-06-26 17:53:26 +02:00
Max Prokhorov
7935bed18f
Provide wl_tcp_state as tcp_state alias (#8609) 2022-06-24 15:41:51 +02:00
david gauchard
7d9abbb605
do not call tcp/udp ::stopAll() when it is not required to do so (#8598)
* do not call tcp/udp ::stopAll() when it is not required to to so
* remove stopAll also from ArduinoOTA
2022-06-23 22:14:19 +02:00
david gauchard
3c43f18510
style 2022-06-16 00:11:18 +02:00
david gauchard
80c685df80
Merge branch 'master' into master 2022-06-15 23:56:51 +02:00
david gauchard
7e9968ca88
style 2022-06-15 23:55:49 +02:00
david gauchard
319f1d066d
style 2022-06-15 23:54:10 +02:00
david gauchard
9ace4ed849
stop incorrectingly increase number of arguments when setting up arg("plain") (#8599) 2022-06-12 22:47:36 +02:00
david gauchard
494e51f2bb
Merge branch 'master' into master 2022-06-11 22:23:53 +02:00
Max Prokhorov
b7c1cfbc45
DHCP custom option (#8582)
* works

* fixup! works

* back to callbacks

* names

* daisy chain

* seconds

* less inline

* fix dns setter

* might as well keep using initlist

/to d-a-v it has automatic storage, here it's the same stack based one
(just one less line for us)

* shift blame

* naming

* fix impl

* revert to ip4 dns

* merge fix

* restyle

* masking done wrong
2022-06-08 23:19:59 +02:00
david gauchard
5f2af1945b
lwIP on ethernet: examples (#8395)
* ethernet: examples

* remove duplicate

* styling

* fix comment restyle + comment eth.setdefault()

* comment and add comments about eth.setDefault()

* update comments when using interface::setDefault()

* repair bad merge

* fix default interface case

* factorize

* change comment
2022-06-02 14:03:38 +02:00
Max Prokhorov
502d9469fa
Initialize SoftAP DhcpServer object on demand (#8546)
* Initialize SoftAP DhcpServer object on demand

Remove dependency on global ctor, and just construct the object when
someone asks us to do it. Only dependency right now is netif_git, which
is expected to be initialized by the lwip code some time before
dhcps_start happens.

Removing ip_info from begin(), since we never reference later on.
Also removing the specific check for netif id and simplify the ctors.

Update tests and recover old nonos-sdk dhcps functions that were not implemented.

* nonos helpers have a separate header

* wifi ap needs this anyway, simplify sketch includes

* missing example

* existing name :/

* trying to fix header dependency

* restyle

* not a c header

* no need to init

* move dhcp server getter to WiFi

more... arduino'ish? we ahve object as namespace, plus everything else
related to softAP is there
redundant includes, redundant mock impl (out-of-scope here to fix)

* ...move things back, still expose as WiFi method

* review fix

* include -nonos header in wifi lib though

* no more lwip include

* style

* need mock dhcpserver instance
2022-06-01 22:46:04 +02:00
david gauchard
80c0570620
Define lwIP's s32/u32 to int (#8560)
* Define lwIP's s32/u32 to int

s32/u32 were previously defined as long,
but long can be 64 bits in host mode,
so this commit reduces valgrind complaints and increase coherency.

* some lads like to use `unsigned long` for 32 bits IPv4 addresses

* fix lwIP's `sys_now()` return type

* fix C declarations

* merge upstream (lwip2) update on sys_now() definition

* matching lwIP api (2/2)

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2022-05-15 21:55:56 +02:00
M Hightower
d1d4212e8b
Add support for global build defines and options (#8504)
* Add support to specify global build defines and options

A script manages the use of a file with a unique name, like
`SketchName.ino.globals.h`, in the Sketch source directory to provide compiler
command-line options (build options) and sketch global defines. The build
option data is encapsulated in a unique "C" comment block and extracted into
the build tree during prebuild.

* Applied os.path.normpath() liberally to input arguments. Fixes windows file path issue.
Improved helpful message for adding embedded build options.

* doubleup '\'

* Added context help for build option support

* expunged sketchbook global
added workaround for aggressive caching

* inital pass at searching for and reading preferences.txt

* Correct Windows path for preferences.txt
Added portable path for preferences.txt
Expanded file timestamp granularity
Improved error message printing for Arduino IDE 2.0 RC4

* Improved portable path and various Windows paths to preferences.txt

* Add cleanup logic and identify 1st run after IDE restart

* text corrections

* Create mkbuildoptglobals.py

When global header file does not exist, this print makes it easier for user to create the header file by providing its name and documentation pointer.

* build.opt heads up to user

Compiler command line changes from build.opt are shown to user

* Updated text

* oops

* Expanded comment and made print help consistent

* Improve handling stderr/stdout with "no verbose output"
Grouped helpful info to print at the end.
Added missing return value.

* Correct timestamp on CommonHFile.h
More improvements to printing
Updated docs.

* Added command-line parser

Support hints for compiler.cache_core. For use when Arduino IDE uses
command-line options that override compiler.cache_core.

Removed overuse of ()

Improve FAQ entry

* Fix script failure under windows

Rely on argpaser for checking that all arguments are present.
Removed redundant argument check in main().

Added '--debug' option and print_dbg method.

Rethink failures on overrides. Remove well know path fallbacks,
error exit when override file is missing.

In well-known path search for preferences.txt, do not assume true.
Make failure to find an error exit event.

When Windows has two preferences.txt files and they have different
values for caching and globals.h is used, error exit. It is not
possible to know from the script which is being used.

* Use quotes on build.opt

Update comment
Include the @ within the expantion string use quotes around file name.
Update doc example to remind and use quotes.

* Update CI for build option and global support

Added "mkbuildoptglobals.extra_flags=--cache_core" to platform.loca.txt
Update "-ide-version=10802" this version number indicates aggressive caching support
Added example to test global .h support

* Add debug prints
Added --debug to CI - this needs to be removed later
Tweaks to touch...

* Give each build VM a unique build.tmp space

* Corrected style on example
temp CI changes
debug crud
Added --ci switch

* Removed CI debug crud

run_CI_locall.sh works fine locally. Hosted Multi-VM CI fails
to work with 'aggressive caching' workaround method.

Add #if defined(CORE_MOCK) to failing example.

* Try HOST_MOCK

* CI adjustments

mkbuildoptglobals.py is optimized around the Arduino IDE 1.x
behaviour. One way the CI differs from the Arduino IDE is in the
handling of core and caching core. With the Arduino IDE, each sketch
has a private copy of core and contributes to a core cache. With the
CI, there is one shared copy of core for all sketches. When global
options are used, the shared copy of core and cache are removed before
and after the build.

* Doc update
2022-05-12 17:14:17 +02:00
david gauchard
8d5dda02f6
emulation on host: fix for latest changes in DNSServer (#8559) 2022-05-10 20:31:12 +03:00
M Hightower
bcb5464167
Add DNS forwarder to DNSServer (#7237)
The key functions added are:

`bool enableForwarder(const String &domainName=emptyString, const IPAddress &dns=uint32_t)0)`

If specified, `enableForwarder` will update the `domainName` that is used to match DNS request to this AP's IP Address. A non-matching request will be forwarded to the DNS server specified by `dns`. 

Returns `true` on success.

Returns `false`, 
 * when forwarding `dns` is not set, or 
 * unable to allocate resources for managing the DNS forward function.

`void disableForwarder(const String &domainName=emptyString, bool freeResources=false)`

`disableForwarder` will stop forwarding DNS requests. If specified, updates the `domainName` that is matched for returning this AP's IP Address.
Optionally, resources used for the DNS forward function can be freed.
2022-05-08 14:04:34 +03:00
Max Prokhorov
1a49a0449b
WebServer: use String when working with Basic authentication (#8548)
Avoid blowing up user code when `$user:$password` string is longer than
127 bytes. Use String to both manage the memory and handle concatenation.

Also clean-up historical quicks such as
- `if(StringObject)` that is always true since we implemented SSO
- `authReq = "";` / `authReq = String();`, which will happen anyway
- `(String)...` casts that happen anyway, implicitly (and which is also not a 'cast' btw, we do init it)
2022-04-30 18:25:42 +03:00
Earle F. Philhower, III
6c8c8cb2d6
Update to LittleFS 2.5 release (#8543) 2022-04-20 00:13:17 +03:00
Dirk O. Kaar
315bc77afe
EspSoftwareSerial release 6.16.1 (#8541) 2022-04-14 08:16:45 -07:00
Paulo Cabral Sanz
27827c8c6d
Delete operator=(Self&) when copy constructor is deleted (#8535) 2022-04-11 13:41:21 +03:00
Mike Bell
684156d211
ESP8266 Web Server: Fix missing implementation of send stream by reference (#8533) 2022-04-08 08:55:02 +03:00
Earle F. Philhower, III
d205a63309
Update sessions example to show speed difference (#8528)
Fixes #8505
2022-04-04 10:48:29 +02:00
Paulo Cabral Sanz
32939c4334
Fix reuse for different URIs in HTTPClient::begin (#8466) 2022-03-30 10:35:46 +02:00
Edd Inglis
732db59492
Catch a possible null-dereference (#8508) 2022-03-13 22:34:42 +01:00
Maxim Prokhorov
19b7a29720 Migrate from astyle to clang-format (#8464) 2022-03-04 02:28:47 +03:00
Max Prokhorov
ead5f94dd3
Correctly using fs:: namespace in SD & SDFS (#8493)
Remove `using namespace fs;` from SDFS.h
Fix everything that depended on it
2022-02-23 08:52:24 -08:00
david gauchard
15e7d35d6e
emulation on host: minor updates (#8454)
* emulation on host: minor fixes
merge MockDigital.cpp and HostWiring.cpp

* emulation: share mockverbose between CI-on-host and emulation

* mock: add missing recently overridden method

* remove extern variable, use weak function
2022-02-20 16:27:52 +03:00
david gauchard
f60defc3d3
flash-size agnostic builds (#6690)
* flash: mapping definition by sketch at runtime depending on flash chip size and user configuration
2022-02-10 18:25:18 +01:00
Drzony
3027acaf11
Fix compilation of ArduinoOTA when no global MDNS is available (#8478) 2022-02-05 00:05:38 +01:00
Earle F. Philhower, III
30b0450d2b
Move ESP8266SDFat library to master, not branch (#8460)
The existing ESP8266SdFat points to a working branch of the tree.
That branch is now merged to master, so move library to it.

There are no code changes,
2022-01-24 10:51:36 +01:00
M Hightower
9fcf14f81f
Fix VM Address mask (#8440)
* Fix VM Address mask

Adjust VM Address mask to allow up to 8M Byte parts.
Allow for free heap size values over 64K
  ESP.getHeapStats(, uint32_t,)
  uint32_t getMaxFreeBlockSize();

* Fix example

* Update MockEsp.cpp for uint32_t on EspClass::getMaxFreeBlockSize()

* Added comment about heap size limitation and static_assert to verify.
Updated boards.txt to show correct External memory size and Heap size.
2022-01-12 01:35:46 +03:00
Luc
2c5885e29d
Fix info.usedBytes calculation giving weird result (#8445) 2022-01-09 16:08:10 -08:00
david gauchard
a05a71fa9d
import getLocalTime() from esp32/Arduino (#8413)
* import getLocalTime() from esp32/Arduino
follows #8407
2022-01-04 22:20:20 +01:00
Juraj Andrássy
f401f08aba
WiFiServer - 'rename' available() to accept() (#8419)
* WiFiServer - 'rename' available() to accept()
* use server.accept() instead of available()
* WiFiServer.accept() and ArduinoWiFiServer class doc update
2022-01-03 14:32:02 +01:00
Juraj Andrássy
d0cc3a80f8
WiFiServer - don't inherit from Server class (#8418)
* WiFiServer - don't inherit from Server class
2022-01-03 14:06:31 +01:00
david gauchard
e3c79de7c9
httpClient: prevent empty user-agent in header (#8411) 2022-01-03 12:09:31 +01:00
Flaviu Tamas
42aa0e6d25
Wire buffer length improvments. (#8398)
* Enable I2C_BUFFER_LENGTH definition for Wire lib

Based on
375a89ed58

We should have been very careful when #defining things to not use a name
that could conflict with the user's own code, so this marks that old
define as deprecated.

If you opt-into the new behavior, you do not get the old BUFFER_LENGTH
constant.

As a bonus, changing these uint8_ts to size_t both reduces the code
size & improves performance.

* Increase buffer indexing variable size

I looked over the users of these variables and they should be fine with
no additional changes. The existing methods already have an option to
use size_t rather than uint8_t.

There's a few methods which return int instead of size_t, which isn't
great from a portability perspective but will be fine since this only is
designed to run on the ESP8266.
2021-12-14 08:45:57 -08:00
david gauchard
d18cbfb07d
mDNS timeout: use real type (#8394) 2021-12-03 01:38:35 +03:00
Dirk O. Kaar
26103a5827
Update EspSoftwareSerial to bug-fix release 6.15.2 (#8389) 2021-12-03 01:09:54 +03:00
Phil1pp
0af18ab313
Add ArduinoOTAClass::end() (#8379)
This adds the end() function for the ArduinoOTA class.

ESP32 has this implemented, however ESP8266 was lacking this.
2021-12-03 00:49:42 +03:00
Alexandre-Jacques St-Jacques
0f231b1c23
Adding custom buffer_length using I2C_BUFFER_LENGTH (#8390)
* Adding custom buffer_length using I2C_BUFFER_LENGTH
2021-12-01 22:31:28 +01:00
david gauchard
2492057b61
LittleFS: add overrides for Stream::send (#8386)
* littlefs: add overrides for Stream::send
2021-11-29 20:39:37 +01:00
Dirk O. Kaar
076a4edf1e
EspSoftwareSerial 6.15.1: Enforce stop-bit count detection strictly. (#8373)
* EspSoftwareSerial 6.15.0: Enforce stop-bit count detection strictly.

* Very minor refactoring and performance maintenance release 6.15.1.
2021-11-20 19:01:07 +03:00
Clemens Kirchgatterer
3090bda07d
Remove obsolete comments about legacy mDNS impl. (#8377)
* Remove obsolete comments about legacy mDNS impl.

* Update libraries/ESP8266mDNS/src/ESP8266mDNS.h

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>

* Update libraries/ESP8266mDNS/src/ESP8266mDNS.h

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2021-11-19 22:46:05 +03:00
Dirk O. Kaar
bf2882d8e0
Update SoftwareSerial to bug-fix release 6.14.2: 0xff at end-of-message wasn't detected until next message (#8370) 2021-11-13 08:06:49 -05:00
Earle F. Philhower, III
a00b2d7091
Update to SdFat 2.1.1 with UTF-8 support (#8355) 2021-11-05 08:41:55 -07:00
Earle F. Philhower, III
7d971fa45b
Remove warnings, errors during host tests in CI (#8358)
* Remove warnings, errors during host tests in CI

Debug strings often included format parameters which did not exactly match
the passed in format parameters, resulting in warnings in the host test build
process like
````
/home/runner/work/Arduino/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp:107:20: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  107 |         DEBUG_WIFI("[AP] SSID length %u, too long or missing!\n", ssid_len);
      |                                                                   ~~~~~~~~
      |                                                                   |
      |                                                                   size_t {aka long unsigned int}
````

Fix by applying casting or PRxxx macros as appropriate.

Also, fix one debug message which was trying to use a `String` as a `char *`:
````
/home/runner/work/Arduino/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp: In member function ‘wl_status_t ESP8266WiFiMulti::connectWiFiMulti(uint32_t)’:
/home/runner/work/Arduino/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp:331:34: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘String’ [-Wformat=]
  331 |                 DEBUG_WIFI_MULTI("[WIFIM] Connecting %s\n", ssid);
````

* Clean up SpeedTest.ino host build
2021-11-02 22:41:03 +01:00
Dirk O. Kaar
0cd90ed4ad
EspSoftwareSerial 6.14.1: Add API for selecting Rx GPIO PULLUP at runtime (#8353)
* EspSoftwareSerial 6.14.0: Add API for selecting Rx GPIO PULLUP at runtime.
* EspSoftwareSerial: bug fix 6.14.1: Set default RX pullup once in ctor, prevents flipping of that state on begin().
2021-10-30 00:52:38 -07:00
aWZHY0yQH81uOYvH
f8de3fb464
ESP8266WebServer - Drop inactive connection when another is waiting to improve page load time (#8216)
* ESP8266WebServer - drop current HC_WAIT_READ connection sooner when another has data

Safari sometimes opens two connections when loading a page and only
sends a request over the second one, resulting in a 5 second wait
(HTTP_MAX_DATA_WAIT) before the request is processed. This commit
drops the current connection after 30ms (HTTP_MAX_DATA_AVAILABLE_WAIT)
when there is a new connection with data available or the buffer of
pending TCP clients is full (currently 5).
2021-10-27 22:28:47 +02:00
Max Prokhorov
ac4af38c09
Correctly access WIFI_EVENT_MODE_CHANGE event info (#8343)
Select the specific union member struct fields.

Co-authored-by: Rastislav Hričák <88608954+RastoH@users.noreply.github.com>
2021-10-19 09:47:26 +03:00