Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Build] Fix compiler warnings #4757

Merged
10 changes: 6 additions & 4 deletions lib/NeoPixelBus/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RgbColor KEYWORD1
Rgb16Color KEYWORD1
Rgb48Color KEYWORD1
Rgbw64Color KEYWORD1
RgbwwColor KEYWORD1
HslColor KEYWORD1
HsbColor KEYWORD1
HtmlColor KEYWORD1
Expand All @@ -35,16 +36,17 @@ NeoBgrFeature KEYWORD1
NeoRgbw64Feature KEYWORD1
NeoRgb48Feature KEYWORD1
NeoGrb48Feature KEYWORD1
NeoGrbcwxFeature KEYWORD1
NeoRgbUcs8903Feature KEYWORD1
NeoRgbwUcs8904Feature KEYWORD1
NeoGrb48Ws2816Feature KEYWORD1
NeoWrgbTm1814Feature KEYWORD1
NeoRgbTm1914Feature KEYWORD1
NeoGrbTm1914Feature KEYWORD1
NeoRgbSm16803pbColorFeature KEYWORD1
NeoRgbSm16823eColorFeature KEYWORD1
NeoRgbwSm16804ebColorFeature KEYWORD1
NeoRgbwSm16824eColorFeature KEYWORD1
NeoRgbSm16803pbFeature KEYWORD1
NeoRgbSm16823eFeature KEYWORD1
NeoRgbwSm16804ebFeature KEYWORD1
NeoRgbwSm16824eFeature KEYWORD1
DotStarBgrFeature KEYWORD1
DotStarLbgrFeature KEYWORD1
Lpd6803GrbFeature KEYWORD1
Expand Down
4 changes: 2 additions & 2 deletions lib/NeoPixelBus/library.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "NeoPixelBus",
"keywords": "NeoPixel, WS2811, WS2812, WS2813, WS2821, SK6812, DotStar, APA102, SK9822, APA106, LPD8806, LPD6803, P9813, TM1829, TM1814, TM1914, TX1812, WS2801, SM16803, SM16823, SM16804, SM16824, SM16716, DMX512, RGB, RGBW",
"description": "A library that makes controlling NeoPixels (WS2812x and many others) and DotStars (SK6812 and many others) easy. Supports most Arduino platforms, including async hardware support for Esp8266, Esp32, and Nrf52 (Nano 33 BLE). Support for RGBW pixels and 7 Segment LED direct driven. Includes seperate RgbColor, RgbwColor, Rgb16Color, Rgb48Color, HslColor, and HsbColor objects. Includes an animator class that helps create asyncronous animations. For all platforms; there are two methods of sending DotStar data, hardware SPI and software SPI.",
"description": "A library that makes controlling NeoPixels (WS2812x and many others) and DotStars (SK6812 and many others) easy. Supports most Arduino platforms, including async hardware support for Esp8266, Esp32, and Nrf52 (Nano 33 BLE). Support for RGBW pixels and 7 Segment LED direct driven. Includes separate RgbColor, RgbwColor, Rgb16Color, Rgb48Color, HslColor, and HsbColor objects. Includes an animator class that helps create asyncronous animations. For all platforms; there are two methods of sending DotStar data, hardware SPI and software SPI.",
"homepage": "https://github.com/Makuna/NeoPixelBus/wiki",
"repository": {
"type": "git",
"url": "https://github.com/Makuna/NeoPixelBus"
},
"version": "2.7.5",
"version": "2.7.6",
"frameworks": "arduino",
"platforms": "*",
"dependencies": [
Expand Down
6 changes: 3 additions & 3 deletions lib/NeoPixelBus/library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=NeoPixelBus by Makuna
version=2.7.5
version=2.7.6
author=Michael C. Miller ([email protected])
maintainer=Michael C. Miller ([email protected])
sentence=A library that makes controlling NeoPixels (WS2812x and many others) and DotStars (SK6812 and many others) easy.
paragraph=Supports most Arduino platforms, including async hardware support for Esp8266, Esp32, and Nrf52 (Nano 33 BLE). Support for RGBW pixels and 7 Segment LED direct driven. Includes seperate RgbColor, RgbwColor, Rgb16Color, Rgb48Color, HslColor, and HsbColor objects. Includes an animator class that helps create asyncronous animations. Supports Matrix layout of pixels. Includes Gamma corretion object. For all platforms; there are two methods of sending DotStar data, hardware SPI and software SPI.
paragraph=Supports most Arduino platforms, including async hardware support for Esp8266, Esp32, and Nrf52 (Nano 33 BLE). Support for RGBW pixels and 7 Segment LED direct driven. Includes separate RgbColor, RgbwColor, Rgb16Color, Rgb48Color, HslColor, and HsbColor objects. Includes an animator class that helps create asyncronous animations. Supports Matrix layout of pixels. Includes Gamma corretion object. For all platforms; there are two methods of sending DotStar data, hardware SPI and software SPI.
category=Display
url=https://github.com/Makuna/NeoPixelBus/wiki
architectures=*
architectures=*
4 changes: 2 additions & 2 deletions lib/NeoPixelBus/src/NeoPixelBrightnessBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ License along with NeoPixel. If not, see

#include "NeoPixelBus.h"


template<typename T_COLOR_FEATURE, typename T_METHOD> class [[deprecated("Use NeoPixelBusLg instead.")]] NeoPixelBrightnessBus :
// FIXME 2023-08-09 tonhuisman: Disabled deprecation warning as the newer classes won't properly work with ESP8266 for ESPEasy P128
template<typename T_COLOR_FEATURE, typename T_METHOD> class /*[[deprecated("Use NeoPixelBusLg instead.")]]*/ NeoPixelBrightnessBus :
public NeoPixelBus<T_COLOR_FEATURE, T_METHOD>
{
private:
Expand Down
20 changes: 17 additions & 3 deletions lib/NeoPixelBus/src/NeoPixelBusLg.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,16 @@ template<typename T_COLOR_FEATURE, typename T_METHOD, typename T_GAMMA = NeoGamm
protected:
uint8_t _luminance;

void setLuminance(uint8_t luminance)
bool setLuminance(uint8_t luminance)
{
_luminance = luminance;
bool different = (_luminance != luminance);

if (different)
{
_luminance = luminance;
}

return different;
}

uint8_t getLuminance() const
Expand Down Expand Up @@ -126,12 +133,19 @@ template<typename T_COLOR_FEATURE, typename T_METHOD, typename T_GAMMA = NeoGamm
{
}

~NeoPixelBusLg()
{
}

void SetLuminance(uint8_t luminance)
{
// does NOT affect current pixel data as there is no safe way
// to reconstruct the original color values after being
// modified with both luminance and gamma without storing them
Shader.setLuminance(luminance);
if (Shader.setLuminance(luminance))
{
this->Dirty();
}
}

uint8_t GetLuminance() const
Expand Down
73 changes: 32 additions & 41 deletions lib/NeoPixelBus/src/internal/NeoColorFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,60 +26,51 @@ License along with NeoPixel. If not, see
-------------------------------------------------------------------------*/
#pragma once

// Core Element base classes
//
#include "features/NeoElementsNoSettings.h"
#include "features/NeoByteElements.h"

// Core Feature base classes
#include "features/Neo2Byte555Feature.h"
#include "features/Neo3ByteFeature.h"
#include "features/Neo3Byte777Feature.h"
#include "features/Neo4ByteFeature.h"
#include "features/DotStarX4ByteFeature.h"
#include "features/DotStarL4ByteFeature.h"
#include "features/Neo6xByteFeature.h"
#include "features/Neo6xxByteFeature.h"
#include "features/Neo3WordFeature.h"
#include "features/Neo4WordFeature.h"

// NeoPixel Features
//
#include "features/Neo2ByteElements.h"
#include "features/Neo3ByteElements.h"
#include "features/Neo4ByteElements.h"
#include "features/Neo6ByteElements.h"
#include "features/Neo6Byte4xxElements.h"
#include "features/Neo8ByteElements.h"
#include "features/NeoBgrFeature.h"
#include "features/NeoBrgFeature.h"
#include "features/NeoGrb48Feature.h"
#include "features/NeoGrbFeature.h"
#include "features/NeoGrbwFeature.h"
#include "features/NeoRbgFeature.h"
#include "features/NeoRgb48Feature.h"
#include "features/NeoRgbFeature.h"
#include "features/NeoRgbw64Feature.h"
#include "features/NeoRgbwFeature.h"
#include "features/NeoRgbwxxFeature.h"
#include "features/NeoSm168xxColorFeatures.h"
#include "features/NeoTm1814ColorFeatures.h"
#include "features/NeoTm1914ColorFeatures.h"
#include "features/NeoRgbFeatures.h"
#include "features/NeoRgbwFeatures.h"
#include "features/NeoRgb48Features.h"
#include "features/NeoRgbw64Features.h"

#include "features/NeoRgbwxxFeatures.h"
#include "features/NeoRgbcwxFeatures.h"
#include "features/NeoSm168xxFeatures.h"
#include "features/NeoTm1814Features.h"
#include "features/NeoTm1914Features.h"

typedef NeoRgb48Feature NeoRgbUcs8903Feature;
typedef NeoRgbw64Feature NeoRgbwUcs8904Feature;
typedef NeoGrb48Feature NeoGrbWs2816Feature;

// DotStart Features
//
#include "features/DotStar3Elements.h"
#include "features/DotStar4Elements.h"
#include "features/DotStarBgrFeature.h"
#include "features/DotStarBrgFeature.h"
#include "features/DotStarGbrFeature.h"
#include "features/DotStarGrbFeature.h"
#include "features/DotStarLbgrFeature.h"
#include "features/DotStarLbrgFeature.h"
#include "features/DotStarLgbrFeature.h"
#include "features/DotStarLgrbFeature.h"
#include "features/DotStarLrbgFeature.h"
#include "features/DotStarLrgbFeature.h"
#include "features/DotStarRbgFeature.h"
#include "features/DotStarRgbFeature.h"
#include "features/Lpd8806BrgFeature.h"
#include "features/Lpd8806GrbFeature.h"
#include "features/Lpd6803BrgFeature.h"
#include "features/Lpd6803GrbFeature.h"
#include "features/Lpd6803GbrFeature.h"
#include "features/Lpd6803RgbFeature.h"
#include "features/DotStarRgbFeatures.h"
#include "features/DotStarLrgbFeatures.h"
#include "features/Lpd6803RgbFeatures.h"
#include "features/Lpd8806RgbFeatures.h"

#include "features/P9813BgrFeature.h"

// 7 Segment Features
//
#include "features/Neo9ByteElements.h"
#include "features/NeoAbcdefgpsSegmentFeature.h"
#include "features/NeoBacedfpgsSegmentFeature.h"

Expand Down
3 changes: 3 additions & 0 deletions lib/NeoPixelBus/src/internal/NeoColors.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ License along with NeoPixel. If not, see

#include "colors/NeoHueBlend.h"

#include "colors/RgbColorIndexes.h"
#include "colors/RgbColorBase.h"

#include "colors/RgbColor.h"
Expand All @@ -41,6 +42,8 @@ License along with NeoPixel. If not, see
#include "colors/RgbwColor.h"
#include "colors/Rgbw64Color.h"

#include "colors/RgbwwColor.h"

#include "colors/SegmentDigit.h"

#include "colors/NeoGamma.h"
Expand Down
1 change: 1 addition & 0 deletions lib/NeoPixelBus/src/internal/NeoMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ License along with NeoPixel. If not, see
#include "methods/P9813GenericMethod.h"
#include "methods/Tlc5947GenericMethod.h"
#include "methods/Sm16716GenericMethod.h"
#include "methods/Mbi6033GenericMethod.h"

// Platform specific and One Wire (data) methods
//
Expand Down
76 changes: 76 additions & 0 deletions lib/NeoPixelBus/src/internal/NeoSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ class NeoRgbCurrentSettings
{
}

// ------------------------------------------------------------------------
// operator [] - readonly
// access elements in order by index rather than member name
// ------------------------------------------------------------------------
uint16_t operator[](size_t idx) const
{
switch (idx)
{
case 0:
return RedTenthMilliAmpere;
case 1:
return GreenTenthMilliAmpere;
default:
return BlueTenthMilliAmpere;
}
}

const uint16_t RedTenthMilliAmpere; // in 1/10th ma
const uint16_t GreenTenthMilliAmpere; // in 1/10th ma
const uint16_t BlueTenthMilliAmpere; // in 1/10th ma
Expand All @@ -55,8 +72,67 @@ class NeoRgbwCurrentSettings
{
}

// ------------------------------------------------------------------------
// operator [] - readonly
// access elements in order by index rather than member name
// ------------------------------------------------------------------------
uint16_t operator[](size_t idx) const
{
switch (idx)
{
case 0:
return RedTenthMilliAmpere;
case 1:
return GreenTenthMilliAmpere;
case 2:
return BlueTenthMilliAmpere;
default:
return WhiteTenthMilliAmpere;
}
}

const uint16_t RedTenthMilliAmpere; // in 1/10th ma
const uint16_t GreenTenthMilliAmpere; // in 1/10th ma
const uint16_t BlueTenthMilliAmpere; // in 1/10th ma
const uint16_t WhiteTenthMilliAmpere; // in 1/10th ma
};

class NeoRgbwwCurrentSettings
{
public:
NeoRgbwwCurrentSettings(uint16_t red, uint16_t green, uint16_t blue, uint16_t warmWhite, uint16_t coolWhite) :
RedTenthMilliAmpere(red),
GreenTenthMilliAmpere(green),
BlueTenthMilliAmpere(blue),
WarmWhiteTenthMilliAmpere(warmWhite),
CoolWhiteTenthMilliAmpere(coolWhite)
{
}

// ------------------------------------------------------------------------
// operator [] - readonly
// access elements in order by index rather than member name
// ------------------------------------------------------------------------
uint16_t operator[](size_t idx) const
{
switch (idx)
{
case 0:
return RedTenthMilliAmpere;
case 1:
return GreenTenthMilliAmpere;
case 2:
return BlueTenthMilliAmpere;
case 3:
return WarmWhiteTenthMilliAmpere;
default:
return CoolWhiteTenthMilliAmpere;
}
}

const uint16_t RedTenthMilliAmpere; // in 1/10th ma
const uint16_t GreenTenthMilliAmpere; // in 1/10th ma
const uint16_t BlueTenthMilliAmpere; // in 1/10th ma
const uint16_t WarmWhiteTenthMilliAmpere; // in 1/10th ma
const uint16_t CoolWhiteTenthMilliAmpere; // in 1/10th ma
};
20 changes: 12 additions & 8 deletions lib/NeoPixelBus/src/internal/buffers/NeoBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ template<typename T_BUFFER_METHOD> class NeoBuffer
public:
NeoBuffer(uint16_t width,
uint16_t height,
PGM_VOID_P pixels) :
PGM_VOID_P pixels = nullptr) :
_method(width, height, pixels)
{
}

