From 0b6862852c4b236be3a514e7c6651c770bbc8090 Mon Sep 17 00:00:00 2001 From: Makuna Date: Sun, 20 Mar 2016 11:20:50 -0700 Subject: [PATCH] esp8266Compiled const & in template causes near 100 bytes extra code, so removed --- examples/NeoPixelGamma/NeoPixelGamma.ino | 6 +++--- src/NeoPixelBus.h | 2 +- src/internal/HtmlColor.h | 13 +++++++++++++ src/internal/RgbColor.h | 3 +++ src/internal/RgbwColor.h | 3 +++ 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/examples/NeoPixelGamma/NeoPixelGamma.ino b/examples/NeoPixelGamma/NeoPixelGamma.ino index 02c8f88e..3621f489 100644 --- a/examples/NeoPixelGamma/NeoPixelGamma.ino +++ b/examples/NeoPixelGamma/NeoPixelGamma.ino @@ -19,8 +19,8 @@ NeoPixelBus strip(PixelCount, PixelPin); // uncomment only one of these to compare memory use or speed // -// NeoGamma gamma; -NeoGamma gamma; +// NeoGamma colorGamma; +NeoGamma colorGamma; void DrawPixels(bool corrected, HslColor startColor, HslColor stopColor) { @@ -30,7 +30,7 @@ void DrawPixels(bool corrected, HslColor startColor, HslColor stopColor) RgbColor color = HslColor::LinearBlend(startColor, stopColor, progress); if (corrected) { - color = gamma.Correct(color); + color = colorGamma.Correct(color); } strip.SetPixelColor(index, color); } diff --git a/src/NeoPixelBus.h b/src/NeoPixelBus.h index b748a5f1..8b2c326e 100644 --- a/src/NeoPixelBus.h +++ b/src/NeoPixelBus.h @@ -133,7 +133,7 @@ template class NeoPixelBus return _countPixels; }; - void SetPixelColor(uint16_t indexPixel, const typename T_COLOR_FEATURE::ColorObject& color) + void SetPixelColor(uint16_t indexPixel, typename T_COLOR_FEATURE::ColorObject color) { if (indexPixel < _countPixels) { diff --git a/src/internal/HtmlColor.h b/src/internal/HtmlColor.h index 80974bd1..d20de526 100644 --- a/src/internal/HtmlColor.h +++ b/src/internal/HtmlColor.h @@ -62,6 +62,19 @@ struct HtmlColor { }; + // ------------------------------------------------------------------------ + // Comparison operators + // ------------------------------------------------------------------------ + bool operator==(const HtmlColor& other) const + { + return (Color == other.Color); + }; + + bool operator!=(const HtmlColor& other) const + { + return !(*this == other); + }; + // ------------------------------------------------------------------------ // BilinearBlend between four colors by the amount defined by 2d variable // c00 - upper left quadrant color diff --git a/src/internal/RgbColor.h b/src/internal/RgbColor.h index 1ee9986a..252bc4cb 100644 --- a/src/internal/RgbColor.h +++ b/src/internal/RgbColor.h @@ -79,6 +79,9 @@ struct RgbColor { }; + // ------------------------------------------------------------------------ + // Comparison operators + // ------------------------------------------------------------------------ bool operator==(const RgbColor& other) const { return (R == other.R && G == other.G && B == other.B); diff --git a/src/internal/RgbwColor.h b/src/internal/RgbwColor.h index 41f0d05e..e47c7086 100644 --- a/src/internal/RgbwColor.h +++ b/src/internal/RgbwColor.h @@ -86,6 +86,9 @@ struct RgbwColor { }; + // ------------------------------------------------------------------------ + // Comparison operators + // ------------------------------------------------------------------------ bool operator==(const RgbwColor& other) const { return (R == other.R && G == other.G && B == other.B && W == other.W);