From 9f717685925c294af23c2f3ba38cfd6379d01c9f Mon Sep 17 00:00:00 2001 From: liyashuai Date: Wed, 4 Sep 2024 14:22:22 +0800 Subject: [PATCH] update the function logic --- src/platform/ESP32/ConfigurationManagerImpl.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/platform/ESP32/ConfigurationManagerImpl.cpp b/src/platform/ESP32/ConfigurationManagerImpl.cpp index 5239bc97e3b9c7..fe5b0dc71715b9 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -243,24 +243,19 @@ CHIP_ERROR ConfigurationManagerImpl::GetLocationCapability(uint8_t & location) CHIP_ERROR ConfigurationManagerImpl::GetDeviceTypeId(uint32_t & deviceType) { -#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE uint32_t value = 0; CHIP_ERROR err = ReadConfigValue(ESP32Config::kConfigKey_PrimaryDeviceType, value); - if (err == CHIP_NO_ERROR) + if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { - deviceType = value; + deviceType = CHIP_DEVICE_CONFIG_DEVICE_TYPE; } else { - deviceType = CHIP_DEVICE_CONFIG_DEVICE_TYPE; + deviceType = value; } - return err; -#else - deviceType = 0; return CHIP_NO_ERROR; -#endif // CONFIG_ENABLE_ESP32_LOCATIONCAPABILITY } CHIP_ERROR ConfigurationManagerImpl::StoreCountryCode(const char * code, size_t codeLen)