Skip to content

Commit f6f1934

Browse files
authored
Merge branch 'master' into spi_pins_detach
2 parents cb86fb3 + 4766608 commit f6f1934

File tree

8 files changed

+57
-68
lines changed

8 files changed

+57
-68
lines changed

.github/workflows/docs_build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
- release/*
88
paths:
99
- 'docs/**'
10-
- '.github/workflows/docs.yml'
10+
- '.github/workflows/docs_build.yml'
1111
pull_request:
1212
paths:
1313
- 'docs/**'
14-
- '.github/workflows/docs.yml'
14+
- '.github/workflows/docs_build.yml'
1515

1616
jobs:
1717

@@ -42,4 +42,3 @@ jobs:
4242
with:
4343
name: docs
4444
path: docs
45-

.github/workflows/docs_deploy.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
name: Documentation Build and Production Deploy CI
22

33
on:
4+
release:
5+
types: [published]
46
push:
57
branches:
68
- release/*
9+
- master
710
paths:
811
- 'docs/**'
9-
- '.github/workflows/docs.yml'
12+
- '.github/workflows/docs_deploy.yml'
1013

1114
jobs:
1215

@@ -27,12 +30,11 @@ jobs:
2730
env:
2831
# Deploy to production server
2932
# DOCS_BUILD_DIR: "./docs/_build/"
30-
DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_PROD_PRIVATEKEY }}
31-
DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PROD_PATH }}
33+
DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_KEY }}
34+
DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PATH }}
3235
DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_SERVER }}
33-
DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_PROD_USER }}
34-
DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_PROD_URL_BASE }}
35-
# Deploy to preview server
36+
DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_USER }}
37+
DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_URL }}
3638
run: |
3739
sudo apt update
3840
sudo apt install python3-pip python3-setuptools

.github/workflows/docs_preview.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ You can use the [Arduino-ESP32 Online Documentation](https://docs.espressif.com/
3636

3737
---
3838

39+
**APIs compatibility with ESP8266 and Arduino-CORE (Arduino.cc) is explained [here](https://docs.espressif.com/projects/arduino-esp32/en/latest/libraries.html#apis).**
40+
41+
---
42+
3943
* [Getting Started](https://docs.espressif.com/projects/arduino-esp32/en/latest/getting_started.html)
4044
* [Installing (Windows, Linux and macOS)](https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html)
4145
* [Libraries](https://docs.espressif.com/projects/arduino-esp32/en/latest/libraries.html)

docs/en/esp-idf_component.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,17 @@ After the setup you can save and exit:
7373
- Close confirmation window [Enter] or [Space] or [Esc]
7474
- Quit [Q]
7575

76-
Option 1. Using Arduino setup() and loop()
77-
******************************************
76+
As the Arduino libraries use C++ features, you will need to swap some file extensions from ``.c`` to ``.cpp``:
7877

7978
- In main folder rename file `main.c` to `main.cpp`.
79+
- In main folder open file `CMakeLists.txt` and change `main.c` to `main.cpp` as described below.
8080

81-
- In main folder open file `CMakeList.txt` and change `main.c` to `main.cpp` as described below.
81+
Option 1. Using Arduino setup() and loop()
82+
******************************************
8283

83-
- Your main.cpp should be formatted like any other sketch.
84+
Your main.cpp should be formatted like any other sketch. Don't forget to include ``Arduino.h``.
8485

85-
.. code-block:: c
86+
.. code-block:: cpp
8687
8788
//file: main.cpp
8889
#include "Arduino.h"
@@ -102,14 +103,14 @@ Option 1. Using Arduino setup() and loop()
102103
Option 2. Using ESP-IDF appmain()
103104
*********************************
104105

105-
In main.c or main.cpp you need to implement ``app_main()`` and call ``initArduino();`` in it.
106+
In main.cpp you need to implement ``app_main()`` and call ``initArduino();`` in it.
106107

107108
Keep in mind that setup() and loop() will not be called in this case.
108109
Furthermore the ``app_main()`` is single execution as a normal function so if you need an infinite loop as in Arduino place it there.
109110

110111
.. code-block:: cpp
111112
112-
//file: main.c or main.cpp
113+
//file: main.cpp
113114
#include "Arduino.h"
114115
115116
extern "C" void app_main()
@@ -141,7 +142,7 @@ Build, flash and monitor
141142

142143
- After a successful flash, you may need to press the RST button again
143144

144-
- To terminate the serial monitor press [Ctrl] + [ ] ]
145+
- To terminate the serial monitor press ``Ctrl`` + ``]``
145146

146147
Logging To Serial
147148
-----------------
@@ -179,7 +180,7 @@ Download the library:
179180

180181
.. code-block:: bash
181182
182-
cd ~/esp/esp-idf/components/arduino-esp32/
183+
cd ~/esp/esp-idf/components/arduino/
183184
git clone --recursive [email protected]:Author/new_library.git libraries/new_library
184185
185186

docs/en/libraries.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ APIs
7171

7272
The Arduino ESP32 offers some unique APIs, described in this section:
7373

74+
.. note::
75+
Please be advised that we cannot ensure continuous compatibility between the Arduino Core ESP32 APIs and ESP8266 APIs, as well as Arduino-Core APIs (Arduino.cc).
76+
While our aim is to maintain harmony, the addition of new features may result in occasional divergence. We strive to achieve the best possible integration but acknowledge
77+
that perfect compatibility might not always be feasible. Please refer to the documentation for any specific considerations.
78+
7479
.. toctree::
7580
:maxdepth: 1
7681
:glob:

libraries/WiFi/src/WiFiSTA.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ bool WiFiSTAClass::reconnect()
367367
* @param eraseap `true` to erase the AP configuration from the NVS memory.
368368
* @return `true` when successful.
369369
*/
370-
bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
370+
bool WiFiSTAClass::disconnectAsync(bool wifioff, bool eraseap)
371371
{
372372
wifi_config_t conf;
373373
wifi_sta_config(&conf);
@@ -391,6 +391,31 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
391391
return false;
392392
}
393393

394+
/**
395+
* Disconnect from the network.
396+
* @param wifioff `true` to turn the Wi-Fi radio off.
397+
* @param eraseap `true` to erase the AP configuration from the NVS memory.
398+
* @param timeoutLength timeout to wait for status change
399+
* @return `true` when successful.
400+
*/
401+
bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap, unsigned long timeoutLength)
402+
{
403+
if (!disconnectAsync(wifioff, eraseap)) {
404+
return false;
405+
}
406+
if (!timeoutLength) {
407+
return true;
408+
}
409+
const unsigned long start = millis();
410+
while ((WiFiGenericClass::getStatusBits() & STA_CONNECTED_BIT) != 0) {
411+
if((millis() - start) >= timeoutLength){
412+
return false;
413+
}
414+
delay(2);
415+
}
416+
return true;
417+
}
418+
394419
/**
395420
* @brief Reset WiFi settings in NVS to default values.
396421
* @return true if erase succeeded

libraries/WiFi/src/WiFiSTA.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class WiFiSTAClass
6161
bool bandwidth(wifi_bandwidth_t bandwidth);
6262

6363
bool reconnect();
64-
bool disconnect(bool wifioff = false, bool eraseap = false);
64+
bool disconnectAsync(bool wifioff = false, bool eraseap = false);
65+
bool disconnect(bool wifioff = false, bool eraseap = false, unsigned long timeoutLength = 100);
6566
bool eraseAP(void);
6667

6768
bool isConnected();

0 commit comments

Comments
 (0)