probonopd / ESP8266HueEmulator

Emulate a Philips Hue bridge running on an ESP8266 using the Arduino IDE.
MIT License
411 stars 93 forks source link

can't compile the code #18

Closed morphygee closed 7 years ago

morphygee commented 8 years ago

Hi,

I have arduino 1.6.5 (OSX) and esp8266 lib v2.1.0

while compiling I get this errors:

ESP8266HueEmulator:37: error: invalid use of template-name 'NeoPixelBus' without an argument list ESP8266HueEmulator:38: error: 'NeoPixelAnimator' does not name a type ESP8266HueEmulator.ino: In function 'void handleAllOthers()': ESP8266HueEmulator:174: error: 'strip' was not declared in this scope ESP8266HueEmulator:177: error: 'AnimUpdateCallback' was not declared in this scope ESP8266HueEmulator:177: error: expected ';' before 'animUpdate' ESP8266HueEmulator:184: error: 'animator' was not declared in this scope ESP8266HueEmulator:184: error: 'animUpdate' was not declared in this scope ESP8266HueEmulator:188: error: 'AnimUpdateCallback' was not declared in this scope ESP8266HueEmulator:188: error: expected ';' before 'animUpdate' ESP8266HueEmulator:195: error: 'animator' was not declared in this scope ESP8266HueEmulator:195: error: 'animUpdate' was not declared in this scope ESP8266HueEmulator.ino: In function 'void setup()': ESP8266HueEmulator:228: error: 'strip' was not declared in this scope ESP8266HueEmulator.ino: In function 'void loop()': ESP8266HueEmulator:297: error: 'animator' was not declared in this scope ESP8266HueEmulator:298: error: 'strip' was not declared in this scope ESP8266HueEmulator.ino: In function 'void infoLight(RgbColor)': ESP8266HueEmulator:309: error: 'strip' was not declared in this scope ESP8266HueEmulator.ino: In function 'void addLightJson(aJsonObject*, int)': ESP8266HueEmulator:403: error: 'strip' was not declared in this scope invalid use of template-name 'NeoPixelBus' without an argument list

what do I wrong?

probonopd commented 8 years ago

Which branch of NeoPixelBus are you using? Might be the wrong one.

morphygee commented 8 years ago

I use this one: NeoPixelBus by Makuna by Michael C. Miller (makuna@live.com) Version 2.0.5

probonopd commented 8 years ago

Yes but which branch? You probably need the NeoPixelAnimator branch of NeoPixelBus. (Discussion regarding the branches on https://github.com/Makuna/NeoPixelBus/issues/50#issuecomment-174873742)

morphygee commented 8 years ago

don't really know. Iinstalled it via library manager. can you tell me what I need?

probonopd commented 8 years ago

I don't know.

Just discovered that the NeoPixelAnimator branch of NeoPixelBus seems to be gone. Please ask in https://github.com/Makuna/NeoPixelBus/issues

Makuna commented 8 years ago

This code base is based on an old version that never did get supported by the library manager. That branch of my library is now gone and evolved into the one code base that is supported by the library manager. This codebase needs to be updated to the official library manager release version. The readme also makes comments that are no longer true. Esp8266/Arduino is supported in the board manager and should be the primary way to get it. ;-)

@morphygee You should consider upgrading to the latest IDE 1.6.8, in 1.6.5 there were bugs with board and library upgrades that caused them to not update correctly. But this is not your issue at hand right now.

morphygee commented 8 years ago

@probonopd were it possible to update your code to the master branch of neopixelbus? @Makuna I tryed the 1.6.8 too. was the same issue.

probonopd commented 8 years ago

@morphygee it is probably possible but I don't have the time to do so at the moment, sorry. Perhaps @Makuna could provide a copy of the old branches in the meantime.

Makuna commented 8 years ago

https://github.com/probonopd/ESP8266HueEmulator/pull/20

probonopd commented 8 years ago

@Makuna I merged and (I think) corrected which branch to pull (the default one) but still get compile errors, see https://travis-ci.org/probonopd/ESP8266HueEmulator

Makuna commented 8 years ago

A bunch of those are from the network.

Missed it, but you need to add an include for NeoPixelAnimator.h.

