1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

4195 Commits

Author SHA1 Message Date
Earle F. Philhower, III
a736a95655
Fix minor typo in generated comment (#8503) 2022-03-05 08:19:17 -08:00
Maxim Prokhorov
24c41524dc Add .git-blame-ignore-revs (#8464)
Ignore mass-reformatting commits
Include the clang-format, and the previous astyle

Based on the idea from black
https://black.readthedocs.io/en/stable/guides/introducing_black_to_your_project.html#avoiding-ruining-git-blame

To be used with git CLI when exploring some specific file history
```
$ git blame --ignore-revs-file .git-blame-ignore-revs -- file.cpp
```

Or, by modifying the config to apply globally
```
$ git config blame.ignoreRevsFile .git-blame-ignore-revs
```
(note that the by default config will apply only for the current repository)
2022-03-04 02:28:47 +03:00
Maxim Prokhorov
19b7a29720 Migrate from astyle to clang-format (#8464) 2022-03-04 02:28:47 +03:00
Earle F. Philhower, III
46190b61f1
Error even w/warnings disabled for no-return fcns (#8495)
* Error even w/warnings disabled for no-return fcns

A function whose prototype says it will return a value but doesn't
is undefined behaviour in C++.  GCC 10 will generate code that crashes
in this case.

In warnings==None mode, insterad of turning off all warnings with
`-w`, explicitly list all G++ possible warnings except for the
`no-return` warning which catches this programming error.

* Use different lists for GCC vs G++

G++ and GCC have different warning options, so use different lists.

* Make separate file for each level, add readme

The readme now includes the exact commands required to regenerate the
none-XXX files, no manual editing needed.

* Address review comments, only adjusts G++/None
2022-03-04 02:10:57 +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
Max Prokhorov
fd53a080ee
Add documentation entry about compiler warnings (#8492)
per #8421 and #8475
after checking HW, suggest to check SW as well by at least by enabling some or all compiler warnings
(and also note of the IDE weirdest defaults causing issues we expected to stay solved)
2022-02-22 13:42:26 +03: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
M Hightower
7356cd1ef1
Heap init code improvements and updates (#8458)
* Heap init code improvements and updates

Moved secondary heap init code to flash.
  External -24 IRAM, +32 IROM
  IRAM     -76 IRAM, +64 IROM

General updates to umm_init call path and DEFINES to better align with
upstream. Name changes: UMM_INIT_HEAP with UMM_CHECK_INITIALIZED,
umm_init_stage_2 with _umm_init_heap, and umm_init_common with umm_init_heap.

Add file umm_cfgport.h to hold port-specific values. Stay focused
on heap initialization only move-related defines.

Improved comments.

Created a wrapper function for running pre-SDK code from flash.
Updated hwdt_app_entry to use it.

Update umm_init with option to run from ICACHE.
Added build define UMM_INIT_USE_ICACHE to move umm_init call path to flash.
When used frees up 160 bytes of IRAM at a cost of 208 bytes of IROM

Defaults to no change, umm_init call path will be in IRAM.

* Changed default to use IROM for umm_init() and option to revert back to UMM_INIT_USE_IRAM.
2022-02-15 22:42:08 +01:00
NaincyKumariKnoldus
d7c3d7b797
Minor git install documentation fix (#8488) 2022-02-15 12:06:25 -08:00
M Hightower
e6fc76ab5f
Fix, calloc now fails on extra-large request. (#8482)
Added code to handle multiply overflow in calloc.
Added code to handle add overflow in umm_poison_*
2022-02-12 22:24:59 +01: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
Paulo Cabral Sanz
9f536e68f8
WString: avoid writing to const storage (#8463)
This avoids the null termination requirement of both String::substring and String::lastIndexOf by using APIs that don't require it. So we can stop writing to the buffer inside of const functions.

I also changed wbuffer to make it non const.
2022-01-28 15:51:45 +03: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
Benedikt Eliasson
f4ef6fd7d8
fix Stream.read into buffer ignoring every second byte (#8452) (#8453) 2022-01-18 15:21:13 +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
Phill
378fcfcda4
Remove obsolete PWMRANGE in keywords.txt (#8447)
PWMRANGE was defined up until v2.7.4:

```
$ cd ~/Library/Arduino15/packages/esp8266/hardware/esp8266
$ grep -R "PWMRANGE" 2.7.4
2.7.4/keywords.txt:PWMRANGE	LITERAL1
2.7.4/tests/host/common/Arduino.h:#define PWMRANGE 1023
2.7.4/cores/esp8266/core_esp8266_wiring_pwm.cpp:static int32_t analogScale = PWMRANGE;
2.7.4/cores/esp8266/Arduino.h:#define PWMRANGE 1023
```

The define was removed in favour of the Arduino standard value of 255
but the keyword coloring was left behind:

```
$ cd ~/Library/Arduino15/packages/esp8266/hardware/esp8266
$ grep -R "PWMRANGE" 3.0.2
3.0.2/keywords.txt:PWMRANGE	LITERAL1
```

In the Arduino IDE, the coloring makes it look like PWMRANGE still
exists, when it doesn't, which is confusing.

Signed-off-by: Phill Kelley <pmk.57t49@lgosys.com>
2022-01-10 19:44:27 -08:00
Luc
2c5885e29d
Fix info.usedBytes calculation giving weird result (#8445) 2022-01-09 16:08:10 -08:00
david gauchard
4c07113ff5
lwIP: v2.1.3 + dhcp fixes (#8319)
* lwIP: v2.1.3
* interface set as default when gw is valid
2022-01-06 12:38:36 +01: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
M Hightower
f26201e6a9
Sync umm_malloc style with upstream (#8426)
Upstream umm_malloc at git hash id 4dac43c3be7a7470dd669323021ba238081da18e
processed all project files with the style program uncrustify.

This PR updates our ported version of umm_malloc processed with "uncrustify".
This should make subsequent merges of upstream into this port easier.

This also makes the style more consistant through umm_malloc.
2022-01-03 22:36:03 +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
david gauchard
2f58f679ee
Emulation on host: updates (#8409)
* mock: +Hash, +scheduled functions
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2022-01-03 14:23:45 +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
dde2c769db
StreamConstPtr: disallow passing a String temporary (#8410)
* StreamConstPtr: prevent from passing a temporary String instance
* unconditionally allow progmem chars
* missing virtual destructor in Stream
(warning: deleting object of abstract class type 'Stream' which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor])
2022-01-03 13:42:27 +01:00
david gauchard
e3c79de7c9
httpClient: prevent empty user-agent in header (#8411) 2022-01-03 12:09:31 +01:00
M Hightower
e5a214e6f1
Fix umm_blocks() (#8429)
Extracted fix from upstream for umm_blocks() - On allocations that were too
large, umm_blocks() could return an incorrectly truncated value when the result
is cast to uint16_t.
2022-01-03 11:44:17 +01:00
Earle F. Philhower, III
b5f3d1d6d5
Remove Python installation from OTA doc (#8417)
Fixes #8416

We install now a private Python and use it for OTA calls, so users do not need to manually install anything.
2021-12-20 14:49:45 +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
Earle F. Philhower, III
55ef3e7397
GCC 10.3 Bugfix 1 (#8393)
Fixes a hard-to-track bug in GCC 10.x.
https://github.com/earlephilhower/newlib-xtensa/issues/19
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115

GCC 10.3 had an issue with addressing constant integer literals which would
result in crazy offsets being used and random crashes in production.
Update with an upstream GCC 11 bugfix by @jjsuwa-sys3175
https://github.com/earlephilhower/esp-quick-toolchain/pull/31
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=dcb2873cd32b263643bfd9d1298b35d6cd028f0a
2021-12-03 02:24:12 +03: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
Marcel
7fc43b6ddd
Correctly link with precompiled libraries (#8392)
Otherwise, this will cause an error when trying to link with one.

ref. https://arduino.github.io/arduino-cli/0.20/platform-specification/#recipes-for-linking
(empty by default, for when this value is not set by the builder)
2021-12-03 00:12:17 +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
Andrej Pala
d5444c4aa3
I2C clock phase correction in START condition (#8383)
* A clock phase correction in write_start(void)

Some devices require the data wire SDA to be held down at the moment while the clock wire is pulled down too to execute the start condition (e.g. devices using "TinyWires.h" library). This change follows a behaviour of Arduino Wire.h library, where the SCL signal is pulled down in half of period of start condition.

* Formatting of modification restyled

* Removing mathematical operations from delay

* Comments added
2021-11-28 18:33:01 +03: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
adams13x13
0761f6f672
Add stream string includes (#8367) 2021-11-09 16:09:20 -08:00
david gauchard
986dd4209d
enable nonosdk-2.2.x version 19-03-13 for Arduino IDE per #7965 (#8363) 2021-11-05 23:49:59 +01: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
Stanimir-Petev
3f5a76cc26
MOD-WIFI-ESP8266(-DEV) update (#8297)
Added Flash mode and reset method selection options for Olimex board MOD-WIFI-ESP8266(-DEV)
The addition of the FlashMode and ResetMethod selection options via boards.txt.py generation file.
2021-10-31 13:30:38 -07: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
Dirk O. Kaar
c7c7d0518b
Remove the HAVE_ESP_SUSPEND define. (#8342)
The define was in the feature development branch, now after merge into main it is redundant, and should not be part of the next release point.
2021-10-17 01:51:53 +03:00
Earle F. Philhower, III
aabfd73c3a
Clean up SpeedTest output, avoid div-by-0 (#8340)
Use a formatting function to give more human-readable output formats
for flash bandwidth.  When the test starts and ends in less than one
millisecond, report as "Infinite".

Sample output:
````
Creating 512KB file, may take a while...
==> Time to write 512KB in 256b chunks = 6641 milliseconds
==> Created file size = 524288
Reading 512KB file sequentially in 256b chunks
==> Time to read 512KB sequentially in 256b chunks = 211 milliseconds = 2.48 MB/s
Reading 512KB file MISALIGNED in flash and RAM sequentially in 256b chunks
==> Time to read 512KB sequentially MISALIGNED in flash and RAM in 256b chunks = 212 milliseconds = 2.47 MB/s
Reading 512KB file in reverse by 256b chunks
==> Time to read 512KB in reverse in 256b chunks = 367 milliseconds = 1.43 MB/s
Writing 64K file in 1-byte chunks
==> Time to write 64KB in 1b chunks = 1249 milliseconds = 52.47 KB/s
Reading 64K file in 1-byte chunks
==> Time to read 64KB in 1b chunks = 296 milliseconds = 221.41 KB/s
````
2021-10-17 01:32:48 +03:00