jasoncoon / esp8266-fastled-webserver

GNU General Public License v3.0
712 stars 360 forks source link

DATA_PIN undefined? #221

Closed CorpusCallosum closed 2 years ago

CorpusCallosum commented 2 years ago

Hi, I just pulled from the main branch, and when I try to compile the code I'm getting this error:

296 | FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_PIXELS); // for WS2812 (Neopixel) no matching function for call to 'CFastLED::addLeds<WS2811, <expression error>, RGB>(CRGB [200], int)'

Looking into it, appears that the DATA_PIN is undefined. I searched through the code and could not find any definition for it anywhere. What am I missing?

Thanks.

henrygab commented 2 years ago

Hi Jack,

I just cloned to a fresh directory, opened the sketch in Arduino, and built without error. [Update ... the fresh clone also built cleanly under PlatformIO]

Are you using PlatformIO to build?

If using Arduino, have you manually installed the required libraries (see README.md)?

dherkes commented 2 years ago

I, too, scanned the config files and could not find the DATA_PIN variable in the ordinary build. I mainly use the "thing" build, but occasionally use the single pin version. Likewise, I built it with both Arduino and PlatformIO, and it compiled ok. I just want to be able to use another pin.

jasoncoon commented 2 years ago

Looks like DATA_PIN is defined here now: https://github.com/jasoncoon/esp8266-fastled-webserver/blob/main/esp8266-fastled-webserver/include/configs/controller/controller_esp8266.h

dherkes commented 2 years ago

Thanks, Jason.

henrygab commented 2 years ago

@dherkes: The easiest way to use a different data pin, when compiling in Arduino:

prior to the line #include "config.h", simply define the variable yourself:

#define DATA_PIN 4

That's it.

Details for those interested in how this all works...

Near the top of `config.h`, it defines a symbol starting with `PRODUCT_`. This defines which product-specific configuration header file is included. Un-comment the one for `PRODUCT_ESP8266_THING` for defaults for ESP Thing. Later in `config.h`, those `PRODUCT_xxx` defines select the header file that is included. For ESP Thing, the header file is `./include/configs/product/esp8266_thing.h`. The configuration in that header file is all simply **_defaults_** ... each one first checks if the symbol is already defined, before defining the default. Therefore, this makes it really easy to override any of those defaults, for any of the products ... just define the symbol yourself before the line that includes `config.h`.


Perhaps I should modify `config.h` with some more examples on how to change stuff?
dherkes commented 2 years ago

I am now using PlatformIO. I, for one, would appreciate the examples in the code.

henrygab commented 2 years ago

Hi @dherkes ... check out https://github.com/jasoncoon/esp8266-fastled-webserver/discussions/218#discussioncomment-1707936.

As you can see, in PlatformIO, it's even easier.

Rather than modify any of the checked-in files, simply create the platformio_override.ini file with your own environment section, with the settings you want/need.

I'll add a comment to the top of the .ino file to help make this clearer.