clydebarrow / esphome

ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
https://esphome.io/
Other
23 stars 12 forks source link

`page` `y` property not respected #45

Closed nagyrobi closed 8 months ago

nagyrobi commented 8 months ago

Not sure if page should respect y property in LVGL, the goal would be to shift it down by an amount of pixels so the children widgets could start at 0. Not a big deal, but setting is accepted (though not respected) at page configuration, but if i add it to theme:

  theme:
    page:
      y: 30 #shift down all pages by 30px, to make room for the header

spits

<unicode string>: In lambda function:
<unicode string>:2327:26: error: no match for call to '(const LvLambdaType {aka const std::function<void(_lv_obj_t*)>}) (esphome::lvgl::LvPageType*&)'
In file included from /root/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/11.2.0/functional:59,
                 from /root/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/11.2.0/pstl/glue_algorithm_defs.h:13,
                 from /root/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/11.2.0/algorithm:74,
                 from src/esphome/core/optional.h:19,
                 from src/esphome/components/socket/socket.h:5,
                 from src/esphome/components/api/api_frame_helper.h:14,
                 from src/esphome/components/api/api_connection.h:3,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
/root/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/11.2.0/bits/std_function.h:556:7: note: candidate: '_Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = void; _ArgTypes = {_lv_obj_t*}]'
  556 |       operator()(_ArgTypes... __args) const
      |       ^~~~~~~~
/root/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/11.2.0/bits/std_function.h:556:27: note:   no known conversion for argument 1 from 'esphome::lvgl::LvPageType*' to '_lv_obj_t*'
  556 |       operator()(_ArgTypes... __args) const
      |                  ~~~~~~~~~^~~~~~~~~~
....
clydebarrow commented 8 months ago

The crash is fixed, but from the lvgl doc:

A screen's size is always equal to its display and their origin is (0;0). Therefore, a screen's coordinates can't be changed, i.e. lv_obj_set_pos(), lv_obj_set_size() or similar functions can't be used on screens.

It therefore probably makes little sense to even allow page: in the theme definition.