From 894432ab818660824351f651a01aaa6c1d0ac2fd Mon Sep 17 00:00:00 2001 From: esp32beans <109044562+esp32beans@users.noreply.github.com> Date: Mon, 2 Oct 2023 18:50:48 -0300 Subject: [PATCH] Fix BTAdvertisedDeviceSet::toString() method output --- libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp b/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp index 14bf01fe815..899fbe21c1c 100644 --- a/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp +++ b/libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp @@ -41,9 +41,9 @@ bool BTAdvertisedDeviceSet::haveRSSI() const { return m_haveRSSI; } std::string BTAdvertisedDeviceSet::toString() { std::string res = "Name: " + getName() + ", Address: " + std::string(getAddress().toString().c_str(), getAddress().toString().length()); if (haveCOD()) { - char val[6]; - snprintf(val, sizeof(val), "%d", getCOD()); - res += ", cod: "; + char val[7]; //6 hex digits + null + snprintf(val, sizeof(val), "%06x", getCOD() & 0xFFFFFF); + res += ", cod: 0x"; res += val; } if (haveRSSI()) {