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

3551 Commits

Author SHA1 Message Date
Dirk O. Kaar
afe40211ef Corrections after review remarks; thanks @earlephilhower 2020-02-20 19:41:08 +01:00
Dirk O. Kaar
50fab5162f No need for preprocessor undefinition of optimistic_yield, after all. 2020-02-05 14:31:42 +01:00
Dirk O. Kaar
8d2eca5684 Remove long-since disused define. 2020-02-05 14:31:42 +01:00
Dirk O. Kaar
554435780b Due to 3rd party use of symbol optimistic_yield without #include <Arduino>, have to resort to preprocessor definition for inlining. 2020-02-05 14:31:42 +01:00
Dirk O. Kaar
3767791fbc Allow constexpr evalution to occur. optimistic_yield is always called with a literal parameter value. 2020-02-05 14:31:42 +01:00
Dirk O. Kaar
3d7423bdde Move yield start time set to esp_yield_within_cont 2020-02-05 14:31:42 +01:00
Dirk O. Kaar
598361f3aa Substitute micros() by CPU cycles - faster, but large values for interval_us can overflow - 26s at 160MHz CPU clock. 2020-02-05 14:31:42 +01:00
Dirk O. Kaar
d6e603f397 Fix optimistic_yield to not yield on every call after a loop runs for x us, but yield only every x us between optimistic_yield calls. 2020-02-05 14:31:42 +01:00
david gauchard
a8515a7d66
use STA as default interface in mDNS (#7042) 2020-02-05 10:14:42 +01:00
david gauchard
14f627218b
update to new prebuilt win sed version (#7062) 2020-02-05 00:05:05 +01:00
Earle F. Philhower, III
6be561617f
Added dependencies for eboot.ld and Makefile to Makefile. (#7047)
Updated eboot.ld to not fill with zeros through the CS field
on its way to the CRC.
Added size test to elf2bin.py
2020-02-03 09:49:13 -08:00
Earle F. Philhower, III
d0316a13fc
Merge branch 'master' into pr-eboot-cs-fix 2020-02-02 15:18:01 -08:00
StanJ
63b73bf181
add Low-Power demo (#6989)
* add Low-Power demo
2020-02-01 21:57:21 -03:00
ramirocarra
378c1f14c7
Update ESP8266HTTPClient.cpp (#7051)
sendRequest has a major problem when sending a big payload, the comparator in the IF loop has its two operators changed, so the last part of payload is never sent
2020-02-01 20:11:00 -03:00
Dirk Mueller
a2141803f1
Code size optimisation of ESP.getResetReason() (#7029)
* Code size optimisation of ESP.getResetReason()

doing if/else snakes for something that is a switch/case
is wasteful, as it repeatedly evaluates the same if() condition.
Also repeating strcpy_P is adding code bloat.

This simplification reduces size from 111 to 41 bytes.

* add break statement also to default case
2020-01-30 13:07:34 -08:00
M Hightower
fe7faf701e Added dependencies for eboot.ld and Makefile to Makefile.
Updated eboot.ld to not fill with zeros through the CS field
on its way to the CRC.
Added size test to elf2bin.py
2020-01-29 13:26:58 -08:00
liebman
9e9515b49f clear _canReuse in setUrl if its not a local redirect (#7039) 2020-01-28 00:35:16 -03:00
Dirk O. Kaar
bb696dd204 host build: optimistic_yield() wrongly delays() instead of avoiding excessive yields (#6802)
* optimistic_yield is a yield, not a delay, and avoids yielding if last yield has occurred recently enough.

* Suppress an unused argument warning.

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-01-27 16:47:39 -08:00
LeisureLadi
7b0fa3554c Update LEAmDNS.cpp (fix issue #6982) (#7025)
* Update LEAmDNS.cpp (issue #6982)

Check m_pUDPContext before calling functions to reset WiFi event callbacks, stop probing ... to close #6982

* Update LEAmDNS.cpp

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-01-27 16:08:30 -08:00
M Hightower
0c6be9e114 Made changes to include "ESP8266_" with ITEAD board names, {build.board}, (#7024)
as proposed by https://github.com/esp8266/Arduino/pull/6972#issue-358508056.
@ttytyper 's changes have been incorporate into this PR
The build flag ARDUINO_SONOFF_... should now appear as ARDUINO_ESP8266_SONOFF_...
@ttytyper, @mcspr, and @d-a-v thanks!
2020-01-27 14:44:08 -08:00
david gauchard
0989932669
allow ".bin.gz" filter in updater file selector (#7026) 2020-01-26 00:56:46 +01:00
Dirk O. Kaar
baf223c6cb Release 6.7.1 (#7034) 2020-01-25 23:54:32 +01:00
david gauchard
6e37ee36f8
fix CI: switch to python3 for pio (#7035) 2020-01-25 22:55:34 +01:00
Dirk Mueller
158039e414 Reduce mem footprint of ESP.getResetInfo() (#7030)
This function has excessively long datastrings that can
better be stored in flash, reducing runtime memory footprint.

Also detailed formatting only makes sense when there is an
exception or a watchdog. In other cases instead of printing
an unhelpful "flag: 0" we can just return the ResetReason, which
is much more readable.

Saves about 120 bytes of (data) memory.
2020-01-22 06:00:11 -08:00
Earle F. Philhower, III
00440cd84a
Remove memory leak on multiple calls to initCertStore (#7021)
In some cases, `initCertStore` may need to be called multiple times
(i.e. to update certs w/oa reboot).  In that case, the saved file names
leaked when the new ones were `malloc()`'d.

Fix by freeing the old strings, if present.
2020-01-17 10:10:17 -08:00
M Hightower
b930c4c3e6 boards.txt.py: Fix packagegen to use newfilestr instead of filestr when writing file. (#7018)
Three missing boards are now in package/package_esp8266com_index.template.json.
2020-01-17 18:24:47 +01:00
Earle F. Philhower, III
bb6243a17b
Use a python3 script to call python3 (#6960)
* Use a python3 script to call python3

It's odd, but because Windows requires a full Python3 install we must
have an executable called "tools/python3/python3" to use Python3 in the
toolchain.

Before, we simply symlinked to /usr/bin/python3 (for Linux) or
/usr/local/bin/python3 (Mac).  Unfortunately, depending on the method of
installation, on MacOS the Python3 executable can be in /usr/bin/python3
instead.

To avoid the entire issue, unify the Mac and Linux python3 placeholders
to use python3 itself to jump to the real executable.

Fixes #6931

* Explicitly remove old symlink to python3

The tar extraction for the updated python3 tarball will fail on systems
that already have a symlink in /tools/python3/python3 because the tar
extractor attempts to open the *target of the symlink* (i.e. the actual
interpreter in /usr/bin or /usr/local/bin).

Add a commented hack to destroy this symlink before expanding the
tarballs, if the file exists.  This is safe to do since it will be
overwritten by any extractions of the python3 tarball later in the
process.

Co-authored-by: david gauchard <gauchard@laas.fr>
2020-01-14 06:53:17 -08:00
Earle F. Philhower, III
0d38ea7308
Add back mklittlefs for linux32 target (#7011)
Fixes #7006

mklittlefs for 32-bit Linux disappeared from the packages.json.  Looks
like a transient build problem on the older eqt release (later builds
look fine).  Add it back, pointing to the first successful mklittlefs
build for lin32.

Co-authored-by: Develo <deveyes@gmail.com>
2020-01-11 09:16:46 -08:00
Earle F. Philhower, III
677007f481
Define MAX_SERVOS to 12, like original Servo.h (#6999)
Fixes #6997
2020-01-08 20:30:44 -08:00
Earle F. Philhower, III
5bc3079217
Fix Updater potential overflow, add host tests (#6954)
* Fix Updater potential overflow, add host tests

Fixes #4674

The Updater class could, when exactly 4K bytes were in the buffer but
not yet written to flash, allow overwriting data written to it beyond
the passed-in size parameter.

Fix per @jason-but's suggestion, and add a host test (plus minor changes
to Updater code to support host testing).

* Add missed mock file

* Remove most testing ifdefs fro updater

Per @mcspr's suggestion, we can pass in fake link symbols allowing
Updater to take the address of `_FS_start`/etc. even when building on
the host for testing.

There is still a single remaining wifi_set_power_mode ifdef'd and a
duplication of the digitalWrite/pinMode for testing vs. host building.

Co-authored-by: Develo <deveyes@gmail.com>
2020-01-08 17:38:28 -08:00
LaborEtArs
5e537e5783 Updating _port to really used port and made _port accessible (#7003)
* Updating _port to really used port and made _port accessible

* 2. Try
2020-01-08 21:36:39 -03:00
Earle F. Philhower, III
b4d2ab102b
Fix boolean/logical & mixup in LittleFS open (#6996)
To mimic SPIFFs behavior, we automatically create subdirectories when a
file is opened in a subdir.

The check mixed up a bitmask check with a boolean AND.  Fix it.
2020-01-07 10:55:42 -08:00
JasperHorn
8242d72271 Add LittleFS support to ESP8266WebServer.serveStatic() (#6987)
* Remove trailing whitespace

* Improve "is file" check for LittleFS support

The previous implementation was based on a quirk of SPIFFS (that exists
returns false for directories) so it wouldn't work with LittleFS. This
implementation works with both.

Co-authored-by: Develo <deveyes@gmail.com>
2020-01-04 20:33:05 -08:00
Earle F. Philhower, III
d4d89244bd
Add SDFS::Dir::fileTime callback (#6985)
Forgot to add a Dir->fileTime override, resulting in it always returning
(time_t)0, or Jan 1, 1970.

Add the override, returning the proper lastWriteTime.

Fixes #6981
2020-01-04 11:36:47 -08:00
Earle F. Philhower, III
753b5a581a
Update LittleFS to latest upstream head (#6986) 2020-01-04 09:59:06 -08:00
Earle F. Philhower, III
b62d8c7633
Update BearSSL, increase SSL stack (#6980)
Only minor updates to headers and no functionality change on the
portions that we use in the ESP8266.

@Teddyz reported random crashes while running against a local MQTT
server and was able to report stack usages of up to 6136 bytes.
Increase the SSL stack to a little more than that, once again.
2020-01-04 08:18:14 -08:00
Dirk Mueller
de307623b2 Move a couple larger strings from rodata to flash (#6976) 2020-01-02 22:26:08 -03:00
Earle F. Philhower, III
fa5040d5da
Only update LittleFS timestamp when opened write (#6956)
Fixes #6955

LittleFS was updating the timestamp on any close, not only for files
when they were opened for writing.  This could lead to excessive writes
to the flash.

Preserve the LFS flags, and only update the timestamp if the file was
opened for writing.
2019-12-30 15:43:26 -08:00
Earle F. Philhower, III
2492043669
Skip . and .. on LittleFS::dir::rewind() (#6959)
Fixes #6958

To match SPIFFS, we get rid of the "." and ".." dirents when we open a
directory on LittleFS.  Do the same on a rewind().
2019-12-30 14:23:14 -08:00
Dirk Mueller
5d5200af41 Reduce temporary string creation in HTTPClient::sendHeader (#6937)
* Reduce temporary string creation/reallocation in HTTPClient

This improves both performance due to fewer memory allocations/copies
as well as reduces code size by ~ 25% (150 bytes)

* Add more correct reservation calculation

Co-authored-by: Develo <deveyes@gmail.com>
2019-12-28 19:48:47 -08:00
StanJ
3197d2ac4e Issue2524 allow clocks below 100KHz (#6934)
* change bus clock (busywait) to be programmable [issue 2524], remove unused slave STOP function

* change bus clock (busywait) to be programmable [issue 2524], remove unused slave STOP function

* change bus clock (busywait) to be programmable [issue 2524], remove unused slave STOP function

* correct for underflow < 233Hz

* change bus clock (busywait) to be programmable [issue 2524], convert tabs to spaces

* updated minimum I2C speed for calculated bus clock
2019-12-28 19:07:38 -03:00
Dirk O. Kaar
809e5c967a EspSoftwareSerial, release 6.6.1 (#6943)
* Bug fixes to EspSoftwareSerial, release 6.6.0

Various improvements to the Delegate class template.
Memory footprint reduction of SoftwareSerial instances based on 3rd party contribution by @dirkmueller

* Bug fix EspSoftwareSerial, delegate template programming for > 3 platforms is interesting.

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
Co-authored-by: Develo <deveyes@gmail.com>
2019-12-28 13:26:38 -08:00
Dirk Mueller
bea9cfc3a0 PROGMEM footprint cleanup for responseCodeToString (#6950)
* PROGMEM footprint cleanup for responseCodeToString

Doing returns with String/FlashStringHelper conversion for every
case means that the code for doing that is duplicated, which
is wasteful. doing it only once saves about 250 bytes (50%) of
code size.

* Remove "I'm a teapot" error code

* Add inline code comment to explain rationale
2019-12-27 19:02:57 -03:00
Dirk Mueller
698ffc3498 Various String handling cleanups (#6945)
Use the proper api (::clear(), isEmpty()) instead of doing
comparisons/assignments of empty strings. Also fix mixture
of tabs and spaces in the source code.
2019-12-26 17:03:18 -03:00
Dirk Mueller
6c2ab25087 Code size optimisations for ESP.getFullVersion() (#6936)
This saves about ~ 60 bytes of flash usage (50% reduction of
the total function size)
2019-12-23 17:52:16 -08:00
Dirk O. Kaar
99aeeadb4d EspSoftwareSerial 6.5.4 (#6932) 2019-12-21 08:24:13 -08:00
M Hightower
30bfdad458 Added missing "if (umm_heap == NULL) {..." to umm_free_heap_size_lw (#6929)
also called through xPortGetFreeHeapSize, umm_free_heap_size, ...

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2019-12-20 15:45:16 -08:00
Earle F. Philhower, III
52d84b1ead
Add a CRC32 over progmem and ESP.checkFlashCRC (#6566)
* Add a CRC32 over progmem and ESP.checkFlashCRC

Automatically embed a CRC32 of the program memory (including bootloader
but excluding any filesystems) in all images in unused space in the
bootloader block.

Add a call, ESP.checkFlashCRC() which returns false if the calculated
CRC doesn't match the one stored in the image (i.e. flash corruption).

Fixes #4165

* Add example that corrupts itself, comments

Show CRC checking catch a 1-bit error in program code by corrupting a
large array, and then return it to clean and verify the CRC matches once
again.

Add comments to the CRC check routine

Clean up pylint complaints on crc32bin.py

* Check linker script for CRC space in bootsector

Add an assertion in the eboot linker file to guarantee that we have at
least 8 bytes of unused space at the end of the boot sector to patch in
the CRC.  If not, the eboot link will fail.

* Add note about what to do if CRC check fails

Per discussion with @d-a-v.

When the CRC check fails, you could *try* to do certain things (but may
not succeed since there is known flash corruption at that point).  List
a few ideas for application authors.

* Only single, flash/ram friendly crc32() function

* Combine the CRC calc and bin generation in 1 step

Per discussion w/@mcspr, combine the CRC calculation with the binary
generation, removing the additional build step.
2019-12-20 14:38:35 -08:00
Earle F. Philhower, III
9985a32914
Add documentation for compressed OTA, fix bug (#6924)
* Add documentation for compressed OTA, fix bug

Fixes #6923

Documents the user steps needed to do a compressed upload, and notes the
2-step process needed for deploying compressed uploads to the field for
the first time.

Fixes a bug in serial output formatting discovered by @AdrianEddy.

Adds additional contributors for uzlib, per @pfalcon.

* Update README for esptool.py, too
2019-12-20 09:22:10 -08:00
Dirk O. Kaar
622baa1659 Bug-fix release EspSoftwareSerial 6.5.3 (#6922)
* EspSoftwareSerial 6.5.0 public release.

* EspSoftwareSerial bug fix public release 6.5.1

* Release 6.5.2, examples changed only, simplified adding WiFi setup etc. by moving logger setup up to the front.

* Parity bug fix: Overflow condition caused data and parity to get out of sync permanently.
2019-12-20 15:37:40 +01:00