Skip to content

Commit

Permalink
Merge pull request Aircoookie#61 from Aircoookie/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
srg74 authored Mar 21, 2020
2 parents c0f5509 + f4f5d6e commit 0e73a02
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

### Development versions after 0.9.1 release

#### 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

#### Build 2003141

Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ DrZzs has made some excellent video guides:

If you'd rather read, here is a very [detailed step-by-step beginner tutorial](https://tynick.com/blog/11-03-2019/getting-started-with-wled-on-esp8266/) by tynick!

Russian speakers, check out the videos by Room31:
[WLED Firmware Overview: Interface and Settings](https://youtu.be/h7lKsczEI7E)
[ESP8266 based LED controller for WS2812b strip. WLED Firmware + OpenHAB](https://youtu.be/K4ioTt3XvGc)

### Other

Licensed under the MIT license
Expand Down
35 changes: 32 additions & 3 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,30 @@
#include "FX.h"
#include "palettes.h"

//enable custom per-LED mapping. This can allow for better effects on matrices or special displays
//#define WLED_CUSTOM_LED_MAPPING

#ifdef WLED_CUSTOM_LED_MAPPING
//this is just an example (30 LEDs). It will first set all even, then all uneven LEDs.
const uint16_t customMappingTable[] = {
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28,
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29};

//another example. Switches direction every 5 LEDs.
/*const uint16_t customMappingTable[] = {
0, 1, 2, 3, 4, 9, 8, 7, 6, 5, 10, 11, 12, 13, 14,
19, 18, 17, 16, 15, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25};*/

const uint16_t customMappingSize = sizeof(customMappingTable)/sizeof(uint16_t); //30 in example
#endif

void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
{
if (supportWhite == _useRgbw && countPixels == _length) return;
if (supportWhite == _useRgbw && countPixels == _length && _skipFirstMode == skipFirst) return;
RESET_RUNTIME;
_useRgbw = supportWhite;
_skipFirstMode = skipFirst;
_length = countPixels;
_skipFirstMode = skipFirst;

uint8_t ty = 1;
if (supportWhite) ty = 2;
Expand Down Expand Up @@ -142,10 +159,16 @@ void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w)
int16_t indexSet = realIndex + (reversed ? -j : j);
int16_t indexSetRev = indexSet;
if (reverseMode) indexSetRev = _length - 1 - indexSet;
#ifdef WLED_CUSTOM_LED_MAPPING
if (indexSet < customMappingSize) indexSet = customMappingTable[indexSet];
#endif
if (indexSetRev >= SEGMENT.start && indexSetRev < SEGMENT.stop) bus->SetPixelColor(indexSet + skip, col);
}
} else { //live data, etc.
if (reverseMode) i = _length - 1 - i;
#ifdef WLED_CUSTOM_LED_MAPPING
if (i < customMappingSize) i = customMappingTable[i];
#endif
bus->SetPixelColor(i + skip, col);
}
if (skip && i == 0) {
Expand Down Expand Up @@ -430,7 +453,13 @@ uint32_t WS2812FX::getColor(void) {

uint32_t WS2812FX::getPixelColor(uint16_t i)
{
i = realPixelIndex(i) + (_skipFirstMode ? LED_SKIP_AMOUNT : 0);
i = realPixelIndex(i);

#ifdef WLED_CUSTOM_LED_MAPPING
if (i < customMappingSize) i = customMappingTable[i];
#endif

if (_skipFirstMode) i += LED_SKIP_AMOUNT;

if (_cronixieMode)
{
Expand Down
2 changes: 1 addition & 1 deletion wled00/NpbWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//PIN CONFIGURATION
#ifndef LEDPIN
#define LEDPIN 2 //strip pin. Any for ESP32, gpio2 or 3 is recommended for ESP8266 (gpio2/3 are labeled D4/RX on NodeMCU and Wemos)
#define LEDPIN 2 //strip pin. Any for ESP32, gpio2 or 3 is recommended for ESP8266 (gpio2/3 are labeled D4/RX on NodeMCU and Wemos)
#endif
//#define USE_APA102 // Uncomment for using APA102 LEDs.
//#define USE_WS2801 // Uncomment for using WS2801 LEDs (make sure you have NeoPixelBus v2.5.6 or newer)
Expand Down
2 changes: 1 addition & 1 deletion wled00/html_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ Send notifications twice: <input type="checkbox" name="S2">
<h3>Realtime</h3>
Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
<i>E1.31 (sACN)</i><br>
Skip out-of-sequence packets (freeze instead of flicker): <input type="checkbox" name="ES"><br>
Use E1.31 multicast: <input type="checkbox" name="EM"><br>
E1.31 start universe: <input name="EU" type="number" min="1" max="63999" required><br>
Skip out-of-sequence packets: <input type="checkbox" name="ES"><br>
<i>Reboot required.</i> Check out <a href="https://github.com/ahodges9/LedFx" target="_blank">LedFx</a>!<br>
DMX start address: <input name="DA" type="number" min="1" max="510" value="1" required><br>
DMX mode:
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled00.ino
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
#endif

//version code in format yymmddb (b = daily build)
#define VERSION 2003141
#define VERSION 2003211

char versionString[] = "0.9.1";

Expand Down

0 comments on commit 0e73a02

Please sign in to comment.