Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 184d5fa

Browse files
authoredMay 3, 2023
Merge branch 'master' into esp-idf-v5.1-libs
2 parents cf75047 + 7e51a03 commit 184d5fa

File tree

13 files changed

+193
-25
lines changed

13 files changed

+193
-25
lines changed
 

‎.github/ISSUE_TEMPLATE/Issue-report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ body:
4141
options:
4242
- latest master (checkout manually)
4343
- latest development Release Candidate (RC-X)
44+
- v2.0.8
4445
- v2.0.7
4546
- v2.0.6
4647
- v2.0.5

‎.github/scripts/find_all_boards.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
# Get all boards
4+
boards_array=()
5+
6+
for line in `grep '.tarch=' boards.txt`; do
7+
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
8+
boards_array+=("espressif:esp32:$board_name")
9+
echo "Added 'espressif:esp32:$board_name' to array"
10+
done
11+
12+
# Create JSON like string with all boards found and pass it to env variable
13+
board_count=${#boards_array[@]}
14+
echo "Boards found: $board_count"
15+
echo "BOARD-COUNT=$board_count" >> $GITHUB_ENV
16+
17+
if [ $board_count -gt 0 ]
18+
then
19+
json_matrix='['
20+
for board in ${boards_array[@]}
21+
do
22+
json_matrix+='"'$board'"'
23+
if [ $board_count -gt 1 ]
24+
then
25+
json_matrix+=","
26+
fi
27+
board_count=$(($board_count - 1))
28+
done
29+
json_matrix+=']'
30+
31+
echo $json_matrix
32+
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV
33+
else
34+
echo "FQBNS=" >> $GITHUB_ENV
35+
fi

‎.github/workflows/allboards.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Boards Test - Remote trigger
2+
3+
# The workflow will run on remote dispath with event-type set to "test-boards"
4+
on:
5+
repository_dispatch:
6+
types: [test-boards]
7+
8+
jobs:
9+
find-boards:
10+
runs-on: ubuntu-latest
11+
12+
outputs:
13+
fqbns: ${{ env.FQBNS }}
14+
board-count: ${{ env.BOARD-COUNT }}
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
with:
20+
ref: ${{ github.event.client_payload.branch }}
21+
22+
- name: Get boards fqbns
23+
run:
24+
bash .github/scripts/find_all_boards.sh
25+
26+
setup-chunks:
27+
needs: find-boards
28+
runs-on: ubuntu-latest
29+
if: needs.find-boards.outputs.fqbns != ''
30+
31+
outputs:
32+
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
- run: npm install
37+
- name: Setup jq
38+
uses: dcarbone/install-jq-action@v1.0.1
39+
40+
- id: set-test-chunks
41+
name: Set Chunks
42+
run:
43+
echo "test-chunks<<EOF" >> $GITHUB_OUTPUT
44+
45+
echo "$( jq -nc '${{ needs.find-boards.outputs.fqbns }} | [_nwise( ${{ needs.find-boards.outputs.board-count }}/15 | ceil)]')" >> $GITHUB_OUTPUT
46+
47+
echo "EOF" >> $GITHUB_OUTPUT
48+
49+
test-boards:
50+
needs: setup-chunks
51+
runs-on: ubuntu-latest
52+
53+
env:
54+
REPOSITORY: |
55+
- source-path: '.'
56+
name: "espressif:esp32"
57+
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
chunk: ${{ fromJSON(needs.setup-chunks.outputs['test-chunks']) }}
62+
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v3
66+
67+
- name: Echo FQBNS to file
68+
run:
69+
echo "$FQBN" > fqbns.json
70+
env:
71+
FQBN: ${{ toJSON(matrix.chunk) }}
72+
73+
- name: Compile sketch
74+
uses: P-R-O-C-H-Y/compile-sketches@main
75+
with:
76+
platforms: |
77+
${{ env.REPOSITORY }}
78+
multiple-fqbn: true
79+
multiple-fqbn-path: "fqbns.json"
80+
use-json-file: false
81+
enable-deltas-report: false
82+
enable-warnings-report: false
83+
cli-compile-flags: |
84+
- --warnings="all"
85+
sketch-paths:
86+
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"

‎.github/workflows/lib.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"name": "ESP32Servo",
2020
"exclude_targets": [],
2121
"sketch_path": [
22-
"~/Arduino/libraries/ESP32Servo/examples/Knob/Knob.ino",
23-
"~/Arduino/libraries/ESP32Servo/examples/Sweep/Sweep.ino",
24-
"~/Arduino/libraries/ESP32Servo/examples/PWMExample/PWMExample.ino",
2522
"~/Arduino/libraries/ESP32Servo/examples/Multiple-Servo-Example-Arduino/Multiple-Servo-Example-Arduino.ino"
2623
]
2724
},
@@ -51,5 +48,19 @@
5148
"sketch_path": [
5249
"~/Arduino/libraries/IRremote/examples/SendDemo/SendDemo.ino"
5350
]
51+
},
52+
{
53+
"name": "MFRC522",
54+
"exclude_targets": [],
55+
"sketch_path": [
56+
"~/Arduino/libraries/MFRC522/examples/ReadUidMultiReader/ReadUidMultiReader.ino"
57+
]
58+
},
59+
{
60+
"name": "WS2812FX",
61+
"exclude_targets": [],
62+
"sketch_path": [
63+
"~/Arduino/libraries/WS2812FX/examples/ws2812fx_spi/ws2812fx_spi.ino"
64+
]
5465
}
5566
]