The warnings in the NeoPixelLibrary should be ignored, the ones I spotted you are not even using that code and they are part of template feature classes which requires the parameters for compatibility between template feature classes.

probonopd commented 8 years ago

Thanks for your help @Makuna, unfortunately the build still fails (log). Can you spot what I am doing wrong? Thanks

Makuna commented 8 years ago

The warning level is so high on your test build it makes it hard to read. It is warning about arguments and variables not used in template functions; which are used if a different method is provided; all standard template architecture.

this one was obvious though

181:  HslColor updatedColor = HslColor::LinearBlend(originalColor, rgb, param.progress);

linear blend for HslColor and HsbColor changed, it is now a template function, si it needs a feature.method class that defines how to blend Hue; so the following is most common to use.

HslColor updatedColor = HslColor::LinearBlend<NeoHueBlendShortestDistance>(originalColor, rgb, param.progress);

The rest are probably the same thing, fix all the LinearBlend for HslColor and HsbColor.

probonopd commented 7 years ago

I can compile the current master fine with the following steps:

mtaram commented 7 years ago

Hi I get stuck at IP2STR error log below. Also could not locate where to do // Replace avm/pgmspace.h with pgmspace.h // could not find any such file.

Arduino: 1.6.9 (Mac OS X), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

WARNING: Spurious .github folder in 'Adafruit NeoPixel' library In file included from /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/user_interface.h:13:0, from /Users/utkarsh/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/internal/NeoEsp8266DmaMethod.h:49, from /Users/utkarsh/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/NeoPixelBus.h:57, from sketch/LightService.cpp:7: sketch/LightService.cpp: In function 'int ssdpMsgFormatCallback(SSDPClass, char, int, bool, int, char, char, char, char, uint32_t, uint16_t, char)': /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/ip_addr.h:56:39: error: invalid operands of types 'uint32_t {aka unsigned int*}' and 'int' to binary 'operator&'

define IP2STR(addr) (uint8_t)(addr & 0xFF), (uint8_t)((addr >> 8) & 0xFF), (uint8_t)((addr >> 16) & 0xFF), (uint8_t)((addr >> 24) & 0xFF)

                                   ^

sketch/LightService.cpp:99:7: note: in expansion of macro 'IP2STR' IP2STR(&ip), port, schemaURL, ^ /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/ip_addr.h:56:65: error: invalid operands of types 'uint32_t {aka unsigned int}' and 'int' to binary 'operator>>'

define IP2STR(addr) (uint8_t)(addr & 0xFF), (uint8_t)((addr >> 8) & 0xFF), (uint8_t)((addr >> 16) & 0xFF), (uint8_t)((addr >> 24) & 0xFF)

                                                             ^

sketch/LightService.cpp:99:7: note: in expansion of macro 'IP2STR' IP2STR(&ip), port, schemaURL, ^ /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/ip_addr.h:56:96: error: invalid operands of types 'uint32_t {aka unsigned int}' and 'int' to binary 'operator>>'

define IP2STR(addr) (uint8_t)(addr & 0xFF), (uint8_t)((addr >> 8) & 0xFF), (uint8_t)((addr >> 16) & 0xFF), (uint8_t)((addr >> 24) & 0xFF)

                                                                                            ^

sketch/LightService.cpp:99:7: note: in expansion of macro 'IP2STR' IP2STR(&ip), port, schemaURL, ^ In file included from /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/user_interface.h:13:0, from /Users/utkarsh/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/internal/NeoEsp8266DmaMethod.h:49, from /Users/utkarsh/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/NeoPixelBus.h:57, from sketch/LightService.cpp:7: /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/ip_addr.h:56:128: error: invalid operands of types 'uint32_t {aka unsigned int}' and 'int' to binary 'operator>>'

define IP2STR(addr) (uint8_t)(addr & 0xFF), (uint8_t)((addr >> 8) & 0xFF), (uint8_t)((addr >> 16) & 0xFF), (uint8_t)((addr >> 24) & 0xFF)

                                                                                                                            ^

