Skip to content

Commit

Permalink
fix compilation errors for lock-app(enable pw rpc) and ipv6only-app w…
Browse files Browse the repository at this point in the history
…ith idf v4.3 (#8129)
  • Loading branch information
wqx6 authored Jul 9, 2021
1 parent 81f0519 commit 630fd1d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
7 changes: 6 additions & 1 deletion examples/ipv6only-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set(EXTRA_COMPONENT_DIRS
)

project(chip-ipv6only-app)
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++17;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND)

get_filename_component(CHIP_ROOT ./third_party/connectedhomeip REALPATH)
Expand All @@ -36,3 +36,8 @@ pw_set_backend(pw_sys_io pw_sys_io.esp32)
add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo)
add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo)
add_subdirectory(third_party/connectedhomeip/examples/platform/esp32/pw_sys_io)

get_target_property(_target_cxx_flags pw_build.cpp17 INTERFACE_COMPILE_OPTIONS)
list(REMOVE_ITEM _target_cxx_flags $<$<COMPILE_LANGUAGE:CXX>:-std=c++17>)
list(APPEND _target_cxx_flags $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>)
set_target_properties(pw_build.cpp17 PROPERTIES INTERFACE_COMPILE_OPTIONS "${_target_cxx_flags}")
4 changes: 2 additions & 2 deletions examples/ipv6only-app/esp32/include/gdm_wifi_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class GDMWifiBase final : public generated::GDMWifiBase<GDMWifiBase>
pw::Status GetSsid(ServerContext &, const chip_rpc_Empty & request, chip_rpc_Ssid & response)
{
wifi_config_t config;
PW_TRY(EspToPwStatus(esp_wifi_get_config(ESP_IF_WIFI_STA, &config)));
PW_TRY(EspToPwStatus(esp_wifi_get_config(WIFI_IF_STA, &config)));
size_t size = std::min(sizeof(response.ssid.bytes), sizeof(config.sta.ssid));
memcpy(response.ssid.bytes, config.sta.ssid, sizeof(response.ssid.bytes));
response.ssid.size = size;
Expand All @@ -77,7 +77,7 @@ class GDMWifiBase final : public generated::GDMWifiBase<GDMWifiBase>
pw::Status GetMacAddress(ServerContext &, const chip_rpc_Empty & request, chip_rpc_MacAddress & response)
{
uint8_t mac[6];
PW_TRY(EspToPwStatus(esp_wifi_get_mac(ESP_IF_WIFI_STA, mac)));
PW_TRY(EspToPwStatus(esp_wifi_get_mac(WIFI_IF_STA, mac)));
sprintf(response.mac_address, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
return pw::OkStatus();
}
Expand Down
2 changes: 1 addition & 1 deletion examples/ipv6only-app/esp32/main/gdm_wifi_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pw::Status GDMWifiBase::Connect(ServerContext &, const chip_rpc_ConnectionData &
std::min(sizeof(wifi_config.sta.password), static_cast<size_t>(request.secret.size)));

WifiConnectionEventHandler event_handler(esp_netif_);
PW_TRY(EspToPwStatus(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)));
PW_TRY(EspToPwStatus(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)));
esp_err_t err = esp_wifi_connect();

if (ESP_ERR_WIFI_SSID == err)
Expand Down
5 changes: 5 additions & 0 deletions examples/lock-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ pw_set_backend(pw_sys_io pw_sys_io.esp32)
add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo)
add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo)
add_subdirectory(third_party/connectedhomeip/examples/platform/esp32/pw_sys_io)

get_target_property(_target_cxx_flags pw_build.cpp17 INTERFACE_COMPILE_OPTIONS)
list(REMOVE_ITEM _target_cxx_flags $<$<COMPILE_LANGUAGE:CXX>:-std=c++17>)
list(APPEND _target_cxx_flags $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>)
set_target_properties(pw_build.cpp17 PROPERTIES INTERFACE_COMPILE_OPTIONS "${_target_cxx_flags}")
endif(CONFIG_ENABLE_PW_RPC)
1 change: 1 addition & 0 deletions examples/lock-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ idf_component_register(INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server"
PRIV_REQUIRES bt chip QRCode tft spidriver screen-framework)

idf_component_get_property(chip_lib chip COMPONENT_LIB)
Expand Down
1 change: 1 addition & 0 deletions examples/lock-app/esp32/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ menu "Demo"
endmenu

menu "PW RPC Debug channel"
depends on ENABLE_PW_RPC
config EXAMPLE_UART_PORT_NUM
int "UART port number"
range 0 2 if IDF_TARGET_ESP32
Expand Down

0 comments on commit 630fd1d

Please sign in to comment.