Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usermod BME280 does not compile (ESP32) #4362

Open
1 task done
euphi opened this issue Dec 7, 2024 · 0 comments
Open
1 task done

Usermod BME280 does not compile (ESP32) #4362

euphi opened this issue Dec 7, 2024 · 0 comments
Labels
bug usermod usermod related

Comments

@euphi
Copy link

euphi commented Dec 7, 2024

What happened?

The usermod BME280 does not compile (with default platformio configuration). Problem is a call to String(..) (constructor) that is ambigious. This affects at least the ESP32-C3 framework.

To Reproduce Bug

Compile wled for ESP32-C3 fails, if USERMOD_BME280 is defined.

Expected Behavior

Compile without errors.

Install Method

Self-Compiled

What version of WLED?

0_15_0 branch of today

Which microcontroller/board are you seeing the problem on?

ESP32-C3

Relevant log/trace output

In file included from wled00/usermods_list.cpp:53:
wled00/../usermods/BME280_v2/usermod_bme280.h: In member function 'virtual void UsermodBME280::loop()':
wled00/../usermods/BME280_v2/usermod_bme280.h:250:77: error: call of overloaded 'String(float&, uint8_t&)' is ambiguous
           publishMqtt("temperature", String(temperature, TemperatureDecimals).c_str());
                                                                             ^
In file included from /home/ian/.platformio/packages/[email protected]/cores/esp32/Arduino.h:176,
                 from wled00/wled.h:69,
                 from wled00/usermods_list.cpp:1:
/home/ian/.platformio/packages/[email protected]/cores/esp32/WString.h:79:18: note: candidate: 'String::String(long long unsigned int, unsigned char)'
         explicit String(unsigned long long, unsigned char base = 10);
                  ^~~~~~
/home/ian/.platformio/packages/[email protected]/cores/esp32/WString.h:78:18: note: candidate: 'String::String(long long int, unsigned char)'
         explicit String(long long, unsigned char base = 10);
                  ^~~~~~
/home/ian/.platformio/packages/[email protected]/cores/esp32/WString.h:77:18: note: candidate: 'String::String(double, unsigned int)'
         explicit String(double, unsigned int decimalPlaces = 2);
                  ^~~~~~
/home/ian/.platformio/packages/[email protected]/cores/esp32/WString.h:76:18: note: candidate: 'String::String(float, unsigned int)'
         explicit String(float, unsigned int decimalPlaces = 2);
                  ^~~~~~
/home/ian/.platformio/packages/[email protected]/cores/esp32/WString.h:75:18: note: candidate: 'String::String(long unsigned int, unsigned char)'
         explicit String(unsigned long, unsigned char base = 10);
                  ^~~~~~
/home/ian/.platformio/packages/[email protected]/cores/esp32/WString.h:74:18: note: candidate: 'String::String(long int, unsigned char)'
         explicit String(long, unsigned char base = 10);
                  ^~~~~~
/home/ian/.platformio/packages/[email protected]/cores/esp32/WString.h:73:18: note: candidate: 'String::String(unsigned int, unsigned char)'
         explicit String(unsigned int, unsigned char base = 10);
                  ^~~~~~
/home/ian/.platformio/packages/[email protected]/cores/esp32/WString.h:72:18: note: candidate: 'String::String(int, unsigned char)'
         explicit String(int, unsigned char base = 10);
                  ^~~~~~
/home/ian/.platformio/packages/[email protected]/cores/esp32/WString.h:71:18: note: candidate: 'String::String(unsigned char, unsigned char)'
         explicit String(unsigned char, unsigned char base = 10);
                  ^~~~~~
*** [.pio/build/esp32c3dev/src/usermods_list.cpp.o] Error 1

Anything else?

The "decimals" (like TemperatureDecimal etc.) are of typeuint8_t, which is ambigious because there ist also a String(int, unsigned char), so gcc does not know if it should implicitly cast the uint8_t to unsigned char or unsigned int.

Solution is to excplicitly cast the "Decimals" to unsigned int.

PR will follow soon.

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug usermod usermod related
Projects
None yet
Development

No branches or pull requests

2 participants