Skip to content

Commit

Permalink
ESP32: fix compile errors related to screen framwork (#25588)
Browse files Browse the repository at this point in the history
* ESP32: fix compile errors related to screen framwork

* Restyled by clang-format

* fix errors in all-clusters-minimal-app and use ESP32-H2-MP now

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Mar 20, 2023
1 parent 996cafa commit 2772953
Show file tree
Hide file tree
Showing 43 changed files with 139 additions and 136 deletions.
4 changes: 1 addition & 3 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,7 @@ if(CONFIG_BT_ENABLED)
if("${CONFIG_IDF_TARGET}" STREQUAL "esp32h2")
idf_component_get_property(bt_dir bt COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
if(CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2)
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32h2/esp32h2-bt-lib/beta2/libble_app.a)
endif()
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32h2/esp32h2-bt-lib/libble_app.a)
elseif("${CONFIG_IDF_TARGET}" STREQUAL "esp32c2")
idf_component_get_property(bt_dir bt COMPONENT_DIR)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}>)
Expand Down
1 change: 1 addition & 0 deletions config/esp32/components/chip/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dependencies:
version: "^1.0.3"
rules:
- if: "idf_version >=5.0"
- if: "target != esp32h2"
17 changes: 3 additions & 14 deletions docs/guides/esp32/setup_idf_chip.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,12 @@ step.
$ ./install.sh
```
- For ESP32H2, please checkout tag
[v5.0](https://github.com/espressif/esp-idf/tree/v5.0), currently only
lighting-app is supported on H2
- For ESP32C6 & ESP32H2, please use commit
[47852846d3](https://github.com/espressif/esp-idf/tree/47852846d3).
```
$ cd esp-idf
$ git checkout v5.0-beta1
$ git submodule update --init
$ ./install.sh
```
- For ESP32C6, please use commit
[afbdb0f3e](https://github.com/espressif/esp-idf/tree/afbdb0f3e).
```
$ cd esp-idf
$ git checkout afbdb0f3e
$ git checkout 47852846d3
$ git submodule update --init
$ ./install.sh
```
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include "DeviceWithDisplay.h"
#include "Globals.h"
#include "LEDWidget.h"
#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"
#endif
#include "driver/gpio.h"
#include "esp_idf_version.h"
#include "esp_log.h"
Expand Down
5 changes: 3 additions & 2 deletions examples/all-clusters-app/esp32/main/BluetoothWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
* connection on display.
*/

#include "ScreenManager.h"

#include "BluetoothWidget.h"

#include "esp_log.h"
#include "esp_system.h"
#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"
#endif

extern const char * TAG;

Expand Down
1 change: 0 additions & 1 deletion examples/all-clusters-app/esp32/main/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "AppTask.h"
#include "Button.h"
#include "Globals.h"
#include "ScreenManager.h"
#include <lib/support/CodeUtils.h>
#include <platform/CHIPDeviceLayer.h>
#include <vector>
Expand Down
15 changes: 4 additions & 11 deletions examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,15 @@ set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
)
endif (CONFIG_ENABLE_PW_RPC)

if(("${CONFIG_DEVICE_TYPE_ESP32_DEVKITC}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C2_DEVKITM}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC}" STREQUAL "y"))
list(APPEND PRIV_INCLUDE_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/screen-framework/include")
set(PRIV_REQUIRES_LIST chip QRCode bt)
elseif(("${CONFIG_DEVICE_TYPE_M5STACK}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_WROVER_KIT}" STREQUAL "y"))
set(PRIV_REQUIRES_LIST chip QRCode bt tft spidrier screen-framework)
set(PRIV_REQUIRES_LIST chip QRCode bt driver app_update nvs_flash spi_flash openthread)
if(CONFIG_HAVE_DISPLAY)
list(APPEND PRIV_REQUIRES_LIST tft spidrier screen-framework)
endif()

if("${CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM}" STREQUAL "y")
if(CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM)
list(APPEND PRIV_REQUIRES_LIST led_strip)
endif()

if (CONFIG_OPENTHREAD_ENABLED)
list(APPEND PRIV_REQUIRES_LIST openthread)
endif()

idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST}
SRC_DIRS ${SRC_DIRS_LIST}
EXCLUDE_SRCS ${EXCLUDE_SRCS_LIST}
Expand Down
5 changes: 5 additions & 0 deletions examples/all-clusters-app/esp32/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ menu "Demo"
default 3 if DEVICE_TYPE_M5STACK
default 4 if DEVICE_TYPE_ESP32_WROVER_KIT

config HAVE_DISPLAY
bool
default y if DEVICE_TYPE_M5STACK || DEVICE_TYPE_ESP32_WROVER_KIT
default n if !(DEVICE_TYPE_M5STACK || DEVICE_TYPE_ESP32_WROVER_KIT)

config RENDEZVOUS_MODE
int
range 0 8
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-app/esp32/main/LEDWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/

#include "LEDWidget.h"

#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"

#endif
#include "esp_log.h"
#include "esp_system.h"
#include "esp_timer.h"
Expand Down
5 changes: 3 additions & 2 deletions examples/all-clusters-app/esp32/main/WiFiWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
* connection on display.
*/

#include "ScreenManager.h"

#include "WiFiWidget.h"

#include "esp_log.h"
#include "esp_system.h"
#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"
#endif

extern const char * TAG;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#pragma once

#include "Display.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@

#include "Button.h"
#include "DeviceCallbacks.h"
#include "Display.h"
#include "Globals.h"
#include "ListScreen.h"
#include "QRCodeScreen.h"
#include "ScreenManager.h"
#include "StatusScreen.h"
#include "esp_check.h"
#include "esp_log.h"
Expand All @@ -40,6 +37,12 @@
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>

#if CONFIG_HAVE_DISPLAY
#include "Display.h"
#include "ListScreen.h"
#include "ScreenManager.h"
#endif

#if CONFIG_DEVICE_TYPE_M5STACK
#define BUTTON_1_GPIO_NUM ((gpio_num_t) 39) // Left button on M5Stack
#define BUTTON_2_GPIO_NUM ((gpio_num_t) 38) // Middle button on M5Stack
Expand Down
2 changes: 0 additions & 2 deletions examples/all-clusters-app/esp32/main/include/LEDWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#pragma once

#include "Display.h"

#include "driver/gpio.h"

#include "freertos/FreeRTOS.h"
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-app/esp32/main/include/QRCodeScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

#pragma once

#include "sdkconfig.h"
#if CONFIG_HAVE_DISPLAY
#include "Screen.h"
#include "ScreenManager.h"

#if CONFIG_HAVE_DISPLAY

#include <cstdint>
#include <vector>

Expand Down
5 changes: 3 additions & 2 deletions examples/all-clusters-app/esp32/main/include/StatusScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@

#pragma once

#include "ListScreen.h"
#include "ScreenManager.h"
#include <sdkconfig.h>

#if CONFIG_HAVE_DISPLAY
#include "ListScreen.h"
#include "ScreenManager.h"

#include <cstdint>
#include <vector>
Expand Down
2 changes: 0 additions & 2 deletions examples/all-clusters-app/esp32/main/include/WiFiWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#pragma once

#include "Display.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-minimal-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include "DeviceWithDisplay.h"
#include "Globals.h"
#include "LEDWidget.h"
#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"
#endif
#include "driver/gpio.h"
#include "esp_idf_version.h"
#include "esp_log.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
* connection on display.
*/

#include "ScreenManager.h"

#include "BluetoothWidget.h"

#include "esp_log.h"
#include "esp_system.h"
#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"
#endif

extern const char * TAG;

Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-minimal-app/esp32/main/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#include "AppTask.h"
#include "Button.h"
#include "Globals.h"
#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"
#endif
#include <lib/support/CodeUtils.h>
#include <platform/CHIPDeviceLayer.h>
#include <vector>
Expand Down
25 changes: 9 additions & 16 deletions examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/application-basic-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/test-cluster-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server"
Expand All @@ -65,7 +65,7 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/target-navigator-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-user-interface-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/channel-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server"
Expand All @@ -80,8 +80,8 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wake-on-lan-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wake-on-lan-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/pump-configuration-and-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server"
Expand All @@ -105,22 +105,15 @@ set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
)
endif (CONFIG_ENABLE_PW_RPC)

if(("${CONFIG_DEVICE_TYPE_ESP32_DEVKITC}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C2_DEVKITM}" STREQUAL "y"))
list(APPEND PRIV_INCLUDE_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/screen-framework/include")
set(PRIV_REQUIRES_LIST chip QRCode bt)
elseif(("${CONFIG_DEVICE_TYPE_M5STACK}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_WROVER_KIT}" STREQUAL "y"))
set(PRIV_REQUIRES_LIST chip QRCode bt tft spidrier screen-framework)
set(PRIV_REQUIRES_LIST chip QRCode bt driver app_update nvs_flash spi_flash openthread)
if(CONFIG_HAVE_DISPLAY)
list(APPEND PRIV_REQUIRES_LIST tft spidrier screen-framework)
endif()

if("${CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM}" STREQUAL "y")
if(CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM)
list(APPEND PRIV_REQUIRES_LIST led_strip)
endif()

if (CONFIG_OPENTHREAD_ENABLED)
list(APPEND PRIV_REQUIRES_LIST openthread)
endif()

idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST}
SRC_DIRS ${SRC_DIRS_LIST}
PRIV_REQUIRES ${PRIV_REQUIRES_LIST})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ menu "Demo"
default 3 if DEVICE_TYPE_M5STACK
default 4 if DEVICE_TYPE_ESP32_WROVER_KIT

config HAVE_DISPLAY
bool
default y if DEVICE_TYPE_M5STACK || DEVICE_TYPE_ESP32_WROVER_KIT
default n if !(DEVICE_TYPE_M5STACK || DEVICE_TYPE_ESP32_WROVER_KIT)

config RENDEZVOUS_MODE
int
range 0 8
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-minimal-app/esp32/main/LEDWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/

#include "LEDWidget.h"

#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"

#endif
#include "esp_log.h"
#include "esp_system.h"
#include "esp_timer.h"
Expand Down
6 changes: 3 additions & 3 deletions examples/all-clusters-minimal-app/esp32/main/WiFiWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
* connection on display.
*/

#include "ScreenManager.h"

#include "WiFiWidget.h"

#include "esp_log.h"
#include "esp_system.h"

#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"
#endif
extern const char * TAG;

void WiFiWidget::Init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#pragma once

#include "Display.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@

#include "Button.h"
#include "DeviceCallbacks.h"
#include "Display.h"
#include "Globals.h"
#if CONFIG_HAVE_DISPLAY
#include "Display.h"
#include "ListScreen.h"
#include "QRCodeScreen.h"
#include "ScreenManager.h"
#include "StatusScreen.h"
#endif
#include "esp_check.h"
#include "esp_log.h"
#include "esp_system.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#pragma once

#include "Display.h"

#include "driver/gpio.h"

#include "freertos/FreeRTOS.h"
Expand Down
Loading

0 comments on commit 2772953

Please sign in to comment.