diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index d3059b23ca9764..93c858ef8876ea 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -98,7 +98,7 @@ std::string createSetupPayload() ChipLogError(DeviceLayer, "Couldn't get discriminator: %s\r\n", ErrorStr(err)); return result; } - ChipLogProgress(DeviceLayer, "Setup discriminator: %u (0x%x)\r\n", discriminator, discriminator); + ChipLogProgress(DeviceLayer, "Setup discriminator: %d (0x%x)\r\n", discriminator, discriminator); uint32_t setupPINCode; err = ConfigurationMgr().GetSetupPinCode(setupPINCode); @@ -107,7 +107,7 @@ std::string createSetupPayload() ChipLogError(DeviceLayer, "Couldn't get setupPINCode: %s\r\n", ErrorStr(err)); return result; } - ChipLogProgress(DeviceLayer, "Setup PIN code: %u (0x%x)\r\n", setupPINCode, setupPINCode); + ChipLogProgress(DeviceLayer, "Setup PIN code: %lu (0x%lx)\r\n", setupPINCode, setupPINCode); uint16_t vendorId; err = ConfigurationMgr().GetVendorId(vendorId); @@ -180,7 +180,7 @@ std::string createSetupPayload() if (err != CHIP_NO_ERROR) { - ChipLogError(DeviceLayer, "Couldn't get payload string %\r\n" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(DeviceLayer, "Couldn't get payload string %lu\r\n" CHIP_ERROR_FORMAT, err.Format()); } return result; }; @@ -209,10 +209,11 @@ extern "C" void ChipTest(void) // Initialize device attestation config SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); - std::string qrCodeText = createSetupPayload(); - ChipLogProgress(DeviceLayer, "QR CODE Text: '%s'\r\n", qrCodeText.c_str()); - + if( RTW_SUCCESS != wifi_is_connected_to_ap()) { + std::string qrCodeText = createSetupPayload(); + ChipLogProgress(DeviceLayer, "QR CODE Text: '%s'\r\n", qrCodeText.c_str()); + std::vector qrCode(3 * qrCodeText.size() + 1); err = EncodeQRCodeToUrl(qrCodeText.c_str(), qrCodeText.size(), qrCode.data(), qrCode.max_size()); if (err == CHIP_NO_ERROR)