KaufHA/common

DDP Component failing to compile in ESPHome 2023.6.5

Closed this issue · 2 comments

Hi there!

I'm attempting to utilize your DDP component, and have found the following issue during compile:

src/esphome/components/ddp/ddp_addressable_light_effect.cpp: In member function 'virtual uint16_t esphome::ddp::DDPAddressableLightEffect::process_(const uint8_t*, uint16_t, uint16_t)': src/esphome/components/ddp/ddp_addressable_light_effect.cpp:98:56: error: no matching function for call to 'min(int32_t, int)' uint16_t num_pixels = min(it->size(), ((size-used)/3)); ^ In file included from /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/algorithm:62, from src/esphome/core/optional.h:19, from src/esphome/core/component.h:7, from src/esphome/components/ddp/ddp.h:5, from src/esphome/components/ddp/ddp_addressable_light_effect.cpp:3: /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)' min(initializer_list<_Tp> __l, _Compare __comp) ^~~ /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algo.h:3456:5: note: template argument deduction/substitution failed: src/esphome/components/ddp/ddp_addressable_light_effect.cpp:98:56: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' uint16_t num_pixels = min(it->size(), ((size-used)/3)); ^ In file included from /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/algorithm:62, from src/esphome/core/optional.h:19, from src/esphome/core/component.h:7, from src/esphome/components/ddp/ddp.h:5, from src/esphome/components/ddp/ddp_addressable_light_effect.cpp:3: /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algo.h:3450:5: note: candidate: 'template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)' min(initializer_list<_Tp> __l) ^~~ /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algo.h:3450:5: note: template argument deduction/substitution failed: src/esphome/components/ddp/ddp_addressable_light_effect.cpp:98:56: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' uint16_t num_pixels = min(it->size(), ((size-used)/3)); ^ In file included from /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/char_traits.h:39, from /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/string:40, from src/esphome/core/component.h:3, from src/esphome/components/ddp/ddp.h:5, from src/esphome/components/ddp/ddp_addressable_light_effect.cpp:3: /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algobase.h:243:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^~~ /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed: src/esphome/components/ddp/ddp_addressable_light_effect.cpp:98:56: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int') uint16_t num_pixels = min(it->size(), ((size-used)/3)); ^ In file included from /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/char_traits.h:39, from /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/string:40, from src/esphome/core/component.h:3, from src/esphome/components/ddp/ddp.h:5, from src/esphome/components/ddp/ddp_addressable_light_effect.cpp:3: /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algobase.h:195:5: note: candidate: 'template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)' min(const _Tp& __a, const _Tp& __b) ^~~ /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed: src/esphome/components/ddp/ddp_addressable_light_effect.cpp:98:56: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int') uint16_t num_pixels = min(it->size(), ((size-used)/3)); ^ *** [/data/dragon-neop1/.pioenvs/dragon-neop1/src/esphome/components/ddp/ddp_addressable_light_effect.cpp.o] Error 1

I am building on an ESP32-C3 using the Arduino framework.

esp32: board: esp32-c3-devkitm-1 framework: type: arduino

Any chance this is a quick fix?

bkaufx commented

Was this working before or is this the first time you've tried it?

Give it a shot now.

Hi! Working great now - first time I've tried it. Thanks a lot.

You should submit a PR to have this included officially in ESPHome :)