‎boards.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7314,6 +7314,7 @@ dfrobot_beetle_esp32c3.menu.EraseFlash.all.upload.erase_cmd=-e
73147314
dfrobot_firebeetle2_esp32e.name=FireBeetle 2 ESP32-E
73157315

73167316
dfrobot_firebeetle2_esp32e.upload.tool=esptool_py
7317+
dfrobot_firebeetle2_esp32e.upload.tool.default=esptool_py
73177318
dfrobot_firebeetle2_esp32e.upload.maximum_size=1310720
73187319
dfrobot_firebeetle2_esp32e.upload.maximum_data_size=327680
73197320
dfrobot_firebeetle2_esp32e.upload.flags=
@@ -22259,6 +22260,7 @@ esp32c3m1IKit.menu.EraseFlash.all.upload.erase_cmd=-e
2225922260
roboheart_hercules.name=RoboHeart Hercules
2226022261

2226122262
roboheart_hercules.upload.tool=esptool_py
22263+
roboheart_hercules.upload.tool.default=esptool_py
2226222264
roboheart_hercules.upload.maximum_size=1310720
2226322265
roboheart_hercules.upload.maximum_data_size=327680
2226422266
roboheart_hercules.upload.wait_for_upload_port=true

‎cores/esp32/WString.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
// A pure abstract class forward used as a means to proide a unique pointer type
3535
// but really is never defined.
3636
class __FlashStringHelper;
37-
#define FPSTR(pstr_pointer) (pstr_pointer)
38-
#define F(string_literal) (string_literal)
37+
#define FPSTR(str_pointer) (reinterpret_cast<const __FlashStringHelper *>(str_pointer))
38+
#define F(string_literal) (FPSTR(PSTR(string_literal)))
3939

4040
// An inherited class for holding the result of a concatenation. These
4141
// result objects are assumed to be writable by subsequent concatenations.

