Lixie Arduino library build problems

Hey everyone,

I am trying to implement the Lixie library located here:

I am using build.particle.io, and added the FastLED and Arduino libraries as they are required looking at the Lixie source. I then created new .cpp and .h files with the plus in the upper right corner, and pasted the contents of the Lixie.cpp and Lixie.h files into them, making sure the filenames were updated as well.

I implemented the example code from the getting started guide, and went to compile.

I ran into some compilation issues, but this forum thread helped me out. FastLED not compiling to Photon. I added FASTLED_USING_NAMESPACE after the include and the vast majority of compilation errors went away.

However, I still get the following error when trying to compile:

src/Lixie.cpp: In member function 'void Lixie::max_power(byte, uint16_t)':
src/Lixie.cpp:787:10: error: 'class NSFastLED::CFastLED' has no member named 
'setMaxPowerInVoltsAndMilliamps'
  FastLED.setMaxPowerInVoltsAndMilliamps(volts,milliamps); 
          ^
../build/module.mk:261: recipe for target '../build/target/user/platform-6-msrc/Lixie.o' failed
make[2]: *** [../build/target/user/platform-6-msrc/Lixie.o] Error 1
make[2]: Leaving directory '/firmware/user'
../../../build/recurse.mk:11: recipe for target 'user' failed
make[1]: *** [user] Error 2
make[1]: Leaving directory '/firmware/modules/photon/user-part'
../build/recurse.mk:11: recipe for target 'modules/photon/user-part' failed
make: *** [modules/photon/user-part] Error 2

The Lixie library indicates that it needs FastLED version 3.0.0 or higher, and as far as I can tell the one I included is 3.1.5

I tried just commenting out all references to max_power, as was able to get it to compile, however when I flash my Photon it goes into SOS mode and indicates a hard fault

Perhaps there are some differences between the official FastLED source and the Photon library, in order to get it working with the Photon? Does anyone know a way around this if that’s the case?

It looks like I’m not the only one interested in getting this library working for the Photon: Lixie driver library import

Thanks in advance for any and all help!

Legomaniac

src/Lixie.cpp:787:10: error: 'class NSFastLED::CFastLED' has no member named 
'setMaxPowerInVoltsAndMilliamps'
  FastLED.setMaxPowerInVoltsAndMilliamps(volts,milliamps); 

Perhaps you could check what the error is actually saying?

On line 787 of src/Lixie.cpp there is the statement:

FastLED.setMaxPowerInVoltsAndMilliamps(volts,milliamps);

Thanks to the error you are informed that the FastLED you are using does not have setMaxPowerInVoltsAndMilliamps.

I read what the error said, and this is why I asked the following. I probably could have been more specific however:

Looking at the current source for FastLED, that function is defined in the FastLED.h, but a quick glance though any of the versions I can import in the Particle web IDE looks like it is not. Does anyone know if that's intentional, or if I'm missing something?

Looking through other files in the library I found a set_max_power_in_volts_and_milliamps in power_mgt.h, but I'm not sure how to reference it, or even if I can. It's been quite a few years since I did anything all too complex with C++

I guess I'm just not completely familiar with the "library porting" process for Arduino -> Photon. Sorry if my question is a bit ignorant, just trying to get my head wrapped around it all.

If you want to get serious with Particle I’d suggest moving away from build.particle.io if possible to preserve your sanity. That way you can easily import any C++ or Particle code you want in order to solve the problem.

Thanks for the suggestion, I am downloading Particle dev now. I guess I just wasn’t aware it existed.

However, I think I’ll likely run into the same problem. FastLED looks to be a pretty expansive library, and I am not very familiar with what changes need to be made from the Arduino source to get it to work properly with the Photon.

Is it reasonable to assume that the versions of FastLED that have been “released” for the Photon will just run into the same issue, whether I’m using the desktop IDE or the web one?

1 Like

Probably, but it will be easier to debug.

Also I think @peekay123 mentioned that he would look into porting the library in the thread that you linked. It might be worth asking him about it.

Thanks for tagging him, I’ll avoid reaching out to him separately to avoid inadvertent spam.

In the mean time I will try this with Particle Dev and see if I can make some progress.

