1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-29 16:03:14 +03:00
Commit Graph

1665 Commits

Author SHA1 Message Date
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
3027acaf11 Fix compilation of ArduinoOTA when no global MDNS is available (#8478) 2022-02-05 00:05:38 +01:00
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
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
a05a71fa9d import getLocalTime() from esp32/Arduino (#8413)
* import getLocalTime() from esp32/Arduino
follows #8407
2022-01-04 22:20:20 +01:00
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
d0cc3a80f8 WiFiServer - don't inherit from Server class (#8418)
* WiFiServer - don't inherit from Server class
2022-01-03 14:06:31 +01:00
e3c79de7c9 httpClient: prevent empty user-agent in header (#8411) 2022-01-03 12:09:31 +01:00
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
d18cbfb07d mDNS timeout: use real type (#8394) 2021-12-03 01:38:35 +03:00
26103a5827 Update EspSoftwareSerial to bug-fix release 6.15.2 (#8389) 2021-12-03 01:09:54 +03:00
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
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
2492057b61 LittleFS: add overrides for Stream::send (#8386)
* littlefs: add overrides for Stream::send
2021-11-29 20:39:37 +01:00
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
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
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
a00b2d7091 Update to SdFat 2.1.1 with UTF-8 support (#8355) 2021-11-05 08:41:55 -07:00
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
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
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
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
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
c312a2eaf1 Implement esp_yield() as a replacement for delay(0)
esp_yield() now also calls esp_schedule(), original esp_yield() function renamed to esp_suspend().

Don't use delay(0) in the Core internals, libraries and examples. Use yield() when the code is
supposed to be called from CONT, use esp_yield() when the code can be called from either CONT or SYS.
Clean-up esp_yield() and esp_schedule() declarations across the code and use coredecls.h instead.

Implement helper functions for libraries that were previously using esp_yield(), esp_schedule() and
esp_delay() directly to wait for certain SYS context tasks to complete. Correctly use esp_delay()
for timeouts, make sure scheduled functions have a chance to run (e.g. LwIP_Ethernet uses recurrent)

Related issues:
- #6107 - discussion about the esp_yield() and esp_delay() usage in ClientContext
- #6212 - discussion about replacing delay() with a blocking loop
- #6680 - pull request introducing LwIP-based Ethernet
- #7146 - discussion that originated UART code changes
- #7969 - proposal to remove delay(0) from the example code
- #8291 - discussion related to the run_scheduled_recurrent_functions() usage in LwIP Ethernet
- #8317 - yieldUntil() implementation, similar to the esp_delay() overload with a timeout and a 0 interval
2021-10-17 00:19:01 +03:00
40b26b769c Movable HTTPClient and fixing WiFiClient copy (#8237)
- =default for default ctor, destructor, move ctor and the assignment move
- use `std::unique_ptr<WiFiClient>` instead of raw pointer to the client
- implement `virtual std::unique_ptr<WiFiClient> WiFiClient::clone()` to safely copy the WiFiClientSecure instance, without accidentally slicing it (i.e. using the pointer with incorrect type, calling base WiFiClient virtual methods)
- replace headers pointer array with `std::unique_ptr<T[]>` to simplify the move operations
- substitute userAgent with the default one when it is empty
(may be a subject to change though, b/c now there is a global static `String`)

Allow HTTPClient to be placed inside of movable classes (e.g. std::optional, requested in the linked issue) or to be returned from functions. Class logic stays as-is, only the underlying member types are changed.

Notice that WiFiClient connection object is now copied, and the internal ClientContext will be preserved even after the original WiFiClient object was destroyed.

replaces #8236
resolves #8231
and, possibly #5734
2021-10-13 04:19:51 +03:00
b7a2f44b50 Update mmu_get... and mmu_set... (#8290)
These changes are needed to address bugs that can emerge with the improved optimization from the GCC 10.3 compiler.

Updated performance inline functions `mmu_get_uint8()`, ... and `mmu_set_uint8()`, ...  to comply with strict-aliasing rules. 
Without this change, stale data may be referenced. This issue was revealed in discussions on https://github.com/esp8266/Arduino/issues/8261#issue-963529268 

Changes to avoid over-optimization of 32-bit wide transfers from IRAM, turning into 8-bit or 16-bit transfers by the new GCC 10.3 compiler. This has been a reoccurring/tricky problem for me with the new compiler. 

So far referencing the 32-bit value loaded by way of an Extended ASM R/W output register has stopped the compiler from optimizing down to an 8-bit or 16-bit transfer.

Example:
```cpp
  uint32_t val;
  __builtin_memcpy(&val, v32, sizeof(uint32_t));
  asm volatile ("" :"+r"(val)); // inject 32-bit dependency
  ...
```

Updated example `irammem.ino`
* do a simple test of compliance to strict-aliasing rules
* For `mmu_get_uint8()`, added tests to evaluate if 32-bit wide transfers were converted to an 8-bit transfer.
2021-10-13 03:47:12 +03:00
9d024d17fd comments on Arduino flush() method (#8318) 2021-09-29 15:22:30 +02:00
93b7325cb8 Update secrets.h to network and credentials (#8325)
WiFi credentials: standard macro used in examples
2021-09-29 15:10:26 +02:00
3f4bcbe483 Improvements to the existing ETag implementation (#8227)
* WebServer eTag implementation improvements
2021-09-29 11:58:40 +02:00
193043d19b Update ESP8266WiFiSTA.cpp (#8229)
change return to `WL_WRONG_PASSWORD` if there is an issue with the password!
2021-09-29 09:35:32 +02:00
64e87f1149 WiFi library ArduinoWiFiServer update (#8238)
* ArduinoWiFiServer - check for clients in write() too
2021-09-22 19:31:07 +02:00
612e7ffd7f Remove temporary buffer in ConfigFile.ino (#8298)
When reading from a `Stream`, like `File`, using a temporary buffer is counterproductive because it complexifies the code and increases memory usage.
It's also a source of confusion because it can create dangling pointers in the `JsonDocument`.
The only benefit of using a buffer is the reading speed, but I don't think speed is the focus in this example; if it were, it would use a buffer in `saveConfig()` too.
2021-09-16 11:23:08 +02:00
140d0ffde1 Add writeToPrint to ESP8266HTTPClient (#8056) 2021-09-04 10:46:47 -07:00
d3f16b3177 Allow manually setting MD5 checksum for HTTP update (#8204) 2021-09-04 10:34:00 -07:00
058ce7c08e Allow control over HTTPClient authorization String allocation (#8225) 2021-09-04 10:17:00 -07:00
65db3aec72 Add HTTP delete method (#8214) 2021-09-01 09:42:19 -07:00
fb5c4a6420 Place deprecated attribute in front of function (#8258) 2021-09-01 09:03:12 -07:00
9f30f2469f EspSoftwareSerial maintenance update 6.13.2 (#8295)
* EspSoftwareSerial maintenance update 6.13.1

* EspSoftwareSerial 6.13.2
2021-08-30 16:48:28 -07:00
5f04fbbf5f EspSoftwareSerial minor release 6.13.0: Improve support for availability of GPIOS on ESP32 S2 and ESP32C3 (#8260) 2021-08-07 15:05:05 -07:00
14c3798d4f release 3.0.2 (#8242) 2021-07-26 22:27:44 +02:00
f9084603de Make multiple FS begin calls noops() SDFS/LittleFS (#8235)
When LittleFS.begin() or SDFS.begin() is called after the filesystem is
already mounted, don't unmount/remount.  When an unmount happens, all old
Files become invalid (but the core doesn't know this), so you would end
up with random crashes in FS code.

Now, check for _mounted, and if so just return immediately from begin().
This mimics the original SPIFFS code.

Fixes https://github.com/earlephilhower/ESP8266Audio/issues/407
2021-07-26 21:58:40 +02:00
cfb6d50844 Fix PRxxx printf format macros (#8222)
* Fix PRxxx printf format macros

Update toolchain (newlib) to supply proper definitions for PRxxx macros.
Fixes #8220

Added a PRxxx macro to an example to ensure CI will catch any problem like
this in the future.
2021-07-26 21:41:08 +02:00
bc302511f5 Clean up use of "byte" as a type. uint8_t or (C++17) std::byte are better. (#8090) 2021-07-26 21:20:45 +02:00
8a42163a50 Call umm_init just before starting SDK (#8207)
* Recover the BearSSL crash stack before the Heap is initialized and zeros it.
* Added comments for hwdt_pre_sdk_init()
* Keep Basic ASM version of app_entry_redefinable and removed alternate "C"/Extended ASM version. Update comments.
* Improved example HwdtStackDump to use StackThunk
2021-07-19 07:58:37 -07:00
69f8cd6934 Certificate and public keys automatic updater (#8218) 2021-07-17 16:29:46 -07:00
c9f27410f7 Fix NO_GLOBAL_INSTANCES for Serial ports (#8184) 2021-07-17 16:21:37 -07:00
09c4e33106 Netdump printf fix (#8215)
* Fix crash printf long getTime()

* Update several printf to printf_P
2021-07-17 11:50:15 -07:00
25a21c3e7d Use valid categories in library.properties of bundled libraries (#8221)
When using previous IDE versions, the use of an invalid category value caused a warning to be displayed on every compilation:

WARNING: Category 'Network' in library lwIP_PPP is not valid. Setting to 'Uncategorized'
WARNING: Category 'Network' in library lwIP_enc28j60 is not valid. Setting to 'Uncategorized'
WARNING: Category 'Network' in library lwIP_w5500 is not valid. Setting to 'Uncategorized'
WARNING: Category 'Network' in library lwIP_w5500 is not valid. Setting to 'Uncategorized'

List of valid category values:
https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format
2021-07-17 11:00:14 -07:00
40876dc6ba Fixes failing https connections to HelloServerBearSSL when using the (#8206)
MMU option with 48K IRAM shared. This happended after changes that
increased IRAM code size that caused  free IRAM for Heap to fall
below ~16K, then "new" would OOM out in WiFiClientSecureBearSSL.

Added private function to try IRAM first then switch to DRAM on fail
to WiFiClientSecureBearSSL for iobuff allocations.
2021-07-11 22:22:34 +02:00