Closed bulburDE closed 1 year ago
In previous versions (here 2021.10.0) there were even more errors regarding the functions delayMicroseconds(int)
, millis()
, micros()
In file included from .piolibdeps/wordclock/FastLED/src/FastLED.h:44:0,
from src/wordclock_light.h:2,
from src/main.cpp:23:
.piolibdeps/wordclock/FastLED/src/fastled_delay.h: In member function 'void CMinWait<WAIT>::wait()':
.piolibdeps/wordclock/FastLED/src/fastled_delay.h:22:19: error: call of overloaded 'micros()' is ambiguous
diff = (micros() & 0xFFFF) - mLastMicros;
^
After downgrading to 2021.9.3 it is working again.
Not trying to solve the issue, but doing a quick jot down of what I think that's going on here:
The FastLED library contains a declaration
void delay(unsigned long ms);
but esphome/home/core.py
adds something called ARDUINO_GLUE_CODE
, which amongs other things defines delay(x)
as esphome::delay(x)
. That basically changes the declaration from above to:
void esphome::delay(unsigned long ms);
and this is invalid.
Long shot: maybe using an #undef delay(x)
before doing the FastLED.h include helps as a work-around?
Thanks for the quick response and the working work-around :) Using the following code in my custom code is working:
#include "esphome.h"
#undef delay
#include "FastLED.h"
Ah, great! Of course, you can't use delay() after this, but esphome::delay() would work as intended.
Including third-party libraries in custom components is usually a bad idea due to how we pollute the global namespace... I'd like to find a solution for that someday, but easier said than done.
In general if you're doing anything somewhat serious, I recommend using external components, which can be in their own namespace, instead of custom components, but this isn't very well documented.
Since a few versions the above mentioned workaround no longer works. Now the errormessage says:
In file included from /data/lixieclock/.piolibdeps/lixieclock/Lixie/src/Lixie.cpp:7:0: /data/lixieclock/.piolibdeps/lixieclock/Lixie/src/Lixie.h:18:21: fatal error: FastLED.h: No such file or directory
This is not an esphome issue.
The problem
After upgrading esphome I get an error when compiling the code. I am implementing an Custom Light Output where I import
FastLED.h
in my custom code.This may be related to this pull request: https://github.com/esphome/esphome/pull/2575.
Which version of ESPHome has the issue?
2021.10.3
What type of installation are you using?
pip
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP8266
Board
Wemos D1 mini
Component causing the issue
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response