Switched LED library to NeoPixelBus in an attempt to fix reset issue

Fixed a bug that caused color correction to work incorrectly
This commit is contained in:
cschwinne 2017-09-18 12:24:31 +02:00
parent 42e4fe7f3a
commit 97065d402d
4 changed files with 290 additions and 234 deletions

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@
#define WS2812FX_h #define WS2812FX_h
#include "Arduino.h" #include "Arduino.h"
#include <Adafruit_NeoPixel.h> #include <NeoPixelBrightnessBus.h>
#define DEFAULT_BRIGHTNESS 50 #define DEFAULT_BRIGHTNESS 50
#define DEFAULT_MODE 0 #define DEFAULT_MODE 0
@ -103,13 +103,13 @@
#define FX_MODE_DUAL_COLOR_WIPE_OUT_IN 51 #define FX_MODE_DUAL_COLOR_WIPE_OUT_IN 51
#define FX_MODE_CIRCUS_COMBUSTUS 52 #define FX_MODE_CIRCUS_COMBUSTUS 52
class WS2812FX : public Adafruit_NeoPixel { class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod> {
typedef void (WS2812FX::*mode_ptr)(void); typedef void (WS2812FX::*mode_ptr)(void);
public: public:
WS2812FX(uint16_t n, uint8_t p, neoPixelType t) : Adafruit_NeoPixel(n, p, t) { WS2812FX(uint16_t n) : NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod>(n) {
_mode[FX_MODE_STATIC] = &WS2812FX::mode_static; _mode[FX_MODE_STATIC] = &WS2812FX::mode_static;
_mode[FX_MODE_BLINK] = &WS2812FX::mode_blink; _mode[FX_MODE_BLINK] = &WS2812FX::mode_blink;
_mode[FX_MODE_BREATH] = &WS2812FX::mode_breath; _mode[FX_MODE_BREATH] = &WS2812FX::mode_breath;
@ -279,6 +279,11 @@ class WS2812FX : public Adafruit_NeoPixel {
private: private:
void void
begin(void),
show(void),
clear(void),
setPixelColor(uint16_t i, uint32_t c),
setPixelColor(uint16_t i, uint8_t r, uint8_t g, uint8_t b),
dofade(void), dofade(void),
strip_off(void), strip_off(void),
strip_off_respectLock(void), strip_off_respectLock(void),
@ -345,6 +350,8 @@ class WS2812FX : public Adafruit_NeoPixel {
_locked; _locked;
uint8_t uint8_t
minval(uint8_t v, uint8_t w),
maxval(uint8_t v, uint8_t w),
get_random_wheel_index(uint8_t), get_random_wheel_index(uint8_t),
_mode_index, _mode_index,
_speed, _speed,
@ -354,6 +361,7 @@ class WS2812FX : public Adafruit_NeoPixel {
_led_count; _led_count;
uint32_t uint32_t
getPixelColor(uint16_t i),
color_wheel(uint8_t), color_wheel(uint8_t),
_color, _color,
_counter_mode_call, _counter_mode_call,

View File

@ -20,7 +20,7 @@
#include "CallbackFunction.h" #include "CallbackFunction.h"
//version in format yymmddb (b = daily build) //version in format yymmddb (b = daily build)
#define VERSION 1709181 #define VERSION 1709183
//to toggle usb serial debug (un)comment following line //to toggle usb serial debug (un)comment following line
//#define DEBUG //#define DEBUG
@ -186,7 +186,7 @@ ESP8266HTTPUpdateServer httpUpdater;
WiFiUDP notifierUdp; WiFiUDP notifierUdp;
WiFiUDP ntpUdp; WiFiUDP ntpUdp;
WS2812FX strip = WS2812FX(LEDCOUNT, 2, NEO_GRB + NEO_KHZ800); WS2812FX strip = WS2812FX(LEDCOUNT);
#ifdef USEFS #ifdef USEFS
File fsUploadFile; File fsUploadFile;

View File

@ -12,7 +12,7 @@ void setAllLeds() {
} else { } else {
strip.setBrightness(val); strip.setBrightness(val);
} }
if (useGammaCorrectionBri) if (useGammaCorrectionRGB)
{ {
strip.setColor(gamma8[col_t[0]], gamma8[col_t[1]], gamma8[col_t[2]]); strip.setColor(gamma8[col_t[0]], gamma8[col_t[1]], gamma8[col_t[2]]);
} else { } else {