Fixes#6984
When a directory index is requested with an explicit index.html, follow
the original webserver order and check for: index.htm, index.htm.gz,
index.html, index.html.gz, in order.
Fixes the regressions introduced in 9f2cfb8 and 6768116
Fixes#7043
Two slightly different custom routines were implemented by hand in
dtostrf (an AVR-lib non-ISO function) and Print. This resulted in
inconsistent output of float/double vars when rounding was needed.
Replace them all with a call to sprintf(), removing the duplicated, not
quite correct code.
Print(String(float)) and Print(float) now generate the same output.
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
* 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
* 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>
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!
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.
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.
* 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>
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>
* 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>
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.
* 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>
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
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.
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.