Commit Graph

616 Commits

Author SHA1 Message Date
Frank
3968821834
HttpClient uses Serial.printf() (#4488)
changed to log_d()
2020-11-04 14:49:33 +02:00
Frank
90f869e772
Fix BUG: Parsing of first line fails (#4484)
..because a firstLine = false; is missing ;)
2020-11-04 02:24:01 +02:00
Me No Dev
22b427df0f
IDF release/v3.3 (#3672)
ESP-IDF release/v3.3: 66d3783c8
esp-face: 420fc7e
esp32-camera: 0107093
2020-11-03 21:20:00 +02:00
lbernstone
e2452c0dfc
Added isKey method to Preferences (#4441)
Checks to see if a string is a key in the namespace. 

Fixes #4440
2020-11-03 17:03:04 +02:00
Mark D
56a7ae8712
Trailing spaces (#3738)
* fix typo in WiFiMulti

* clean up trailing spaces

* clean up script file used in cleaning

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-11-02 22:11:26 +02:00
Denys Fedoryshchenko
e4b008e712
Handle stream timeouts properly, for slow HTTP/HTTPS links (#3752)
This patch fixes update timeouts (error #6) on slow HTTP/HTTPS links.
2020-11-02 22:01:27 +02:00
saknarak
dccb4e8608
improve & fix BLEScan when wantDuplicates (#3995)
* improve & fix BLEScan when too many BLE devices
- when wantDuplicates, no need to check duplicate and no more insert into vector
- delete advertisedDevice when not insert into vector, fix memory leak
- add showParse when you just want raw advertised data
2020-11-02 20:41:50 +02:00
Ivorius
0e341a6192
Add sdkconfig option CONFIG_ARDUINO_UDP_TASK_PRIORITY, which sets the task priority for the UDP vtask." (#4131) 2020-11-02 20:21:59 +02:00
buxtronix
76cd2e2375
Fix BLE connection handling (#4137)
Remove device from Peer list if connection fails.

Only call onConnect callback if connection was successful.

Only call onDisconnect callback if the connection was previously connected (ESP_GATTC_DISCONNECT_EVT is fired on a unsuccessful connection attempt also).

Resolves a number of issues with phantom events and callbacks being fired.
2020-11-02 20:20:40 +02:00
buxtronix
9f7ff009c6
Fix parameter to BLEDevice::updatePeerDevice (#4133)
::addPeerDevice and ::removePeerDevice are called with m_appId, so should ::updatePeerDevice as all use the same parameter for the underlying map's key.
2020-11-02 20:20:16 +02:00
Me No Dev
704b71dabe
Fix header parsing
fixes #4454

closes #4455
2020-11-02 20:10:22 +02:00
Ernst Sikora
7c0572172c
Fix for issue #4158: BLEAdvertising - Crash with stack trace originating in Bluedroid (#4182)
* Fix for issue #4158: Crash with stack trace originating in Bluedroid
Improved configuration of scan response data in 'BLEAdvertising' avoids the crash:
- Added member variable 'm_scanRespData' to configure scan response differently from advertising data
- Initialization of 'm_scanRespData' in BLEAdvertising constructor
- Use of 'm_scanRespData' within BLEAdvertising::start() to configure the scan response
- 'Flags' and 'Appearance' are cleared in the scan response data
- With this fix, device names of up to 29 characters can be used without causing a crash.
2020-11-02 19:39:20 +02:00
Niklas Mollenhauer
f57c36782f
Add sendContent overload that takes a const char* and a length (#4276)
The web server currently lacks the ability to send a buffer. Only strings are supported.

This PR adds an overload to sendContent.
2020-11-02 19:17:02 +02:00
Hristo Kapanakov
3054bdf5a5
HTTPUpdateServer library (#4244) 2020-11-02 19:16:23 +02:00
Ivan Golubic
d6b91872cb
Fix for espressif#3460 issue (#4424)
Fixes: #3460

This code has been run in production for 1 month and it looks stable, no data dropped and it definitely fixes the issue described. I think that this can be merged to avoid using custom package referencing in PlatformIO that has been used in quite a few projects for now.

Co-authored-by: Ivan Golubic <ivan@mvt-solutions.com>
2020-11-02 18:59:03 +02:00
Me No Dev
d6b383f84b
Merge pull request #4429 from Bmooij/feature/Add_flash_helper_constructor_to_Uri
Add flash helper constructor to Uri
2020-11-02 18:56:08 +02:00
thewavelength
cadbad8850
Add partition label argument to Update and ArduinoOTA classThe UpdateClass in the Updater component has the ability to update data toa SPIFFS partition. It selects the first available partition using theESP-IDF esp_partition_find_first() function.That behaviour is problematic if one has multiple SPIFFS partitions.This change allows a user to pass the label argument (defaults to NULL)to UpdateClass::begin() so a specific SPIFFS partition can be updated.Additionally, ArduinoOTA can set this partition label using thenew method ArduinoOTAClass::setPartitionLabel which is optional.This change does not break compatibility. (#4442)
The UpdateClass in the Updater component has the ability to update data to
a SPIFFS partition. It selects the first available partition using the
ESP-IDF esp_partition_find_first() function.
That behaviour is problematic if one has multiple SPIFFS partitions.

This change allows a user to pass the label argument (defaults to NULL)
to UpdateClass::begin() so a specific SPIFFS partition can be updated.

Additionally, ArduinoOTA can set this partition label using the
new method ArduinoOTAClass::setPartitionLabel which is optional.

This change does not break compatibility.
2020-11-02 18:49:24 +02:00
thewavelength
3cbfa2ffef
Add partition label argument to SPIFFS (#4443)
* Add partition label argument to SPIFFSSPIFFS currently assumes there is only ever one partition.This change allows a user to pass the label argument (defaults to NULL)to SPIFFS::begin() so a specific SPIFFS partition can be referenced.This change does not break compatibility.
2020-11-02 18:47:36 +02:00
Jimmy Durand Wesolowski
360e04fa36
Fixing BLE GATT Characteristic notification and Characteristic Descriptor read (#4464)
* BLERemoteChar: fix descriptor 2902 write for characteristic notifications

When registering a notification on a characteristic, the 2902 descriptor
(CCCD) value is set to 1 (or 2 for indication).
According to the BLUETOOTH CORE SPECIFICATION Version 5.2, Revision Date
2019-12-31, section 4.12.3 "Write Characteristic Descriptors" (page 1588),
the characteristic descriptor write must expect a response.
Currently, the descriptor write is performed without expecting a reponse,
which prevents the notification to be functional with some BLE stacks.
This commit modify the write to expect the response.

Signed-off-by: Jimmy Durand Wesolowski <jimmy.durand.wesolowski@commsolid.com>

* BLERemoteChar: forward GATT client event to characteristic descriptors

This commits prevents a permanent wait when calling BLERemoteDescriptor
readValue function, on the m_semaphoreReadDescrEvt semaphore.

ESP32 BLE stack calls to remote characteristic
- notification,
- value read
- value write
and remote characteristic descriptor
- value read
are asynchronous.

When such a call is performed by this library, a semaphore is taken prior
to the BLE stack read or write operation, and waited on after it.

Releasing the semaphore is done by the characteristic event handling
function (gattClientEventHandler), when the appropriate event is received.

However, the characteristic descriptor events are discarded, and the
value read semaphore is never released.

This commits forwards the GATT client events from the remote
characteristic down to their remote characteristic descriptor, and
implements their event handling.

Adding a semaphore for the remote characteristic descriptor value write
will be done in a separate commit.

Signed-off-by: Jimmy Durand Wesolowski <jimmy.durand.wesolowski@commsolid.com>

* BLERemoteDescriptor: add semaphore to characteristic descriptor write

This adds a semaphore to characteristic descriptor value write, to mimic
the value read function, and to ensure completion of the operation before
we carry on.

Signed-off-by: Jimmy Durand Wesolowski <jimmy.durand.wesolowski@commsolid.com>

Co-authored-by: Jimmy Durand Wesolowski <jimmy.durand.wesolowski@commsolid.com>
2020-11-02 18:36:25 +02:00
Muhammad Mobashir
57145ade6f
Small description comment correction (#4471)
esp8266 --> esp32
2020-11-02 18:35:23 +02:00
snosrap
f39024675c
Don't convert to null-terminated string prior to writeValue (#4473)
fixes: #4472
2020-11-02 18:34:57 +02:00
JelleWho
f7fb00632e
#4293 added missing '<tr>' (#4450)
Fixes issue #4293
2020-10-27 15:35:54 +02:00
M Hotchin
7e40de226f
Fixes #4435 - WiFiClient improperly treats zero data available for read as an error (#4448) 2020-10-27 12:01:41 +02:00
Bob Mooij
ae240a3902 Add flash helper constructor to Uri 2020-10-19 16:20:49 +02:00
Dirk-Willem van Gulik
d79a1f3d10
Add an aditional (void *) arg to the RMT callback (much like Ticker() et.al.). (#3345)
* Add an aditional (void *) arg to the RMT callback - to allow more flexible handling of the callback (e.g. by passing a private struct or a class pointer). Same pattern as used by the Ticker() and many others. Example updated & new example with a trapoline added.

* Fix example for new API

* Fix lint warnings

* Add a second missed example.

* Correct timeout & improve socket error handling.
2020-10-14 14:41:50 +03:00
Dan Oprescu
ee3bb16c77
Fix support for following redirects added by ee88c42c3b (#4240) (#4385) 2020-10-14 14:32:47 +03:00
programminghoch10
c3f3497048
fixed some typos (#4395) 2020-10-14 14:27:49 +03:00
programminghoch10
18c3345451
fix typos in WiFiSTA.cpp (#4396)
* fix typos

* made return value description a bit more helpful
2020-10-14 14:27:19 +03:00
Vo Linh Truc
2685a5dd7b
Certificate isn't be free in case parse failure. (#4412)
I met problem while I was working with the WiFiClientSecure.
I tried to found the source of the problem, and I found it in the sll_client.cpp.
Please check my contribution.

I've open this problem in #4335 but received no response.
2020-10-14 14:25:26 +03:00
TANAKA Masayuki
675a40b257
Fix Not by reference. But the value was updated. (#3279) 2020-10-03 03:41:03 +03:00
Shawn A
f76ec4f50b
adds debugging to dnsserver (#1046) 2020-10-03 02:59:55 +03:00
sasodoma
219ff3005b
Add missing slashes in HTTPUpdate examples (#4238)
I spent quite a while today figuring out how to get an OTA update over HTTPS on a custom port working. A part of my problem was not putting a slash before the .bin filename, since it wasn't there in the example. This produced invalid HTTP requests. Adding the slash would make it clear that it needs to be there.

Given that the URL in line 53 contains the same words "server" and "file.bin", one might assume that in line 55, the slash after the port number would get added automatically, however I have found out that without a slash you get an invalid request. Adding the slash removes any doubt.
2020-10-03 02:13:27 +03:00
thebigpotatoe
99aa866477
Update MDNSResponder::addService to return a boolean (#4365)
I was playing with the mDNS service and noticed the method MDNSResponder::addService could return a Boolean with the way it is implemented just like other functions in this library.

This would be handy to know at a higher level weather or not the service was added correctly to the mDNS server of the ESP32.
2020-10-01 15:44:24 +03:00
Jens Hauke
82670b96f8
Fix for missed scan response data (BLEScan). (#4358)
This is a fix for missing scan responses after a first successfull scan.

While running the BLE_scan.ino sketch with wantDuplicates=false, i got
only one result with correct advertising and scan response length (31,26):

pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks(), false);
pBLEScan->start(scanTime, false);
...
[W][BLEScan.cpp:109] handleGAPEvent(): bytes length: 31 + 26, addr type: 1

All following calls to start() just returned the advertising data without
scan response data:

pBLEScan->start(scanTime, false);
[W][BLEScan.cpp:109] handleGAPEvent(): bytes length: 31 + 0, addr type: 1

With "wantDuplicates=true" i got:

pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks(), true);
pBLEScan->start(scanTime, false);
[W][BLEScan.cpp:109] handleGAPEvent(): bytes length: 31 + 26, addr type: 1
[W][BLEScan.cpp:109] handleGAPEvent(): bytes length: 31 + 26, addr type: 1
[W][BLEScan.cpp:73] handleGAPEvent(): ESP_GAP_SEARCH_INQ_CMPL_EVT
Devices found: 1
Scan done!
pBLEScan->start(scanTime, false);
[W][BLEScan.cpp:109] handleGAPEvent(): bytes length: 31 + 0, addr type: 1
[W][BLEScan.cpp:109] handleGAPEvent(): bytes length: 0 + 26, addr type: 1
[W][BLEScan.cpp:109] handleGAPEvent(): bytes length: 31 + 0, addr type: 1
[W][BLEScan.cpp:109] handleGAPEvent(): bytes length: 0 + 26, addr type: 1

Explicitly initializing m_scan_params.scan_duplicate of BLEScan solves
this issue (In my case the un-initialized value was
m_scan_params.scan_duplicate == 1073599044).

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-10-01 15:43:30 +03:00
lbernstone
9e7b13e46d
WebServer.handleClient delay (#4350)
* If WebServer.handleClient is run in a tight loop, it will starve other processes.  So, if there is no connection, throw in a delay(1).  Fixes #4348

* Made a variable to control the delay behavior
2020-10-01 15:42:23 +03:00
Tom Davis
1f4491f4ee
Updated AzureIoT submodule. (#4322) 2020-10-01 15:38:56 +03:00
wadim
aa529eb5a0
Fix getString() freeze on empty responses (#4317) 2020-10-01 15:36:23 +03:00
lbernstone
99c94bb482
Set SD state to idle before unregister (reduces power) (#4272) 2020-10-01 15:31:16 +03:00
Cristian Popescu
0957776855
Reinit updater md5 related fields (#4260)
MD5 cleanup on begin
Typos
2020-10-01 15:29:58 +03:00
Clickau
ee88c42c3b
Add support for following redirects in HTTPClient (#4240) 2020-10-01 14:41:54 +03:00
nicolaser15
663effa00e
Update Parsing.cpp (#4217)
* Update Parsing.cpp

When uploading TLS cert files the end of file "-----END CERTIFICATE-----" (or any kind of file with the sequence "CRLF--") is taken as posible end boundary. Then it is compared to the start boundary string. As it is expected, comparison turns to be false, and the whole end boundary string is put to _currentUpload->buf through _uploadWriteByte(). Here you have the problem: if you read boundary.length() bytes from HTTP request and you have some of the actual end boundary bytes in it, when you put all those bytes into _currentUpload->buf you are making a mistake. You will miss the actual end boundary string because some of those bytes were put in _currentUpload->buf.

* Update Parsing.cpp
2020-10-01 14:37:59 +03:00
lbernstone
882b12c44e
rmdir causes issues in SPIFFS. Fixes #4138, albeit not very cleanly (#4154)
SPIFFS causes crashes if you attempt to rmdir. Since there are no true directories in spiffs, this ought to be a noop. It looks like @me-no-dev worked around this by using unlink instead of rmdir, which works in fatfs and doesn't panic spiffs. This behavior is not universal. In order to get littlefs working, it would be good to get this back to conformity. Rather than digging deep into the upstream spiffs, I just check the mountpoint and noop if it is "/spiffs". So, if the user has changed the mountpoint, this will not work, but I think it's a pretty good tradeoff.
2020-10-01 13:52:24 +03:00
Dan Head
93d850f783
Fixed comment with correct FQDN (#4152) 2020-10-01 13:51:36 +03:00
buxtronix
4f48caca2c
Set scan_duplicate in BLE scan params (#4126)
This value is uninitialised and as such can be a random (and invalid) value. It's needs to be set per the espressif documentation here:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/bluetooth/esp_gap_ble.html#_CPPv4N21esp_ble_scan_params_t14scan_duplicateE

This PR sets it to DUPLICATE_DISABLE. Chosen as this is needed to ensure all scan data is populated in the scan callback, per this comment in the IDF:

https://github.com/espressif/esp-idf/blob/master/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c#L3591

"//if scan duplicate is enabled, the adv packet without scan response is allowed to report to higher layer"

We **don't** want it to report to the higher layer (ie BLEScan.cpp) **unless** it has the active scan response.

Seems to resolve #3770 #3677 and possibly others.
2020-10-01 13:45:45 +03:00
Nikos Mouratidis
80e9e42c3b
Fix issue #3522 (WiFi does not restart after stopped) (#4114)
This commit fixes issue https://github.com/espressif/arduino-esp32/issues/3522 where WiFi service fails to start after a WiFi.disconnect(true) or a WiFi.mode(WIFI_OFF).
2020-09-30 15:34:10 +03:00
Emil Sandstø
494061af26
WebServer: Fix OOB write (#4088)
Successful exploitation could lead to arbitrary code execution.

The bug can be reproduced by running the following in a browser:
```
const formData = new FormData();
for (let i = 0;i < 33;++i) { formData.append("foo", i.toString()); }
await fetch("http://esp.local", { method: 'POST', body: formData });
```
2020-09-30 15:28:28 +03:00
Kevin Hester
2fd3d042b2
Fix #4046 Details below: (#4086)
Informed by the discussion in the bug and the code in 'that other branch'
the fix was clear.  Just set a flag if we start handling a write, and
use that flag to guard the long write complete call.
2020-09-30 15:27:35 +03:00
ToXIc
b551310c37
Minor change but could confuse some (#4084) 2020-09-30 15:26:38 +03:00
lbernstone
f30edd040e
Update CaptivePortal.ino (#4080)
* Update CaptivePortal.ino

Illegal SSID used for SoftAP

* Fixed ordering problem.  Now actually works
2020-09-30 15:26:15 +03:00
chegewara
b7c5e502e7
Add static pin support (#4078) 2020-09-30 15:25:42 +03:00
M. Betz
fa8a1c38d5
fix #4071 (#4072)
SPIFFS File object evaluates as true even if the file could not be opened.
2020-09-30 15:24:59 +03:00
cweinhofer
d56267bd8c
Update GetChipID.ino (#4070)
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-09-30 15:24:29 +03:00
buxtronix
1f6b0b35f8
Have BLECLient gattc event handlers verify conn_id (#4064)
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-09-30 15:21:59 +03:00
buxtronix
342b9cf2d8
Fix handling of registerForNotify in BLERemoteCharacteristic.cpp (#4063) 2020-09-30 15:20:28 +03:00
pulquero
11d071b1c8
Fix to allow more than one certificate to be loaded (espressif#3248). (#4056)
Co-authored-by: Mark Hale <mark.hale@physics.org>
2020-09-30 15:19:41 +03:00
Bascy
c1a7198e7d
Don't change owner if take() doesnt succeed (#3987) 2020-09-30 15:15:47 +03:00
lbernstone
19ccc479c3
WIFI_PS_MAX_MODEM feature requested #3896 (#3900) 2020-09-30 15:06:58 +03:00
robertpoll
c18d50cb91
Use esp_partition_* functions in Updater.cpp (#3898)
Background

The current implementation of Update() uses the spi_flash_* api to write and read from flash. These functions ignore the partition->encrypted flag and always write raw data to flash even if the partition is marked as encrypted.

Changes in this PR

Update() now uses the esp_partition_* api.
Wrapper functions for esp_partition_* added to ESP.cpp. This was done to maintain a consistent approach to the way the spi_flash_* functions were used. I note though that not all of the esp-idf functions are used are wrapped, for example esp_ota_get_next_update_partition() so it may be that these should not be added?
The current implementation of Update() changes the first (magic) byte of firmware to 0xFF on write, and then when the firmware is completely written changes it back to ESP_IMAGE_HEADER_MAGIC. This works without erasing the sector because flash bits can be changed from 1->0 (but not 0->1). If the flash is encrypted then the actual data written to flash will not be all ones, so this approach will not work. In addition, encrypted flash must be written in 16 byte blocks. So, instead of changing the first byte the changed code stashes the first 16 bytes, and starts writing at the 17th byte, leaving the first 16 bytes as 0xFF. Then, in _enablePartition() the stashed bytes can be successfully written.
Benefits

Whilst it's not possible to use encrypted flash directly from either the Arduino IDE or PIO it's reasonably straightforward to compile and flash a bootloader with the necessary support from a simple esp-idf project and then use ArduinoOTA for subsequent updates. This PR enables the use of this workflow until such time as encrypted flash is supported, and is a first (small) step toward adding support.
Regardless of the above, the esp_partition_* api is recommended over the api_flash_* api.
Application code should mostly use these esp_partition_* API functions instead of lower level spi_flash_* API functions. Partition table API functions do bounds checking and calculate correct offsets in flash, based on data stored in a partition table.
2020-09-30 15:06:19 +03:00
sindney
5197916983
Fix BLEClient disconnect bug (#3876)
By default the disconnect is broadcasted to every clients. So if you call disconnect on one connected client, they'll all be disconnected if we don't filter the event by conn_id.
2020-09-30 15:01:02 +03:00
Martijn Scheepers
7e9d42da68
ESP.getChipModel() and ESP.getChipCores() (#3847)
* ESP.getChipModel() returns model of the chip

* ESP.getChipCores() returns the core count.

* Example gives chip model, revision and core count.

* Read efuse for chipmodel

Co-authored-by: Martijn Scheepers <ms@SDNengineering.nl>
2020-09-30 14:57:36 +03:00
Bernd Giesecke
ef2b54547e
Fix issue #3833, data parsing of Eddystone TLM data frame (#3836)
* Fix issue #3833, data parsing of Eddystone TLM data frame    
Add Beacon scanner example to show usage of BLEEddystoneTLM class and  BLEEddystoneURL class     
Add EddystoneTLM beacon example    
Add EddystoneURL beacon example

* Fix buffer size for .toString()
2020-09-30 14:55:58 +03:00
jgdent
9856f0cc28
Update RMTLoopback.ino (#3823)
BUGFIX: avoids assertion in xEventGroupWaitBits()
(/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/event_groups.c:350 (xEventGroupWaitBits)- assert failed!)
2020-09-30 14:52:22 +03:00
Mark D
af7ec4ead1
fix EEPROM class example (#3786) 2020-09-30 14:43:05 +03:00
kliment
7a92f89d12
Set TLS cert options before calling connect on client, so verify works (#3774)
When connecting using transportTraits, the CA and client certificates are ignored after the initial _client->connect() is called. This is because on connect, WiFiClientSecure will call start_ssl_client with _CA_Cert and other cert options set to null unless setCACert, setCertificate etc. are called before connect. Running _transportTraits->verify after connect therefore does exactly nothing. It's easy to verify that this is the case by passing a CACert to HTTPClient with verbose logging enabled - the logs will say "WARNING: Use certificates for a more secure communication!" which is only present when both PSK and CA are null. This change fixes the issue.
2020-09-30 14:41:03 +03:00
puuu
5871ca9ce9
UpdateClass::printError now accepts the Print object (#3763) 2020-09-30 14:39:25 +03:00
Mark D
0dfa5babc2
fix typo in WiFiMulti (#3737) 2020-09-30 14:37:21 +03:00
Andrzej Sierżęga
e4b2ce4e81
DNS resolving timeout change to prevent stack overlapping (#3731)
Real DNS resolving timeout used by lwip library is 14[s] (7[s] for DNS1 + 7[s] for DNS2). Function WiFiGenericClass::hostByName() has timeout set to lower value (only 4[s]), so callback function may be called after this low timeout and it may overlappe stack memory used now by other function.
Fixes #3722
2020-09-30 14:35:53 +03:00
Me No Dev
7af4490fcc
Update SPI.h 2020-09-30 14:34:37 +03:00
crnchbng
5999b7ba46
removed double delete of characteristics (#3521) 2020-09-30 14:25:31 +03:00
Sweety
9d547a8a44
Provisioning fixes for: 1.Space 2.Provisioned (#4291) 2020-08-25 11:03:06 +03:00
Sweety
1fd5cd79c5
Add OTA update feature
This sketch provide functionality for OTA firmware upgrade.
2020-08-25 11:01:58 +03:00
me-no-dev
4d98cea085 Add Wire:setPins(sda, scl)
Fixes: https://github.com/espressif/arduino-esp32/issues/3779
2020-07-19 02:21:15 +03:00
Nigel Mellor
b92c58d74b
M5Stack's product offering includes various ESP32-based camera devices. (#4030)
They are all broadly similar, all being based on the ESP32-D0WD core, but have
some subtle differences between variants around PSRAM inclusion and camera pin
mappings.

The ESP32CAM "unit" product (SKU: U007) has no PSRAM and maps the
"Pixel Data 0" (Y2 GPIO/OV2640 D2) camera pin to IO17 rather than IO32 as is
the case with most other M5Stack ESP32 camera devices.

The ESP32CAM also requires the "hmirror" and "vflip" camera configuration
bits setting in order to capture a true image.

The relevant M5Stack pin configuration documentation can be found here:
https://docs.m5stack.com/#/en/unit/esp32cam?id=pinmap
2020-06-01 01:41:56 +03:00
James.Y
35d9759fa6
Fix for issue 3974 m_connectedCount incorrectly decremented when no connection exists
There is no need to decrement if nothing was removed from removePeerDevice

Reference issue:
#3974
2020-06-01 01:35:01 +03:00
Gitshaoxiang
79f77afc98
update M5Camera pins (#4021)
* change m5camera pins

* add M5Camera version B pins

* add M5Camera version B pins
2020-05-22 12:59:33 +03:00
Verkehrsrot
594ee6d249
Update SD_MMC.cpp (#4020)
According to ESP-IDF API
dc14d027ce/docs/en/api-reference/peripherals/sdmmc_host.rst :

"To configure the bus width, set the width field of :cpp:class:`sdmmc_slot_config_t`. For example, to set 1-line mode:

sdmmc_slot_config_t slot = SDMMC_SLOT_CONFIG_DEFAULT();
slot.width = 1;
"
2020-05-22 11:07:40 +03:00
sweetymhaiske
4d118b36a2
Minor modifications in provisioning (#3919) 2020-04-21 14:39:26 +03:00
sweetymhaiske
2c9b648502
Add support of unified provisioning to Arduino
1. WiFiProv.ino sketch is added that allows arduino users to do provisioning via SoftAP or BLE. WiFi.beginProvision( ) API is designed for provisioning in Arduino.
2. In WiFiProv.h provisioning class is defined.
3. WiFiProv.cpp contains implementation for provisioning class.
4. README.md file is added which contains detail information for working.
2020-04-15 23:37:55 +03:00
Alexander Bergmann
13e02063d6
Move _STREAM_BOUNDARY before _STREAM_PART (#3720)
The boundary delimiter (_STREAM_BOUNDARY) needs to be send before the
body part (_STREAM_PART) too follow RFC2046. This caused ffplay/ffmpeg
to fail to open the MJPEG stream.
2020-02-14 11:03:38 +02:00
Me No Dev
109ba7a3b4
Revert "std::shared_ptr Memory Leak (#3680)" (#3682)
This reverts commit b2c678877c.
2020-01-29 12:30:08 +02:00
chuck todd
b2c678877c
std::shared_ptr Memory Leak (#3680)
* std::shared_ptr Memory Leak

clientSocketHande and _rxBuffer are std::shared_ptr, the stop() call was not correctly releasing them and the operator= had similar problems fix for #3679

* operator= second attempt

* operator= third time
2020-01-29 12:18:54 +02:00
Mark D
bb0a194bb7 fix WiFiClient.connected() (#3654)
WiFiClient.connected() was hanging thinking there was still a connection when the remote had already closed. The one-liner in this patch addresses recv() returning 0 and errno==128. I couldn't find the corresponding errno for 128 but its caught by the case statement which includes EPIPE, ENOTCONN, ECONNRESET and ECONNABORTED so I assume its one of those. Broken pipe maybe?
```c
[D][WiFiClient.cpp:511] connected(): Disconnected: RES: 0, ERR: 128
```
EDIT: added comment to reflect that recv() can set errno when it returns 0.
2020-01-21 12:36:03 +02:00
Kartik Nighania
ed59ae6482 Update README.md (#3653) 2020-01-21 12:35:05 +02:00
mishafarms
b4a9684a74 Fix SerialBT.flush (#3579)
* Fix flush

flush should not flush the read buffer, it should wait till all output is drained from the write buffer.

* Update BluetoothSerial.cpp

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-01-20 22:34:57 +02:00
Me No Dev
307b1368dd
Implement BTSerial onData to dynamically receive packets from SPP (#3649) 2020-01-20 19:43:52 +02:00
lbernstone
cd85239252 Added file.close to examples (#3611) 2020-01-20 16:47:40 +02:00
Robert Alfaro
ac9d04a400 Add BLEDevice::stopAdvertising() helper method to compliment startAdvertising(). (#3624) 2020-01-20 16:31:12 +02:00
Franco Minucci
2195109ecc Added the channel parameter to the scan fucntion in order to select which channel to scan. (#3638)
The default value is 0 (= all channels) to preserve backward compatibility.
2020-01-20 16:13:10 +02:00
Robert Alfaro
cb005fc8b5 Extend BLEDevice::setPower() to include powerType parameter. It's optional and set to ESP_BLE_PWR_TYPE_DEFAULT for compatibility. (#3623)
Extend BLEDevice::setPower() to include powerType parameter. It's optional and set to ESP_BLE_PWR_TYPE_DEFAULT for compatibility.
2020-01-20 16:09:02 +02:00
Guil-T
89351e3ade Update WiFiClient.cpp (#3608)
fixed the connected() function so that it only checks errno if recv returns a value of -1.

"in the even of an error, errno is set to indicate the error" --manpage

This fixes the ESP32 Webserver when dealing with a modern webserver with a slow SD card.
2020-01-20 16:08:17 +02:00
DanielLester83
dd78794311 Update CaptivePortal.ino (#3628)
Small change to insure wifi starts off and avoid crashing
2020-01-20 16:04:21 +02:00
I-Connect
6e77f7f3e5 Setting loging level to VERBOSE on Semaphore::take (#3545) 2020-01-20 15:50:19 +02:00
syonbori
915d45de7d Defined BLE setAdvertisementType (#3535)
Currently we have no way to set BLE Advertisement Type.
We have an initial value of ADV_TYPE_IND and the member is private.

iBeacon should advertise with ADV_TYPE_NONCONN_IND.
esp-idf's example code specifies this value.

93a8603c54/examples/bluetooth/bluedroid/ble/ble_ibeacon/main/ibeacon_demo.c (L57)
2020-01-20 15:42:38 +02:00
lj
c2b37d95e0 Updated BLERemoteCharacteristic to exposre esp_gatt_auth_req_t parame… (#3531)
* Updated BLERemoteCharacteristic to exposre esp_gatt_auth_req_t parameter for readValue and writeValue.

* Updated BLERemoteCharacteristic/Descriptor to expose a setAuth method to allow tweaking the authentication request type for that remotecharacteristic/descriptor without the need to add auth on each read/write.
2020-01-20 15:40:13 +02:00
felixstorm
2f13a960ac Add WIFI_REASON_CONNECTION_FAIL in WiFiGeneric.cpp (#3529)
`WIFI_REASON_CONNECTION_FAIL` has been added to `wifi_err_reason_t` some time ago:  
cec3fca4ad/tools/sdk/include/esp32/esp_wifi_types.h (L95)

But it was still missing from `system_event_reasons` in `WiFiGeneric.cpp` sometimes causing panics here:  
cec3fca4ad/libraries/WiFi/src/WiFiGeneric.cpp (L348)
2020-01-20 15:38:58 +02:00
Michael Uman
579e04be25 Cleanup SPI_Multiple_Buses (#3527)
* Utilize prepoc symbols for SPI pins
* Adjusts for GPIO pins when ALTERNATE_PINS is set
2020-01-20 15:37:47 +02:00
WizardTim
5443d7ca93 Add TTGO T Journal Camera module & improve commenting (#3515)
Added pinout for TTGO T Journal device and improved the intent of comments.
2020-01-20 15:33:38 +02:00
Evgenii Grekov
85ef51ffbc BLE: reception support multiple service data (#3502)
* BLE: reception support multiple service data

* fix prev commit, i not inicialized
2020-01-20 15:30:29 +02:00
Jeroen88
7de1717640 Fix replacing of headers with overlapping names. Fixes issue #3483 (#3487)
If two headers with overlapping names are added while replace == true, like in:
```cpp
http.addHeader("api_token",  "pMXFOLpinQqajaRQJYMeWObg2XYmcX1");
http.addHeader("token", "1234");
```
then replacing went wrong. This is fixed with this PR.
2020-01-20 15:27:51 +02:00
Bob
cfe8526ec8 Add Uri with support for regexUri and globUri (#3441)
* Add Uri with support for staticUri, regexUri and globUri

* Add newline to end of files

* Update example

* Suppress gcc warnings (unused params)
2020-01-20 15:21:01 +02:00
Rick van Hattem
bc3d11364f Fixed incorrect usage of xEventGroupWaitBits (#3446)
* Fixed incorrect usage of xEventGroupWaitBits

* Added parentheses and `!= 0`
2019-11-11 17:34:01 +01:00
takanotume24
8c4ca5a235 Update BLE_client.ino (#3463)
fix typo
2019-11-11 15:49:34 +01:00
Martin
547c2d3346 Root CA of webserver has changed, minor changes (#3447) 2019-11-11 15:45:26 +01:00
Mikhail Khalizev
ec63d09e54 Fix WiFiGeneric event handler (#3412) 2019-11-11 14:24:50 +01:00
xk
188560e7f3 Some event log messages were off by one. (#3391)
This event name was missing in the list:
d5e2bb12ca/tools/sdk/include/esp32/esp_event_legacy.h (L43)

E.g., it was giving
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 24 - ETH_GOT_IP
When it should have been
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 24 - ETH_DISCONNECTED
2019-11-11 14:21:24 +01:00
Sven
91e095f5a7 Add an error message in case of invalid configured dependency mbedTLS. (#3364)
Especially if the user wants to use the library as component in IDF,
there are some pitfalls while doing make menuconfig. One is this missing
dependency which will now fail with a better error message with a hint to
the user how to fix it.

refs #2154 #3215
2019-10-17 09:48:36 +03:00
David J. Fiddes
b847f41e24 SPI: Ensure all read-only data pointers are marked as const (#3356)
This changes all SPI functions that take data pointers which are
not modified so that the declaration is const. This allows them
to be used with const data (i.e. held in flash). No functional
changes are required.

The defnitions of spiWrite() and spiTransferBytes()  in
esp-hal-spi.h/c have been updated to be consistent.

Tests:
 - Build a simple sketch using SPI.writePattern() and
   SPI.transferBytes()  which uses const data and verify that the
   attached device functions as expected.
2019-10-14 20:39:27 +03:00
lbernstone
0cab2483e6 Added a description README.md for libraries (#3349) 2019-10-14 20:37:09 +03:00
Luc
79e4339582 Remove warnings if no debug enabled (#3334) 2019-10-08 10:35:42 +03:00
lightzl
a35035f827 fix authrization problem (#3329)
I compiled the sample "WebServer -> HttpAdvancedAuth". But the right username and password can not login in. I found the file "Webserver.h" may be have some problem. So I fix it. Please check it.
2019-10-08 10:34:36 +03:00
Me No Dev
0cdfb0b193
Add support for WiFi long range mode (#3190)
* Add support for WiFi long range mode

* Update WiFiGeneric.cpp
2019-10-06 17:43:15 +03:00
Marian Šámal
e50613622e Fix typo in SPIFFS and FFAT examples (#3322)
* fix typo in SPIFFS example

* fix typo in FFAT example
2019-10-06 17:29:28 +03:00
copercini
24b277ad92 Add readFloat to BLE (#3321)
* Add readFloat

* Add readFloat to BLE
2019-10-06 17:28:53 +03:00
Frank Paynter
4638628873 Wait for client.available() to prevent ESP32 crashes (#3154)
* Wait for client.available() to prevent ESP32 crashes

* Removed user-specific SSID & passphrase
2019-10-02 14:45:42 +03:00
IonicEV
38c4c06108 Support for Master mode, Pin and SSP (#3219)
* 20190916 - initial: support for Master mode, Pin and SSP

* 20190916 - initial: Add example app for Master mode

* 20190916 - initial: Force another build

* 20190916 - connect would use resolved address as preference and remove now redundant _remote_address

* 20190916 - rework set/reset/default pin logic

* 20190916 - cleanup: remove static vars, add/use constants, fix typos

* 20190916 - fix build issues and implement geoup events for status verification.

* 20190916 - remove extra lines,misc

* 20190916 - rework ESP_BT_GAP_DISC_RES_EVT, added SPP_DISCONNECTED bit for disconnect event. + timeout for disconnect()

* 20190916 - Small log change to improve log sequencing

* 20190916 - remove static from local vars

* 20190916 - Limited scope and duration for the scan, log device address during scan in info mode as it is very difficult to find out sometimes. Fixed get_name_from_eir() not resetting the name when called.

* 20190916 - break property for loop during scan when name matches.

* 20190916 - misc

* 20190916 - SPP_DISCONNECT state updates

* 20190916 - formatting, remove some strange syntax from initiator code

* 20190916 - Add comments to the example about connect(...) usage and timeouts

* 20190916 - fix disconnect() without timeout

* 20190916 - Add example comment to view BT address and name during connect(name)

* 20190916 - wording in example comments

* 20190916 - rework connect() and disconnect() methods to help with concurrency and more authoritative status returned back to caller. Automatic disconnect in connect() methods

* 20190916 - optimize code

* 20190916 - optimize code - more

* 20190916 - add timeout for pin set

* 20190916 - change scan mode to ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE

* 20190916 - update example code slightly

* 20190916 - increase READY_TIMEOUT to 10 secs

* 20190916 - typo in example and move waitForConnect() to static area

* 20190916 - update example comments

* 20190916 - update example comments

* 20190916 - update example comments

* 20190916 - add new example to remove paired devices from ESP32

* 20190916 - correct typo in example

* 20190916 - update example comment, add remove_bond_device() method for convenience.

* 20190916 - reword example comment.

* 20190916 - rename remove_bond_device()

* 20190916 - rename removePairedDevice() to unpairDevice()

* 20190916 - code review changes

* 20190916 - fix return value in setup() od example
2019-10-01 17:34:46 +03:00
William Ferguson
8a46697168 Fix for issue_3209. (#3210)
#include "esp32-hal-log.h" is mandatory is order to build BLEDevice.cpp.
It can't be left up to a compiler variable.
2019-10-01 16:32:47 +03:00
TANAKA Masayuki
71e3d515f3 Fix BLEUUID toString (#3289)
uuid16 is Missing first 4 characters.
uuid is Missing last 2 characters.
2019-10-01 11:54:21 +03:00
TANAKA Masayuki
64cfb33deb Add Added unimplemented getCharacteristicsByHandle function (#3277)
* Add Added unimplemented getCharacteristicsByHandle function

Defined in BLERemoteService.h
But, Not included in BLERemoteService.cpp

* Delete log output
2019-10-01 11:43:59 +03:00
rafern
40ebee1cb1 Update BluetoothSerial.cpp (#3308) 2019-10-01 11:10:31 +03:00
Me No Dev
1c77790a5b
allow the examples to build in a more strict env (#3299) 2019-09-29 23:47:02 +03:00
William Ferguson
5bff89f0be Fixed issue-3153 - Allocating enough memory to construct the entire UUID as a String. (#3297) 2019-09-29 23:03:48 +03:00
billprozac
9bbd720d4c Update BLEDevice.cpp (#3267)
Pretty sure this was a typo as the deinit doesn't actually allow for reinit if that is an ifndef.  Changed in my local copy and can now deinit and reinit just fine.  Also, not sure why we are checking for the architecture here.  Just curious.
2019-09-26 21:50:16 +03:00
billprozac
589bb7032d Update WiFiScan.h (#3266)
Add an accessor function for the useful wifi data
2019-09-26 21:03:08 +03:00
lbernstone
f8c06894c5 Better cleanup on mount failures, as the idf api now seems to assign handle and mountpoint before failing. Fixes #3265 (#3282) 2019-09-26 19:12:52 +03:00
lbernstone
ca88fdc273 Fixed FFat::end. Fixes #3244 (#3245)
* Fixed FFat::end. Fixes #3244

* Missed the handle check in format
2019-09-24 23:23:03 +03:00
lbernstone
b3ba80d570 nvs_handle is an int, was assigning NULL. Also cleaned up end to ensure no memory leak. (#3246) 2019-09-22 23:31:38 +03:00
Luc
a5935ce1cc Add sample for Time date for FatFS like SPIFFS (#3234) 2019-09-22 09:38:24 +03:00
Me No Dev
9eaeeb660c
Change the first argument of SPI::wrteBytes to be const (#3242)
fixes: https://github.com/espressif/arduino-esp32/issues/3241
2019-09-22 09:36:32 +03:00
Luc
56fe2dbaff Fix F_Fat::format return false when succeed (#3220)
this is due to ussage of esp_err_t result; instead of boolean, ESP_OK =0 so it is false
2019-09-21 02:34:25 +03:00
Me No Dev
06a399b84a
Extend logging of ArduinoOTA (#3217) 2019-09-16 19:54:21 +03:00
Me No Dev
4ce2cc3c1d
Fix HTTP Client with SSL (#3216) 2019-09-16 19:14:32 +03:00
Me No Dev
07390157df
Fix Camera Example (#3202)
* Update app_httpd.cpp

* Stop LWIP from using PSRAM and enable OV7725
2019-09-13 01:19:53 +03:00
EricMc1289
bab3a70f54 Added timeout to WiFiScan.cpp to prevent getting stuck at WIFI_SCAN_RUNNING (#3197)
* Added timeout to WiFiScan class to prevent haning at stucking at WIFI_SCAN_RUNNING when scan fails internally

* fixed tabs and returns, connected scanTimeout to max_scan_per_channel timeout

* Corrected tabs two

* Added static vars scanTimeout und scanStarted to WiFiScan.h protected section

* Fixed missing ; in line 64
2019-09-11 15:58:34 +03:00
Edoardo Odorico
cd4f9038ee Fix WiFi disconnect event not being propageted. (#3085)
Relative to #3006
2019-09-11 15:12:15 +03:00
Marcel Stör
07613b3158 Update URL to point to upstream repository (#3187)
Pointing to an old fork is misleading.
2019-09-08 23:15:46 +03:00
full-stack-ex
2a7e509978 Fix long Ticker period conversion: cast ms to uint64_t when calculating us (#3175)
* Fix long Ticker period conversion

* Simplify long Ticker period conversion fix by using 1000ULL
2019-09-05 10:34:47 +03:00
Julian Büchel
f356ccd54a Added the pragma line to the top (#3139)
* Removed pragme in BLERemoteService.cpp

* Added the line at the top and changed to warning
2019-08-27 10:21:27 +03:00
Jeroen88
f4acac4c2b Bugfix/http client (#2867)
* Fix persistance issue found, see ESP8266 issue #6152

* Correcting the parsing of the header for HTTP1.0

* Send 'Connection: Close' header in case of HTTP1.0

* Let reuse connection depend on protocol used: HTTP1.0 or HTTP1.1

* Fixed reuse, added null ptr checks, added check for _trainsportTraits in connect() in case _client was set null

* Fix reuse connection issues, similar to ESP8266 PR #6176
2019-08-20 17:18:09 +03:00
Roman Savrulin
5137fc5c80 Ble notification/indication status and timeout (#2998)
* add timed wait

* Added Notification/Indication data and status callbacks

* imply null-object pattern for BLE callback
2019-08-20 17:15:30 +03:00
ducalex
61f71930e9 The progress callback is now correctly invoked with Update.write (#3024)
The progress callback was only invoked with Update.writeStream before
2019-08-20 16:45:57 +03:00
lbernstone
ec40c4c96f Cast TimerWakeup conversion factor as ULL (#3027) 2019-08-20 16:45:18 +03:00
Bernd Giesecke
2bda4a9617 Fix BLE stop advertising not working (#3034)
BLEAdvertising::handleGAPEvent -> ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT should NOT call start()!
2019-08-20 16:44:50 +03:00
Ahmed Al-Qaidom
91b9fae111 Add generic IP utilities (#3038)
* Add generic IP calculations

Add:
calculateNetworkID(IPAddress ip, IPAddress subnet) => Calculate the network id using the ip and subnet (e.g. 192.168.0.0)
calculateBroadcast(IPAddress ip, IPAddress subnet) => Calculate the broadcast ip using the ip and subnet (e.g. 192.168.0.255)
calculateSubnetCIDR(IPAddress subnetMask) => Calculate the subnet CIDR using the subnet (e.g. 24)

Add:
broadcastIP() => Retrieve the network id (e.g. 192.168.0.0)
networkID() => Retrieve the broadcast IP (e.g. 192.168.0.255)
subnetCIDR() => Retrieve the subnet CIDR (e.g. 24)

Add:
broadcastIP() => Retrieve the network id (e.g. 192.168.0.0)
networkID() => Retrieve the broadcast IP (e.g. 192.168.0.255)
subnetCIDR() => Retrieve the subnet CIDR (e.g. 24)

Add:
softAPBroadcastIP() => Retrieve the network id (e.g. 192.168.0.0)
softAPNetwrokID() => Retrieve the broadcast IP (e.g. 192.168.0.255)
softAPSubnetCIDR() => Retrieve the subnet CIDR (e.g. 24)
2019-08-20 16:42:55 +03:00
Arjan Mels
a12d609b22 Corrected count of characteristics to get (#3082)
Only space for 1 characteristic is allocated, requesting 10 leads to stack corruption.
2019-08-20 16:38:59 +03:00
david-cermak
1c7e329140 RMT: Fix in bitshift of NeoPixel example project (#2986)
Fixed bit shift in demo application of using RMT peripheral. Init data array to be transmitted was off by one, as for the first iteration (i==0) the mask was 1<<8, which results in shifted RGB value in color variable
Closes https://github.com/espressif/arduino-esp32/issues/2921
2019-07-16 17:14:28 +03:00
boarchuz
c17b212cd0 WPA2 connection fix (significant improvement to connection time) (#2989)
* Config fix test

* Also force config even if equal
2019-07-16 17:12:20 +03:00
chegewara
d1134fd45e Fix issue with semaphores (#2974) 2019-07-10 09:11:35 +03:00
Felix Weinrank
d5fdd715ef WiFiClient.cpp - Fix connect() behavior (#2784)
* WiFiClient.cpp - Fix connect() behavior

* lwip_connect_r() : check return code
2019-07-09 19:48:05 +03:00
lbernstone
ca7106e97e Added convert method to EEPROM to transfer data from partition to nvs (#2841)
* Added convert method to transfer data from partition to nvs

* Could have sworn I changed the return when I made the label

* Empty state should be 0xFF.  Fixed some logging levels

* Set result on success
2019-07-09 19:47:06 +03:00
pmalhaire
c13d11e7d1 fix empty reply from server error (#2903)
The flush causes an empty response a client side.

see https://github.com/espressif/arduino-esp32/issues/2902
2019-07-09 19:39:12 +03:00