Added custom per-LED mapping
This commit is contained in:
parent
9bc48ececa
commit
e5c3629e2e
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
### Development versions after 0.9.1 release
|
### 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
|
#### Build 2003141
|
||||||
|
|
||||||
|
@ -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!
|
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
|
### Other
|
||||||
|
|
||||||
Licensed under the MIT license
|
Licensed under the MIT license
|
||||||
|
@ -27,6 +27,23 @@
|
|||||||
#include "FX.h"
|
#include "FX.h"
|
||||||
#include "palettes.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)
|
void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
|
||||||
{
|
{
|
||||||
if (supportWhite == _useRgbw && countPixels == _length) return;
|
if (supportWhite == _useRgbw && countPixels == _length) return;
|
||||||
@ -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 indexSet = realIndex + (reversed ? -j : j);
|
||||||
int16_t indexSetRev = indexSet;
|
int16_t indexSetRev = indexSet;
|
||||||
if (reverseMode) indexSetRev = _length - 1 - 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);
|
if (indexSetRev >= SEGMENT.start && indexSetRev < SEGMENT.stop) bus->SetPixelColor(indexSet + skip, col);
|
||||||
}
|
}
|
||||||
} else { //live data, etc.
|
} else { //live data, etc.
|
||||||
if (reverseMode) i = _length - 1 - i;
|
if (reverseMode) i = _length - 1 - i;
|
||||||
|
#ifdef WLED_CUSTOM_LED_MAPPING
|
||||||
|
if (i < customMappingSize) i = customMappingTable[i];
|
||||||
|
#endif
|
||||||
bus->SetPixelColor(i + skip, col);
|
bus->SetPixelColor(i + skip, col);
|
||||||
}
|
}
|
||||||
if (skip && i == 0) {
|
if (skip && i == 0) {
|
||||||
@ -430,7 +453,13 @@ uint32_t WS2812FX::getColor(void) {
|
|||||||
|
|
||||||
uint32_t WS2812FX::getPixelColor(uint16_t i)
|
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)
|
if (_cronixieMode)
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
//PIN CONFIGURATION
|
//PIN CONFIGURATION
|
||||||
#ifndef LEDPIN
|
#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
|
#endif
|
||||||
//#define USE_APA102 // Uncomment for using APA102 LEDs.
|
//#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)
|
//#define USE_WS2801 // Uncomment for using WS2801 LEDs (make sure you have NeoPixelBus v2.5.6 or newer)
|
||||||
|
@ -284,9 +284,9 @@ Send notifications twice: <input type="checkbox" name="S2">
|
|||||||
<h3>Realtime</h3>
|
<h3>Realtime</h3>
|
||||||
Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
|
Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
|
||||||
<i>E1.31 (sACN)</i><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>
|
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>
|
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>
|
<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 start address: <input name="DA" type="number" min="1" max="510" value="1" required><br>
|
||||||
DMX mode:
|
DMX mode:
|
||||||
|
@ -119,7 +119,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//version code in format yymmddb (b = daily build)
|
//version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2003141
|
#define VERSION 2003211
|
||||||
|
|
||||||
char versionString[] = "0.9.1";
|
char versionString[] = "0.9.1";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user