‎cores/esp32/esp32-hal-ledc.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -215,26 +215,32 @@ static int cnt_channel = LEDC_CHANNELS;
215215
static uint8_t analog_resolution = 8;
216216
static int analog_frequency = 1000;
217217
void analogWrite(uint8_t pin, int value) {
218-
// Use ledc hardware for internal pins
219-
if (pin < SOC_GPIO_PIN_COUNT) {
220-
if (pin_to_channel[pin] == 0) {
221-
if (!cnt_channel) {
222-
log_e("No more analogWrite channels available! You can have maximum %u", LEDC_CHANNELS);
223-
return;
224-
}
225-
if(ledcSetup(cnt_channel - 1, analog_frequency, analog_resolution) == 0){
226-
log_e("analogWrite setup failed (freq = %u, resolution = %u). Try setting different resolution or frequency");
227-
return;
228-
}
229-
ledcAttachPin(pin, cnt_channel - 1);
230-
pin_to_channel[pin] = cnt_channel--;
218+
// Use ledc hardware for internal pins
219+
if (pin < SOC_GPIO_PIN_COUNT) {
220+
int8_t channel = -1;
221+
if (pin_to_channel[pin] == 0) {
222+
if (!cnt_channel) {
223+
log_e("No more analogWrite channels available! You can have maximum %u", LEDC_CHANNELS);
224+
return;
225+
}
226+
cnt_channel--;
227+
channel = cnt_channel;
228+
} else {
229+
channel = analogGetChannel(pin);
230+
}
231+
log_v("GPIO %d - Using Channel %d, Value = %d", pin, channel, value);
232+
if(ledcSetup(channel, analog_frequency, analog_resolution) == 0){
233+
log_e("analogWrite setup failed (freq = %u, resolution = %u). Try setting different resolution or frequency");
234+
return;
235+
}
236+
ledcAttachPin(pin, channel);
237+
pin_to_channel[pin] = channel;
238+
ledcWrite(channel, value);
231239
}
232-
ledcWrite(pin_to_channel[pin] - 1, value);
233-
}
234240
}
235241

236242
int8_t analogGetChannel(uint8_t pin) {
237-
return pin_to_channel[pin] - 1;
243+
return pin_to_channel[pin];
238244
}
239245

240246
void analogWriteFrequency(uint32_t freq) {

‎docs/source/api/timer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,4 @@ Repeat timer example:
219219
Watchdog timer example:
220220

221221
.. literalinclude:: ../../../libraries/ESP32/examples/Timer/WatchdogTimer/WatchdogTimer.ino
222-
:language: arduino
222+
:language: arduino

‎docs/source/getting_started.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ in the examples menu or inside each library folder.
133133

134134
https://github.com/espressif/arduino-esp32/tree/master/libraries
135135

136+
There is also a `list of examples <https://techtutorialsx.com/category/esp32/>`_ managed outside of Espressif, so check them out.
136137

137138
.. include:: common/datasheet.inc
138139

‎libraries/ESPmDNS/src/ESPmDNS.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ MDNSResponder::~MDNSResponder() {
6161
end();
6262
}
6363

64-
bool MDNSResponder::begin(const char* hostName){
64+
bool MDNSResponder::begin(const String& hostName){
6565
if(mdns_init()){
6666
log_e("Failed starting MDNS");
6767
return false;
6868
}
6969
//WiFi.onEvent(_on_sys_event);
7070
_hostname = hostName;
7171
_hostname.toLowerCase();
72-
if(mdns_hostname_set(hostName)) {
72+
if(mdns_hostname_set(hostName.c_str())) {
7373
log_e("Failed setting MDNS hostname");
7474
return false;
7575
}

‎libraries/ESPmDNS/src/ESPmDNS.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ class MDNSResponder {
5555
public:
5656
MDNSResponder();
5757
~MDNSResponder();
58-
bool begin(const char* hostName);
58+
bool begin(const String& hostName);
59+
bool begin(const char* hostName){
60+
return begin(String(hostName));
61+
}
5962
void end();
6063

6164
void setInstanceName(String name);

‎libraries/WiFi/src/WiFiSTA.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,22 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
367367
return false;
368368
}
369369

370+
/**
371+
* @brief Reset WiFi settings in NVS to default values.
372+
* @return true if erase succeeded
373+
* @note: Resets SSID, password, protocol, mode, etc.
374+
* These settings are maintained by WiFi driver in IDF.
375+
* WiFi driver must be initialized.
376+
*/
377+
bool WiFiSTAClass::eraseAP(void) {
378+
if(WiFi.getMode()==WIFI_MODE_NULL) {
379+
if(!WiFi.enableSTA(true))
380+
return false;
381+
}
382+
383+
return esp_wifi_restore()==ESP_OK;
384+
}
385+
370386
/**
371387
* Change IP configuration settings disabling the dhcp client
372388
* @param local_ip Static ip configuration

‎libraries/WiFi/src/WiFiSTA.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,21 @@ class WiFiSTAClass
4545
public:
4646

4747
wl_status_t begin(const char* wpa2_ssid, wpa2_auth_method_t method, const char* wpa2_identity=NULL, const char* wpa2_username=NULL, const char *wpa2_password=NULL, const char* ca_pem=NULL, const char* client_crt=NULL, const char* client_key=NULL, int32_t channel=0, const uint8_t* bssid=0, bool connect=true);
48+
wl_status_t begin(const String& wpa2_ssid, wpa2_auth_method_t method, const String& wpa2_identity = (const char*)NULL, const String& wpa2_username = (const char*)NULL, const String& wpa2_password = (const char*)NULL, const String& ca_pem = (const char*)NULL, const String& client_crt = (const char*)NULL, const String& client_key = (const char*)NULL, int32_t channel=0, const uint8_t* bssid=0, bool connect=true) {
49+
return begin(wpa2_ssid.c_str(), method, wpa2_identity.c_str(), wpa2_username.c_str(), wpa2_password.c_str(), ca_pem.c_str(), client_crt.c_str(), client_key.c_str(), channel, bssid, connect);
50+
}
4851
wl_status_t begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
52+
wl_status_t begin(const String& ssid, const String& passphrase = (const char*)NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true) {
53+
return begin(ssid.c_str(), passphrase.c_str(), channel, bssid, connect);
54+
}
4955
wl_status_t begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
5056
wl_status_t begin();
5157

5258
bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = (uint32_t)0x00000000, IPAddress dns2 = (uint32_t)0x00000000);
5359

5460
bool reconnect();
5561
bool disconnect(bool wifioff = false, bool eraseap = false);
62+
bool eraseAP(void);
5663

5764
bool isConnected();
5865

0 commit comments

Comments
 (0)
Please sign in to comment.