Commit Graph

627 Commits

Author SHA1 Message Date
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
Roman Savrulin
05de017bd5 BLE Library onRead Callback fix and Client disconnect feature (#2913)
* BLEServer::disconnect()

* Invoke Read callback first, to make data update possible before read
2019-07-09 19:35:07 +03:00
Roman Savrulin
e1548e9b7e Fix hang on client disconnect during upload (#2914) 2019-07-09 19:34:24 +03:00
lbernstone
c29ec9da3d Removed partitioning comments from EEPROM class example (#2920)
* Remove partitioning comments

* Revert "Remove partitioning comments"

This reverts commit b3b03a81572d352816819cff772231ba037dc338.

* Removed partitioning comments from EEPROM example
2019-07-09 19:34:04 +03:00
exezm0r
b3783fba95 fixed typo (#2927) 2019-07-09 19:31:38 +03:00
Roman Savrulin
a22ec4a978 Reduce flash usage up to 214k in one click (#2929)
* std::stringstream -> std::string

* Fix small issues

* Small fix 2
2019-07-09 19:31:17 +03:00
Victor Aprea
02e51728c4 Fix Timeout Bug in WebServer (#2938) 2019-07-09 19:27:24 +03:00
Krishna Kumar
74ffdac74a fix for BLE Library Compile Error #2866 (#2876) 2019-07-09 19:23:01 +03:00
Martin Falatic
4ee17ec3ee Fix warning -Wempty-body by adding braces to 'if' stmt body (#2951) 2019-07-09 19:21:57 +03:00
Nathan Phillips
476660f763 Cleanup WiFiMulti (#2955)
* Use macros for switch case labels

* Fixed spelling error in "too"

* Fix spacing

* Inline private functions that are only called once
2019-07-09 19:21:01 +03:00
Luc
f558e69181 Fix warnings in platformio (#2960)
Fix : warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
Fix : warning: unused variable 'res' [-Wunused-variable]
2019-07-09 19:19:16 +03:00
Jeroen88
7d7824701f Fix persistance issue found, see ESP8266 issue #6152 (#2851) 2019-06-05 14:00:00 +02:00
andig
43b781a158 Update AsyncUDP library.json (#2837)
* Fix https://github.com/platformio/platform-espressif32/issues/186

* Drop library.json
2019-06-05 13:43:15 +02:00
elettro1
714ba948e6 Update BLERemoteCharacteristic.cpp (#2800)
Prevents the error that is generated on free on row 186
When calling the function readValue() sometimes it gave an error on this free.
2019-06-05 13:38:49 +02:00
HanCheol Cho
e57de64a3c Fixed multi_heap_free failed during setting the value of the characteristic in BLE Library. (#2789) 2019-06-05 13:37:06 +02:00
Paul Andrews
fd5a2f08f9 Fix #2750 (#2763)
* Fix #2750

* Fixes for pull comments

* latest modifications following comments from me-no-dev

* Move SPIFFSFSImpl to .cpp file
2019-05-14 00:15:35 +03:00
Me No Dev
e9389e3122
Fix AsyncUDP buffer error
fixes: https://github.com/espressif/arduino-esp32/issues/2685
2019-05-13 23:18:38 +03:00
Me No Dev
0acf19af8f
Update IDF to v3.2 977854975 (#2771)
* Update IDF to v3.2 977854975

* Update app_httpd.cpp
2019-05-12 18:52:23 +03:00
h2zero
43bf393dbf Fix semaphores in IDF & std::string assert (#2728)
* Fix semaphores in IDF & std::string assert 

Fixes the problem of giving a mutex from a callback with the latest IDF. Also addresses an occasional assert that happens when the btc_task callback gives the semaphore and causes an assert due to both cores potentially writing m_owner concurrently.

* Restored m_owner position in wait() as requested

* Reapply assert fix and move setting m_owner in ::give() 

Revert previous revert commit and move setting of m_owner in ::give to before giving the semaphore to prevent race condition possibility.
2019-05-11 11:03:09 +03:00
Adam
bea7bd1852 Implemented ability to change BLE address (#2690)
Implemented the ability to change the ESP32s BLE device address as
according the the BLE specification. This address is used when
advertising the ESP32 over BLE.
2019-05-11 11:02:26 +03:00
lbernstone
932666a03f Ensure that _size is properly set in begin (#2706)
* Ensure that _size is properly set in begin

* NULL check on _data assignment

* Changed _data to malloc in order to catch alloc fails
2019-04-26 19:39:22 +03:00
Nick Hynes
271e5cd206 Fix Werror=reorder for idf.py build (#2707) 2019-04-25 12:02:21 +03:00
lbernstone
619568db5b Converted EEPROM library to use nvs instead of partition. (#2678)
* Converted EEPROM library to use nvs instead of partition.  Removed eeprom partition from all partition table CSV files.
* Changed variable names, added some comments, formatting as per me-no-dev's requests
* Checks for memory on malloc
* Moved include nvs.h from header to code
* Reworked the extra example to make it more clear how to actually use the library and persist data
2019-04-23 23:55:12 +03:00
Nick Hynes
0202ba7c21 Fix reorder error in WebServer (#2700) 2019-04-23 17:57:33 +03:00
Victor Aprea
672e4faa92 Add optional support for CORS headers (#2688)
* add support for CORS headers

* remove accidental function impl

* rename setCORS to enableCORS, and add aliased function enableCrossOrigin
2019-04-22 21:52:39 +03:00
me-no-dev
3d6e4e1b94 Use milliseconds for timeout 2019-04-15 17:27:54 +02:00
Bascy
01d7ea7b80 Refactored use of LOG_X(LOG_TAG, ...) to log_x(...) (#2672)
* Replaced ARDUINO_VARIANT with const char

* Fixed missing return value

* Added quotes around defined value in macro (Issue #2193)

* Change logging from Error to Verbose when not found and default available

* Move Enter and Exit logging to Verbose Level

* Refactored LOG_X() into log_x()
2019-04-15 17:26:35 +02:00
Bob
af23d0bb10 Return empty string instead of "0" (#2673) 2019-04-15 17:23:42 +02:00
me-no-dev
582e6433e9 Add proper timeout handling to WiFiClientSecure 2019-04-15 17:19:49 +02:00
me-no-dev
ea043cdb14 Fix WiFi Multi not clearing password 2019-04-13 17:19:06 +02:00
me-no-dev
fa74767b2e Allow selecting in IDF the running core for Arduino's core tasks 2019-04-13 17:13:13 +02:00
Victor Aprea
1efcd21ba9 replace with strerror (#2663) 2019-04-12 15:44:16 +02:00
Me No Dev
7b5cd47d07
Set ESP-IDF to 3.2 (#2662)
* Set IDF to v3.2

* Remove BLE submodule

* Add BLE lib source

* Update Camera example to support OV3660
2019-04-12 15:43:53 +02:00
Arsham Skrenes
14126060a1 Properly allocate string and remove warning (#2652)
* Properly allocate string and remove warning

The former way generates the following warning:
ISO C++ forbids converting a string constant to 'char*'

This change makes a character array the size of the string with null ending. It's clearer and gets rid of the warning.

* Better way

Since this is technically immutable, the type should reflect this too.
2019-04-12 12:46:08 +02:00
Victor Aprea
25c0b52212 Alternative Improve _uploadReadByte (#2656)
* add opportunity for more than one retry to _uploadReadByte

* an alternative timeout-based method to making _uploadReadByte more resilient

* move timing variables in the correct scope

* implement and use client.getTimeout instead of hard-coded timeout in _uploadReadByte

* add missing return

* some refactoring to address respecting the timeout in a potentially deadlocked connection

* fix spelling in comment

* address review comments; move impl to cpp file for getTimeout, and remove local variable for currentMillis

* remove redundant cast

* need to check for timeout outside the inner while as well

* update WebUpdate example to print something in unexpected callback condition

* update log_e messages per review comments
2019-04-12 12:45:35 +02:00
Jean Marc BRUNO
e0beac88c9 File with more than 32,767 characters (#2566) 2019-04-11 16:54:40 +02:00
Jan Weigelt
a87b2ec690 Fix AsyncUDP receive memory leak (#2607)
If _handler is set, pbuf_free is not called. ~AsyncUDPPacket() calls pbuf_free once but only after calling pbuf_ref in it's constructor. The refcount never reaches zero and the memory allocated for pbuf is never released.
2019-04-11 16:49:35 +02:00
lbernstone
da8b7c1b80 overload Preferences.getBytes similar to nvs so you can get size of t… (#2498)
* overload Preferences.getBytes similar to nvs so you can get size of the array.

* Cleaner implentation, with a separate function to get length.  Added an example
2019-04-10 02:45:38 +02:00
dyarkovoy
a0c975dfbc Reset retry counter upon successful write (#2638)
Currently  WiFiClient::write is unable to send messages over 25Kb, because of the hard-coded retry limit of 10, that is getting decremented on every successful send. Since we cannot send more than 2*MTU bytes in one go, and have only 10 retries, write() is limited to approximately 25Kb. Technically it is not a bug, as it correctly returns the number of sent bytes and the caller can set up futher retries. But not all libs are aware of this behavior, for example, WebServer is not.
I suggest improving current behavior by resetting retry counter every time we had a successful write, so the limit of 10 retries will apply to Failed writes only, and will not apply to Successful writes. This will allow to write() blobs of arbitrary sizes.
2019-04-10 02:41:29 +02:00
Matthias Budde
92220b7643 Added PATCH request. (#2610) 2019-04-09 21:22:47 +02:00
boarchuz
dd649808d1 Add server connect timeout to HTTPClient (#2606) 2019-04-09 21:19:25 +02:00
Clemens Kirchgatterer
67ee7c32e7 workaround for FS implementations that do not support fflush() (#2596)
https://github.com/espressif/arduino-esp32/issues/1293
2019-04-09 21:15:21 +02:00
Cellie
4930853edb Add support for ffat on 4MB ESP32 Dev Module and mhetesp32minikit board. (#2588)
* Update boards.txt

Add menu items for ffat on mhetesp32minikit board.

* Add partition table.

* Added ffat partition for 4MB ESP32 Dev Module.

* Added comment about partitioning schemes.
2019-04-09 21:11:17 +02:00
lbernstone
d5f71ce545 Added a parameter for max files in SD (#2563) 2019-04-09 21:07:25 +02:00
A C SREEDHAR REDDY
ff85f3e90e connect only to provided creds (#2491) 2019-03-03 15:49:59 +01:00
A C SREEDHAR REDDY
dffda0bd6e log no networks found when scanResult is 0 (#2484) 2019-03-03 15:49:16 +01:00
A C SREEDHAR REDDY
2ceab7c279 return macaddress (#2477)
* WiFi.macaddress() returns mac address

* change description

* return macaddress when WiFi mode is WIFI_MODE_NULL
2019-03-03 15:48:30 +01:00
A C SREEDHAR REDDY
5af0336177 Changed the description of file (#2476) 2019-02-20 00:50:20 +02:00
Kevin M Fitzgerald
89d6b895d1 Fixed missing null terminator in EEPROM.readString(address, value, maxLen) (#2439) 2019-02-14 19:31:37 +01:00
lbernstone
2e9cb5945d default FORMAT_FILESYSTEM to false in FSBrowser.ino (#2425) 2019-02-14 13:06:21 +01:00
Joey Babcock
f6b9e9c2ab Clarified comments and debug messages in WiFiClient Example (#2389)
* Clarified comments and debug messages

Made debug messages and comments easier to understand/grammatical fixes

* few more fixes
2019-02-14 12:59:55 +01:00
boarchuz
fc737e08c6 Add connect timeout to WiFiClient (#2383)
* Add timeout to WiFiClient.connect()

* Changed default handling
2019-02-14 12:55:50 +01:00
acevest
aa2393b573 remove useless condition in if statement (#2371)
* fix log error code format

* remove useless condition in if statement
2019-02-14 12:52:52 +01:00
Marco G. Maia
755cd938f7 add missing EEPROM lib to CMakeLists.txt, moved the EEPROM files to proper dir (#2333)
* add missing EEPROM lib to CMakeLists.txt, moved the EEPROM files to proper directory

* add missing EEPROM lib to CMakeLists.txt, moved the EEPROM files to proper directory
2019-02-14 12:49:34 +01:00
acevest
ffd15e4637 fix log error code format (#2366) 2019-01-23 15:33:41 +08:00
Neal MIller
29d59876b4 Webserver library - fix logging (#2355) (#2359)
* Webserver fix logging (#1)

* Change logging to use esp32-hal-log.h

fixes #2355

* adjust log parameter output positions, reduce lines

The DEBUG_ESP method used less lines than I originally set `log_v` to use when displaying the details of the received params ("@" and "=" indexes, and File info on a single line)
2019-01-22 17:30:10 +08:00
chuck todd
3350476d1d I2C debugging and Log Dump Explaination (#2325)
* I2C debugging and Log Dump Explaination

Create a help file for I2C debugging and interpretation of log dumps

* Update i2c_debugging.md

version

* add formatting, file locations
2019-01-22 17:24:51 +08:00
lbernstone
fa6f75952d I2s adc (#2309)
* An example to read high frequency analog data using i2s_adc

* HiFreq_ADC.ino
2019-01-22 17:24:16 +08:00
me-no-dev
6718da0350 Add ESP-EYE support to the camera demo 2019-01-22 14:38:24 +08:00
me-no-dev
45fa0f8294 Fix issue with WiFi lib sending the wrong event ID when debug is on 2019-01-22 14:37:55 +08:00
lbernstone
a539257a38 An example to read high frequency analog data using i2s_adc (#2295) 2019-01-10 08:24:17 +01:00
Me No Dev
fa61b3bffe
Update IDF to e931fe9 and add esp-face (#2291)
* Update IDF to e931fe9 and add esp-face

* Fix PIO builds fail because of sketch size

* Fix example build failing for Arduino
2019-01-09 19:31:46 +01:00
Me No Dev
2fd39b1aff
Handle APB frequency change (#2250)
* Add APB change callbacks and move cpu code to own file

* Properly set esp_timer and FreeRTOS tick dividers

* Improve updated devisors

* No need to update REF_TICK yet

* Add initial handling for UART baud change

* fix uartWriteBuf and uartDetectBaudrate

* trigger callbacks even when APB did not change

* toggle UART ISR on CPU change

* add XTAL freq getter and add cpu freq validation

* Support CPU frequency changes in I2C (#2287)

**esp32-hal-i2c.c**
* add callback for cpu frequency changes
* adjust fifo thresholds based on cpu frequency and i2c bus frequency
* reduce i2c bus frequency if differential is too small
**Wire.h**
* version to 1.1.0

* Implement clock change for the other peripherals

* remove bad CPU clock values from the menu

* Add note to CPU freqs that support WiFi and BT
2019-01-09 10:07:54 +01:00
Shelby Merrick
a6e3b29004 Added support for using TCPIP_ADAPTER_IF_MAX to join igmp groups on all (#2279)
interfaces
2019-01-06 21:29:38 +02:00
johannesmaibaum
812d131663 Correct comment in SPI_Multiple_Buses.ino (#2272)
The default SPI bus is VSPI (see libraries/SPI/src/SPI.cpp). This change corrects a misleading comment in a code example which was stating wrongly that HSPI would be the default one.
2019-01-04 15:26:32 +02:00
Jeroen88
00e69a28bc Redo PR #2259 because I messed up my local git (#2263) 2019-01-02 17:44:17 +02:00
copercini
229d9b7366 [WiFiClientSecure] Shows only free internal heap on logs (#2252)
* Shows only free internal heap on logs

Since Mbedtls is running only on internal heap, show internal + PSRAM available memory on logs can confuse the users

* Clarify logs
2018-12-31 11:44:57 +02:00
me-no-dev
6dd8be3262 Use more agressive disconnect on wifi connect error 2018-12-28 21:23:17 +02:00
me-no-dev
28ea39cf05 Add WDT API for Core 0 and disable it while SPIFFS is formatting 2018-12-28 21:14:46 +02:00
me-no-dev
1628f533a1 Add Camera WebServer Example 2018-12-20 00:41:48 +01:00
atanisoft
0de0d3f79a move call to setTimeout() to after the client connects. (#2214)
This is necessary to avoid this log entry from being generated due to invalid usage of setTimeout:
[E][WiFiClient.cpp:236] setSocketOption(): 1006 : 9
2018-12-18 19:21:36 +01:00
me-no-dev
77810471ce Move Example to proper folder 2018-12-16 19:24:02 +01:00
Muhammad Lutfi Santoso
be081ac026 Add FreeRTOS multi-thread example (#2067)
* Add FreeRTOS exsample

* Update Code

* Change stack size

* Fix LED_BUILTIN not defined

Fix LED_BUILTIN not defined
2018-12-16 18:09:57 +01:00
Bascy
4d3f6caa0d Add quotes around macro value (Issue #2193) (#2197)
* Replaced ARDUINO_VARIANT with const char

* Fixed missing return value

* Added quotes around defined value in macro (Issue #2193)
2018-12-16 17:10:56 +01:00
me-no-dev
278fa0d87a Fix read(), peek() and available() in WiFiClientSecure
closes: https://github.com/espressif/arduino-esp32/pull/2151
2018-12-15 18:14:38 +01:00
copercini
b37f4069e4 Increase _network_event_task priority (#2184)
Fixes https://github.com/espressif/arduino-esp32/issues/1595
2018-12-15 17:39:51 +01:00
Me No Dev
6f6ee98188
Update ESP-IDF da2116f + esp32-camera f8f26ab + BLE b232e7f (#2194)
* ESP-IDF da2116f + esp32-camera f8f26ab +BLE b232e7f

* Fix fail compilation due to missing cpp guard
2018-12-15 17:38:34 +01:00
Jeroen88
1289f4be4b Add MD5 computation to Esp and add request header with MD5 hash of the running sketch to HTTPUpdate (#2176) 2018-12-11 02:06:58 +01:00
Jeroen88
884e417a49 Fix HTTPUpdate flash size check and add SPIFFS size check (#2161)
* Fix error in PR #2048: if ::available() is called before ::connect() _rxBuffer is not initialised

* Fixed flash size check and added SPIFFS size check

* Rewriting ESP.getFreeSketchSpace(), moving code from HTTPUpdate.cpp
2018-12-06 20:39:52 +01:00
Jeroen88
bff9f0b6b1 Fix error in PR #2048: if ::available() is called before ::connect() _rxBuffer is not initialised (#2155) 2018-12-06 19:01:06 +01:00
Martin
72803703fd Updated table of tested locations of Eduroam network (#2157) 2018-12-06 18:56:48 +01:00
Jeroen88
0596a2ac86 Abort update if http.begin() returns false. Fix a typo in httpUpdate.ino (#2156) 2018-12-06 18:50:53 +01:00
rdowning-triax
fe1fdd2790 #2147 available() shouldn't return 0 after disconnect if there is still data in the buffer. Otherwise, how would we know it was there? (#2148) 2018-12-04 18:23:34 +01:00
Thorsten von Eicken
af7e489f01 WiFiClientSecure: add support for PSK (pre-shared key) ciphers (#2133)
* WiFiClientSecure: add support for PSK (pre-shared key) ciphers

* add example for WiFiClientSecure PSK

* WiFiClientSecure: added README
2018-12-03 16:17:55 +01:00
Luc
5cfff190e9 removing log (#2140)
* Use right function for BSSID

* removing log
2018-12-03 16:17:16 +01:00
chuck todd
7a332864ab I2C ReSTART returns Success (#2141)
* Don't Return I2C_ERROR_CONTINUE on ReSTART

ReSTART operations on the ESP32 have to be handled differently than on AVR chips, so ReSTART operations(`Wire.endTransmission(false), Wire.requestFrom(id,size,false);` are queued until a STOP is send (`Wire.endTransmission(TRUE), Wire.endTransmission(), Wire.requestFrom(id,size), Wire.requestFrom(id,size,TRUE)). To indicate the queuing I had used `I2C_ERROR_CONTINUE`, this caused compatibility issues with the existing Arduino I2C Code base. So, back to Lying to the public(for their own good of course) about success!  This update just returns `I2C_ERROR_OK` on ReSTART commands.

* add comments

add comments

* Change Return error for ReSTART operation to I2C_ERROR_OK

This change restores compatibility with pre-existing Arduino Libraries.  The ReSTART queuing operations are hidden behind the scenes.  Wire.endTransmission(id,len,FALSE); will know return I2C_ERROR_OK instead of I2C_ERROR_CONTINUE, Wire.lastError() will return the true condition of I2C_ERROR_CONTINUE.
2018-12-03 16:16:43 +01:00
Arjan Filius
b5f317010c Fixed Arduino SPI/Ethernet compile issue as described in issue #1623 (#2136)
* #1623, implementing suggested change

Splitted suggested fix issue #1623 in a header and source part. Dit not completely dive into the code.
Giving data twice as parameter feels wrong, but it compiles, and i can succesfully use the W5500 with SPI with this fix.
Doesn't compile without.

* #1623, implementing suggested change SPI.h/cpp

Splitted suggested fix issue #1623 in a header and source part. Dit not completely dive into the code.
Giving data twice as parameter feels wrong, but it compiles, and i can succesfully use the W5500 with SPI with this fix.
Doesn't compile without.
2018-12-02 18:15:01 +01:00
Luc
f644d9d157 Use right function for BSSID (#2132) 2018-12-01 10:20:13 +01:00
Me No Dev
a15b7e9088
Update IDF to afe4c76 and BLE lib (#2130)
* Update BLE

* Update IDF to afe4c76

* Update CMakeLists.txt

* Update BLE to fix compilation issues

* Update BLE
2018-11-30 17:21:06 +01:00
Luc
ce340faf94 Clean warnings when all warning enabled (#2112)
* Clean warnings when all warning enabled

Not used variables / functions due to debug log

Dual define with different values :
cores\esp32/binary.h
#define B110 6
#define B1000000 64

tools/sdk/include/newlib/sys/termios.h
#define B110        3
#define B1000000   23

Local variable returned in WiFiclient Secure

* change due to deprecated function

* Update with proper variable and label

* Update esp32-hal-i2c.c

* Apply changes requested

* Fix warnings due to #define conflict thanks @atanisoft
2018-11-29 11:34:55 +01:00
Jeroen88
cfe7e01158 Remove F() macro's (#2121) 2018-11-28 11:45:25 +01:00
Jeroen88
7e9afe8c5e Add response headers with sketch and flash sizes, and a SHA256 (#2116) 2018-11-27 21:27:38 +01:00
A C SREEDHAR REDDY
46257c03b3 handshake in ssl_client.cpp (#2044)
* issue #2041

* handshake timeout

* seconds to milliseconds
2018-11-26 23:25:08 +01:00
Jeroen88
0640964879 Solve issue #2092 by initializing * _client to nullptr (#2097) 2018-11-26 23:23:19 +01:00
Luc
c3ec91f968 Allow to add custom callback in BT Serial (#2081)
This allow to catch the events when connected /disconnected,, etc...
This also allow to get parameters of events like the remote address of connected devices, etc...
Small change but lot of flexibility
2018-11-19 19:30:28 +01:00
Nikos Mouratidis
0d564d7b1d Limit the number of simultaneously connected devices to BluetoothSerial to only 1 (#2061) 2018-11-19 17:08:15 +01:00
Martin
273196d7e6 HTTPClientEnterprise example (#2023) 2018-11-19 17:02:47 +01:00
Martin
5d2460c74a Working example for HTTPS over Eduroam network - WifiClient secure library (#2022)
* Working example for HTTPS over Eduroam network

* Update WiFiClientSecureEnterprise.ino
2018-11-19 17:02:24 +01:00
Bob
3902aa4019 Adding path arguments to WebServer (#1994) 2018-11-19 17:00:52 +01:00
Martin
c7fa251d78 updated WifiClientEnterprise example (#1988)
* updated WifiClientEnterprise example

* Update WiFiClientEnterprise.ino
2018-11-19 16:59:56 +01:00
FotoFieber
7b811f9b3a leave possible endless loop (#1986) 2018-11-19 16:59:14 +01:00
Martin
a53c9de09d Updated table of tested locations - Enterprise wifi networks - WifiClientEnterprise (#1980)
* Updated table of tested locations

* updated
2018-11-19 16:58:07 +01:00
Jeroen88
b58a3509b8 Feature/http update (#1979)
* Added HTTPUpdate class for downloading sketches from a server

* Added HTTPUpdate class for downloading sketches from a server

* Added HTTPUpdate to CMakeLists.txt

* Change ESP8266 class references to ESP32 for httpUpdate.ino example

* Change ESP8266 class references to ESP32 for httpUpdate.ino example. setLedPin() commented out because not all boards support LED_BUITLIN

* Added check to handle mixup of old and present api properly

* Correct HTTPClient::setTimeout() to convert milliseconds to seconds. Correct WiFiClient::setTimeout() to call Stream::setTimeout() with seconds converted back to milliseconds. Remove inproper checks for _insecure.

* Added small comment because it looked like the Travis build did not finish
2018-11-19 16:57:38 +01:00
Jeroen88
01d22c8807 Feature/http client (#1973)
* Pass client parameter into two new begin() functions. Set other begin() functions deprecated. Updated library version to 1.2

* Added working HTTPS example on a public url with a certificate

* Remove two unnecessary tests in ::disconnect()

* Add a scoping block to BasicHttpsClient.ino to assure HTTPClient is destroyed before WiFiClientSecure

* Added check to handle mixup of old and present api properly

* Correct HTTPClient::setTimeout() to convert milliseconds to seconds. Correct WiFiClient::setTimeout() to call Stream::setTimeout() with seconds converted back to milliseconds. Remove inproper checks for _insecure.

* Added small comment because it looked like the Travis build did not finish
2018-11-19 16:57:23 +01:00
lbernstone
65c861ad4c Added loadCert methods to WiFiClientSecure (#1959) 2018-11-19 16:50:08 +01:00
Mark D
14ff311479 make WiFi.softAP() more robust (#1925)
* make WiFi.softAP() more robust

* WiFi.softAP() revert fallback to WIFI_AUTH_OPEN
2018-11-19 16:43:59 +01:00
Junxiao Shi
a3ed511884 WiFi: improve WiFiEvent list in WiFiClientEvents example (#1917)
fixes #1875
2018-11-19 16:42:33 +01:00
Rob de Jonge
9e2888392e Added a message for all event types. (#1916) 2018-11-19 16:41:56 +01:00
WereCatf
a43682596f Deep-sleep example-sketches reported wrong wakeup-reason (#1911)
Incorrect values used, use the proper defines from header-files instead.
2018-11-19 16:41:07 +01:00
bperrybap
deaf339bde Wire endTransmission() fix for issue #1725 (#1888)
* removed uint8_t Wire.endTransmission(uint8_t sendStop)

Having both endTransmission(bool) and endTransmission(uint8_t) creates problems.
There is no need for endTransmission(uint8_t)
endTransmission(1) and endTransmission(0) works with endTransmission(bool).
Removing endTransmission(uint8_t) allows the ESP32 code to be compatible with
all the other Arduino cores by allowing endTransmission(1) and endTranmission(0)
to work as it does on all the other cores.

* Wire library version bump for endTransmission() update
2018-11-19 16:40:14 +01:00
me-no-dev
85032b226c Do not break UDP if pbuf is null 2018-09-26 23:29:51 +02:00
Me No Dev
96822d783f
Update IDF to 3.2-3276a13 and esptool.py to 2.5.0 (#1878)
* TX Flow Control and Code cleanup

* Use semaphore instead of delay

TX functionality is done.

* Use single buffer and empty queue on exit

* Fix compile issues because of LwIP code relocation

* Add temporary header to fix Azure not compiling

* Fix AsyncUDP early init

* AsyncUDP Multicast fixes

* Add source mac address and rework multicast

* Allow redefinition of default pins for Serials 1 and 2

* Update IDF to 3276a13

* Update esptool.py to 2.5.0

* Fix sketches

* Fix log level in BluetoothSetial
2018-09-21 08:39:36 +02:00
david-cermak
4e96bffe0e Initial version of rmt driver (#1525)
* rmt driver initial version

* supporting conti mode plus interrupts

* using conitnous mode for sending more data

* working continous mode

* rmt driver cleanup after conti mode

* initial version of rmt driver

* adding a simple example

* adding channel and block locks

* modified of rmt interface for simpler/easier usage

* adding header sentinels, split interface to common and additional settings

* Fixes per code review + support for rx callback mode

* renamed internal structures and enums, fixed formatting

* cmake support for rmt

* refactored tx-conti interrupts to function to make it more readable

* added Tx and Rx examples

* added license headers

* minor updates per review

* used struct access, renamed defines, corrected diagram
2018-09-17 23:19:27 +02:00
hreintke
ea61563c69 Functional interrupt (#1728)
* Initial

* Implementation

* Add to CMakelist.txt

* Add example

* Add IRAM_ATTR
2018-09-17 23:13:58 +02:00
lbernstone
7206b2f397 FAT on SPI Flash Library (#1809)
* First commit of FFat library

* Fixed reboot loops if no fat present. Added CMakeLists

* Functionalize the partition checks

* Cleanup, especially in format

* Dont format if mounted.  More wording cleanup

* 16M ffat should only be on 16M board

* Fix some casting issues that trip up the compiler when building as ESP-IDF component
2018-09-17 23:06:04 +02:00
Martin
cb8d72fdc7 Fix WifiClientEnterprise - STA mode set (#1782)
Few testers let me know, they were unable with connection to Eduroam network under PEAP+MsCHAPv2 methods.
They were trying many modifications. Solution is very absurd. 
Change board to STA mode manually. 
One tester from Italy was able to connect to Eduroam network under TTLS + MsCHAPv2 with that sketch too!

Sketch was tested and worked almost for all testers with that problem.
2018-09-17 21:43:16 +02:00
Junxiao Shi
1e4bf14a3e cores: replace max, min, round macros with imports from std (#1783)
fixes #1734
2018-09-17 21:33:01 +02:00
lbernstone
f9f995b283 Flush serial in DeepSleep example to allow print before sleep (#1791)
* Add delay into example to allow print before sleep

* Changed to Serial.flush()
2018-09-17 21:31:24 +02:00
Ifediora Elochukwu C
c8fe873965 add WiFiAccessPoint example (#1833) 2018-09-17 21:24:23 +02:00
copercini
a0f0bd930c Fix BTserial memory leaks (#1801)
- Delete queue at end
- Close BT connection before end
- DeInit SPP
2018-08-27 12:06:23 +02:00
Martin
cb53ec4891 Informations about WifiClientEnterprise.ino sketch (#1737)
* informations about sketch

* Update README.md
2018-08-14 12:00:31 +02:00
lbernstone
d057e544e0 Added a freeEntries method to Preferences library (#1722) 2018-08-14 11:52:01 +02:00
chuck todd
b05430cfd9 Wire ReSTART fix, with others (#1717)
* ReSTART fix, Sequencing fix

pr #1665 introduce a problem with ReSTART, when solving this problem I found an interaction between the TxFifo refill, RxFifo empty and CMD[] fill.  during certain sequences a dataqueue command would be skipped, this skipping resulted in a mismatch between the contents of the TxFifo and the i2c command sequence.  The problem manifested as an ACK error. 
In addition to this required bug fix I propose:
* `Wire.begin()` be changed from a `void` to a `bool` this will allow the reset functionality of `Wire.begin()` to be reported.  Currently `Wire.begin()` attempts to reset the i2c Peripheral, but cannot report success/failure.
* `Wire.busy()` be added. this `bool` function returns the hardware status of the bus. This status can be use in multi-master environments for application level interleaving of commands, also in single master environment, it can be used to detect a 'hung' bus.  With the functional change to `Wire.begin()` this allows app level recover of a hung bus.
* `Wire.lastError()` value updated for all errors, previously when interleaving `Wire.endTransmission(false)` and `Wire.readTransmission(false)`, the 128 byte `Wire.write()` buffer was exhausted without generating and error(very exotic). I discovered this error when I created a sequence of directed reads to a EEPROM. Each directed read used 2 bytes of the 128 byte `write()` buffer, so after 64 consecutive ReSTART writes with ReSTART reads, `Wire()`  had no room to record the directed address bytes.  It generated just a NAK check without setting the EEPROMs internal register address.  The succeeding ReSTART read succeeded at incorrect address.
* Changes to the HAL layer:
** added `i2cGetStatus()` which returns the i2c peripheral status word, used to detect bus_busy currently
** added `i2cDebug()` programmatic control of debug buffer output
** changed `i2cAddQueue()` to allow data_only queue element this will allow a i2c transaction to use multiple data pointers.
** removed direct access to DumpInts(), DumpI2c() from app, use i2cDebug() to set trigger points 
 
*

* Update esp32-hal-i2c.c

* Update Wire.cpp

* ReSTART, Sequencing

pr #1665 introduce a problem with ReSTART, when solving this problem I found an interaction between the TxFifo refill, RxFifo empty and CMD[] fill.  during certain sequences a dataqueue command would be skipped, this skipping resulted in a mismatch between the contents of the TxFifo and the i2c command sequence.  The problem manifested as an ACK error. 
In addition to this required bug fix I propose:
* `Wire.begin()` be changed from a `void` to a `bool` this will allow the reset functionality of `Wire.begin()` to be reported.  Currently `Wire.begin()` attempts to reset the i2c Peripheral, but cannot report success/failure.
* `Wire.busy()` be added. this `bool` function returns the hardware status of the bus. This status can be use in multi-master environments for application level interleaving of commands, also in single master environment, it can be used to detect a 'hung' bus.  With the functional change to `Wire.begin()` this allows app level recover of a hung bus.
* `Wire.lastError()` value updated for all errors, previously when interleaving `Wire.endTransmission(false)` and `Wire.readTransmission(false)`, the 128 byte `Wire.write()` buffer was exhausted without generating and error(very exotic). I discovered this error when I created a sequence of directed reads to a EEPROM. Each directed read used 2 bytes of the 128 byte `write()` buffer, so after 64 consecutive ReSTART writes with ReSTART reads, `Wire()`  had no room to record the directed address bytes.  It generated just a NAK check without setting the EEPROMs internal register address.  The succeeding ReSTART read succeeded at incorrect address.
* Changes to the HAL layer:
** added `i2cGetStatus()` which returns the i2c peripheral status word, used to detect bus_busy currently
** added `i2cDebug()` programmatic control of debug buffer output
** changed `i2cAddQueue()` to allow data_only queue element this will allow a i2c transaction to use multiple data pointers.
** removed direct access to DumpInts(), DumpI2c() from app, use i2cDebug() to set trigger points 
 
*

* Forgot DebugFlags Return

@andriyadi found this, total brain fade on my part.
2018-08-14 11:51:15 +02:00
copercini
e346f20aa9
Fix WiFiMulti Logs 2018-07-30 09:42:44 -03:00
copercini
abb8ea99d5 Fix WiFiMulti Logs (#1690) 2018-07-30 10:18:48 +03:00
me-no-dev
7d2560cbbf roll back the while loop in _parseForm 2018-07-25 20:59:56 +02:00
lbernstone
17065dfd3a Added a define to format the spiffs in SPIFFS_Test.ino (#1662)
* Added a define to format the spiffs in SPIFFS_Test.ino

* Uncommented the define

* Matched define names
2018-07-25 18:44:37 +02:00
MaValki
2f5b3c0c56 Functions _uploadReadByte and _parseForm were modified in order to (#1677)
speed up uploading data. Now there is no need to call time consuming
client.connected() method.
2018-07-25 17:37:15 +02:00
Jan P. Schümann
328523f5e3 Memory leak (#1672)
When a package of size 0 arrives, "buf" is created, but never released. (Sorry, that was my mistake in the last patch)
2018-07-25 12:56:41 +02:00
Martin
d854dc1bf6 Create WiFiClientEnterprise.ino (#1640)
Sketch for ESP32 boards that allow them to connect to WPA/WPA2 Enterprise Networks.
2018-07-24 19:57:57 +02:00
Schuemi
f1f8d7e306 Packet with zero data length (#1659)
If you receive a package with a data length of zero, parsePacket returns 0, but rx_buffer will exist. So if another parsePacket with no read access returns to zeros, there is still data that can be read. This example would not work: https://www.arduino.cc/en/Reference/EthernetUDPParsePacket

Also I added a check if rx_buffer exit when you try to flush it.
2018-07-24 19:52:42 +02:00
Sathishkumar T
2fda054bea [OTA Timeout] Added ability set OTA timeout in the OTA client (#1669) 2018-07-24 19:40:18 +02:00
Luc
e157ec06a7 expose post args during upload (#1650) 2018-07-17 10:58:03 +02:00
me-no-dev
05d72f963d fix WiFi STA going into loop in some cases of disconnect 2018-07-16 22:50:52 +02:00
per1234
c830511f01 EEPROM library: Move #include of Arduino.h to header file (#1641)
EEPROM.h uses data types which are declared through Arduino.h but that file does not contain an #include directive for Arduino.h. This does not cause any problems when the EEPROM library is #included from a .ino file because the Arduino IDE automatically adds an #include directive for Arduino.h but this is not the case for .cpp files. If a .cpp file has an #include directive for EEPROM.h that does not follow an #include directive for Arduino.h then compilation fails:

E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:91:5: error: 'float_t' does not name a type

     float_t readFloat(int address);

     ^

E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:92:5: error: 'double_t' does not name a type

     double_t readDouble(int address);

     ^

E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:95:5: error: 'String' does not name a type

     String readString(int address);

     ^

E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:110:36: error: 'float_t' has not been declared

     size_t writeFloat(int address, float_t value);

                                    ^

E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:111:37: error: 'double_t' has not been declared

     size_t writeDouble(int address, double_t value);

                                     ^

E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:114:37: error: 'String' has not been declared

     size_t writeString(int address, String value);
2018-07-16 20:44:36 +02:00
me-no-dev
44f5a4dbc8 Fix Client returning disconnected because of VFS errors 2018-07-16 20:08:27 +02:00
me-no-dev
ddfeae90d0 Fix AsyncUDP server exception 2018-07-11 20:46:54 +02:00
me-no-dev
ff90778173 Fix HTTP client returning disconnected when there is still data avalable 2018-07-10 21:06:20 +02:00
me-no-dev
4e9d1ee237 Fix connected to be wrongly reported in WiFiClient 2018-07-10 21:05:44 +02:00
me-no-dev
c1a94b5326 Fix wrong event description 2018-07-10 16:13:34 +02:00
me-no-dev
3e160587f3 Fix WiFi Client not properly reporting connected state 2018-07-10 15:01:40 +02:00
Bert Melis
c77aed4ac4 Allow using argument with attachInterrupt (#1535)
* Allow using argument with attachInterrupt

* formatting

replace tabs with spaces

* fix bug more then 1 interrupt

* leftover

* add example

* make attachInterruptArg public

* update example

* leftover
2018-07-07 11:26:58 +02:00
Gottfried Haider
901a341949 BluetoothSerial: set COD to be compatible with macOS (#1304) (#1556) 2018-07-07 11:25:10 +02:00
lbernstone
9f6d0d2958 EEPROM.readstring was returning an extra character (#1609) 2018-07-07 10:19:44 +02:00
me-no-dev
9efecc1be0 Implement RX buffer for WiFi client to speed up small reads 2018-07-05 22:31:58 +02:00
me-no-dev
b0c6991bcf Small adjustments to the web server 2018-07-05 22:31:19 +02:00
me-no-dev
8afdd71b3a Add missing event string to WiFi events 2018-07-05 22:30:54 +02:00
me-no-dev
871dd183d8 Print to debug the IP address obtained by DHCP 2018-07-05 16:04:07 +02:00
me-no-dev
bad53905e8 Prevent exceptions in WiFi if not yet started 2018-07-05 12:28:15 +02:00
me-no-dev
95b87545e7 Make Stream functions if File to not wait for timeout
Fixes: https://github.com/espressif/arduino-esp32/issues/1597
2018-07-05 11:51:58 +02:00
me-no-dev
659c8ad528 Fix TelnetToSerial sketch 2018-07-03 21:51:24 +02:00
me-no-dev
2fe965259a "fix" SPI 2018-07-03 21:23:04 +02:00
Karan Sharma
0161e28614 Added OTAWebUpdater Doc (#1583) 2018-07-03 20:43:18 +02:00
me-no-dev
4e5cbdaa7f Add declarations for all Serial, SPI and Wire buses 2018-07-03 20:41:03 +02:00
lbernstone
c4c946a83d Broke HTTP_Method out into a separate library for reuse in ESPAsyncWebServer (#1562) 2018-07-02 18:24:08 +02:00
Karan Sharma
47421b869f Added OTAWebupdated (#1544)
* added OTAWebUpdater

* added OTAWebUpdater

* Updated OTAWebUpdater
2018-06-28 21:19:22 +02:00
Gottfried Haider
ed953a0d2e BluetoothSerial: check return value and return number of bytes written (#1538) 2018-06-27 23:00:31 +02:00
me-no-dev
873876d94c Fix peek, read and available logic in WiFiClientSecure 2018-06-27 22:09:21 +02:00
lbernstone
cde668dada ArduinoOTA endless loop (#1533)
* Changed pinmap to show pins34-39 as GPI

* ArduinoOTA could have endless loop b/c udp.read can return negative result
2018-06-27 09:06:02 +02:00
Me No Dev
a59eafbc9d
Update IDF to aaf1239 (#1539)
* fix sdmmc config

* Fix warnings in EEPROM

from @Curclamas

* remove leftover TAG in EEPROM

* Initial add of @stickbreaker i2c

* Add log_n

* fix warnings when log is off

* i2c code clean up and reorganization

* add flags to interrupt allocator

* fix sdmmc config

* Fix warnings in EEPROM

from @Curclamas

* remove leftover TAG in EEPROM

* fix errors with latest IDF

* fix debug optimization (#1365)

incorrect optimization for debugging tick markers.

* Fix some missing BT header

* Change BTSerial log calls

* Update BLE lib

* Arduino-ESP32 release management scripted (#1515)

* Calculate an absolute path for a custom partitions table (#1452)

* * Arduino-ESP32 release management scripted
(ready-to-merge)

* * secure env for espressif/arduino-esp32

* * build tests enabled
* gitter webhook enabled

* * gitter room link fixed
* better comment

* * filepaths fixed

* BT Serial adjustments

* * don't run sketch builds & tests for tagged builds

* Return false from WiFi.hostByName() if hostname is not resolved

* Free BT Memory when BT is not used

* WIFI_MODE_NULL is not supported anymore

* Select some key examples to build with PlatformIO to save some time

* Update BLE lib

* Fixed BLE lib

* Major WiFi overhaul

- auto reconnect on connection loss now works
- moved to event groups
- some code clean up and procedure optimizations
- new methods to get a more elaborate system ststus

* Add cmake tests to travis

* Add initial AsyncUDP

* Add NetBIOS lib and fix CMake includes

* Add Initial WebServer

* Fix WebServer and examples

* travis not quiting on build fail

* Try different travis build

* Update IDF to aaf1239

* Fix WPS Example

* fix script permission and add some fail tests to sketch builder

* Add missing space in WiFiClient::write(Stream &stream)
2018-06-27 09:01:06 +02:00
lbernstone
36c8020cbc Added WiFi.disconnect to ESPNow examples. Fixes https://github.com/espressif/arduino-esp32/issues/1425 (#1511) 2018-06-19 11:33:50 +03:00
Alan
d06fa8ee70 Make scanNetworks return int16 (#1496) (#1514) 2018-06-19 11:32:12 +03:00
horihiro
83810fa156 add support for TXT records in mDNS query responses (#1480)
* add methods for getting TXTs.

* add methods for getting TXTs.
2018-06-18 18:18:50 +03:00
Renhe Li
40d85ce582 Add submodule of Azure IoT library (#1448)
* Add submodule of Azure IoT library

* update the submodule of AzureIoT
2018-05-31 14:52:02 +02:00
Me No Dev
900e0a0257
Update commented pins in SPI Multi example
Update commented pins so people do not get confused and try to use them
2018-05-28 13:44:49 +02:00
sticilface
c24a3404c6 Add SYSTEM_EVENT_WIFI_READY call back + WiFiMode fixes (#1322)
* Add `SYSTEM_EVENT_WIFI_READY` call back once wifi service is init.  allows you to hook in, as the sdk does not generate this event for you.
As it stands the SDK does not appear to set `WIFI_MODE_NULL` correctly.  if the wifi is initialised and set to `WIFI_MODE_NULL` it actually defaults to AP mode.  This fix keeps `WIFI_MODE_NULL` within the ESP class if the wifi has not been init yet, and works in my testing.  albeit a one sided conversation.
https://github.com/espressif/arduino-esp32/issues/1306

* make changes compatible with new _persistent behaviour.
2018-05-23 10:53:01 +02:00
Ramesh
f14de5cf14 WiFi disconnect reason message updated (#1323)
wifi_err_reason_t doesn't have reason code 12. After reason code 11, we are getting wrong wifi disconnected reason message. Added "UNSPECIFIED"  in place of reason code 12.
And above 201 reason code, it should be r-176 instead of r-177. Because messages are started from zeroth offset.
2018-05-14 13:12:04 +02:00
Giuseppe
848cf98ba9 Update ExternalWakeUp.ino (#1332) 2018-05-14 13:09:51 +02:00
BuzzRage
f5246cf4c1 Adding a getClockDivider function (#1355)
* Adding getClockDivider function

* indentation correction
2018-05-14 13:08:27 +02:00
Tim P
6bf7619ccc std::functioanl for WFIF event + Minor fix (#1366)
* add missing bits from esp8266 to help porting other libs

* Clean Up of Wifi event

* Exampl of Wifi Events
2018-05-14 13:05:49 +02:00
chemicstry
611db61d84 Fix WiFiClient error handling (#1388) 2018-05-14 13:01:22 +02:00
chemicstry
00f962439a Port SSL fingerprint checking from ESP8266 WiFiClientSecure to ESP32 (#1397) 2018-05-14 13:00:40 +02:00
Clemens Kirchgatterer
0ea9ea4447 Fix WiFi.persistent(false); having no effect. (#1406)
This PR calls `esp_wifi_set_storage(WIFI_STORAGE_RAM);` when
  persistent WiFi configuration is not desired.
2018-05-14 12:59:59 +02:00
AlistairSymonds
68265084b1 Created example program showing usage of both VSPI/HSPI within arduino API (#1368) 2018-05-02 15:22:56 +02:00
sticilface
1424b6d1a4 Add guard to handle to check for _initialized (#1321)
The wifi stack initialisation must be complete before calling  `_udp_ota.parsePacket()` otherwise you just get a screen filled with 
```
```
and due to the more async methods in ESP32 `handle()` may be called before this can occur.
2018-04-16 18:56:58 +02:00
Craig Leres
c92b617397 Convert the few remaining cr/lf files to use lf for eol. (#1316)
If you develop on windows and need cr/lf files, see this:

    https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace

    Git can handle this by auto-converting CRLF line endings into LF
    when you add a file to the index, and vice versa when it checks out
    code onto your filesystem. You can turn on this functionality with
    the core.autocrlf setting. If you're on a Windows machine, set it
    to true - this converts LF endings into CRLF when you check out code:

    $ git config --global core.autocrlf true
2018-04-16 16:34:39 +02:00
copercini
febcda0095 add WiFiClientSecure::peek(); (#1310) 2018-04-14 09:44:21 +02:00
Me No Dev
69f72eca84
Update IDF to f586f5e (#1296)
* Update BLE lib

* Update IDF to f586f5e

* Restructure Bluetooth Serial includes

* Update esptool and gen_esp32part

* Add partition scheme selection for menuconfig

* Add partition scheme selection for Arduino IDE

* Fix BLE example

* Second attempt BLE fix

* Add exceptions to PIO
2018-04-07 09:45:18 +03:00
FloX
2ded419486 Update WiFiMulti.cpp (#1220)
* Update WiFiMulti.cpp

added 5 sec timeout from ESP8266

* Update WiFiMulti.cpp

* Update WiFiMulti.h
2018-04-06 19:10:06 +03:00
chuck todd
7998e2321d Preserver custom pin assigments (#1239)
This code allows Wire.begin() to assign the default values of SDA, and SCL only if they have not been previously configured.  Arduino libraries that use Wire() usually re-init the I2C interface in their initialization code with a call to Wire.begin().  If a user app sets custom pins assignment in setup(); These assignments will be overwritten with the default values  whenever Wire.begin() is called.
2018-04-06 19:05:48 +03:00
Shawn A
f6a4b024c7 fixes #1249 (#1269) 2018-04-06 19:02:21 +03:00
me-no-dev
25dff4f044 Fix Bluetooth Serial 2018-04-03 11:09:29 +03:00
copercini
3a4ec66d41 Add hasClient for BluetoothSerial (#1183)
* Add hasClient for BluetoothSerial

* Add SPP_TAG
2018-03-09 11:16:18 +01:00
per1234
146b2f6a23 Use correct separator in keywords.txt (#1175)
The Arduino IDE currently requires the use of a tab separator between the name and identifier. Without this tab the keyword is not highlighted.

Reference:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywords
2018-03-05 07:38:39 +01:00
copercini
b4b9a79eea Add BluetoothSerial library (#1144)
* Add BluetoothSerial library

A simple UART to Classical Bluetooth bridge for ESP32

* Create README.md

* Fix typos

* Replace deprecated header and small fixes

* Add coexistence with BLE

* Add missing semicolon
2018-03-05 07:34:10 +01:00
Luc
adf513fc17 Unify time modification on SD and SPIFFS (#738)
* Add access to last write date time

add example

* rename cpp to ino orz

* wrong copy -past

* No comment orz

* Add missing space
2018-03-04 21:20:34 +01:00
Shawn A
848f98e5f0 fix event reason logging > 176 (#1132)
off by one
2018-03-04 21:05:54 +01:00
Marco Tombesi
bb8b255429 fix issue 1081 and 1086 Wifi connection error when using STATIC IP settings (#1129) 2018-03-04 21:05:24 +01:00
Jason K
7aa7c3f0dd Add additional test detail (#1099)
Update test to show more detail to help for checking for poor/inconsistent FLASH operation.
2018-03-04 20:57:45 +01:00
h3ndrik
e3a5ae439b clean up faster (fixes #828) (#1087)
flush tcp buffer instead of reading it byte by byte.
2018-03-04 20:53:04 +01:00