sketch/LightService.cpp:99:7: note: in expansion of macro 'IP2STR' IP2STR(&ip), port, schemaURL, ^ In file included from /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/user_interface.h:13:0, from /Users/utkarsh/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/internal/NeoEsp8266DmaMethod.h:49, from /Users/utkarsh/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/NeoPixelBus.h:57, from sketch/LightService.cpp:7: /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/ip_addr.h:56:39: error: invalid operands of types 'uint32_t {aka unsigned int}' and 'int' to binary 'operator&'

define IP2STR(addr) (uint8_t)(addr & 0xFF), (uint8_t)((addr >> 8) & 0xFF), (uint8_t)((addr >> 16) & 0xFF), (uint8_t)((addr >> 24) & 0xFF)

                                   ^

sketch/LightService.cpp:108:7: note: in expansion of macro 'IP2STR' IP2STR(&ip), port, schemaURL, ^ /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/ip_addr.h:56:65: error: invalid operands of types 'uint32_t {aka unsigned int}' and 'int' to binary 'operator>>'

define IP2STR(addr) (uint8_t)(addr & 0xFF), (uint8_t)((addr >> 8) & 0xFF), (uint8_t)((addr >> 16) & 0xFF), (uint8_t)((addr >> 24) & 0xFF)

                                                             ^

sketch/LightService.cpp:108:7: note: in expansion of macro 'IP2STR' IP2STR(&ip), port, schemaURL, ^ /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/ip_addr.h:56:96: error: invalid operands of types 'uint32_t {aka unsigned int}' and 'int' to binary 'operator>>'

define IP2STR(addr) (uint8_t)(addr & 0xFF), (uint8_t)((addr >> 8) & 0xFF), (uint8_t)((addr >> 16) & 0xFF), (uint8_t)((addr >> 24) & 0xFF)

                                                                                            ^

sketch/LightService.cpp:108:7: note: in expansion of macro 'IP2STR' IP2STR(&ip), port, schemaURL, ^ In file included from /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/user_interface.h:13:0, from /Users/utkarsh/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/internal/NeoEsp8266DmaMethod.h:49, from /Users/utkarsh/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/NeoPixelBus.h:57, from sketch/LightService.cpp:7: /Users/utkarsh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.2.0/tools/sdk/include/ip_addr.h:56:128: error: invalid operands of types 'uint32_t {aka unsigned int}' and 'int' to binary 'operator>>'

define IP2STR(addr) (uint8_t)(addr & 0xFF), (uint8_t)((addr >> 8) & 0xFF), (uint8_t)((addr >> 16) & 0xFF), (uint8_t)((addr >> 24) & 0xFF)

                                                                                                                            ^

sketch/LightService.cpp:108:7: note: in expansion of macro 'IP2STR' IP2STR(&ip), port, schemaURL, ^ exit status 1 Error compiling for board Generic ESP8266 Module.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

probonopd commented 7 years ago

Which exact combination of Arduino IDE version and library versions are you using? See .travis.yml for "known good" versions.

mtaram commented 7 years ago

I have Arduino 1.6.9 ESP8266 2.2.0 And the Neobixel bus by Makuna 2.1.4 as mentioned.

I am in the process of updating Arduino to 1.6.13 ESP8266 to latest version.... Will test and update in some time... Seems like the IP2STR error is due to ESP

mtaram commented 7 years ago

Compile and upload done with the above mentioned version, however not able to connect to any wifi access point and no output on serial monitor. Even the test string in serial print doesn't come up.

mtaram commented 7 years ago

I have been able to compile and deploy it for test successfully. Was able to find the bridge via the app and also able to control 6 LEDs of the strip individually. Power was the issue. I had all powered up from USB port, later moved Strip and ESP to external 2A power adapter. Since then it all is fine. I also recall that I faced similar issue with ESP before. It seems USB port can not provide enough power to run the wifi thing. External power supply fixed it.

Thanks for the code. Nice work. Will see how soon I can get to controlling the entire strip.

probonopd commented 7 years ago

Which app and app version did you use? Looks to me like they have changed something in the app and I seem to be unable to connect...

mtaram commented 7 years ago

Philips hue gen 1 v 1.12.1.0 also the Hue disco app. I have Gen 1 Hue. I only get to do these things on Sundays hence late reply.