~NeoBuffer()
{
}

operator NeoBufferContext<typename T_BUFFER_METHOD::ColorFeature>()
{
return _method;
Expand All @@ -64,14 +68,14 @@ template<typename T_BUFFER_METHOD> class NeoBuffer
int16_t y,
typename T_BUFFER_METHOD::ColorObject color)
{
_method.SetPixelColor(pixelIndex(x, y), color);
_method.SetPixelColor(PixelIndex(x, y), color);
};

typename T_BUFFER_METHOD::ColorObject GetPixelColor(
int16_t x,
int16_t y) const
{
return _method.GetPixelColor(pixelIndex(x, y));
return _method.GetPixelColor(PixelIndex(x, y));
};

void ClearTo(typename T_BUFFER_METHOD::ColorObject color)
Expand Down Expand Up @@ -120,7 +124,7 @@ template<typename T_BUFFER_METHOD> class NeoBuffer

if (indexDest < destPixelCount)
{
const uint8_t* pSrc = T_BUFFER_METHOD::ColorFeature::getPixelAddress(_method.Pixels(), pixelIndex(xSrc + x, ySrc + y));
const uint8_t* pSrc = T_BUFFER_METHOD::ColorFeature::getPixelAddress(_method.Pixels(), PixelIndex(xSrc + x, ySrc + y));
uint8_t* pDest = T_BUFFER_METHOD::ColorFeature::getPixelAddress(destBuffer.Pixels, indexDest);

_method.CopyPixels(pDest, pSrc, 1);
Expand Down Expand Up @@ -155,10 +159,7 @@ template<typename T_BUFFER_METHOD> class NeoBuffer
}
}

private:
T_BUFFER_METHOD _method;

uint16_t pixelIndex(
uint16_t PixelIndex(
int16_t x,
int16_t y) const
{
Expand All @@ -173,4 +174,7 @@ template<typename T_BUFFER_METHOD> class NeoBuffer
}
return result;
}

private:
T_BUFFER_METHOD _method;
};
Loading