-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Closed
Copy link
Labels
Area: BT&WifiBT & Wifi related issuesBT & Wifi related issuesStatus: SolvedThe issue has been resolved and requires no further action.The issue has been resolved and requires no further action.Type: Bug 🐛All bugsAll bugs
Description
Board
ESP32 devkit
Device Description
ESP32 devkit board plugged in via USB to PC. No other hardware plugged into the board.
Hardware Configuration
No connections to GPIO pins.
Version
v2.0.13
IDE Name
Arduino IDE 1.8.19
Operating System
Ubuntu 22.04
Flash frequency
80MHz
PSRAM enabled
no
Upload speed
921600
Description
Logging shows the correct value ESP_BT_GAP_DEV_PROP_COD 0x40680
but the sketch shows cod: 26380
. Note 0x40680 = 263808 (base 10) so the incorrect value is the decimal value with the least significant digit chopped off.
[ 7020][D][BluetoothSerial.cpp:467] esp_bt_gap_cb(): ESP_BT_GAP_DEV_PROP_COD 0x40680
[ 7027][D][BluetoothSerial.cpp:477] esp_bt_gap_cb(): ESP_BT_GAP_DEV_PROP_RSSI 189
[ 7034][I][BluetoothSerial.cpp:435] esp_bt_gap_cb(): ESP_BT_GAP_DISC_RES_EVT : EIR : BlueTooth Printer : 17
>>>>>>>>>>>Found a new device asynchronously: Name: BlueTooth Printer, Address: 66:12:56:03:28:18, cod: 26380, rssi: -67
char val[6]; |
The COD is a 24 bit value so "val[6]" is too small. It would be better to display COD in hex like the log message.
char val[6+1]; // +1 for NUL terminator
snprintf(val, sizeof(val), "%06x", getCOD() & 0xFFFFFF);
res += ", cod: 0x";
Fixing BTAdvertisedDeviceSet::toString() will also make other examples show the correct COD.
Sketch
https://github.com/espressif/arduino-esp32/blob/master/libraries/BluetoothSerial/examples/DiscoverConnect/DiscoverConnect.ino
Debug Message
[ 7020][D][BluetoothSerial.cpp:467] esp_bt_gap_cb(): ESP_BT_GAP_DEV_PROP_COD 0x40680
[ 7027][D][BluetoothSerial.cpp:477] esp_bt_gap_cb(): ESP_BT_GAP_DEV_PROP_RSSI 189
[ 7034][I][BluetoothSerial.cpp:435] esp_bt_gap_cb(): ESP_BT_GAP_DISC_RES_EVT : EIR : BlueTooth Printer : 17
>>>>>>>>>>>Found a new device asynchronously: Name: BlueTooth Printer, Address: 66:12:56:03:28:18, cod: 26380, rssi: -67
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Metadata
Metadata
Assignees
Labels
Area: BT&WifiBT & Wifi related issuesBT & Wifi related issuesStatus: SolvedThe issue has been resolved and requires no further action.The issue has been resolved and requires no further action.Type: Bug 🐛All bugsAll bugs