From 3c2e6effb07f11768bdc37f008a3144a115c8d9a Mon Sep 17 00:00:00 2001 From: Cecille Freeman Date: Wed, 9 Jun 2021 23:10:38 -0400 Subject: [PATCH 1/2] Print pin code and long discriminator on QR screen This is very helpful info, and it's already part of the QR code string anyway. --- examples/all-clusters-app/esp32/main/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index eaec0723c1ee66..8a8a1e990d4e60 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -669,6 +669,16 @@ extern "C" void app_main() [=]() { ESP_LOGI(TAG, "Opening QR code screen"); ESP_LOGI(TAG, "QR CODE Text: '%s'", qrCodeText.c_str()); + uint16_t discriminator; + if (ConfigurationMgr().GetSetupDiscriminator(discriminator) == CHIP_NO_ERROR) + { + ESP_LOGI(TAG, "Setup discriminator: %u (0x%x)", discriminator, discriminator); + } + uint32_t setupPINCode; + if (ConfigurationMgr().GetSetupPinCode(setupPINCode) == CHIP_NO_ERROR) + { + ESP_LOGI(TAG, "Setup PIN code: %u (0x%x)", setupPINCode, setupPINCode); + } ScreenManager::PushScreen(chip::Platform::New(qrCodeText)); }) ->Item("Setup", From ea368e9c0fb1dbac8488293c03d796f24ef7163b Mon Sep 17 00:00:00 2001 From: Cecille Freeman Date: Thu, 10 Jun 2021 10:23:10 -0400 Subject: [PATCH 2/2] Also add prints at QR code generation. Means other devices can see it too. --- examples/all-clusters-app/esp32/main/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 8a8a1e990d4e60..4bcfb74491f916 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -445,6 +445,7 @@ std::string createSetupPayload() ESP_LOGE(TAG, "Couldn't get discriminator: %s", ErrorStr(err)); return result; } + ESP_LOGI(TAG, "Setup discriminator: %u (0x%x)", discriminator, discriminator); uint32_t setupPINCode; err = ConfigurationMgr().GetSetupPinCode(setupPINCode); @@ -453,6 +454,7 @@ std::string createSetupPayload() ESP_LOGE(TAG, "Couldn't get setupPINCode: %s", ErrorStr(err)); return result; } + ESP_LOGI(TAG, "Setup PIN code: %u (0x%x)", setupPINCode, setupPINCode); uint16_t vendorId; err = ConfigurationMgr().GetVendorId(vendorId);