Merge pull request #71 from FabLab-Luenen/development
Version Bump to 3.1.0
This commit is contained in:
@@ -718,14 +718,12 @@ void loop() {
|
|||||||
if ((State.mode == HOLD) || ((State.mode == OFF) && (strip->getBrightness() > 0) && Config.transEffect)) {
|
if ((State.mode == HOLD) || ((State.mode == OFF) && (strip->getBrightness() > 0) && Config.transEffect)) {
|
||||||
if(!strip->isRunning()) strip->start();
|
if(!strip->isRunning()) strip->start();
|
||||||
strip->service();
|
strip->service();
|
||||||
|
bool playE131 = false;
|
||||||
for (uint8_t i = 0; i < Config.segments; i++) {
|
for (uint8_t i = 0; i < Config.segments; i++) {
|
||||||
if (segState.mode[i] == FX_MODE_CUSTOM_0) { handleAutoPlay(i); }
|
if (segState.mode[i] == FX_MODE_CUSTOM_0) { handleAutoPlay(i); }
|
||||||
if (segState.mode[i] == FX_MODE_CUSTOM_3) {
|
if (segState.mode[i] == FX_MODE_CUSTOM_3) { playE131 = true; }
|
||||||
if (strip->getSpeed(i) > SPEED_MIN) {
|
|
||||||
strip->setSpeed(i, SPEED_MIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (playE131 == true) { handleE131Play(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevmode != State.mode) {
|
if (prevmode != State.mode) {
|
||||||
|
|||||||
@@ -781,7 +781,7 @@ uint16_t WS2812FX::scan(uint32_t color1, uint32_t color2, bool dual) {
|
|||||||
|
|
||||||
SEGMENT_RUNTIME.counter_mode_step += dir;
|
SEGMENT_RUNTIME.counter_mode_step += dir;
|
||||||
if(SEGMENT_RUNTIME.counter_mode_step == 0) SEGMENT_RUNTIME.aux_param = 0;
|
if(SEGMENT_RUNTIME.counter_mode_step == 0) SEGMENT_RUNTIME.aux_param = 0;
|
||||||
if(SEGMENT_RUNTIME.counter_mode_step >= (SEGMENT_LENGTH - size)) SEGMENT_RUNTIME.aux_param = 1;
|
if(SEGMENT_RUNTIME.counter_mode_step >= (uint16_t)(SEGMENT_LENGTH - size)) SEGMENT_RUNTIME.aux_param = 1;
|
||||||
|
|
||||||
return (SEGMENT.speed / (SEGMENT_LENGTH * 2));
|
return (SEGMENT.speed / (SEGMENT_LENGTH * 2));
|
||||||
}
|
}
|
||||||
@@ -1388,7 +1388,7 @@ uint16_t WS2812FX::mode_larson_scanner(void) {
|
|||||||
else CLR_CYCLE;
|
else CLR_CYCLE;
|
||||||
|
|
||||||
SEGMENT_RUNTIME.counter_mode_step++;
|
SEGMENT_RUNTIME.counter_mode_step++;
|
||||||
if(SEGMENT_RUNTIME.counter_mode_step >= ((SEGMENT_LENGTH * 2) - 2)) {
|
if(SEGMENT_RUNTIME.counter_mode_step >= (uint16_t)((SEGMENT_LENGTH * 2) - 2)) {
|
||||||
SEGMENT_RUNTIME.counter_mode_step = 0;
|
SEGMENT_RUNTIME.counter_mode_step = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1630,7 +1630,7 @@ uint8_t WS2812FX::setCustomMode(const __FlashStringHelper* name, uint16_t (*p)()
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t WS2812FX::setCustomMode(uint8_t index, const __FlashStringHelper* name, uint16_t (*p)()) {
|
uint8_t WS2812FX::setCustomMode(uint8_t index, const __FlashStringHelper* name, uint16_t (*p)()) {
|
||||||
if((FX_MODE_CUSTOM_0 + index) < MODE_COUNT) {
|
if((uint8_t)(FX_MODE_CUSTOM_0 + index) < MODE_COUNT) {
|
||||||
_names[FX_MODE_CUSTOM_0 + index] = name; // store the custom mode name
|
_names[FX_MODE_CUSTOM_0 + index] = name; // store the custom mode name
|
||||||
customModes[index] = p; // store the custom mode
|
customModes[index] = p; // store the custom mode
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
#define MAX_CUSTOM_MODES 10
|
#define MAX_CUSTOM_MODES 10
|
||||||
#define SEGMENT _segments[_segment_index]
|
#define SEGMENT _segments[_segment_index]
|
||||||
#define SEGMENT_RUNTIME _segment_runtimes[_segment_index]
|
#define SEGMENT_RUNTIME _segment_runtimes[_segment_index]
|
||||||
#define SEGMENT_LENGTH (SEGMENT.stop - SEGMENT.start + 1)
|
#define SEGMENT_LENGTH (uint16_t)(SEGMENT.stop - SEGMENT.start + 1)
|
||||||
|
|
||||||
// some common colors
|
// some common colors
|
||||||
#define RED (uint32_t)0xFF0000
|
#define RED (uint32_t)0xFF0000
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#define USE_WS2812FX_DMA 0 // 0 = Used PIN is ignored & set to RX/GPIO3; 1 = Used PIN is ignored & set to TX/GPIO1; 2 = Uses PIN is ignored & set to D4/GPIO2; Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX
|
#define USE_WS2812FX_DMA 0 // 0 = Used PIN is ignored & set to RX/GPIO3; 1 = Used PIN is ignored & set to TX/GPIO1; 2 = Used PIN is ignored & set to D4/GPIO2; Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX
|
||||||
// or comment it out
|
// or comment it out
|
||||||
#if defined(USE_WS2812FX_DMA)
|
#if defined(USE_WS2812FX_DMA)
|
||||||
#define MAXLEDS 384 // due to memory limit of esp8266 at the moment only 384 leds are supported in DMA Mode. More can crash if mqtt is used.
|
#define MAXLEDS 384 // due to memory limit of esp8266 at the moment only 384 leds are supported in DMA Mode. More can crash if mqtt is used.
|
||||||
@@ -22,13 +22,13 @@ char HOSTNAME[65] = "McLightingRGBW"; // Friedly hostname is configurable just
|
|||||||
#define MQTT_HOME_ASSISTANT_SUPPORT // If defined, use AMQTT and select Tools -> IwIP Variant -> Higher Bandwidth
|
#define MQTT_HOME_ASSISTANT_SUPPORT // If defined, use AMQTT and select Tools -> IwIP Variant -> Higher Bandwidth
|
||||||
//#define DISABLE_MQTT_OUT_ON_MQTT_IN // If defined, McLighting will not send back MQTT-out on MQTT-in regarding issue #67, does not change anything at the moment
|
//#define DISABLE_MQTT_OUT_ON_MQTT_IN // If defined, McLighting will not send back MQTT-out on MQTT-in regarding issue #67, does not change anything at the moment
|
||||||
|
|
||||||
#define ENABLE_BUTTON 14 // If defined, enable button handling code, see: https://github.com/toblum/McLighting/wiki/Button-control, the value defines the input pin (14 / D5) for switching the LED strip on / off, connect this PIN to ground to trigger button.
|
//#define ENABLE_BUTTON 14 // If defined, enable button handling code, see: https://github.com/toblum/McLighting/wiki/Button-control, the value defines the input pin (14 / D5) for switching the LED strip on / off, connect this PIN to ground to trigger button.
|
||||||
//#define ENABLE_BUTTON_GY33 12 // If defined, enable button handling code for GY-33 color sensor to scan color. The value defines the input pin (12 / D6) for read color data with RGB sensor, connect this PIN to ground to trigger button.
|
//#define ENABLE_BUTTON_GY33 12 // If defined, enable button handling code for GY-33 color sensor to scan color. The value defines the input pin (12 / D6) for read color data with RGB sensor, connect this PIN to ground to trigger button.
|
||||||
//#define POWER_SUPPLY 12 // PIN (12 / D6) If defined, enable output to control external power supply
|
//#define POWER_SUPPLY 12 // PIN (12 / D6) If defined, enable output to control external power supply
|
||||||
#if defined(POWER_SUPPLY)
|
#if defined(POWER_SUPPLY)
|
||||||
#define POWER_ON HIGH // Define the output state to turn on the power supply, either HIGH or LOW. Opposite will be uses for power off.
|
#define POWER_ON HIGH // Define the output state to turn on the power supply, either HIGH or LOW. Opposite will be uses for power off.
|
||||||
#endif
|
#endif
|
||||||
//#define ENABLE_REMOTE 13 // If defined, enable Remote Control via TSOP31238. The value defines the input pin (13 / D7) for TSOP31238 Out
|
#define ENABLE_REMOTE 13 // If defined, enable Remote Control via TSOP31238. The value defines the input pin (13 / D7) for TSOP31238 Out
|
||||||
|
|
||||||
#if defined(ENABLE_BUTTON_GY33)
|
#if defined(ENABLE_BUTTON_GY33)
|
||||||
#define GAMMA 2.5 // Gamma correction for GY-33 sensor
|
#define GAMMA 2.5 // Gamma correction for GY-33 sensor
|
||||||
|
|||||||
@@ -250,8 +250,8 @@ void initStrip(uint16_t _stripSize = Config.stripSize, uint8_t _num_segments = C
|
|||||||
}
|
}
|
||||||
|
|
||||||
void getSegmentParams(uint8_t _seg) {
|
void getSegmentParams(uint8_t _seg) {
|
||||||
segState.start = strip->getSegment(_seg)->start;;
|
segState.start = strip->getSegment(_seg)->start;
|
||||||
segState.stop = strip->getSegment(_seg)->stop;;
|
segState.stop = strip->getSegment(_seg)->stop;
|
||||||
//segState.mode[_seg] = strip->getMode(_seg);
|
//segState.mode[_seg] = strip->getMode(_seg);
|
||||||
//segState.speed[_seg] = unconvertSpeed(strip->getSpeed(_seg));
|
//segState.speed[_seg] = unconvertSpeed(strip->getSpeed(_seg));
|
||||||
//fx_mode = segState.mode[_seg];
|
//fx_mode = segState.mode[_seg];
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ uint16_t handleCustomWS(void) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (millis() - dipStartTime[_seg_num] < darkTime[_seg_num]) {
|
if (millis() - dipStartTime[_seg_num] < darkTime[_seg_num]) {
|
||||||
for (uint16_t i=(_seg->start + 3); i<= _seg->stop; i++) {
|
for (uint16_t i = _seg->start; i <= _seg->stop; i++) {
|
||||||
ledstates[i] = 0;
|
ledstates[i] = 0;
|
||||||
for (uint16_t j=_seg->start; j<=_seg->stop; j++) {
|
for (uint16_t j=_seg->start; j<=_seg->stop; j++) {
|
||||||
uint16_t index = (j%3 == 0) ? 400 : random(0,767);
|
uint16_t index = (j%3 == 0) ? 400 : random(0,767);
|
||||||
@@ -118,15 +118,19 @@ uint16_t handleCustomWS(void) {
|
|||||||
// E1.31 mode
|
// E1.31 mode
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
uint16_t handleE131(void) {
|
uint16_t handleE131(void) {
|
||||||
WS2812FX::Segment* _seg = strip->getSegment();
|
WS2812FX::Segment* _seg = strip->getSegment();
|
||||||
|
return _seg->speed/(_seg->stop - _seg->start);
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleE131Play(void) {
|
||||||
if (!e131->isEmpty()) {
|
if (!e131->isEmpty()) {
|
||||||
e131_packet_t packet;
|
e131_packet_t packet;
|
||||||
e131->pull(&packet); // Pull packet from ring buffer
|
e131->pull(&packet); // Pull packet from ring buffer
|
||||||
|
|
||||||
uint16_t universe = htons(packet.universe);
|
uint16_t universe = htons(packet.universe);
|
||||||
uint8_t *data = packet.property_values + 1;
|
uint8_t *data = packet.property_values + 1;
|
||||||
|
|
||||||
if (universe < START_UNIVERSE || universe > END_UNIVERSE) return _seg->speed/(_seg->stop - _seg->start); //async will take care about filling the buffer
|
if (universe < START_UNIVERSE || universe > END_UNIVERSE) return; //async will take care about filling the buffer
|
||||||
|
|
||||||
// Serial.printf("Universe %u / %u Channels | Packet#: %u / Errors: %u / CH1: %u\n",
|
// Serial.printf("Universe %u / %u Channels | Packet#: %u / Errors: %u / CH1: %u\n",
|
||||||
// htons(packet.universe), // The Universe for this packet
|
// htons(packet.universe), // The Universe for this packet
|
||||||
@@ -140,21 +144,24 @@ uint16_t handleCustomWS(void) {
|
|||||||
uint16_t len = (128 + multipacketOffset > Config.stripSize) ? (Config.stripSize - multipacketOffset) : 128;
|
uint16_t len = (128 + multipacketOffset > Config.stripSize) ? (Config.stripSize - multipacketOffset) : 128;
|
||||||
#else*/
|
#else*/
|
||||||
uint16_t multipacketOffset = (universe - START_UNIVERSE) * 170; //if more than 170 LEDs * 3 colors = 510 channels, client will send in next higher universe
|
uint16_t multipacketOffset = (universe - START_UNIVERSE) * 170; //if more than 170 LEDs * 3 colors = 510 channels, client will send in next higher universe
|
||||||
if (Config.stripSize <= multipacketOffset) return _seg->speed/(_seg->stop - _seg->start);
|
if (Config.stripSize <= multipacketOffset) return;
|
||||||
uint16_t len = (170 + multipacketOffset > Config.stripSize) ? (Config.stripSize - multipacketOffset) : 170;
|
uint16_t len = (170 + multipacketOffset > Config.stripSize) ? (Config.stripSize - multipacketOffset) : 170;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
for (uint16_t i = 0; i < len; i++){
|
for (uint8_t k = 0; k < Config.segments; k++) {
|
||||||
if ((i >= _seg->start) && (i <= _seg->stop)) {
|
if (segState.mode[k] == FX_MODE_CUSTOM_3) {
|
||||||
uint16_t j = i * 3;
|
for (uint16_t i = 0; i < len; i++){
|
||||||
/* #if defined(RGBW)
|
if ((i >= strip->getSegment(k)->start) && (i <= strip->getSegment(k)->stop)) {
|
||||||
strip->setPixelColor(i + multipacketOffset, data[j], data[j + 1], data[j + 2], data[j + 3]);
|
uint16_t j = i * 3;
|
||||||
#else */
|
/* #if defined(RGBW)
|
||||||
strip->setPixelColor(i + multipacketOffset, data[j], data[j + 1], data[j + 2], 0);
|
strip->setPixelColor(i + multipacketOffset, data[j], data[j + 1], data[j + 2], data[j + 3]);
|
||||||
/* #endif */
|
#else */
|
||||||
|
strip->setPixelColor(i + multipacketOffset, data[j], data[j + 1], data[j + 2], 0);
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _seg->speed/(_seg->stop - _seg->start);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1244,7 +1244,7 @@ void handleRemote() {
|
|||||||
_updateState = true;
|
_updateState = true;
|
||||||
} else {
|
} else {
|
||||||
State.mode = OFF;
|
State.mode = OFF;
|
||||||
_updateState = true;;
|
_updateState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (State.mode == HOLD) {
|
if (State.mode == HOLD) {
|
||||||
@@ -1348,7 +1348,7 @@ void handleRemote() {
|
|||||||
last_remote_cmd = results.value;
|
last_remote_cmd = results.value;
|
||||||
if (selected_color == 1) {
|
if (selected_color == 1) {
|
||||||
if (main_color.green - chng >= 0) {
|
if (main_color.green - chng >= 0) {
|
||||||
main_color.green = main_color.green - chng;;
|
main_color.green = main_color.green - chng;
|
||||||
_updateSegState = true;
|
_updateSegState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define SKETCH_VERSION "3.1.0.BETA7"
|
#define SKETCH_VERSION "3.1.0"
|
||||||
|
|||||||
@@ -248,8 +248,13 @@
|
|||||||
* Homeassistant will allways use active segment
|
* Homeassistant will allways use active segment
|
||||||
* E1.31 is only working for one segment at the moment
|
* E1.31 is only working for one segment at the moment
|
||||||
*
|
*
|
||||||
* 27 January
|
* 27 January 2020
|
||||||
* Version Bump to 3.1.0.BETA7
|
* Version Bump to 3.1.0.BETA7
|
||||||
* small API changes
|
* small API changes
|
||||||
* work to solve heap problems
|
* work to solve heap problems
|
||||||
|
*
|
||||||
|
* 23 February 2020
|
||||||
|
* Version Bump to 3.1.0
|
||||||
|
* bugfixes
|
||||||
|
* E1.31 is now working for multi segments
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user