From 1131c7503a258b81ea2a34df68aadacff04999f0 Mon Sep 17 00:00:00 2001 From: Maurotb Date: Thu, 30 May 2019 23:25:47 +0200 Subject: [PATCH 1/5] Update definitions.h --- Arduino/McLighting/definitions.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Arduino/McLighting/definitions.h b/Arduino/McLighting/definitions.h index 835cbeea..ed6bd959 100644 --- a/Arduino/McLighting/definitions.h +++ b/Arduino/McLighting/definitions.h @@ -5,6 +5,8 @@ // Neopixel #define LED_PIN 14 // LED_PIN (14 / D5) where neopixel / WS2811 strip is attached #define NUMLEDS 24 // Number of leds in the strip +// +//#define OFFSET // If defined, first led of starting effect like dual scan,scan etc, is traslated of OFFSET number of leds //#define LED_TYPE_WS2811 // Uncomment if LED type uses 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) #define BUILTIN_LED 2 // ESP-12F has the built in LED on GPIO2, see https://github.com/esp8266/Arduino/issues/2192 #define BUTTON 4 // Input pin (4 / D2) for switching the LED strip on / off, connect this PIN to ground to trigger button. From 1e4c5f83e1cfd3f8d4f37a1cdf51f962f9acc0a0 Mon Sep 17 00:00:00 2001 From: Maurotb Date: Thu, 30 May 2019 23:30:09 +0200 Subject: [PATCH 2/5] Update McLighting.ino Add ability to stranslate starting led of effect by OFFSET number of leds --- Arduino/McLighting/McLighting.ino | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Arduino/McLighting/McLighting.ino b/Arduino/McLighting/McLighting.ino index 9216a1f0..4279e3f4 100644 --- a/Arduino/McLighting/McLighting.ino +++ b/Arduino/McLighting/McLighting.ino @@ -256,6 +256,26 @@ void saveConfigCallback () { #include "custom_ws2812fx_animations.h" // Add animations in this file #endif +#ifdef OFFSET +void OffsetShow(void) { + static uint8_t tmpPixels[NUMLEDS * 4]; // allocate space for a copy of the ADafruit pixel data + uint8_t bytesPerPixel = strip->getNumBytes() / strip->getLength(); // 3=RGB, 4=RGBW + + // copy the Adafruit pixel array + memcpy(tmpPixels, strip->getPixels(), strip->getNumBytes()); + + // offset the data in the Adafruit pixel array + memcpy(strip->getPixels() + OFFSET * bytesPerPixel, tmpPixels, (NUMLEDS - OFFSET) * bytesPerPixel); + memcpy(strip->getPixels(), tmpPixels + (NUMLEDS - OFFSET) * bytesPerPixel, OFFSET * bytesPerPixel); + + // run the standard Adafruit show() function + strip->Adafruit_NeoPixel::show(); + + // copy the original pixel data back to the Adafruit pixel array + memcpy(strip->getPixels(), tmpPixels, strip->getNumBytes()); +} +#endif + // function to Initialize the strip void initStrip(uint16_t stripSize = WS2812FXStripSettings.stripSize, neoPixelType RGBOrder = WS2812FXStripSettings.RGBOrder, uint8_t pin = WS2812FXStripSettings.pin){ if (strip) { @@ -283,6 +303,10 @@ void initStrip(uint16_t stripSize = WS2812FXStripSettings.stripSize, neoPixelTyp // on a live circuit...if you must, connect GND first. strip->init(); + #ifdef OFFSET + strip->setCustomShow(OffsetShow); + #endif + #if defined(USE_WS2812FX_DMA) or defined(USE_WS2812FX_UART1) or defined(USE_WS2812FX_UART2) initDMA(stripSize); strip->setCustomShow(DMA_Show); From 1d32c4bae9da1580b3379aa2b00300af395c51ca Mon Sep 17 00:00:00 2001 From: Maurotb Date: Thu, 30 May 2019 23:31:35 +0200 Subject: [PATCH 3/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dcb0e439..a1e34048 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # McLighting v2 - The ESP8266 based multi-client lighting gadget +This version, add ability to translate starting led of effect by OFFSET number of leds, respect of elettric wire of led strip. + [![Gitter](https://badges.gitter.im/mclighting/Lobby.svg)](https://gitter.im/mclighting/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://travis-ci.com/toblum/McLighting.svg?branch=master)](https://travis-ci.com/toblum/McLighting) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![version](https://img.shields.io/badge/version-v2.2.4-blue.svg)](https://github.com/toblum/McLighting/blob/master/Arduino/McLighting/version.h) McLighting (the multi-client lighting gadget) is a very cheap internet-controllable lighting solution based on the famous ESP8266 microcontroller and WS2811/2812 led strips. It features among other things a web-interface, a REST-API and a websocket connector. From 96471cdb42002ae00fa3d1d9dd25891adec50147 Mon Sep 17 00:00:00 2001 From: Maurotb Date: Sat, 1 Jun 2019 22:35:39 +0200 Subject: [PATCH 4/5] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a1e34048..3b5666d0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # McLighting v2 - The ESP8266 based multi-client lighting gadget This version, add ability to translate starting led of effect by OFFSET number of leds, respect of elettric wire of led strip. +Thanks to @moose4lord [![Gitter](https://badges.gitter.im/mclighting/Lobby.svg)](https://gitter.im/mclighting/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://travis-ci.com/toblum/McLighting.svg?branch=master)](https://travis-ci.com/toblum/McLighting) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![version](https://img.shields.io/badge/version-v2.2.4-blue.svg)](https://github.com/toblum/McLighting/blob/master/Arduino/McLighting/version.h) From df5b58cedf697e7157366e8931f9966a7c2538a4 Mon Sep 17 00:00:00 2001 From: Maurotb Date: Sun, 2 Jun 2019 18:55:26 +0200 Subject: [PATCH 5/5] Update definitions.h --- Arduino/McLighting/definitions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arduino/McLighting/definitions.h b/Arduino/McLighting/definitions.h index ed6bd959..80cfa369 100644 --- a/Arduino/McLighting/definitions.h +++ b/Arduino/McLighting/definitions.h @@ -6,7 +6,7 @@ #define LED_PIN 14 // LED_PIN (14 / D5) where neopixel / WS2811 strip is attached #define NUMLEDS 24 // Number of leds in the strip // -//#define OFFSET // If defined, first led of starting effect like dual scan,scan etc, is traslated of OFFSET number of leds +//#define OFFSET // If defined, first led of starting effect like dual scan,scan etc, is traslated of OFFSET number of leds. Not use this in conjuction of USE_WS2812FX_DMA,USE_WS2812FX_UART1 or USE_WS2812FX_UART2 //#define LED_TYPE_WS2811 // Uncomment if LED type uses 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) #define BUILTIN_LED 2 // ESP-12F has the built in LED on GPIO2, see https://github.com/esp8266/Arduino/issues/2192 #define BUTTON 4 // Input pin (4 / D2) for switching the LED strip on / off, connect this PIN to ground to trigger button.