From 403db04392a93dc73033de08d11b51849e1eb73c 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 bac4dea37d38ce..78446432c58b0a 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -271,24 +271,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)