2 Likes

AFAICT not even the official FastLED library (not the Particle port) features this function

@Legomaniac, sorry it is taking so long. I discovered the same missing function issue and went on a walk-about looking for a version of FastLED that had it. I never found such a version so I’m not sure where the heck it came from. I ended up simply commenting out the call and everything compiled.

However, the real work is in converting the examples. The goal was to post the Lixie library in the web IDE so having examples is important. This is where I haven’t had a lot of time to spend just yet. I’ve been testing using CLI so I can send you a zip of what I have. Since I have no Lixies, I can only assume it works.

1 Like

Hey guys, thanks for the replies.

I am confused however, is that function not defined in the official FastLED source right here?
https://github.com/FastLED/FastLED/blob/master/FastLED.h#L477

I have compiled the Lixie library for Arduino and everything works fine, that function included.

I also commented out all references to the function and got the code to compile, however I still run into issues:

In the power_mgt.cpp, there appears to be a related function that has the same name but with underscores instead of camelCase. Like I said earlier, it's been quite a while since I've developed in C++, but is there I way I can reference that function directly to maybe get around the issue with the version of FastLED that is available for Photon?

There is a short example on the getting started page for the Lixies: Lixie getting started

Do you know typically what would need to be changed to get this to work on Photon? I am guessing something with the pin number but at first glance that's all that I can tell. Am I missing something here?

Thanks again for the replies, this is a very helpful community.

In deed there is.
Obviously the GitHub search feature isn’t very elastic. Ususally when searching for long terms entering the first representative characters should suffice and case sensitivity is also not expected for a (non-advanced) search feature.
When typing it fully and correct case it in deed came up. Initially I must have missed the final s in setMaxPowerInVoltsAndMilliamps and hence didn’t get any other serach hit than the issue I linked above :blush:
But it’s still not to be found in the version that’s been published to Web IDE (AFAICT).

@Legomaniac, for testing, you can do without that function. I have the simple example compiling.

@peekay123 I have tried commenting out all references to max_power several times. My code compiles, but when I flash my Photon it immediately goes into SOS mode and indicates a hard fault. I then have to put it into safe mode before I can flash again.

Is there something you changed to the example code that maybe I have missed? I have tried the example code copied directly (with max_power commented out of course), and also have tried changing #define DATA_PIN 5 to #define DATA_PIN D5 but both end up in an SOS coming from the LED on the Photon.

@Legomaniac, which SOS code are you getting. I’ve got errands to run but I can try running the code on a Photon later to see what results I get. Perhaps creating the FastLED object is causing a RAM or other issue.

@peekay123 as far as I can tell it’s just one blink after the SOS so hard fault.

@Legomaniac, that sounds like a class memory over-allocation or over-write failure. Which firmware version are you using?

It looks like I am compiling for 0.6.0

However, it looks like my Photon is running 0.6.3… I found the option to change the firmware target, but if I select anything higher than 0.6.0, the compilation fails with this error:

In file included from lib/FastLED/src/led_sysdefs.h:16:0,
                 from lib/FastLED/src/FastLED.h:34,
                 from src/Lixie.h:7,
                 from src/Lixie.cpp:7:
lib/FastLED/src/led_sysdefs_arm_stm32.h:36:32: note: previous declaration as 'typedef volatile uint8_t RwReg'
 typedef volatile       uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */
                            ^

@Legomaniac, I’m compiling with CLI using the default 0.7.0 firmware. I am using the web IDE FastLED library. If I have time tonight, I’ll load the app on a Photon and see if I get the SOS.

Thanks, I would really appreciate that. Since my last post, I have installed the Particle CLI and updated the firmware on the destination Photon to 0.7.0. I set up the project structure locally and included the FastLED library from the web IDE.

However, I am still getting the same error as I was in my last post, with the RwReg previous declaration thing.

Update -

I was able to get everything compiled with the CLI using the default 0.7.0 firmware. I needed to add #include “Arduino.h” and comment out the following line in led_sysdefs_arm_stm32.h -

//typedef volatile       uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */

However, I am still getting the SOS with hard fault blink codes after using the CLI to flash the .bin file to my device.