Commit Graph

204 Commits

Author SHA1 Message Date
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
Me No Dev
1c77790a5b
allow the examples to build in a more strict env (#3299) 2019-09-29 23:47:02 +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
Me No Dev
4ce2cc3c1d
Fix HTTP Client with SSL (#3216) 2019-09-16 19:14:32 +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
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
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
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
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
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
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
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
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
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
acevest
ffd15e4637 fix log error code format (#2366) 2019-01-23 15:33:41 +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
Jeroen88
00e69a28bc Redo PR #2259 because I messed up my local git (#2263) 2019-01-02 17:44:17 +02:00
me-no-dev
6dd8be3262 Use more agressive disconnect on wifi connect error 2018-12-28 21:23:17 +02: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
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
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
Luc
5cfff190e9 removing log (#2140)
* Use right function for BSSID

* removing log
2018-12-03 16:17:16 +01:00
Luc
f644d9d157 Use right function for BSSID (#2132) 2018-12-01 10:20:13 +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
Martin
c7fa251d78 updated WifiClientEnterprise example (#1988)
* updated WifiClientEnterprise example

* Update WiFiClientEnterprise.ino
2018-11-19 16:59:56 +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
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
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
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
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
Ifediora Elochukwu C
c8fe873965 add WiFiAccessPoint example (#1833) 2018-09-17 21:24: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
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
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
me-no-dev
05d72f963d fix WiFi STA going into loop in some cases of disconnect 2018-07-16 22:50:52 +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
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
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
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
659c8ad528 Fix TelnetToSerial sketch 2018-07-03 21:51:24 +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
Alan
d06fa8ee70 Make scanNetworks return int16 (#1496) (#1514) 2018-06-19 11:32:12 +03: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
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
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
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
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
Shawn A
f6a4b024c7 fixes #1249 (#1269) 2018-04-06 19:02:21 +03: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
me-no-dev
8332a235d6 fix issue with STA emiting the wrong event 2018-01-18 13:54:26 +02:00
Me No Dev
600f4c4130
Update IDF to 1c3dd23
* Update mDNS and LEDC

* update toolchain

* Update IDF to 1c3dd23

* Advertise the board variant for Arduino OTA

* Add generic variant definition for mDNS
2018-01-18 00:56:58 +02:00
copercini
70d0d46487 Enable static IP via ethernet (#924) 2017-12-19 14:07:22 +01:00
Frank Sautter
75bc1e648b Allow configuration of Ethernet PHY clock source (#916)
* Allow configuration of Ethernet PHY clock source
Refer to https://github.com/espressif/esp-idf/pull/1127
The internal APLL can be used to generate the 50MHz clock for the internal EMAC and the external Ethernet PHY.
The clock can either be input on GPIO0 (as before) or output on GPIO0, GPIO16 or GPIO17 (only GPIO17 extensively tested).
New example available.

* Allow configuration of Ethernet PHY clock source
Refer to https://github.com/espressif/esp-idf/pull/1127
The internal APLL can be used to generate the 50MHz clock for the internal EMAC and the external Ethernet PHY.
The clock can either be input on GPIO0 (as before) or output on GPIO0, GPIO16 or GPIO17 (only GPIO17 extensively tested).
New example available.
2017-12-19 14:06:01 +01:00
Masaki Koyanagi
79e5d4c40d Allow PSK instead of passphrase in WiFiSTA::begin (#897) 2017-12-04 17:46:49 +01:00
me-no-dev
f0336b38ad fix change in IDF causing havoc when used as component 2017-11-30 16:17:26 +01:00
allex1978
47cdfff475 Now SmartConfig works! (#807)
* little fix to WiFiSTA.cpp

Now SmartConfig works! Tested on ESP32

* little fix to WiFiSTA.cpp

Now SmartConfig works! Tested on ESP32
2017-11-06 20:10:48 +02:00
Me No Dev
0c038b4063 Update WiFiGeneric.cpp
Missed definition
2017-10-21 09:50:43 +03:00
Me No Dev
43544d89c5 Run WiFi thread on the Arduino core
Fixes: https://github.com/espressif/arduino-esp32/issues/749

Works even when single core mode is selected
2017-10-21 09:47:24 +03:00
me-no-dev
81f225a4c5 Fix ioctl undefined in latest IDF 2017-10-18 10:51:18 +02:00
me-no-dev
e72895b722 Quiet SSL and HTTPClient debug 2017-09-29 20:31:45 +08:00
me-no-dev
28b7b4e287 Move network events to their own task 2017-09-28 11:41:35 +08:00
me-no-dev
eb282131ba Allow DHCP to be started again by giving a zero IP address to STA config
Fixes: https://github.com/espressif/arduino-esp32/issues/654
2017-09-22 12:20:53 +08:00
Pranav Cherukupalli
17add63139 Add Example Code for WPS Functionality (#648) 2017-09-21 16:47:45 +08:00
me-no-dev
4cf0e98f32 Fix desync with IDF in dhcpserver 2017-09-20 15:36:39 +08:00
me-no-dev
f648ad7cea Allow WiFi Event Callback to read the event info
Helps in cases where Event Info is needed (WPS and others)
2017-09-18 17:54:57 +08:00
copercini
9edf65d56e Static IP example 2017-09-09 00:15:54 -03:00
Tomasz Scislowicz
3a8e28dc87 change esp_wifi_scan_start to async mode (#574) 2017-08-17 16:12:35 +03:00
me-no-dev
9618eec19e Set DNS IP to type V4
Fixes: https://github.com/espressif/arduino-esp32/issues/553
2017-08-02 09:32:05 +03:00
me-no-dev
3af1710a92 Add initial support for Ethernet and examples 2017-08-02 00:02:45 +03:00
sticilface
91d02cc6d5 Change disconnect function (#466)
* Change disconnect function

Current implementation does not disconnect the WiFi. Use of `esp_wifi_disconnect()` does.

* Update WiFiSTA.cpp

put back the clear ssid + password
remove the duplicate `esp_wifi_set_config(WIFI_IF_STA, &conf);`
2017-08-01 12:59:52 +03:00
bbx10
37ef5a43e3 Handle partial socket send (#503)
send() can return a value > 0 but less than size indicating it was able to accept some of the data in buffer. The caller must try again after updating the buffer pointer and size remaining.
2017-07-31 22:51:41 +03:00
me-no-dev
7811668fb1 Make sure that WiFi is started before trying to erase configuration.
Connected to: https://github.com/espressif/arduino-esp32/issues/400
2017-06-21 12:42:58 +03:00
me-no-dev
409926ef77 Fix commits duplicating methods 2017-06-14 13:48:48 +03:00
bbx10
b05c7dfa59 Additions to WiFiClient and WiFiServer (#404)
Required for WebServer and/or DNSServer libraries
2017-06-14 10:22:16 +02:00
bbx10
26677a4b05 Add WiFiClient localIP and localPort (#428)
Implement methods from ESP8266WiFiClient but use sockets API.
2017-06-14 10:17:14 +02:00
SO_yeah
73cd8d7f7e set max clients from code (#432)
* Update WiFiAP.cpp

set from code the maximum number of clients to smaller than 4 (in my case i must allow only one client at a time)

* Update WiFiAP.h

* Update WiFiAP.cpp

* Update WiFiAP.cpp

* Create WiFiAP.cpp
2017-06-14 10:14:14 +02:00
Joey Babcock
4d47deab24 Some grammar/spelling fixes (#438) 2017-06-14 10:12:59 +02:00