Skip to content

Commit 22b2e44

Browse files
committed
Updates
1 parent f419cd5 commit 22b2e44

File tree

13 files changed

+74
-59
lines changed

13 files changed

+74
-59
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.11
4445
- v2.0.10
4546
- v2.0.9
4647
- v2.0.8

cores/esp32/HWCDC.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,18 @@ void HWCDC::begin(unsigned long baud)
200200
if(tx_lock == NULL) {
201201
tx_lock = xSemaphoreCreateMutex();
202202
}
203-
setRxBufferSize(256);//default if not preset
204-
setTxBufferSize(256);//default if not preset
205-
203+
//RX Buffer default has 256 bytes if not preset
204+
if(rx_queue == NULL) {
205+
if (!setRxBufferSize(256)) {
206+
log_e("HW CDC RX Buffer error");
207+
}
208+
}
209+
//TX Buffer default has 256 bytes if not preset
210+
if (tx_ring_buf == NULL) {
211+
if (!setTxBufferSize(256)) {
212+
log_e("HW CDC TX Buffer error");
213+
}
214+
}
206215
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
207216
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
208217
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT | USB_SERIAL_JTAG_INTR_BUS_RESET);

cores/esp32/esp32-hal-bt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
#if SOC_BT_SUPPORTED
1818
#ifdef CONFIG_BT_ENABLED
1919

20+
#if CONFIG_IDF_TARGET_ESP32
21+
bool btInUse(){ return true; }
22+
#else
2023
// user may want to change it to free resources
2124
__attribute__((weak)) bool btInUse(){ return true; }
25+
#endif
2226

2327
#include "esp_bt.h"
2428

cores/esp32/esp32-hal-misc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,15 @@ bool verifyRollbackLater() { return false; }
243243
#endif
244244

245245
#ifdef CONFIG_BT_ENABLED
246+
#if CONFIG_IDF_TARGET_ESP32
247+
//overwritten in esp32-hal-bt.c
248+
bool btInUse() __attribute__((weak));
249+
bool btInUse(){ return false; }
250+
#else
246251
//from esp32-hal-bt.c
247252
extern bool btInUse();
248253
#endif
254+
#endif
249255

