Various fixes
This commit is contained in:
parent
d2726aae90
commit
dc936b63d6
@ -469,7 +469,19 @@ void WS2812FX::setSegment(uint8_t n, uint16_t i1, uint16_t i2, uint8_t grouping,
|
|||||||
if (seg.stop) setRange(seg.start, seg.stop -1, 0); //turn old segment range off
|
if (seg.stop) setRange(seg.start, seg.stop -1, 0); //turn old segment range off
|
||||||
if (i2 <= i1) //disable segment
|
if (i2 <= i1) //disable segment
|
||||||
{
|
{
|
||||||
seg.stop = 0; return;
|
seg.stop = 0;
|
||||||
|
if (n == mainSegment) //if main segment is deleted, set first active as main segment
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++)
|
||||||
|
{
|
||||||
|
if (_segments[i].isActive()) {
|
||||||
|
mainSegment = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mainSegment = 0; //should not happen (always at least one active segment)
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (i1 < _length) seg.start = i1;
|
if (i1 < _length) seg.start = i1;
|
||||||
seg.stop = i2;
|
seg.stop = i2;
|
||||||
@ -482,6 +494,7 @@ void WS2812FX::setSegment(uint8_t n, uint16_t i1, uint16_t i2, uint8_t grouping,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WS2812FX::resetSegments() {
|
void WS2812FX::resetSegments() {
|
||||||
|
mainSegment = 0;
|
||||||
memset(_segments, 0, sizeof(_segments));
|
memset(_segments, 0, sizeof(_segments));
|
||||||
//memset(_segment_runtimes, 0, sizeof(_segment_runtimes));
|
//memset(_segment_runtimes, 0, sizeof(_segment_runtimes));
|
||||||
_segment_index = 0;
|
_segment_index = 0;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
//#define USE_LPD8806 // Uncomment for using LPD8806
|
//#define USE_LPD8806 // Uncomment for using LPD8806
|
||||||
//#define WLED_USE_ANALOG_LEDS //Uncomment for using "dumb" PWM controlled LEDs (see pins below, default R: gpio5, G: 12, B: 15, W: 13)
|
//#define WLED_USE_ANALOG_LEDS //Uncomment for using "dumb" PWM controlled LEDs (see pins below, default R: gpio5, G: 12, B: 15, W: 13)
|
||||||
//#define WLED_USE_H801 //H801 controller. Please uncomment #define WLED_USE_ANALOG_LEDS as well
|
//#define WLED_USE_H801 //H801 controller. Please uncomment #define WLED_USE_ANALOG_LEDS as well
|
||||||
//#define WLED_USE_5CH //5 Channel H801 for cold and warm white
|
//#define WLED_USE_5CH_LEDS //5 Channel H801 for cold and warm white
|
||||||
|
|
||||||
#define BTNPIN 0 //button pin. Needs to have pullup (gpio0 recommended)
|
#define BTNPIN 0 //button pin. Needs to have pullup (gpio0 recommended)
|
||||||
#define IR_PIN 4 //infrared pin (-1 to disable) MagicHome: 4, H801 Wifi: 0
|
#define IR_PIN 4 //infrared pin (-1 to disable) MagicHome: 4, H801 Wifi: 0
|
||||||
|
@ -535,6 +535,7 @@ void loop() {
|
|||||||
if (!offMode) strip.service();
|
if (!offMode) strip.service();
|
||||||
}
|
}
|
||||||
yield();
|
yield();
|
||||||
|
MDNS.update();
|
||||||
if (millis() - lastMqttReconnectAttempt > 30000) initMqtt();
|
if (millis() - lastMqttReconnectAttempt > 30000) initMqtt();
|
||||||
|
|
||||||
//DEBUG serial logging
|
//DEBUG serial logging
|
||||||
|
Loading…
Reference in New Issue
Block a user