Add Lights Plugin in EspEasy Compiling Help needed

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Konfusius
Normal user
Posts: 8
Joined: 09 Jan 2021, 14:01

Add Lights Plugin in EspEasy Compiling Help needed

#1 Post by Konfusius » 09 Jan 2021, 14:19

Hallo Professionals,
i want to control a rgb stripe with ESPEasy , Thats why i want to add the "Lights" Plugin in my Firmware. https://github.com/ddtlabs/ESPEasy-Plugin-Lights

I read the Instructions here: https://www.letscontrolit.com/wiki/inde ... are_Upload
but whatever i done, there is a Error. The Compiling Process failed. Should i take a stable version of ESPEasy or a Nightly Build?

Is it right to copy the "Lights.ino" into the ESPEasy Folder and add a line in the "Custom.h" file like that:
"#define USES_C123 // Lights" ?

With the ESPEasy-mega-20201227 Build iv got an Error relatet to "/lwip/etharp.h" File. Because it is no present. LWIP is missing in the libs. What could i do?

Is there a better way to control a RGBW Stripe with ESPEasy and FHEM ?

I would be happy, if i get some help here.

(And sorry for my bad english, i hope everybody understands me...)

User avatar
Ath
Normal user
Posts: 565
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add Lights Plugin in EspEasy Compiling Help needed

#2 Post by Ath » 09 Jan 2021, 15:22

