retrospy / OPT4048

Arduino library for the TI OPT4048 Ambient Light Sensor
MIT License
1 stars 1 forks source link

v1.12.0 is somehow missing OPT4048::D65_Illuminant ? #6

Closed jbeale1 closed 3 months ago

jbeale1 commented 3 months ago

After loading the OPT4048 by RetroSpy Technnologies, version 1.12 in my Arduino IDE 2.2.1 I cannot compile the provided example code, because it reports missing OPT4048::D65_Illuminant although that does appear on line 282 of https://github.com/retrospy/OPT4048/blob/main/src/OPT4048.h For what it's worth I'm using a Pi Pico, not any Teensy product at the moment.

C:\Users\beale\AppData\Local\Temp\arduino\sketches\49DDEE2FAEB092E94E301BE1D35BF515\libraries\OPT4048\OPT4048.cpp.o: In function `OPT4048::ConvertXYZtoRGB(OPT4048_XYZ)':
c:\Users\beale\Documents\Arduino\libraries\OPT4048\src/OPT4048.cpp:302: undefined reference to `OPT4048::D65_Illuminant'
c:\Users\beale\Documents\Arduino\libraries\OPT4048\src/OPT4048.cpp:302: undefined reference to `OPT4048::XYZ_to_RGB'
collect2.exe: error: ld returned 1 exit status

For what it's worth, it does compile and work OK if I move the D65_Illuminant and XYZ_to_RGB[][] inside the function in the '#else' clause of the #if defined(CORE_TEENSY), as shown:

OPT4048_RGB OPT4048::ConvertXYZtoRGB(OPT4048_XYZ xyz)
{
    static constexpr OPT4048_XYZ D65_Illuminant = { 95.0500, 100.0000, 108.9000, NAN };
    static constexpr float XYZ_to_RGB[3][3] = { {  3.2404542, -1.5371385, -0.4985314 },
                        { -0.9692660,  1.8760108,  0.0415560 },
                        {  0.0556434, -0.2040259,  1.0572252 }
    };
    return ConvertXYZtoRGB(xyz, XYZ_to_RGB, D65_Illuminant, &OPT4048::sRGBCompandingFunction);
}
zoggins commented 3 months ago

Let me take a look. I am not sure I tried it with a Pi Pico. Thanks for letting me know.

jbeale1 commented 3 months ago

Thanks. I am using Arduino Mbed OS RP2040 boards (Raspberry Pi Pico) https://github.com/arduino/ArduinoCore-mbed

I guess some people also use a different toolchain for Pico, like https://github.com/earlephilhower/arduino-pico but I have not tried that.

zoggins commented 3 months ago

This should be fixed in 1.13, which will take a little while to propagate out to the world