Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Aircoookie/WLED into Airc…
Browse files Browse the repository at this point in the history
…oookie-master
  • Loading branch information
srg74 committed Apr 8, 2020
2 parents c97bead + 9b87a51 commit a0960f5
Show file tree
Hide file tree
Showing 45 changed files with 2,356 additions and 1,876 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/platformio_override.ini
.DS_Store
.gitignore
.clang-format
45 changes: 29 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,56 @@

### Development versions after 0.9.1 release

#### Build 2004061

- Fixed RBG and BGR getPixelColor (#825)
- Improved formatting

#### Build 2004060

- Consolidated global variables in wled.h

#### Build 2003300

- Major change of project structure from .ino to .cpp and func_declare.h

#### Build 2003262

- Fixed compilation for Analog LEDs
- Fixed sync settings network port fields too small
- Fixed compilation for Analog LEDs
- Fixed sync settings network port fields too small

#### Build 2003261

- Fixed live preview not displaying whole light if over 255 LEDs
- Fixed live preview not displaying whole light if over 255 LEDs

#### Build 2003251

- Added Pacifica effect (tentative, doesn't yet support other colors)
- Added Atlantica palette
- Fixed ESP32 build of Espalexa
- Added Pacifica effect (tentative, doesn't yet support other colors)
- Added Atlantica palette
- Fixed ESP32 build of Espalexa

#### Build 2003222

- Fixed Alexa Whites on non-RGBW lights (bump Espalexa to 2.4.5)
- Fixed Alexa Whites on non-RGBW lights (bump Espalexa to 2.4.5)

#### Build 2003221

- Moved Cronixie driver from FX library to drawOverlay handler
- Moved Cronixie driver from FX library to drawOverlay handler

#### Build 2003211

- Added custom mapping compile define to FX_fcn.h
- Merged pull request #784 by @TravisDean: Fixed initialization bug when toggling skip first
- Added link to youtube videos by Room31 to readme
- Added custom mapping compile define to FX_fcn.h
- Merged pull request #784 by @TravisDean: Fixed initialization bug when toggling skip first
- Added link to youtube videos by Room31 to readme

#### Build 2003141

- Fixed color of main segment returned in JSON API during transition not being target color (closes #765)
- Fixed arlsLock() being called after pixels set in E1.31 (closes #772)
- Fixed HTTP API calls not having an effect if no segment selected (now applies to main segment)
- Fixed color of main segment returned in JSON API during transition not being target color (closes #765)
- Fixed arlsLock() being called after pixels set in E1.31 (closes #772)
- Fixed HTTP API calls not having an effect if no segment selected (now applies to main segment)

#### Build 2003121

- Created changelog.md - make tracking changes to code easier
- Merged pull request #766 by @pille: Fix E1.31 out-of sequence detection
- Created changelog.md - make tracking changes to code easier
- Merged pull request #766 by @pille: Fix E1.31 out-of sequence detection

2 changes: 1 addition & 1 deletion usermods/blynk_relay_control/wled06_usermod.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file allows you to add own functionality to WLED more easily
* See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality
* EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in wled01_eeprom.h)
* EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in wled_eeprom.h)
* bytes 2400+ are currently ununsed, but might be used for future wled features
*/

Expand Down
2 changes: 1 addition & 1 deletion usermods/stairway_wipe_basic/wled06_usermod.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file allows you to add own functionality to WLED more easily
* See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality
* EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in wled01_eeprom.h)
* EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in wled_eeprom.h)
* bytes 2400+ are currently ununsed, but might be used for future wled features
*/

Expand Down
16 changes: 8 additions & 8 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ uint16_t WS2812FX::mode_hyper_sparkle(void) {
}

if(random8(5) < 2) {
for(uint16_t i = 0; i < max(1, SEGLEN/3); i++) {
for(uint16_t i = 0; i < MAX(1, SEGLEN/3); i++) {
setPixelColor(random16(SEGLEN), SEGCOLOR(1));
}
return 20;
Expand Down Expand Up @@ -1115,7 +1115,7 @@ uint16_t WS2812FX::mode_fireworks() {
if (valid1) setPixelColor(SEGENV.aux0 , sv1);
if (valid2) setPixelColor(SEGENV.aux1, sv2);

for(uint16_t i=0; i<max(1, SEGLEN/20); i++) {
for(uint16_t i=0; i<MAX(1, SEGLEN/20); i++) {
if(random8(129 - (SEGMENT.intensity >> 1)) == 0) {
uint16_t index = random(SEGLEN);
setPixelColor(index, color_from_palette(random8(), false, false, 0));
Expand Down Expand Up @@ -1162,12 +1162,12 @@ uint16_t WS2812FX::mode_fire_flicker(void) {
byte r = (SEGCOLOR(0) >> 16) & 0xFF;
byte g = (SEGCOLOR(0) >> 8) & 0xFF;
byte b = (SEGCOLOR(0) & 0xFF);
byte lum = (SEGMENT.palette == 0) ? max(w, max(r, max(g, b))) : 255;
byte lum = (SEGMENT.palette == 0) ? MAX(w, MAX(r, MAX(g, b))) : 255;
lum /= (((256-SEGMENT.intensity)/16)+1);
for(uint16_t i = 0; i < SEGLEN; i++) {
byte flicker = random8(lum);
if (SEGMENT.palette == 0) {
setPixelColor(i, max(r - flicker, 0), max(g - flicker, 0), max(b - flicker, 0), max(w - flicker, 0));
setPixelColor(i, MAX(r - flicker, 0), MAX(g - flicker, 0), MAX(b - flicker, 0), MAX(w - flicker, 0));
} else {
setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0, 255 - flicker));
}
Expand Down Expand Up @@ -1197,7 +1197,7 @@ uint16_t WS2812FX::gradient_base(bool loading) {
{
val = abs(((i>pp) ? p2:pp) -i);
} else {
val = min(abs(pp-i),min(abs(p1-i),abs(p2-i)));
val = MIN(abs(pp-i),MIN(abs(p1-i),abs(p2-i)));
}
val = (brd > val) ? val/brd * 255 : 255;
setPixelColor(i, color_blend(SEGCOLOR(0), color_from_palette(i, true, PALETTE_SOLID_WRAP, 1), val));
Expand Down Expand Up @@ -1778,7 +1778,7 @@ uint16_t WS2812FX::mode_fire_2012()

// Step 4. Map from heat cells to LED colors
for (uint16_t j = 0; j < SEGLEN; j++) {
CRGB color = ColorFromPalette(currentPalette, min(heat[j],240), 255, LINEARBLEND);
CRGB color = ColorFromPalette(currentPalette, MIN(heat[j],240), 255, LINEARBLEND);
setPixelColor(j, color.red, color.green, color.blue);
}
return FRAMETIME;
Expand Down Expand Up @@ -2573,7 +2573,7 @@ uint16_t WS2812FX::mode_bouncing_balls(void) {

uint32_t color = SEGCOLOR(0);
if (SEGMENT.palette) {
color = color_wheel(i*(256/max(numBalls, 8)));
color = color_wheel(i*(256/MAX(numBalls, 8)));
} else if (hasCol2) {
color = SEGCOLOR(i % NUM_COLORS);
}
Expand Down Expand Up @@ -3101,7 +3101,7 @@ uint16_t WS2812FX::mode_plasma(void) {
*/
uint16_t WS2812FX::mode_percent(void) {

uint8_t percent = max(0, min(200, SEGMENT.intensity));
uint8_t percent = MAX(0, MIN(200, SEGMENT.intensity));
uint16_t active_leds = (percent < 100) ? SEGLEN * percent / 100.0
: SEGLEN * (200 - percent) / 100.0;

Expand Down
4 changes: 2 additions & 2 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#define DEFAULT_SPEED (uint8_t)128
#define DEFAULT_COLOR (uint32_t)0xFFAA00

#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))

/* Not used in all effects yet */
#define WLED_FPS 42
Expand Down
12 changes: 6 additions & 6 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void WS2812FX::show(void) {
if(useWackyWS2815PowerModel)
{
// ignore white component on WS2815 power calculation
powerSum += (max(max(c.R,c.G),c.B)) * 3;
powerSum += (MAX(MAX(c.R,c.G),c.B)) * 3;
}
else
{
Expand Down Expand Up @@ -412,8 +412,8 @@ uint32_t WS2812FX::getPixelColor(uint16_t i)
case 0: return ((col.W << 24) | (col.G << 8) | (col.R << 16) | (col.B)); //0 = GRB, default
case 1: return ((col.W << 24) | (col.R << 8) | (col.G << 16) | (col.B)); //1 = RGB, common for WS2811
case 2: return ((col.W << 24) | (col.B << 8) | (col.R << 16) | (col.G)); //2 = BRG
case 3: return ((col.W << 24) | (col.R << 8) | (col.B << 16) | (col.G)); //3 = RBG
case 4: return ((col.W << 24) | (col.B << 8) | (col.G << 16) | (col.R)); //4 = BGR
case 3: return ((col.W << 24) | (col.B << 8) | (col.G << 16) | (col.R)); //3 = RBG
case 4: return ((col.W << 24) | (col.R << 8) | (col.B << 16) | (col.G)); //4 = BGR
case 5: return ((col.W << 24) | (col.G << 8) | (col.B << 16) | (col.R)); //5 = GBR
}
return 0;
Expand Down Expand Up @@ -647,7 +647,7 @@ uint8_t WS2812FX::get_random_wheel_index(uint8_t pos) {
r = random8();
x = abs(pos - r);
y = 255 - x;
d = min(x, y);
d = MIN(x, y);
}
return r;
}
Expand Down Expand Up @@ -730,8 +730,8 @@ void WS2812FX::handle_palette(void)
CHSV prim_hsv = rgb2hsv_approximate(prim);
targetPalette = CRGBPalette16(
CHSV(prim_hsv.h, prim_hsv.s, prim_hsv.v), //color itself
CHSV(prim_hsv.h, max(prim_hsv.s - 50,0), prim_hsv.v), //less saturated
CHSV(prim_hsv.h, prim_hsv.s, max(prim_hsv.v - 50,0)), //darker
CHSV(prim_hsv.h, MAX(prim_hsv.s - 50,0), prim_hsv.v), //less saturated
CHSV(prim_hsv.h, prim_hsv.s, MAX(prim_hsv.v - 50,0)), //darker
CHSV(prim_hsv.h, prim_hsv.s, prim_hsv.v)); //color itself
break;}
case 4: {//primary + secondary
Expand Down
5 changes: 4 additions & 1 deletion wled00/wled12_alexa.ino → wled00/alexa.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include "wled.h"

/*
* Alexa Voice On/Off/Brightness Control. Emulates a Philips Hue bridge to Alexa.
* Alexa Voice On/Off/Brightness/Color Control. Emulates a Philips Hue bridge to Alexa.
*
* This was put together from these two excellent projects:
* https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch
* https://github.com/probonopd/ESP8266HueEmulator
*/
#include "src/dependencies/espalexa/EspalexaDevice.h"

#ifndef WLED_DISABLE_ALEXA
void onAlexaChange(EspalexaDevice* dev);
Expand Down
3 changes: 3 additions & 0 deletions wled00/wled16_blynk.ino → wled00/blynk.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include "wled.h"
#include "src/dependencies/blynk/Blynk/BlynkHandlers.h"

/*
* Remote light control with the free Blynk app
*/
Expand Down
4 changes: 3 additions & 1 deletion wled00/wled09_button.ino → wled00/button.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "wled.h"

/*
* Physical IO
*/
Expand Down Expand Up @@ -44,7 +46,7 @@ void handleButton()

if (dur > 6000) //long press
{
initAP(true);
WLED::instance().initAP(true);
}
else if (!buttonLongPressed) { //short press
if (macroDoublePress)
Expand Down
9 changes: 6 additions & 3 deletions wled00/wled14_colors.ino → wled00/colors.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "wled.h"

/*
* Color conversion methods
*/
Expand All @@ -18,7 +20,7 @@ void colorFromUint32(uint32_t in, bool secondary)
}

//load a color without affecting the white channel
void colorFromUint24(uint32_t in, bool secondary = false)
void colorFromUint24(uint32_t in, bool secondary)
{
if (secondary) {
colSec[0] = in >> 16 & 0xFF;
Expand All @@ -32,7 +34,7 @@ void colorFromUint24(uint32_t in, bool secondary = false)
}

//relatively change white brightness, minumum A=5
void relativeChangeWhite(int8_t amount, byte lowerBoundary =0)
void relativeChangeWhite(int8_t amount, byte lowerBoundary)
{
int16_t new_val = (int16_t) col[3] + amount;
if (new_val > 0xFF) new_val = 0xFF;
Expand Down Expand Up @@ -149,7 +151,8 @@ void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.develo
xy[0] = X / (X + Y + Z);
xy[1] = Y / (X + Y + Z);
}
#endif
#endif // WLED_DISABLE_HUESYNC


void colorFromDecOrHexString(byte* rgb, char* in)
{
Expand Down
24 changes: 22 additions & 2 deletions wled00/const.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#ifndef wled_const_h
#define wled_const_h
#ifndef WLED_CONST_H
#define WLED_CONST_H

/*
* Readability defines and their associated numerical values + compile-time constants
*/

//Defaults
#define DEFAULT_CLIENT_SSID "Your_Network"
Expand Down Expand Up @@ -72,4 +76,20 @@
#define HUE_ERROR_TIMEOUT 251
#define HUE_ERROR_ACTIVE 255

//EEPROM size
#define EEPSIZE 2560 //Maximum is 4096

#define NTP_PACKET_SIZE 48

// maximum number of LEDs - MAX_LEDS is coming from the JSON response getting too big, MAX_LEDS_DMA will become a timing issue
#define MAX_LEDS 1500
#define MAX_LEDS_DMA 500

// string temp buffer (now stored in stack locally)
#define OMAX 2048

#define E131_MAX_UNIVERSE_COUNT 9

#define ABL_MILLIAMPS_DEFAULT 850; // auto lower brightness to stay close to milliampere limit

#endif
62 changes: 62 additions & 0 deletions wled00/dmx.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include "wled.h"

/*
* Support for DMX via MAX485.
* Change the output pin in src/dependencies/ESPDMX.cpp if needed.
* Library from:
* https://github.com/Rickgg/ESP-Dmx
*/

#ifdef WLED_ENABLE_DMX
#include "src/dependencies/dmx/ESPDMX.h"
DMXESPSerial dmx;

void handleDMX()
{
// TODO: calculate brightness manually if no shutter channel is set

uint8_t brightness = strip.getBrightness();

for (int i = 0; i < ledCount; i++) { // uses the amount of LEDs as fixture count

uint32_t in = strip.getPixelColor(i); // get the colors for the individual fixtures as suggested by Aircoookie in issue #462
byte w = in >> 24 & 0xFF;
byte r = in >> 16 & 0xFF;
byte g = in >> 8 & 0xFF;
byte b = in & 0xFF;

int DMXFixtureStart = DMXStart + (DMXGap * i);
for (int j = 0; j < DMXChannels; j++) {
int DMXAddr = DMXFixtureStart + j;
switch (DMXFixtureMap[j]) {
case 0: // Set this channel to 0. Good way to tell strobe- and fade-functions to fuck right off.
dmx.write(DMXAddr, 0);
break;
case 1: // Red
dmx.write(DMXAddr, r);
break;
case 2: // Green
dmx.write(DMXAddr, g);
break;
case 3: // Blue
dmx.write(DMXAddr, b);
break;
case 4: // White
dmx.write(DMXAddr, w);
break;
case 5: // Shutter channel. Controls the brightness.
dmx.write(DMXAddr, brightness);
break;
case 6: // Sets this channel to 255. Like 0, but more wholesome.
dmx.write(DMXAddr, 255);
break;
}
}
}

dmx.update(); // update the DMX bus
}

#else
void handleDMX() {}
#endif
Loading

0 comments on commit a0960f5

Please sign in to comment.