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

39 Commits

Author SHA1 Message Date
Earle F. Philhower, III
9632e868d5
Fix espota completion success/fail check (#7204)
The OTA script was not reporting the actual reported upload status from
the ESP8266, and instead always printed "Result: OK" no matter what
happened.

Now check for ERROR or OK in final message (and ensure the message is
not accidentally merged with the final byte count) and report properly.

Fixes #7162
2020-04-16 15:15:00 -07: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
david gauchard
8ec93dcd26 use wificlient.available() where relevant (#6827) 2019-11-23 20:12:37 -03:00
Dirk Mueller
8bc5a10d6d Further const correctness / String by reference passing cleanups (#6571)
There are actually several instances where we pass in read-only
parameters as pass-by-value, where in the case of String() that
is inefficient as it involves copy-constructor/temp string creations.

We can avoid that, similarly to single character string concatenations
done via string literals instead of char literals.
2019-10-31 16:02:39 +01:00
thangktran
f78ab66f89 libraries: fixed no "OK" ACK for Signed Update (#6351) 2019-08-01 14:00:49 +02:00
Earle F. Philhower, III
a389a995fb Add LittleFS as an optional filesystem, API compatible w/SPIFFS (but not on-flash-format compatible) (#5511)
* Add LittleFS as internal flash filesystem

Adds a LittleFS object which uses the ARMmbed littlefs embedded filesystem,
https://github.com/ARMmbed/littlefs, to enable a new filesystem for onboard
flash utilizing the exact same API as the existing SPIFFS filesystem.

LittleFS is built for low memory systems that are subject to random power
losses, is actively supported by the ARMmbed community, supports directories,
and seems to be much faster in the large-ish read-mostly applications I use.

LittleFS, however, has a larger minimum file allocation unit and does not do
static wear levelling.  This means that for systems that need many little
files (<4K), have small SPIFFS areas (64K), or which have a large static
set of files covering the majority of flash coupled with a frequently
updated set of other files, it may not perform as well.

Simply replace SPIFFS.begin() with LittleFS.begin() in your sketch,
use LittleFS.open in place of SPIFFS.open to open files, and everything
else just works thanks to the magic of @igrr's File base class.

**LITTLEFS FLASH LAYOUT IS INCOMPATIBLE WITH SPIFFS**
Since it is a completely different filesystem, you will need to reformat
your flash (and lose any data therein) to use it. Tools to build the
flash filesystem and upload are at
https://github.com/earlephilhower/arduino-esp8266littlefs-plugin and
https://github.com/earlephilhower/mklittlefs/ .  The mklittlefs tool
is installed as part of the Arduino platform installation, automatically.

The included example shows a contrived read-mostly example and
demonstrates how the same calls work on either SPIFFS.* or LittleFS.*
Host tests are also included as part of CI.

Directories are fully supported in LittleFS. This means that LittleFS
will have a slight difference vs. SPIFFS when you use
LittleFS.openDir()/Dir.next().  On SPIFFS dir.next()
will return all filesystem entries, including ones in "subdirs"
(because in SPIFFS there are no subdirs and "/" is the same as any
other character in a filename).

On LittleFS, dir.next() will only return entries in the directory
specified, not subdirs.  So to list files in "/subdir/..." you need
to actually openDir("/subdir") and use Dir.next() to parse through
just those elements.  The returned filenames also only have the
filename returned, not full paths.  So on a FS with "/a/1", "/a/2"
when you do openDir("/a"); dir.next().getName(); you get "1" and "2"
and not "/a/1" and "/a/2" like in SPIFFS.  This is consistent with
POSIX ideas about reading directories and more natural for a FS.

Most code will not be affected by this, but if you depend on
openDir/Dir.next() you need to be aware of it.

Corresponding ::mkdir, ::rmdir, ::isDirectory, ::isFile,
::openNextFile, and ::rewind methods added to Filesystem objects.
Documentation has been updated with this and other LittleFS information.

Subdirectories are made silently when they do not exist when you
try and create a file in a subdir.  They are silently removed when
the last file in them is deleted.  This is consistent with what
SPIFFS does but is obviously not normal POSIX behavior.  Since there
has never been a "FS.mkdir()" method this is the only way to be
compatible with legacy SPIFFS code.

SPIFFS code has been refactored to pull out common flash_hal_* ops
and placed in its own namespace, like LittleFS.

* Fix up merge blank line issue

* Merge in the FSConfig changs from SDFS PR

Enable setConfig for LittleFS as well plys merge the SPIFFS changes
done in the SDFS PR.

* Fix merge errors

* Update to use v2-alpha branch

The V2-alpha branch supports small file optimizations which can help
increase the utilization of flash when small files are prevalent.
It also adds support for metadata, which means we can start adding
things like file creation times, if desired (not yet).

* V2 of littlefs is now in upstream/master

* Update test to support non-creation-ordered files

In a directory, the order in which "readNextFile()" will return a name
is undefined.  SPIFFS may return it in order, but LittleFS does not as
of V2.  Update the test to look for files by name when doing
readNextFile() testing.

* Fix LittleFS.truncate implementation

* Fix SDFS tests

SDFS, SPIFFS, and LittleFS now all share the same common set of tests,
greatly increasing the SDFS test coverage.

* Update to point to mklittlefs v2

Upgrade mklittlefs to V2 format support

* Remove extra FS::write(const char *s) method

This was removed in #5861 and erroneously re-introduced here.

* Minimize spurious differences from master

* Dramatically reduce memory usage

Reduce the program and read chunk sizes which impacts performance
minimally but reduces per-file RAM usage of 16KB to <1KB.

* Add @d-a-v's host emulation for LittleFS

* Fix SW Serial library version

* Fix free space reporting

Thanks to @TD-er for discovering the issue

* Update littlefs to latest upstream

* Remove sdfat version included by accident

* Update SDFAT to include MOCK changes required

* Update to include SD.h test of file append
2019-05-25 09:53:24 +02:00
Allman-astyler
eea9999dc5 Revert "Allman now (#6080)" (#6090)
This reverts commit 98125f88605cd7e46e9be4e1b3ad0600dd5d2b51.
2019-05-14 00:09:54 +02:00
Allman-astyler
98125f8860 Allman now (#6080)
* switch restyle script for CI

* remove confirmation

* restyle with allman
2019-05-13 16:41:34 +02:00
Clemens Kirchgatterer
e721089e60 Fix hardcoded dependency of ArduinoOTA on mDNS (#5768)
Fixes #4643 

This is especially important when compiling for host mode, because ArduinoOTA is pulled in unconditionally by the Makefile in tests/host. Thus it breaks the build as soon as NO_GLOBAL_INSTANCES or NO_GLOBAL_MDNS is defined.
2019-02-16 10:44:43 -03:00
Develo
e9d052c621
WIP - Update ArduinoOTA and examples with MDNS.update() calls (#5494)
* ArduinoOTA: allow use without MDNS, add MDNS.update() in handle()

* Update examples with MDNS.update() in loop

* Update CaptivePortalAdvanced.ino

Fix typo

* Update CaptivePortalAdvanced.ino

astyle

* Update Arduino_Wifi_AVRISP.ino

astyle
2018-12-14 03:29:32 -03:00
david gauchard
5c4db3acf4
IPv6 on esp8266-nonos-sdk and arduino (#5136) 2018-11-27 23:07:47 +01:00
david gauchard
83a8076db8 ClientContext (tcp) updates (#5089)
* +sync, get/set default nodelay, sync

* default nodelay=1

* update flush()

* fix return value

* ClientContext: put things together

* ClientContext: fix debugging messages

* WiFiClient: move static members out of the class, add comments

* remove circular dependency

* parameter and return value for Client::flush&stop, flush timeout raised to 300ms

* tcp flush: restart timer on ack receive

* OTA protocol needs setNoDelay(true)

* fix Ethernet with Client changes

* 1 line unredable -> 5 lines readable code

* doc

* Update client-class.rst

* Added details for getters
2018-09-25 10:47:27 -03:00
Mike Killewald
fb7c519856 small fix to stop crash on unrecognized packets (#4092) 2018-01-04 20:10:46 -03:00
ZaPpInG
a19ff3517e Update ArduinoOTA.cpp to solve #4086 (#4090)
* Update ArduinoOTA.cpp

* Update ArduinoOTA.cpp
2018-01-04 18:48:56 -03:00
yoursunny
d9ef6b5f18 ArduinoOTA: don't crash on unrecognized packets (#4086)
* ArduinoOTA: handle end of packet in readStringUntil

fixes #3912

* ArduinoOTA: fix buffer overflow in parseInt

fixes #3912
2018-01-04 00:14:32 -03:00
Alessio Leoncini
03f1a540ca Added constant time string comparison to avoid possible time-based attacks. (#3836)
* Added constant time strings comparison to avoid possible time-based attacks

* Fixed data types

* Fixed indentation

* Moved string comnparison in constant time to String class; modified function body to assure constant time comparison despite compiler optimizations

* Removed wrong code

* Fixed error and prevented compiler optimization to delete u1 local variable

* Avoid timing attacks on string comparison

* Minor

* changed counter names, removed else
2017-11-21 01:56:05 -03:00
Ivan Grokhotkov
03baea27ef ArduinoOTA: forward errors from Update.begin to espota.py
If Update.begin fails, instead of printing “No response from device”,
espota.py will print the actual error message from the Updater.
2017-05-09 06:17:06 -05:00
Me No Dev
889775c6fe ArduinoOTA optimizations (#2445)
- Added option to control if the ESP should be rebooted on success
- Added delay before ESP.restart() is called
- Added some comments to the header
2016-08-27 18:32:26 +03:00
Clemens Kirchgatterer
18297458be allows global object instances be switch off with defines (#2344) 2016-08-01 11:21:50 +08:00
Me No Dev
e83f30a78d Ota hashed password (#2292)
* Add option to give ArduinoOTA a hashed value of the password

hashed password can be safely stored on flash

* Switch to separate method to accept the hash

* Calculate the hash of plain passwords at setup

* missed line

* Remove underscores from local variable
2016-07-18 19:28:56 +08:00
andig
c4f9f102ce Add getCommand() api for OTA update type (#2259) 2016-07-15 11:03:34 +03:00
NullMedia
d60d744b59 ArduinoOTA library change (#2013)
* Fixed callbacks to allow lambda capture

* Update ArduinoOTA.cpp

* Fixed callbacks to allow lambda capture

* Fixed callbacks to allow lambda capture

* Update ArduinoOTA.h

* Tests update

Update ArduinoOTA.h

Fixed callbacks to allow lambda capture

* Modified callbacks to enable lambda capture

* Modified callbacks to enable lambda capture
2016-06-01 11:10:29 +08:00
Yuichi Tateno
cffdd55759 Add ArduinoOTA::getHostname() interface 2016-05-22 18:17:23 +09:00
Me No Dev
bfe9f7be69 Update and move lwIP headers, add options to use different lwIP build for generic device
Makefile added to lwip source folder to build and install liblwip_gcc.a
2016-04-10 21:55:22 +03:00
Markus Sattler
137c50757e add OTA debug level 2016-01-02 13:27:21 +01:00
Stavros Korokithakis
e9f2f1c989 Fix typo. 2015-11-28 16:37:36 +02:00
Me No Dev
a44632b8cf make compiler happier 2015-11-25 18:11:16 +02:00
Me No Dev
fe9dc913b4 unref udp if exists 2015-11-21 21:14:11 +02:00
Me No Dev
d2982d3555 Make ArduinoOTA AUTH async
still up to the user to call ArduinoOTA.handle() to start the upload
2015-11-19 22:49:40 +02:00
Me No Dev
0213dc34ff Skip authentication when password is empty
should have been changed when turned in String
2015-11-12 03:09:04 +02:00
Me No Dev
18f0a9999a add progress option for espota.py and fix typo in ArduinoOTA 2015-11-11 23:23:25 +02:00
Ivan Grokhotkov
92069e657b Replace some manually managed buffers with Strings, fix code style 2015-11-11 01:07:02 +03:00
Me No Dev
950e9c9522 Let the socket to properly close
python was keeping the connection open and sending duplicate FINs until
the ESP came back online, because the ESP was resetting without giving
the network a chance to answer and close
2015-11-09 02:38:20 +02:00
Me No Dev
13b8cc0a27 Add sanity check so we do not trigger an update from wrong data 2015-11-09 01:47:51 +02:00
Me No Dev
a8976a01fd Add MD5 to core, Fix OTA examples and Digest Authentication to OTA and espota.py 2015-11-09 00:42:30 +02:00
sticilface
0c9892fd24 Update ArduinoOTA.cpp
my bad
2015-11-04 21:38:00 +00:00
sticilface
46658593b0 Update ArduinoOTA.cpp
Restarts the UDP port if it becomes disconnected. Works when for example the wifi is disconnected and reconnected
2015-11-03 19:57:57 +00:00
Pascal Gollor
c773140a5b use ArduinoOTA class in OTA-mDNS.SPIFFS example 2015-10-22 16:43:00 +02:00
Miguel Angel Ajo
6978b6a777 OTA support encapsulated to ArduinoOTA class 2015-10-12 10:29:18 +02:00