250256
void initArduino()
251257
{

libraries/BluetoothSerial/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Note: Since version 3.0.0 this library does not support legacy pairing (using fi
66

77
### How to use it?
88

9-
There are 3 basic use cases: phone, other ESP32 or any MCU with BT serial module
9+
There are 3 basic use cases: phone, other ESP32 or any MCU with a Bluetooth serial module
1010

1111
#### Phone
1212

@@ -28,9 +28,9 @@ There are 3 basic use cases: phone, other ESP32 or any MCU with BT serial module
2828
You can flash one of the ESP32 with the example [`SerialToSerialBTM`](https://github.com/espressif/arduino-esp32/blob/master/libraries/BluetoothSerial/examples/SerialToSerialBTM/SerialToSerialBTM.ino) (the Master) and another ESP32 with [`SerialToSerialBT`](https://github.com/espressif/arduino-esp32/blob/master/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino) (the Slave).
2929
Those examples are preset to work out-of-the-box but they should be scalable to connect multiple Slaves to the Master.
3030

31-
#### 3rd party Serial BT module
31+
#### 3rd party Serial Bluetooth module
3232

33-
Using 3rd party Serial BT module will require to study the documentation of the particular module in order to make it work, however, one side can utilize the mentioned [`SerialToSerialBTM`](https://github.com/espressif/arduino-esp32/blob/master/libraries/BluetoothSerial/examples/SerialToSerialBTM/SerialToSerialBTM.ino) (the Master) or [`SerialToSerialBT`](https://github.com/espressif/arduino-esp32/blob/master/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino) (the Slave).
33+
Using a 3rd party Serial Bluetooth module will require to study the documentation of the particular module in order to make it work, however, one side can utilize the mentioned [`SerialToSerialBTM`](https://github.com/espressif/arduino-esp32/blob/master/libraries/BluetoothSerial/examples/SerialToSerialBTM/SerialToSerialBTM.ino) (the Master) or [`SerialToSerialBT`](https://github.com/espressif/arduino-esp32/blob/master/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino) (the Slave).
3434

3535
### Pairing options
3636

@@ -48,8 +48,7 @@ This method will authenticate automatically any attempt to pair and should not b
4848

4949
The usage of SSP provides a secure connection. This option is demonstrated in the example `SerialToSerialBT_SSP``](https://github.com/espressif/arduino-esp32/blob/master/libraries/BluetoothSerial/examples/SerialToSerialBT_SSP/SerialToSerialBT_SSP.ino)
5050

51-
The Secure Simple Pairing is enabled by calling method `enableSSP` which has two variants - one is backward compatible without parameter `enableSSP()` and second with parameters `enableSSP(bool inputCapability, bool outputCapability)`.
52-
Alternatively, the SSP can be disabled by `disableSSP()`
51+
The Secure Simple Pairing is enabled by calling method `enableSSP` which has two variants - one is backward compatible without parameter `enableSSP()` and second with parameters `enableSSP(bool inputCapability, bool outputCapability)`. Similarly, the SSP can be disabled by calling `disableSSP()`.
5352

5453
Both options must be called before `begin()` or if it is called after `begin()` the driver needs to be restarted (call `end()` followed by `begin()`) in order to take in effect enabling or disabling the SSP.
5554

libraries/BluetoothSerial/examples/DiscoverConnect/DiscoverConnect.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
BluetoothSerial SerialBT;
3030

3131
#define BT_DISCOVER_TIME 10000
32-
esp_spp_sec_t sec_mask=ESP_SPP_SEC_NONE; // or ESP_SPP_SEC_ENCRYPT|ESP_SPP_SEC_AUTHENTICATE to request pincode confirmation
33-
esp_spp_role_t role=ESP_SPP_ROLE_SLAVE; // or ESP_SPP_ROLE_MASTER
32+
esp_spp_sec_t sec_mask = ESP_SPP_SEC_NONE; // or ESP_SPP_SEC_ENCRYPT|ESP_SPP_SEC_AUTHENTICATE to request pincode confirmation
33+
esp_spp_role_t role = ESP_SPP_ROLE_SLAVE; // or ESP_SPP_ROLE_MASTER
3434

3535
// std::map<BTAddress, BTAdvertisedDeviceSet> btDeviceList;
3636

libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
String device_name = "ESP32-BT-Slave";
1111

12-
// Check if BlueTooth is available
12+
// Check if Bluetooth is available
1313
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
1414
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
1515
#endif
1616

1717
// Check Serial Port Profile
1818
#if !defined(CONFIG_BT_SPP_ENABLED)
19-
#error Serial Port Profile for BlueTooth is not available or not enabled. It is only available for the ESP32 chip.
19+
#error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip.
2020
#endif
2121

2222
BluetoothSerial SerialBT;

libraries/BluetoothSerial/examples/SerialToSerialBTM/SerialToSerialBTM.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
#define USE_NAME // Comment this to use MAC address instead of a slaveName
2121

22-
// Check if BlueTooth is available
22+
// Check if Bluetooth is available
2323
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
2424
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
2525
#endif
2626

2727
// Check Serial Port Profile
2828
#if !defined(CONFIG_BT_SPP_ENABLED)
29-
#error Serial Port Profile for BlueTooth is not available or not enabled. It is only available for the ESP32 chip.
29+
#error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip.
3030
#endif
3131
BluetoothSerial SerialBT;
3232

libraries/BluetoothSerial/examples/SerialToSerialBT_Legacy/SerialToSerialBT_Legacy.ino

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77

88
#include "BluetoothSerial.h"
99

10-
// Check if BlueTooth is available
10+
// Check if Bluetooth is available
1111
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
1212
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
1313
#endif
1414

1515
// Check Serial Port Profile
1616
#if !defined(CONFIG_BT_SPP_ENABLED)
17-
#error Serial Port Profile for BlueTooth is not available or not enabled. It is only available for the ESP32 chip.
17+
#error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip.
1818
#endif
1919

2020
// Check Simple Secure Pairing
2121
#if defined(CONFIG_BT_SSP_ENABLED)
22-
#warning Legacy Pairing is disabled (the CONFIG_BT_SSP_ENABLED is enabled) disable it in menuconfig.
22+
#warning Legacy Pairing is disabled (CONFIG_BT_SSP_ENABLED is enabled. Disable it in menuconfig).
2323
void setup(){}
2424
void loop(){}
2525
#else
@@ -32,20 +32,19 @@ void BTAuthCompleteCallback(boolean success){
3232
if (success){
3333
confirmRequestDone = true;
3434
Serial.println("Pairing success!!");
35-
}
36-
else{
35+
} else {
3736
Serial.println("Pairing failed, rejected by user!!");
3837
}
3938
}
4039

4140
void serial_response(){
4241
if (Serial.available()){
43-
SerialBT.write(Serial.read());
44-
}
45-
if (SerialBT.available()){
46-
Serial.write(SerialBT.read());
47-
}
48-
delay(20);
42+
SerialBT.write(Serial.read());
43+
}
44+
if (SerialBT.available()){
45+
Serial.write(SerialBT.read());
46+
}
47+
delay(20);
4948
}
5049

5150
void setup(){
@@ -59,8 +58,8 @@ void setup(){
5958
void loop(){
6059
if (confirmRequestDone){
6160
serial_response();
62-
}else{
61+
} else {
6362
delay(1); // Feed the watchdog
6463
}
6564
}
66-
#endif
65+
#endif

libraries/BluetoothSerial/examples/SerialToSerialBT_SSP/SerialToSerialBT_SSP.ino

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212

1313
//#define AUTO_PAIR // Uncomment to automatically authenticate ESP32 side
1414

15-
// Check if BlueTooth is available
15+
// Check if Bluetooth is available
1616
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
1717
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
1818
#endif
1919

2020
// Check Serial Port Profile
2121
#if !defined(CONFIG_BT_SPP_ENABLED)
22-
#error Serial Port Profile for BlueTooth is not available or not enabled. It is only available for the ESP32 chip.
22+
#error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip.
2323
#endif
2424

2525
// Check Simple Secure Pairing
2626
#if !defined(CONFIG_BT_SSP_ENABLED)
27-
#error Simple Secure Pairing for BlueTooth is not available or not enabled.
27+
#error Simple Secure Pairing for Bluetooth is not available or not enabled.
2828
#endif
2929

3030
const char * deviceName = "ESP32_SSP_example";
@@ -48,17 +48,17 @@ void BTConfirmRequestCallback(uint32_t numVal){
4848
#ifndef AUTO_PAIR
4949
Serial.printf("The PIN is: %06lu. If it matches number displayed on the other device write \'Y\' or \'y\':\n", numVal); // Note the formatting "%06lu" - PIN can start with zero(s) which would be ignored with simple "%lu"
5050
while (!Serial.available()) {
51-
delay(1); // Feed the watchdog
52-
// Wait until data is available on the Serial port.
53-
}
54-
Serial.printf("Oh you sent %d Bytes, lets see...", Serial.available());
55-
int dat = Serial.read();
56-
if (dat == 'Y' || dat == 'y'){
57-
SerialBT.confirmReply(true);
58-
}
59-
else{
60-
SerialBT.confirmReply(false);
61-
}
51+
delay(1); // Feed the watchdog
52+
// Wait until data is available on the Serial port.
53+
}
54+
Serial.printf("Oh you sent %d Bytes, lets see...", Serial.available());
55+
int dat = Serial.read();
56+
if (dat == 'Y' || dat == 'y'){
57+
SerialBT.confirmReply(true);
58+
}
59+
else{
60+
SerialBT.confirmReply(false);
61+
}
6262
#else
6363
SerialBT.confirmReply(true);
6464
#endif
@@ -90,20 +90,19 @@ void BTAuthCompleteCallback(boolean success){
9090
if (success){
9191
confirmRequestDone = true;
9292
Serial.println("Pairing success!!");
93-
}
94-
else{
93+
} else {
9594
Serial.println("Pairing failed, rejected by user!!");
9695
}
9796
}
9897

9998
void serial_response(){
10099
if (Serial.available()){
101-
SerialBT.write(Serial.read());
102-
}
103-
if (SerialBT.available()){
104-
Serial.write(SerialBT.read());
105-
}
106-
delay(20);
100+
SerialBT.write(Serial.read());
101+
}
102+
if (SerialBT.available()){
103+
Serial.write(SerialBT.read());
104+
}
105+
delay(20);
107106
}
108107

109108
void setup(){
@@ -129,7 +128,7 @@ void setup(){
129128
void loop(){
130129
if (confirmRequestDone){
131130
serial_response();
132-
}else{
131+
} else {
133132
delay(1); // Feed the watchdog
134133
}
135134
}

libraries/BluetoothSerial/examples/bt_remove_paired_devices/bt_remove_paired_devices.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void setup(){
4343
int count = SerialBT.getNumberOfBondedDevices();
4444
if(!count){
4545
Serial.println("No bonded devices found.");
46-
}else{
46+
} else {
4747
Serial.printf("Bonded device count: %d\n", count);
4848
if(PAIR_MAX_DEVICES < count){
4949
count = PAIR_MAX_DEVICES;
@@ -62,7 +62,7 @@ void setup(){
6262
if(REMOVE_BONDED_DEVICES){
6363
if(SerialBT.deleteBondedDevice(pairedDeviceBtAddr[i])){
6464
Serial.printf("Removed bonded device # %d\n", i);
65-
}else{
65+
} else {
6666
Serial.printf("Failed to remove bonded device # %d", i);
6767
} // if(ESP_OK == tError)
6868
} // if(REMOVE_BONDED_DEVICES)
@@ -71,4 +71,4 @@ void setup(){
7171
} // if(!count)
7272
}
7373

74-
void loop() {}
74+
void loop() {}

libraries/BluetoothSerial/src/BluetoothSerial.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,7 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
573573
if (key_request_callback) {
574574
memcpy(current_bd_addr, param->cfm_req.bda, sizeof(esp_bd_addr_t));
575575
key_request_callback();
576-
}
577-
else {
576+
} else {
578577
log_w("ESP_BT_GAP_KEY_REQ_EVT: key_request_callback does not exist - refuseing pairing");
579578
esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, false);
580579
}
@@ -1355,7 +1354,7 @@ void BluetoothSerial::deleteAllBondedDevices(){
13551354
if(expected_dev_num == 0){
13561355
log_i("No devices in cache.");
13571356
return;
1358-
}else{
1357+
} else {
13591358
log_d("Found %d bonded devices", expected_dev_num);
13601359
}
13611360
esp_err_t ret;
@@ -1382,7 +1381,7 @@ void BluetoothSerial::deleteAllBondedDevices(){
13821381
log_d("esp_bt_gap_remove_bond_device ret = %d", ret);
13831382
if(ret == ESP_OK){
13841383
log_d("Removed bonded device #%d", i);
1385-
}else{
1384+
} else {
13861385
log_w("Failed to removed bonded device #%d", i);
13871386
}
13881387
//btc_storage_remove_bonded_device(dev_list[i]);

libraries/HTTPUpdateServer/examples/WebUpdater/WebUpdater.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ void setup(void) {
3333
Serial.println("WiFi failed, retrying.");
3434
}
3535

36-
MDNS.begin(host);
37-
if (MDNS.begin("esp32")) {
36+
if (MDNS.begin(host)) {
3837
Serial.println("mDNS responder started");
3938
}
4039

0 commit comments

Comments
 (0)