Skip to content

Commit

Permalink
[ESP32] ESP-IDF v5.0 support in reamining apps (#24983)
Browse files Browse the repository at this point in the history
* [ESP32] ota-requestor-app: changes to support idf v5.0

* [ESP32] ota-provider-app: changes to support idf v5.0

* [ESP32] temperature-measurement-app: changes to support idf v5.0

* [ESP32] lock-app: changes to support idf v5.0

* [ESP32] chef-app: changes to support idf v5.0

* Fix specifiers for endpoint/cluster/attribute ids
  • Loading branch information
shubhamdp authored and pull[bot] committed Sep 22, 2023
1 parent a7da011 commit 3467308
Show file tree
Hide file tree
Showing 22 changed files with 55 additions and 85 deletions.
9 changes: 4 additions & 5 deletions examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ Identify gIdentify1 = {
void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId,
uint8_t type, uint16_t size, uint8_t * value)
{
ESP_LOGI(TAG,
"PostAttributeChangeCallback - Cluster ID: '0x%04" PRIx32 "', EndPoint ID: '0x%02x' , Attribute ID: '0x%04" PRIx32 "'",
ESP_LOGI(TAG, "PostAttributeChangeCallback - Cluster ID: '0x%" PRIx32 "', EndPoint ID: '0x%x' , Attribute ID: '0x%" PRIx32 "'",
clusterId, endpointId, attributeId);

switch (clusterId)
Expand Down Expand Up @@ -125,7 +124,7 @@ void AppDeviceCallbacks::OnOnOffPostAttributeChangeCallback(EndpointId endpointI
{
using namespace app::Clusters::OnOff::Attributes;

VerifyOrExit(attributeId == OnOff::Id, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04" PRIx32 "'", attributeId));
VerifyOrExit(attributeId == OnOff::Id, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%" PRIx32 "'", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));

// At this point we can assume that value points to a bool value.
Expand All @@ -143,7 +142,7 @@ void AppDeviceCallbacks::OnLevelControlAttributeChangeCallback(EndpointId endpoi
bool onOffState = mEndpointOnOffState[endpointId - 1];
uint8_t brightness = onOffState ? *value : 0;

VerifyOrExit(attributeId == CurrentLevel::Id, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04" PRIx32 "'", attributeId));
VerifyOrExit(attributeId == CurrentLevel::Id, ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%" PRIx32 "'", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));

// At this point we can assume that value points to a bool value.
Expand All @@ -161,7 +160,7 @@ void AppDeviceCallbacks::OnColorControlAttributeChangeCallback(EndpointId endpoi
using namespace app::Clusters::ColorControl::Attributes;

VerifyOrExit(attributeId == CurrentHue::Id || attributeId == CurrentSaturation::Id,
ESP_LOGI(TAG, "Unhandled AttributeId ID: '0x%04" PRIx32 "'", attributeId));
ESP_LOGI(TAG, "Unhandled AttributeId ID: '0x%" PRIx32 "'", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));
if (endpointId == 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ Identify gIdentify1 = {
void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId,
uint8_t type, uint16_t size, uint8_t * value)
{
ESP_LOGI(TAG,
"PostAttributeChangeCallback - Cluster ID: '0x%04" PRIx32 "', EndPoint ID: '0x%02x' , Attribute ID: '0x%04" PRIx32 "'",
ESP_LOGI(TAG, "PostAttributeChangeCallback - Cluster ID: '0x%" PRIx32 "', EndPoint ID: '0x%x' , Attribute ID: '0x%" PRIx32 "'",
clusterId, endpointId, attributeId);

switch (clusterId)
Expand Down Expand Up @@ -123,7 +122,7 @@ void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Clus
void AppDeviceCallbacks::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == Clusters::OnOff::Attributes::OnOff::Id,
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04" PRIx32 "'", attributeId));
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%" PRIx32 "'", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));

// At this point we can assume that value points to a bool value.
Expand All @@ -140,7 +139,7 @@ void AppDeviceCallbacks::OnLevelControlAttributeChangeCallback(EndpointId endpoi
uint8_t brightness = onOffState ? *value : 0;

VerifyOrExit(attributeId == Clusters::LevelControl::Attributes::CurrentLevel::Id,
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04" PRIx32 "'", attributeId));
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%" PRIx32 "'", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));

// At this point we can assume that value points to a bool value.
Expand All @@ -158,7 +157,7 @@ void AppDeviceCallbacks::OnColorControlAttributeChangeCallback(EndpointId endpoi
using namespace Clusters::ColorControl::Attributes;

VerifyOrExit(attributeId == CurrentHue::Id || attributeId == CurrentSaturation::Id,
ESP_LOGI(TAG, "Unhandled AttributeId ID: '0x%04" PRIx32 "'", attributeId));
ESP_LOGI(TAG, "Unhandled AttributeId ID: '0x%" PRIx32 "'", attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));
if (endpointId == 1)
{
Expand Down
3 changes: 1 addition & 2 deletions examples/bridge-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ using namespace ::chip::System;
void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId,
uint8_t type, uint16_t size, uint8_t * value)
{
ESP_LOGI(TAG,
"PostAttributeChangeCallback - Cluster ID: '0x%04" PRIx32 "', EndPoint ID: '0x%02x', Attribute ID: '0x%04" PRIx32 "'",
ESP_LOGI(TAG, "PostAttributeChangeCallback - Cluster ID: '0x%" PRIx32 "', EndPoint ID: '0x%x', Attribute ID: '0x%" PRIx32 "'",
clusterId, endpointId, attributeId);
ESP_LOGI(TAG, "Current free heap: %d\n", heap_caps_get_free_size(MALLOC_CAP_8BIT));
}
Expand Down
1 change: 0 additions & 1 deletion examples/chef/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/../../common/cmake/idf_flashing.cmake)
set(EXTRA_COMPONENT_DIRS
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components"
"${CMAKE_CURRENT_LIST_DIR}/../../common/QRCode"
"${IDF_PATH}/examples/common_components/led_strip"
)

if(${IDF_TARGET} STREQUAL "esp32")
Expand Down
8 changes: 7 additions & 1 deletion examples/chef/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}"
"${CMAKE_SOURCE_DIR}/../../common/pigweed/esp32"
"${CMAKE_SOURCE_DIR}/../../common/screen-framework/include/"
"${CMAKE_SOURCE_DIR}/../../../src/lib/support"
"${IDF_PATH}/components/freertos/include/freertos"
)

if (${IDF_VERSION_MAJOR} LESS 5)
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/include/freertos")
else()
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
endif()

set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
"${CMAKE_SOURCE_DIR}/../../platform/esp32"
"${CMAKE_SOURCE_DIR}/../../common/pigweed"
Expand Down
2 changes: 2 additions & 0 deletions examples/chef/esp32/main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dependencies:
espressif/led_strip: "^1.0.0-alpha"
3 changes: 1 addition & 2 deletions examples/light-switch-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ using namespace chip::app::Clusters;
void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId,
uint8_t mask, uint8_t type, uint16_t size, uint8_t * value)
{
ESP_LOGI(TAG,
"PostAttributeChangeCallback - Cluster ID: '0x%04" PRIx32 "', EndPoint ID: '0x%02x', Attribute ID: '0x%04" PRIx32 "'",
ESP_LOGI(TAG, "PostAttributeChangeCallback - Cluster ID: '0x%" PRIx32 "', EndPoint ID: '0x%x', Attribute ID: '0x%" PRIx32 "'",
clusterId, endpointId, attributeId);

switch (clusterId)
Expand Down
9 changes: 4 additions & 5 deletions examples/lighting-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ using namespace chip::app::Clusters;
void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId,
uint8_t type, uint16_t size, uint8_t * value)
{
ESP_LOGI(TAG,
"PostAttributeChangeCallback - Cluster ID: '0x%04" PRIx32 "', EndPoint ID: '0x%02x', Attribute ID: '0x%04" PRIx32 "'",
ESP_LOGI(TAG, "PostAttributeChangeCallback - Cluster ID: '0x%" PRIx32 "', EndPoint ID: '0x%x', Attribute ID: '0x%" PRIx32 "'",
clusterId, endpointId, attributeId);

switch (clusterId)
Expand Down Expand Up @@ -78,7 +77,7 @@ void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Clus
void AppDeviceCallbacks::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == OnOff::Attributes::OnOff::Id,
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04" PRIx32 "'", attributeId));
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%" PRIx32 "'", attributeId));
VerifyOrExit(endpointId == 1, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));

AppLED.Set(*value);
Expand All @@ -90,7 +89,7 @@ void AppDeviceCallbacks::OnOnOffPostAttributeChangeCallback(EndpointId endpointI
void AppDeviceCallbacks::OnLevelControlAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == LevelControl::Attributes::CurrentLevel::Id,
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04" PRIx32 "'", attributeId));
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%" PRIx32 "'", attributeId));
VerifyOrExit(endpointId == 1, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));

AppLED.SetBrightness(*value);
Expand All @@ -107,7 +106,7 @@ void AppDeviceCallbacks::OnColorControlAttributeChangeCallback(EndpointId endpoi

VerifyOrExit(attributeId == ColorControl::Attributes::CurrentHue::Id ||
attributeId == ColorControl::Attributes::CurrentSaturation::Id,
ESP_LOGI(TAG, "Unhandled AttributeId ID: '0x%04" PRIx32 "'", attributeId));
ESP_LOGI(TAG, "Unhandled AttributeId ID: '0x%" PRIx32 "'", attributeId));
VerifyOrExit(endpointId == 1, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));

if (attributeId == ColorControl::Attributes::CurrentHue::Id)
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ idf_component_register(INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server"
PRIV_REQUIRES bt chip QRCode)
PRIV_REQUIRES bt chip QRCode nvs_flash driver)
add_dependencies(${COMPONENT_LIB} app-codegen)

set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo")
Expand Down Expand Up @@ -185,7 +185,7 @@ idf_component_register(PRIV_INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/lock"
PRIV_REQUIRES chip QRCode bt)
PRIV_REQUIRES chip QRCode bt nvs_flash driver)

add_dependencies(${COMPONENT_LIB} app-codegen)

Expand Down
8 changes: 4 additions & 4 deletions examples/lock-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ using namespace ::chip::DeviceLayer;
void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId,
uint8_t type, uint16_t size, uint8_t * value)
{
ESP_LOGI(TAG, "PostAttributeChangeCallback - Cluster ID: '0x%04x', EndPoint ID: '0x%02x', Attribute ID: '0x%04x'", clusterId,
endpointId, attributeId);
ESP_LOGI(TAG, "PostAttributeChangeCallback - Cluster ID: '0x%" PRIx32 "', EndPoint ID: '0x%x', Attribute ID: '0x%" PRIx32 "'",
clusterId, endpointId, attributeId);

switch (clusterId)
{
Expand All @@ -49,7 +49,7 @@ void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Clus
break;

default:
ESP_LOGI(TAG, "Unhandled cluster ID: %d", clusterId);
ESP_LOGI(TAG, "Unhandled cluster ID: %" PRIu32, clusterId);
break;
}

Expand All @@ -59,7 +59,7 @@ void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Clus
void AppDeviceCallbacks::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == app::Clusters::OnOff::Attributes::OnOff::Id,
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%04x", attributeId));
ESP_LOGI(TAG, "Unhandled Attribute ID: '0x%" PRIx32, attributeId));
VerifyOrExit(endpointId == 1 || endpointId == 2, ESP_LOGE(TAG, "Unexpected EndPoint ID: `0x%02x'", endpointId));
if (*value)
{
Expand Down
7 changes: 2 additions & 5 deletions examples/lock-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "esp_heap_caps_init.h"
#include "esp_log.h"
#include "esp_netif.h"
#include "esp_spi_flash.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "freertos/FreeRTOS.h"
Expand All @@ -37,8 +36,6 @@
#include <string>
#include <vector>

#include <lib/support/ErrorStr.h>

#if CONFIG_ENABLE_PW_RPC
#include "PigweedLogger.h"
#include "Rpc.h"
Expand Down Expand Up @@ -82,7 +79,7 @@ static void InitServer(intptr_t context)
CHIP_ERROR error = GetAppTask().StartAppTask();
if (error != CHIP_NO_ERROR)
{
ESP_LOGE(TAG, "GetAppTask().StartAppTask() failed: %s", ErrorStr(error));
ESP_LOGE(TAG, "GetAppTask().StartAppTask() failed: %" CHIP_ERROR_FORMAT, error.Format());
}
}

Expand Down Expand Up @@ -114,7 +111,7 @@ extern "C" void app_main()
CHIP_ERROR error = deviceMgr.Init(&EchoCallbacks);
if (error != CHIP_NO_ERROR)
{
ESP_LOGE(TAG, "device.Init() failed: %s", ErrorStr(error));
ESP_LOGE(TAG, "device.Init() failed: %" CHIP_ERROR_FORMAT, error.Format());
return;
}

Expand Down
8 changes: 4 additions & 4 deletions examples/ota-provider-app/esp32/main/BdxOtaSender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ void BdxOtaSender::HandleTransferSessionOutput(TransferSession::OutputEvent & ev
acceptData.StartOffset = mTransfer.GetStartOffset();
acceptData.Length = mTransfer.GetTransferLength();
VerifyOrReturn(mTransfer.AcceptTransfer(acceptData) == CHIP_NO_ERROR,
ChipLogError(BDX, "%s: %s", __FUNCTION__, chip::ErrorStr(err)));
ChipLogError(BDX, "AcceptTransfter failed error:%" CHIP_ERROR_FORMAT, err.Format()));

// Store the file designator, used during block query
uint16_t fdl = 0;
const uint8_t * fd = mTransfer.GetFileDesignator(fdl);
VerifyOrReturn(fdl < sizeof(mFileDesignator), ChipLogError(BDX, "Cannot store file designator with length = %d", fdl));
VerifyOrReturn(fdl < sizeof(mFileDesignator), ChipLogError(BDX, "Cannot store file designator with length = %u", fdl));
memcpy(mFileDesignator, fd, fdl);
mFileDesignator[fdl] = 0;

Expand Down Expand Up @@ -157,7 +157,7 @@ void BdxOtaSender::HandleTransferSessionOutput(TransferSession::OutputEvent & ev

if (CHIP_NO_ERROR != mTransfer.PrepareBlock(blockData))
{
ChipLogError(BDX, "%s: PrepareBlock failed: %s", __FUNCTION__, chip::ErrorStr(err));
ChipLogError(BDX, "PrepareBlock failed: %" CHIP_ERROR_FORMAT, err.Format());
mTransfer.AbortTransfer(StatusCode::kUnknown);
}
break;
Expand Down Expand Up @@ -215,7 +215,7 @@ void BdxOtaSender::HandleTransferSessionOutput(TransferSession::OutputEvent & ev
case TransferSession::OutputEventType::kBlockReceived:
default:
// TransferSession should prevent this case from happening.
ChipLogError(BDX, "%s: unsupported event type", __FUNCTION__);
ChipLogError(BDX, "unsupported event type");
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/ota-provider-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ idf_component_register(PRIV_INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers"
EXCLUDE_SRCS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/ota-provider-app/ota-provider-common/BdxOtaSender.cpp"
PRIV_REQUIRES chip QRCode bt console spiffs)
PRIV_REQUIRES chip QRCode bt console spiffs spi_flash nvs_flash)

get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH)
include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake")
Expand Down
2 changes: 1 addition & 1 deletion examples/ota-provider-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void AppDeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Clus
{
ESP_LOGI(TAG,
"PostAttributeChangeCallback - Cluster ID: '" ChipLogFormatMEI
"', EndPoint ID: '0x%02x', Attribute ID: '" ChipLogFormatMEI "'",
"', EndPoint ID: '0x%x', Attribute ID: '" ChipLogFormatMEI "'",
ChipLogValueMEI(clusterId), endpointId, ChipLogValueMEI(attributeId));

// TODO handle this callback in switch statement
Expand Down
13 changes: 6 additions & 7 deletions examples/ota-provider-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <common/Esp32AppServer.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>
#include <lib/support/ErrorStr.h>
#include <lib/support/logging/CHIPLogging.h>

#include <OTAProviderCommands.h>
Expand Down Expand Up @@ -89,7 +88,7 @@ static void InitServer(intptr_t context)
chip::Protocols::BDX::Id, bdxOtaSender);
if (error != CHIP_NO_ERROR)
{
ESP_LOGE(TAG, "RegisterUnsolicitedMessageHandler failed: %s", chip::ErrorStr(error));
ESP_LOGE(TAG, "RegisterUnsolicitedMessageHandler failed: %" CHIP_ERROR_FORMAT, error.Format());
return;
}

Expand All @@ -114,7 +113,7 @@ static void InitServer(intptr_t context)
}
size_t total = 0, used = 0;
err = esp_spiffs_info(NULL, &total, &used);
ESP_LOGI(TAG, "Partition size: total: %d, used: %d", total, used);
ESP_LOGI(TAG, "Partition size: total: %u, used: %u", total, used);
char otaImagePath[kMaxImagePathlen];
memset(otaImagePath, 0, sizeof(otaImagePath));
snprintf(otaImagePath, sizeof(otaImagePath), "/fs/%s", otaFilename);
Expand All @@ -129,7 +128,7 @@ static void InitServer(intptr_t context)
fseek(otaImageFile, 0, SEEK_END);
otaImageLen = ftell(otaImageFile);
rewind(otaImageFile);
ESP_LOGI(TAG, "The OTA image size: %d", otaImageLen);
ESP_LOGI(TAG, "The OTA image size: %" PRIu32, otaImageLen);
if (otaImageLen > 0)
{
otaProvider.SetQueryImageStatus(OTAQueryStatus::kUpdateAvailable);
Expand Down Expand Up @@ -203,12 +202,12 @@ CHIP_ERROR OnBlockQuery(void * context, chip::System::PacketBufferHandle & block
size_t size_read = fread(blockBuf->Start(), 1, size, otaImageFile);
if (size_read != size)
{
ESP_LOGE(TAG, "Failed to read %d bytes from %s", size, otaFilename);
ESP_LOGE(TAG, "Failed to read %u bytes from %s", size, otaFilename);
size = 0;
isEof = false;
return CHIP_ERROR_READ_FAILED;
}
ESP_LOGI(TAG, "Read %d bytes from %s", size, otaFilename);
ESP_LOGI(TAG, "Read %u bytes from %s", size, otaFilename);
return CHIP_NO_ERROR;
}

Expand Down Expand Up @@ -253,7 +252,7 @@ extern "C" void app_main()
CHIP_ERROR error = deviceMgr.Init(&EchoCallbacks);
if (error != CHIP_NO_ERROR)
{
ESP_LOGE(TAG, "device.Init() failed: %s", ErrorStr(error));
ESP_LOGE(TAG, "device.Init() failed: %" CHIP_ERROR_FORMAT, error.Format());
return;
}

Expand Down
8 changes: 4 additions & 4 deletions examples/ota-provider-app/esp32/partitions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, , 0x6000,
phy_init, data, phy, , 0x1000,
# Factory partition size about 1.5MB
factory, app, factory, , 1500K,
# spiffs partition to storage the image file size about 1.5MB
img_storage, data, spiffs, , 1500K,
# Factory partition size about 1.6MB
factory, app, factory, , 1600K,
# spiffs partition to storage the image file size about 1.6MB
img_storage, data, spiffs, , 1600K,
2 changes: 1 addition & 1 deletion examples/ota-requestor-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers"
)

set(PRIV_REQUIRES_LIST chip QRCode bt console app_update)
set(PRIV_REQUIRES_LIST chip QRCode bt console app_update nvs_flash)

if (CONFIG_ENABLE_PW_RPC)
# Append additional directories for RPC build
Expand Down
Loading

0 comments on commit 3467308

Please sign in to comment.