Looks like you are looking for the NeoPixel plugin? (I can't detect the required hardware from that, rather old, plugin code) but it uses a bit different commands.

NeoPixel is already included as Plugin 038 "Output - NeoPixel (Basic)" in the regular ESPEasy builds that have 'normal', 'test' or 'display' in their filename. Download from here: https://github.com/letscontrolit/ESPEasy/releases

The instructions you found are a bit outdated, as all documentation is to be moved to ReadTheDocs (where the source is maintained in the normal github repo, instead of on a separate wiki), so the most recent instructions are here:
PlatformIO and VSCode (or Atom): https://espeasy.readthedocs.io/en/lates ... ormIO.html
ArduinoIDE (deprecated, only use that if you have a lot of experience with ArduinoIDE) here (again: deprecated)

Because that Lights plugin functionality seems to be incorporated into the PlayGround plugin P124, it may be better to see if that better fits you use-case, might P038 (NeoPixel) not meet your requirements.
Compiling stuff from the PlayGround can be hard, because a lot of improvements to the plugin code has been done in the main repository, as that is being worked on towards a 'release' state. The PlayGround code is not kept up to date.
/Ton

Konfusius
Normal user
Posts: 8
Joined: 09 Jan 2021, 14:01

Re: Add Lights Plugin in EspEasy Compiling Help needed

#3 Post by Konfusius » 09 Jan 2021, 17:23

Many Thanks!
Compiling works fine now with Visual Studio Code.

Now i find out how to put in the Lights Plugin.

EDIT: This works not how i thought. VSC tolds me to convert the .ino File manually to cpp. Thats to much for my skills...

I will control a normal rgb Stripe. Neopixels are Stripes with integrated Contollers.
I want to use an nodeMCU for experimental Use.

User avatar
Ath
Normal user
Posts: 565
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add Lights Plugin in EspEasy Compiling Help needed

#4 Post by Ath » 09 Jan 2021, 19:13

Konfusius wrote: 09 Jan 2021, 17:23 EDIT: This works not how i thought. VSC tolds me to convert the .ino File manually to cpp. Thats to much for my skills...
Just ignore that message/suggestion, you need the .ino file for plugins, other stuff can be .cpp/.h, but not the plugins.
/Ton

Konfusius
Normal user
Posts: 8
Joined: 09 Jan 2021, 14:01

Re: Add Lights Plugin in EspEasy Compiling Help needed

#5 Post by Konfusius » 09 Jan 2021, 19:50

ok, then the Plugin ist incompatible. iv got 104 Errors:
examples :
identifier "Settings" is undefined
pointer to incomplete class type is not allowed
identifier "WebServer" is undefined
identifier "PLUGIN_TEN_PER_SECOND" is undefined

I cant copy all Errors out of the Error Message Box. Only one by one?

Is there another Chance to control a normal RGBW Stripe? Is an old Hue Stripe from Philips...

Thank You!

User avatar
Ath
Normal user
Posts: 565
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add Lights Plugin in EspEasy Compiling Help needed

#6 Post by Ath » 09 Jan 2021, 20:07

Start by replacing

Code: Select all

Device[deviceCount].VType = SENSOR_TYPE_QUAD;
with

Code: Select all

Device[deviceCount].VType = Sensor_VType::SENSOR_TYPE_QUAD;
then replace

Code: Select all

WebServer
by

Code: Select all

web_server

That should work away most of the compiler errors.
/Ton

Konfusius
Normal user
Posts: 8
Joined: 09 Jan 2021, 14:01

Re: Add Lights Plugin in EspEasy Compiling Help needed

#7 Post by Konfusius » 10 Jan 2021, 14:40

Thanks for helping!

I figured out, that i need to set "#include_Plugin_Helper.h" in beginnig of the Lights.ino sketch. All other Plugins have it so.
Now i changed the Syntax Differences as you advised me.
After that, i need to have the "Ticker" Library, because there is a line "#include Ticker.h"in the Sketch.
Every Time the Compiling Process runs a little bit longer.

Now i stuck in the Ticker.cpp.
Here are 3 includes missing:
#include "c_types.h"
#include "eagle_soc.h"
#include "osapi.h"

And in Ticker.h
#include <functional>
What Library is this now? My Brain is overheating....

TD-er
Core team member
Posts: 4270
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Add Lights Plugin in EspEasy Compiling Help needed

#8 Post by TD-er » 10 Jan 2021, 14:53

Why does it need the Ticker library?
We do have a number of timer options that can be used to for example perform the next fade step as it tries to do here:
https://github.com/ddtlabs/ESPEasy-Plug ... #L274-L278

Code: Select all

        // disable Timer if defaultFadingTime < 0
        if (Plugin_123_defaultFadingTime >= 0) {
          log += F("FADING ");
          Plugin_123_Ticker.attach_ms(20, Plugin_123_FadingTimer);
        }
        
So what you can do for now, is just disable all lines in the code using Plugin_123_Ticker by putting two slashes (//) in front of it.
Like this:

Code: Select all

        // disable Timer if defaultFadingTime < 0
        if (Plugin_123_defaultFadingTime >= 0) {
          log += F("FADING ");
//          Plugin_123_Ticker.attach_ms(20, Plugin_123_FadingTimer);
        }
        
Do it also for the include for this Ticker library.
Then you can at least continue with the compile for now and you don't have the fade option.

TD-er
Core team member
Posts: 4270
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Add Lights Plugin in EspEasy Compiling Help needed

#9 Post by TD-er » 10 Jan 2021, 14:58

If you need the fading, we can help you to call this function in the PLUGIN_FIFTY_PER_SECOND loop.

Konfusius
Normal user
Posts: 8
Joined: 09 Jan 2021, 14:01

Re: Add Lights Plugin in EspEasy Compiling Help needed

#10 Post by Konfusius » 10 Jan 2021, 15:22

Ok i set the lines as comment.

Now its hanging here: Line 455
Plugin_123_SendStatus(event->Source);
if (Plugin_123_debug) Plugin_123_dumpValues();<
Error:
....../ESPEasy-mega-20201227/src/_P123_LIGHTS.ino:455:44: error: cannot convert 'EventValueSource::Enum' to 'byte {aka unsigned char}' for argument '1' to 'void Plugin_123_SendStatus(byte)'

and :
ESPEasy-mega-20201227/src/_P123_LIGHTS.ino:628:81: error: 'analogWrite' was not declared in this scope // this is related to the missing Ticker Library?

Should i comment out this Lines to?

TD-er
Core team member
Posts: 4270
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Add Lights Plugin in EspEasy Compiling Help needed

#11 Post by TD-er » 10 Jan 2021, 16:17

I think this is going to be somewhat of an endless exercise as the code of that plugin is over 4 years old, so I think there will be other things that may need additional includes or small prefix changes.
So I can try to compile it later this evening, to see what else is needed.
But it seems quite a lot of it may need a change to be compliant with the current coding standard.

Konfusius
Normal user
Posts: 8
Joined: 09 Jan 2021, 14:01

Re: Add Lights Plugin in EspEasy Compiling Help needed

#12 Post by Konfusius » 10 Jan 2021, 16:27

Ok no hurry here. i have time. Its only for learning.

If i comment out these Lines, the Compiling is successfull...

Yes the Plugin is old. I wondering, that there is no other Solution for NodeMCU to control an RGBW Stripe, except Neopixels with FHEM.
May be I not knowing this...

Thank You!

Konfusius
Normal user
Posts: 8
Joined: 09 Jan 2021, 14:01

Re: Add Lights Plugin in EspEasy Compiling Help needed

#13 Post by Konfusius » 15 Jan 2021, 14:24

Iv loaded the ESPEasy Version "Stable 2.0" from 2018. (https://github.com/letscontrolit/ESPEasy/tree/v2.0)
This should be can compiled with the Arduino IDE.
Installed Arduino 6.1.12 and ESP8266 Board Version 2.3.0.

All runs fine while compiling. Only one line makes a Problem and i dont understand why:

In Lights.ino Line 243 : (https://github.com/ddtlabs/ESPEasy-Plugin-Lights)
Plugin_123_options.sendData_enabled = Settings.TaskDeviceSendData[event->TaskIndex];

Error:
invalid conversion from 'boolean* {aka unsigned char*}' to 'boolean {aka unsigned char}' [-fpermissive]

From from 'boolean* {aka unsigned char*}' to 'boolean {aka unsigned char}??? Is it not the same??

If i marked out this line, compiling is successfully.

And it work to in FHEM !???

TD-er
Core team member
Posts: 4270
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Add Lights Plugin in EspEasy Compiling Help needed

#14 Post by TD-er » 15 Jan 2021, 20:33

Code: Select all

invalid conversion from 'boolean* {aka unsigned char*}' to 'boolean {aka unsigned char}' [-fpermissive]
boolean* is indeed not the same as boolean (without the asterisk).

boolean* is a pointer to a bool. (or actually an unsigned char according to the error, as the "boolean" type does not exist in C++)
boolean (without the asterisk) is a bool value, not a pointer to it.

But to be honest the error here is quite misleading, as it isn't just a matter of a pointer to something, but more like using a wrong way of addressing an item in an array.

Code: Select all

Plugin_123_options.sendData_enabled = Settings.TaskDeviceSendData[event->TaskIndex];
You're addressing Settings.TaskDeviceSendData here as a 1 dimensional array, while it is a 2 dimensional array.
See its definition:

Code: Select all

  boolean       TaskDeviceSendData[CONTROLLER_MAX][N_TASKS];
Thus when you try to access only the first one (using the wrong kind of index, so potentially causing a crash if TaskIndex > 3) you get a pointer to an array of boolean.

I think this code is so old, it even pre-dates the fact ESPEasy does support upto 3 controllers to send data to.
Also the plugin itself does not need to handle it, as ESPEasy's core does it for you.
So I guess it is safe to remove this line.

Konfusius
Normal user
Posts: 8
Joined: 09 Jan 2021, 14:01

Re: Add Lights Plugin in EspEasy Compiling Help needed

#15 Post by Konfusius » 17 Jan 2021, 18:30

So far the device has been working properly. I have now connected a BME-280 sensor. That works well too.
Maybe the Lights plug-in can still be adapted for the newer version of ESPEasy?

Thank You for helping here!

User avatar
Ath
Normal user
Posts: 565
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add Lights Plugin in EspEasy Compiling Help needed

#16 Post by Ath » 17 Jan 2021, 19:14

I think there are a few possible routes:
- Renovate the code to be more compliant with the regular plugins of ESPEasy and make a pull-request on the ESPEasy repository. You'll have to pick (or ask for) the correct Plugin-ID, as 123 isn't yet to be used
- Place your version of the plugin on the PluginPlayGround (add a pull-request there) and request TD-er to do the code-renovation (duplicate Plugin-ID doesn't really seem to matter)
- Make a PR on the site you got the code from (not sure if that's going to work, it seems abandoned by the owner), and motivate 'm to PR to ESPEasy
- Share your code here and ask if someone can adjust to current standards and do a PR in ESPEasy

As the code is quite old, the renovation part is possibly best to ensure maintainability and stability.
/Ton

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests