Skip to content

Commit 2c12bcd

Browse files
authored
Merge branch 'master' into args
2 parents 480e4fb + 205db02 commit 2c12bcd

File tree

1,107 files changed

+79640
-8880
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,107 files changed

+79640
-8880
lines changed

Diff for: .github/ISSUE_TEMPLATE/Issue-report.yml

+1
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.4
4445
- v2.0.3
4546
- v2.0.2
4647
- v2.0.1

Diff for: CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ set(CORE_SRCS
3636
cores/esp32/esp32-hal-matrix.c
3737
cores/esp32/esp32-hal-misc.c
3838
cores/esp32/esp32-hal-psram.c
39+
cores/esp32/esp32-hal-rgb-led.c
3940
cores/esp32/esp32-hal-sigmadelta.c
4041
cores/esp32/esp32-hal-spi.c
4142
cores/esp32/esp32-hal-time.c

Diff for: boards.txt

+915-184
Large diffs are not rendered by default.

Diff for: cores/esp32/Tone.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ static void tone_task(void*){
3131
log_d("Task received from queue TONE_START: _pin=%d, frequency=%u Hz, duration=%lu ms", tone_msg.pin, tone_msg.frequency, tone_msg.duration);
3232

3333
log_d("Setup LED controll on channel %d", _channel);
34-
// ledcSetup(_channel, tone_msg.frequency, 11);
35-
// ledcAttachPin(tone_msg.pin, _channel);
36-
// ledcWrite(_channel, 1024);
37-
ledcWriteTone(_channel, tone_msg.frequency);
3834
ledcAttachPin(tone_msg.pin, _channel);
35+
ledcWriteTone(_channel, tone_msg.frequency);
3936

4037
if(tone_msg.duration){
4138
delay(tone_msg.duration);

Diff for: cores/esp32/esp32-hal-gpio.c

+15
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ static InterruptHandle_t __pinInterruptHandlers[SOC_GPIO_PIN_COUNT] = {0,};
9191

9292
extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode)
9393
{
94+
#ifdef BOARD_HAS_NEOPIXEL
95+
if (pin == LED_BUILTIN){
96+
__pinMode(LED_BUILTIN-SOC_GPIO_PIN_COUNT, mode);
97+
return;
98+
}
99+
#endif
100+
94101
if (!GPIO_IS_VALID_GPIO(pin)) {
95102
log_e("Invalid pin selected");
96103
return;
@@ -127,6 +134,14 @@ extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode)
127134

128135
extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val)
129136
{
137+
#ifdef BOARD_HAS_NEOPIXEL
138+
if(pin == LED_BUILTIN){
139+
//use RMT to set all channels on/off
140+
const uint8_t comm_val = val != 0 ? LED_BRIGHTNESS : 0;
141+
neopixelWrite(LED_BUILTIN, comm_val, comm_val, comm_val);
142+
return;
143+
}
144+
#endif
130145
gpio_set_level((gpio_num_t)pin, val);
131146
}
132147

Diff for: cores/esp32/esp32-hal-gpio.h

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern "C" {
2626

2727
#include "esp32-hal.h"
2828
#include "soc/soc_caps.h"
29+
#include "pins_arduino.h"
2930

3031
#if (CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3)
3132
#define NUM_OUPUT_PINS 46
@@ -63,6 +64,7 @@ extern "C" {
6364
#define ONLOW_WE 0x0C
6465
#define ONHIGH_WE 0x0D
6566

67+
6668
#define digitalPinIsValid(pin) GPIO_IS_VALID_GPIO(pin)
6769
#define digitalPinCanOutput(pin) GPIO_IS_VALID_OUTPUT_GPIO(pin)
6870

Diff for: cores/esp32/esp32-hal-rgb-led.c

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#include "esp32-hal-rgb-led.h"
2+
3+
4+
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val){
5+
rmt_data_t led_data[24];
6+
static rmt_obj_t* rmt_send = NULL;
7+
static bool initialized = false;
8+
9+
uint8_t _pin = pin;
10+
#ifdef BOARD_HAS_NEOPIXEL
11+
if(pin == LED_BUILTIN){
12+
_pin = LED_BUILTIN-SOC_GPIO_PIN_COUNT;
13+
}
14+
#endif
15+
16+
if(!initialized){
17+
if((rmt_send = rmtInit(_pin, RMT_TX_MODE, RMT_MEM_64)) == NULL){
18+
log_e("RGB LED driver initialization failed!");
19+
rmt_send = NULL;
20+
return;
21+
}
22+
rmtSetTick(rmt_send, 100);
23+
initialized = true;
24+
}
25+
26+
int color[] = {green_val, red_val, blue_val}; // Color coding is in order GREEN, RED, BLUE
27+
int i = 0;
28+
for(int col=0; col<3; col++ ){
29+
for(int bit=0; bit<8; bit++){
30+
if((color[col] & (1<<(7-bit)))){
31+
// HIGH bit
32+
led_data[i].level0 = 1; // T1H
33+
led_data[i].duration0 = 8; // 0.8us
34+
led_data[i].level1 = 0; // T1L
35+
led_data[i].duration1 = 4; // 0.4us
36+
}else{
37+
// LOW bit
38+
led_data[i].level0 = 1; // T0H
39+
led_data[i].duration0 = 4; // 0.4us
40+
led_data[i].level1 = 0; // T0L
41+
led_data[i].duration1 = 8; // 0.8us
42+
}
43+
i++;
44+
}
45+
}
46+
rmtWrite(rmt_send, led_data, 24);
47+
}

Diff for: cores/esp32/esp32-hal-rgb-led.h

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef MAIN_ESP32_HAL_RGB_LED_H_
2+
#define MAIN_ESP32_HAL_RGB_LED_H_
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#include "esp32-hal.h"
9+
10+
#ifndef LED_BRIGHTNESS
11+
#define LED_BRIGHTNESS 64
12+
#endif
13+
14+
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val);
15+
16+
#ifdef __cplusplus
17+
}
18+
#endif
19+
20+
#endif /* MAIN_ESP32_HAL_RGB_LED_H_ */

Diff for: cores/esp32/esp32-hal.h

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ void yield(void);
8888
#include "esp32-hal-timer.h"
8989
#include "esp32-hal-bt.h"
9090
#include "esp32-hal-psram.h"
91+
#include "esp32-hal-rgb-led.h"
9192
#include "esp32-hal-cpu.h"
9293

9394
void analogWrite(uint8_t pin, int value);

Diff for: docs/source/api/wifi.rst

+18-18
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The Wi-Fi API provides support for the 802.11b/g/n protocol driver. This API inc
1111

1212
* AP mode (aka Soft-AP mode or Access Point mode). Devices connect to the ESP32
1313

14-
* Security modes (WPA, WPA2, WEP, etc.)
14+
* Security modes (WPA2, WPA3 etc.)
1515

1616
* Scanning for access points
1717

@@ -446,26 +446,12 @@ Return the connection state.
446446
setAutoConnect
447447
**************
448448

449-
Function used to set the automatic connection.
450-
451-
.. code-block:: arduino
452-
453-
bool setAutoConnect(bool autoConnect);
454-
455-
Where:
456-
457-
* ``bool autoConnect`` is set to ``true`` to enable this option.
449+
Function is deprecated.
458450

459451
getAutoConnect
460452
**************
461453

462-
Function used to get the automatic connection setting value.
463-
464-
.. code-block:: arduino
465-
466-
bool getAutoConnect();
467-
468-
The function will return ``true`` if the setting is enabled.
454+
Function is deprecated.
469455

470456
setAutoReconnect
471457
****************
@@ -484,11 +470,25 @@ getAutoReconnect
484470
****************
485471

486472
Function used to get the automatic reconnection if the connection is lost.
473+
487474
.. code-block:: arduino
488475
489476
bool getAutoReconnect();
490477
491-
The function will return ``true`` if this setting is enabled.
478+
The function will return ``true`` if this setting is enabled.
479+
480+
setMinSecurity
481+
**************
482+
483+
Function used to set the minimum security for AP to be considered connectable.
484+
485+
.. code-block:: arduino
486+
487+
bool setMinSecurity(wifi_auth_mode_t minSecurity);
488+
489+
Where:
490+
491+
* ``minSecurity`` is the minimum security for AP to be considered connectable. Default is ``WIFI_AUTH_WPA2_PSK``.
492492

493493
WiFiMulti
494494
---------

Diff for: docs/source/troubleshooting.rst

+39
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,42 @@ Solution
8080
* Change the USB port.
8181
* Check your power supply.
8282
* Check if the board is damaged or defective.
83+
84+
Wi-Fi
85+
-----
86+
87+
Why does the board not connect to WEP/WPA-"encrypted" Wi-Fi?
88+
************************************************************
89+
90+
Please note that WEP/WPA has significant security vulnerabilities and its use is strongly discouraged.
91+
The support may therefore be removed in the future. Please migrate to WPA2 or newer.
92+
93+
Solution
94+
^^^^^^^^
95+
96+
Nevertheless, it may be necessary to connect to insecure networks. To do this, the security requirement of the ESP32 must be lowered to an insecure level by using:
97+
98+
.. code-block:: arduino
99+
100+
WiFi.setMinSecurity(WIFI_AUTH_WEP); // Lower min security to WEP.
101+
// or
102+
WiFi.setMinSecurity(WIFI_AUTH_WPA_PSK); // Lower min security to WPA.
103+
104+
Why does the board not connect to WPA3-encrypted Wi-Fi?
105+
*******************************************************
106+
107+
WPA3 support is resource intensive and may not be compiled into the used SDK.
108+
109+
Solution
110+
^^^^^^^^
111+
112+
* Check WPA3 support by your SDK.
113+
* Compile your custom SDK with WPA3 support.
114+
115+
Sample code to check SDK WPA3 support at compile time:
116+
117+
.. code-block:: arduino
118+
119+
#ifndef CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE
120+
#warning "No WPA3 support."
121+
#endif

Diff for: libraries/BLE/src/BLE2902.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void BLE2902::setIndications(bool flag) {
4646
uint8_t *pValue = getValue();
4747
if (flag) pValue[0] |= 1 << 1;
4848
else pValue[0] &= ~(1 << 1);
49+
setValue(pValue, 2);
4950
} // setIndications
5051

5152

@@ -57,6 +58,7 @@ void BLE2902::setNotifications(bool flag) {
5758
uint8_t *pValue = getValue();
5859
if (flag) pValue[0] |= 1 << 0;
5960
else pValue[0] &= ~(1 << 0);
61+
setValue(pValue, 2);
6062
} // setNotifications
6163

6264
#endif

Diff for: libraries/BLE/src/BLEDescriptor.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ BLEDescriptor::BLEDescriptor(const char* uuid, uint16_t len) : BLEDescriptor(BLE
3232
BLEDescriptor::BLEDescriptor(BLEUUID uuid, uint16_t max_len) {
3333
m_bleUUID = uuid;
3434
m_value.attr_len = 0; // Initial length is 0.
35-
m_value.attr_max_len = max_len; // Maximum length of the data.
35+
m_value.attr_max_len = max_len; // Maximum length of the data.
3636
m_handle = NULL_HANDLE; // Handle is initially unknown.
3737
m_pCharacteristic = nullptr; // No initial characteristic.
3838
m_pCallback = nullptr; // No initial callback.
@@ -235,6 +235,10 @@ void BLEDescriptor::setValue(uint8_t* data, size_t length) {
235235
}
236236
m_value.attr_len = length;
237237
memcpy(m_value.attr_value, data, length);
238+
if (m_handle != NULL_HANDLE) {
239+
esp_ble_gatts_set_attr_value(m_handle, length, (const uint8_t *)data);
240+
log_d("Set the value in the GATTS database using handle 0x%x", m_handle);
241+
}
238242
} // setValue
239243

240244

Diff for: libraries/BLE/src/BLEDescriptor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class BLEDescriptor {
5151
uint16_t m_handle;
5252
BLEDescriptorCallbacks* m_pCallback;
5353
BLECharacteristic* m_pCharacteristic;
54-
esp_gatt_perm_t m_permissions = ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE;
54+
esp_gatt_perm_t m_permissions = ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE;
5555
FreeRTOS::Semaphore m_semaphoreCreateEvt = FreeRTOS::Semaphore("CreateEvt");
5656
esp_attr_value_t m_value;
5757

Diff for: libraries/BLE/src/BLERemoteDescriptor.cpp

+19-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,26 @@ BLEUUID BLERemoteDescriptor::getUUID() {
5151

5252
void BLERemoteDescriptor::gattClientEventHandler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t* evtParam) {
5353
switch(event) {
54+
// ESP_GATTC_READ_DESCR_EVT
55+
// This event indicates that the server has responded to the read request.
56+
//
57+
// read:
58+
// - esp_gatt_status_t status
59+
// - uint16_t conn_id
60+
// - uint16_t handle
61+
// - uint8_t* value
62+
// - uint16_t value_len
5463
case ESP_GATTC_READ_DESCR_EVT:
55-
if (evtParam->read.handle != getHandle())
56-
break;
64+
// If this event is not for us, then nothing further to do.
65+
if (evtParam->read.handle != getHandle()) break;
66+
// At this point, we have determined that the event is for us, so now we save the value
67+
if (evtParam->read.status == ESP_GATT_OK) {
68+
// it will read the cached value of the descriptor
69+
m_value = std::string((char*) evtParam->read.value, evtParam->read.value_len);
70+
} else {
71+
m_value = "";
72+
}
73+
// Unlock the semaphore to ensure that the requestor of the data can continue.
5774
m_semaphoreReadDescrEvt.give();
5875
break;
5976

0 commit comments

Comments
 (0)